Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old Dec 17, 2012, 11:23 AM   #1
VulchR
macrumors 68000
 
VulchR's Avatar
 
Join Date: Jun 2009
Location: Scotland
Very odd error in looping - possible bug in AWK maths library?

I use AWK (C-like programming language used to parse tables - and, yes, I know that's primitive of me). Check out the following behaviour

for (x=0.01;x<=0.05;x+=0.01) Stops at 0.05 as expected
for (x=0.01;x<=0.06;x+=0.01) Stops at 0.05
for (x=0.01;x<=0.06000001;x+=0.01) Stops at 0.06 as expected
for (x=0.1;x<=0.6;x+=0.1) Stops at 0.6, as expected
for (x=0.01;x<=0.10;x+=0.01) Stops at 0.10 as expected and steps through 0.06 just fine

Possible maths library bug? Anybody else able to confirm this perhaps with C (I am not sure, but I presume AWK uses C's maths libraries)?

Mac OS X 10.8.2
iMac 27" i7
__________________
My first was a Mac+. Now I own an iPhone with 3.5x the pixels, a colour display, WiFi, 512x the RAM, >1500x the data storage, and 100x the speed. And it fits in the palm of my hand.

Last edited by VulchR; Dec 17, 2012 at 11:39 AM.
VulchR is offline   0 Reply With Quote

 
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Tags
awk, bug, looping

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 12:38 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC