Jump to content
Sign in to follow this  
strikeout

scientific numbers to human readable conversion?

Recommended Posts

strikeout

how can i transform a number like this ( -2e-006 ) into a human readable number like this (0.000000448787) ?

i tried round(), number() and lots of other functions but i might have missed something..

sorry for the noob question :D

cheers//

strikeout

Share this post


Link to post
Share on other sites
strikeout

nope, sorry.

ConsoleWrite(Execute(-2e-006) & @CRLF)
returns --> -2e-006

Share this post


Link to post
Share on other sites
LurchMan

try this:

ConsoleWrite(Execute(-2^-006) & @CRLF)

Dating a girl is just like writing software. Everything's going to work just fine in the testing lab (dating), but as soon as you have contract with a customer (marriage), then your program (life) is going to be facing new situations you never expected. You'll be forced to patch the code (admit you're wrong) and then the code (wife) will just end up all bloated and unmaintainable in the end.

Share this post


Link to post
Share on other sites
PsaltyDS

Demo:

Global $sInput = "-2e-006"
ConsoleWrite("Debug: $sInput = " & $sInput & ", Type = " & VarGetType($sInput) & @LF)

Global $fRET = Execute($sInput)
ConsoleWrite("Debug: $fRET = " & $fRET & ", Type = " & VarGetType($fRET) & @LF)

$sRET = StringFormat("%1.10f", $fRET)
ConsoleWrite("Debug: $sRET = " & $sRET & ", Type = " & VarGetType($sRET) & @LF)

:D


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
James

Demo:

Global $sInput = "-2e-006"
 ConsoleWrite("Debug: $sInput = " & $sInput & ", Type = " & VarGetType($sInput) & @LF)
 
 Global $fRET = Execute($sInput)
 ConsoleWrite("Debug: $fRET = " & $fRET & ", Type = " & VarGetType($fRET) & @LF)
 
 $sRET = StringFormat("%1.10f", $fRET)
 ConsoleWrite("Debug: $sRET = " & $sRET & ", Type = " & VarGetType($sRET) & @LF)

:D

Neat!

Share this post


Link to post
Share on other sites
PsaltyDS

try this:

ConsoleWrite(Execute(-2^-006) & @CRLF)
Well, that's cute, but doesn't address scientific notation as the initial input. It's also the wrong answer:

-2e-006 = (-2)(10 ^ -6) = 0.000002

:D


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
Valuater

I have never needed or found a use for this kind of number

0.000002

.... Well, maybe excepting my bank account balance... :D

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
PsaltyDS

I have never needed or found a use for this kind of number

0.000002

.... Well, maybe excepting my bank account balance... :D

8)

Isn't that your fraction of the CA state budget deficit?

:D


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
strikeout

$sRET = StringFormat("%1.10f", $fRET)

just what i was looking for! works like a charm!

thank you very much! :D

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.