Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Decimal to Scientific notation

by karlgoethebier (Abbot)
on Mar 24, 2015 at 14:28 UTC ( [id://1121159]=note: print w/replies, xml ) Need Help??


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:  <%-(-(-(-<

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1121159]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2024-04-24 12:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found