However, the value of Twist[3] is not 3.14; it's 3.140000104904175. What's even stranger is that the value of Twist is 0 1 0 3.14 !!
As said by wikipedia, "floating-point numbers cannot faithfully mimic the real numbers" and "floating-point operations cannot faithfully mimic true arithmetic operations". http://en.wikipedia.org/wiki/Floating_point#Accuracy_problems
And the situation is worse because of different precision levels of floating-point numbers in VRML engine and javascript interpretter. VRML engine uses 32 bit IEEE floating-points number, while javascript numbers are always 64 bit IEEE.
You should never compare two floating-point numbers for equality with '=='. It may works, but in general, the results are unpredictable.