CheeseBiscuit Posted December 19, 2013 Posted December 19, 2013 For example, I have a number "0.00000002", now to do calculations on it would make it 4e-008, I don't want that, I want it to stay in the same format as "0.00000002" + whatever I did to it so like "0.00000038" So I tried manipulating it as a string and so far I got this: #include <String.au3> Local $Num = InputBox("InputNum", "Enter Number", "0.00000002", "") Local $NumSplitP1 = StringTrimLeft($Num, 2) ;Removes 0. Local $NumSplitP2 = StringReplace($NumSplitP1, "0", "") ;Removes all instances of 0 MsgBox(64, "Num", $NumSplitP2) But as you can painfully see, I am limited with numbers like 1000 or any number that has a 0 in it.. Basically I'm trying to do maths on a really tiny number but want its format to stay the same, with all the decimal and 0's. I know it has to be possible right?
Solution AZJIO Posted December 19, 2013 Solution Posted December 19, 2013 >BigNum My other projects or all
CheeseBiscuit Posted December 19, 2013 Author Posted December 19, 2013 >BigNum That was easy.. Thanks!
Malkey Posted December 20, 2013 Posted December 20, 2013 And here is another alternative. Local $Num = InputBox("InputNum", "Enter Number", "0.00000002", "") MsgBox(0, "Results", $Num & " x 2 = " & $Num * 2 & " or " & StringRegExpReplace(StringFormat("%.15f", $Num * 2), "0+$|\.0+$", "")) ; Returns:- 0.00000002 x 2 = 4e-008 or 0.00000004
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now