WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED WORKSFORME
15445
NaN is not converted correctly from Math functions
https://bugs.webkit.org/show_bug.cgi?id=15445
Summary
NaN is not converted correctly from Math functions
Scott Trenda
Reported
2007-10-09 17:54:36 PDT
Running Safari (Windows) 3.0.3 v 522.15.5. Try these in the address bar: javascript:var x = Math.sqrt(-1); alert(x || "fallback value") javascript:var x = Math.pow(-1, .5); alert(x || "fallback value") javascript:var x = NaN; alert(x || "fallback value") Local behavior: In Safari, alerts "NaN" for the first two, and "fallback value" for the third. Alerts "fallback value" (expected behavior) in IE6/7, Firefox 2.0.0.7 and Opera 9.23. The same behavior happens with an explicit alert(x ? x : "fallback value"). NaN should always convert to Boolean false; it seems that the Math functions are at fault here.
Attachments
Add attachment
proposed patch, testcase, etc.
Alexey Proskuryakov
Comment 1
2008-04-01 23:03:54 PDT
This works correctly for me with Safari 3.1. There were some bug fixes made for NaN and Boolean expressions made in 3.1, but I'm surprised that these cases worked differently.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug