ennio Posted June 4, 2009 Posted June 4, 2009 Simple code:$data = "start" For $j = 0 To 1 Step 0.02 $data = $data & $j & @CRLF Next $docu = FileOpen("testo.txt", 2) FileWrite($docu, $data) FileClose($docu) exitcheck the last numbers:0.880.90.920.9400000000000010.9600000000000010.980000000000001any help is apreciattedregards,- ennio
JackDinn Posted June 4, 2009 Posted June 4, 2009 try $data = $data & Round($j,2) & @CRLF Thx all,Jack Dinn. JD's Auto Internet Speed Tester JD's Clip Catch (With Screen Shot Helper) Projects :- AutoIt - My projects My software never has bugs. It just develops random features. :-D
ennio Posted June 4, 2009 Author Posted June 4, 2009 try $data = $data & Round($j,2) & @CRLFThank for the reply , but this code should reach to "1"and for that mistake in the STEP the cycle is not completedany ideas?regards..-ennio
JackDinn Posted June 4, 2009 Posted June 4, 2009 yea it is an odd result from the step & you would have to ask the gurus why it does both these things but as another kinda fudge yo could just use For $j = 0 To 1.01 Step 0.02 to get you to 1 Thx all,Jack Dinn. JD's Auto Internet Speed Tester JD's Clip Catch (With Screen Shot Helper) Projects :- AutoIt - My projects My software never has bugs. It just develops random features. :-D
CodyBarrett Posted June 4, 2009 Posted June 4, 2009 im not a guru but this IS odd.. ive never seen this.... maybe its the decimal put in there? can you use whole numbers instead? [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size]
Valik Posted June 4, 2009 Posted June 4, 2009 Yada yada yada, floating point numbers are imprecise, yada yada yada. Seriously, I've answered this more times than I care to remember. It is not a bug. It is expected behavior. If you wish to know more I hear there's this thing called the internet that can answer all your "floating point imprecise" questions.
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