in reply to Decimal to Scientific notation

You might also say something like: perl -e 'map{printf("%.11e", $_)} 0.99982928833;'.

Update: : NB.: This is a working example (note that it compiles), based on what stevieb suggested above - with the same result. Sorry, that i forgot the newline...

karls-mac-mini:monks karl$ perl -e 'map{printf("%.11e\n", $_)} 0.99982 +928833;' 9.99829288330e-01

Regards, Karl

«The Crux of the Biscuit is the Apostrophe»

Replies are listed 'Best First'.
Re^2: Decimal to Scientific notation
by toolic (Bishop) on Mar 24, 2015 at 16:05 UTC
    Same thing, without map:
    perl -e 'printf "%.11e\n", 0.99982928833' 9.99829288330e-01

      Yes sure toolic, but:

      karls-mac-mini:monks karl$ perl -e 'map{printf("%.11e\n", $_)} (0.9998 +2928833, 0.99982928832);' 9.99829288330e-01 9.99829288320e-01

      ...if so...;-)

      Best regards, Karl

      «The Crux of the Biscuit is the Apostrophe»

        I'd still be inclined to write

        c:\@Work\Perl>perl -wMstrict -le "printf qq{%.11e\n}, $_ for 0.99982928833, 0.99982928832; " 9.99829288330e-001 9.99829288320e-001
        instead ;-)


        Give a man a fish:  <%-(-(-(-<