|
|
|
09-09-2009 12:55 AM | |||
|
|||
Floating point. 'Nuff said...
|
09-09-2009 02:13 AM | |||
|
|||
splx has an init value of 5e-17 for denormal prevention (common speculation)
while the amount of accuracy is by design: Code:
@sample true = 0; spl0 == 0 ? true = 1; // true = 1, while spl0 is 5e-17 Code:
@sample a = 5*10^-5; b = 4*10^-5; c = 0; a == b ? c = 1; //c is 1 //* 10e-4 -> c = 0 not necessarily a bug...more like two feature requests :) |
09-09-2009 02:27 AM | |||
|
|||
rob, I don't really understand what your saying ("'Nuff" !? seems I've got a lack of american culture... once again! ;-) but -IF- you're saying that it's not a bug, I disagree. It's indeed due to the floating point and its "-0" capability (i.e. the bug above occurs when spl0 = -0.0, MSB set to 1) but, to be consistent, in such a case, (spl0 == 0) should be false, then ?
no! 0 = -0, floating point or not. > Forget this post if I misunderstood! note: other math oddity: normally, log(0) is an invalid opération, just like x/0... [EDIT] Liteon posted in the meantime!! Thanks for this interesting info. However, I still think it's a bug (wasted a few hours on this stuff) but, since I'm aware of that now, I won't be frustated if it's turned into a FR... [EDIT2] according to the liteon's post, I should have rather said "(i.e. the bug above occurs when spl0 looks like -0.0...". I really wonder how you know that liteon! It's not said in the JS doc and you can not monitor such accurate values as (5e-17) in the JS "watches"... ... and thanks to mikeroephonics ! |
09-09-2009 03:04 AM | |||
|
|||
" 'Nuff " is simply short for "enough".
- Mike |
09-09-2009 05:48 AM | |||
|
|||
liteon is a clever guy.
Jeffos, nice work locating the issue, but this will probably get marked "live with it". JS isn't going to get exception handling, and any sort of validation wrapper would require the caller to test the return which is no more convenient than testing the sample for epsilon values before calling log. Documenting the current behavior is a good FR though :) |
09-09-2009 10:04 AM | |||
|
|||
Yeah, having a == b documented to be "a is within 0.00001 of b" would be good.
Note (for the docs), if you need more accuracy, you could do a*1000000 == b*1000000 etc. |
Issue Tools |
---|
Subscribe to this issue |