#Bad_Calc.K3D
20-Jun-95 17:04:07
Sb: #Bad_Calc.K3D
Fm: Chris Thomas 71031,3133
To: Martin Doudoroff/KUB 74664,2144
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