Jump to content
Sign in to follow this  
buzz44

WTF! 8e-005 ?

Recommended Posts

buzz44

i didnt wanna post the code but i guess i have too.... why does the below script return 1-9e-005 when $test1 < 1 ...

instead of returning "0.0001928" or sumthing it returns "8e-005" or sumthing else ... then when $test1 > 1 it returns decimals again ... .00004363 , 0.23252 etc

just run the script below and move the mouse

#include <GUIConstants.au3>

GUICreate("My GUI")

$test = GUICtrlCreateLabel ("0",  10, 190, 100, 15, -1, $WS_EX_STATICEDGE)

GUISetState ()

$test1 = 0

While 1
   $msg = GUIGetMsg()
   If $msg = $GUI_EVENT_CLOSE Then ExitLoop
   _MousePos()
Wend

Func _Set()
   $test1 = $test1 + .01
   GUICtrlSetData($test, $test1 * .00062 + .00001)
EndFunc

Func _MousePos()
   $MousePos_1 = MouseGetPos()
   Sleep(5)
   $MousePos_2 = MouseGetPos()
   If $MousePos_2[0] <> $MousePos_1[0] AND $MousePos_2[1] <> $MousePos_1[1] Then
      _Set()
   EndIf
EndFunc

qq

Share this post


Link to post
Share on other sites
Ejoc

Because the number is so small, it's not writing all the 0's

8e-005 is 8 with the decimale placed moved left 5 times:

.00008 = 8e-005

From the help file:

Signed value having the form [ - ]d.dddd e [sign]ddd where d is a single decimal digit, dddd is one or more decimal digits, ddd is exactly three decimal digits, and sign is + or -.

as for a solution...

GUICtrlSetData($test, StringFormat("%.7f",$test1 * .00062 + .00001))

*Edit I also changed:

If $MousePos_2[0] <> $MousePos_1[0] Or $MousePos_2[1] <> $MousePos_1[1] Then _Set()
Edited by Ejoc

Start -> Programs -> AutoIt v3 -> AutoIt Help File -> Index -> (The Function you are asking about)----- Links -----DllStruct UDFsRSA Crypto UDFs

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.