CompuServe Thread

#Bad_Calc.K3D

3 messages in this thread
#176311From: Chris ThomasJun 20, 1995 5:04 PM
Martin, Here's a short script that shows a example of an apparent error with the INT( ) script command. Encountered this with the spring.p3d script that I posted today. found a work around, but not sure if it's floating point or an actual bug. Martin, feel free to use the Spring script with TSE as you see fit. See as Siggraph CT. ——————————————————————————- ————– 'This script appears to have a mathmatical error in deriving the Integer value of calculated numbers. 'Not sure if it's a floating point problem or an actual bug. CDIA = 5 :' Also 9, 10, 17, 29 will generate errors WDIA = 1 DeltaC = 18 DeltaZ = 0.099999998 :'10/(20*5) :'Replace the last 98 with 97 will calc ok. Replace w/0.1 fails ATTACK = Atn(DeltaZ/(CDIA/2 * sin(DeltaC))) SEMI_SEG_DIST = CDIA/2 * sin(DeltaC) FULL_SEG_DIST = WDIA/2 / sin(ATTACK) * cos(ATTACK) FULL_SEG_DIV_BY_SEMI_SEG=FULL_SEG_DIST/SEMI_SEG_DIST INT_NUM=int(FULL_SEG_DIV_BY_SEMI_SEG) print "The calculated value of FULL_SEG_DIV_BY_SEMI_SEG = ", FULL_SEG_DIV_BY_SEMI_SEG print "The integer value of FULL_SEG_DIV_BY_SEMI_SEG = ", INT_NUM
#176403From: Martin Doudoroff/KUBJun 21, 1995 8:39 AM
Chris: Great work on the coil P3D! >> Here's a short script that shows a example of an apparent error with the INT( ) script command. << Thanks! I'll pass it along. Martin
#176511From: Chris ThomasJun 21, 1995 4:22 PM
>>Great work on the coil P3D! Thanks Martin.