in reply to Printing a very small number
G'day Dr Manhattan,
Saying "is not very useful" is not very useful to us. What format would you find useful? sprintf may do what you want; its documentation has copious examples. Here's a few possibilities:
$ perl -Mstrict -Mwarnings -le ' my $x = 9**-10; print "$x"; print sprintf "%f" => $x; print sprintf "%.15f" => $x; print sprintf "%.31f" => $x; print sprintf "%g" => $x; print sprintf "%.15g" => $x; print sprintf "%.31g" => $x; ' 2.86797199079244e-10 0.000000 0.000000000286797 0.0000000002867971990792441349306 2.86797e-10 2.86797199079244e-10 2.86797199079244134930566254989e-10
-- Ken
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Printing a very small number
by Laurent_R (Canon) on Aug 16, 2013 at 17:32 UTC | |
by kcott (Archbishop) on Aug 17, 2013 at 05:16 UTC | |
by Laurent_R (Canon) on Aug 17, 2013 at 08:37 UTC |