<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>23624</bug_id>
          
          <creation_ts>2009-01-29 11:27:33 -0800</creation_ts>
          <short_desc>Expose a cross-platform NaN in MathExtras.h</short_desc>
          <delta_ts>2009-01-30 09:12:52 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>JavaScriptCore</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Mac</rep_platform>
          <op_sys>OS X 10.5</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WONTFIX</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Simon Fraser (smfr)">simon.fraser</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ap</cc>
    
    <cc>darin</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>107553</commentid>
    <comment_count>0</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2009-01-29 11:27:33 -0800</bug_when>
    <thetext>MathExtras.h should expose a NaN that works everywhere.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>107557</commentid>
    <comment_count>1</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2009-01-29 11:54:40 -0800</bug_when>
    <thetext>Ugh, std::numeric_limits&lt;double&gt;::quiet_NaN() is marked as throw(), which throws the JIT into a tizzy if I put it in a header.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>107560</commentid>
    <comment_count>2</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2009-01-29 12:14:15 -0800</bug_when>
    <thetext>(In reply to comment #1)
&gt; Ugh, std::numeric_limits&lt;double&gt;::quiet_NaN() is marked as throw(), which
&gt; throws the JIT into a tizzy if I put it in a header.

Thows the JIT into a tizzy? Could you be more specific?

I&apos;ve used quiet_NaN() in many cases without having any problems. I don&apos;t think we need it in MathExtras.h -- I think we should just use it directly.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>107569</commentid>
    <comment_count>3</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2009-01-29 13:11:17 -0800</bug_when>
    <thetext>Sorry to be vague. With this patch:

diff --git a/JavaScriptCore/wtf/MathExtras.h b/JavaScriptCore/wtf/MathExtras.h
index 76488b4..9638b35 100644
--- a/JavaScriptCore/wtf/MathExtras.h
+++ b/JavaScriptCore/wtf/MathExtras.h
@@ -28,6 +28,7 @@
 
 #include &lt;math.h&gt;
 #include &lt;stdlib.h&gt;
+#include &lt;limits&gt;
 
 #if PLATFORM(SOLARIS)
 #include &lt;ieeefp.h&gt;
@@ -44,7 +45,6 @@
 #else
 #include &lt;xmath.h&gt;
 #endif
-#include &lt;limits&gt;
 
 #if HAVE(FLOAT_H)
 #include &lt;float.h&gt;
@@ -68,6 +68,8 @@ const double piOverFourDouble = M_PI_4;
 const float piOverFourFloat = static_cast&lt;float&gt;(M_PI_4);
 #endif
 
+const double nanDouble = std::numeric_limits&lt;double&gt;::quiet_NaN();
+
 #if PLATFORM(DARWIN)
 
 // Work around a bug in the Mac OS X libc where ceil(-0.1) return +0.

I get link errors:

ld warning: symbol _ctiVMThrowTrampoline found in unsupported section in /Volumes/InternalData/Development/WebKit/WebKit.git/WebKitBuild/JavaScriptCore.build/Debug/JavaScriptCore.build/Objects-normal/i386/JIT.o
ld warning: symbol _ctiTrampoline found in unsupported section in /Volumes/InternalData/Development/WebKit/WebKit.git/WebKitBuild/JavaScriptCore.build/Debug/JavaScriptCore.build/Objects-normal/i386/JIT.o
Undefined symbols:
  &quot;_ctiTrampoline&quot;, referenced from:
      __ZN3JSC3JIT7executeEPvPNS_12RegisterFileEPNS_9ExecStateEPNS_12JSGlobalDataEPNS_10JSValuePtrE in Interpreter.o
  &quot;_ctiVMThrowTrampoline&quot;, referenced from:
      _ctiVMThrowTrampoline$non_lazy_ptr in Interpreter.o
ld: symbol(s) not found

I think this is because quiet_NaN() is declared as 
  double quiet_NaN() throw()
.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>107697</commentid>
    <comment_count>4</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2009-01-30 07:32:04 -0800</bug_when>
    <thetext>FWIW, we also have &quot;extern const double NaN&quot;, which is used in several places.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>107708</commentid>
    <comment_count>5</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2009-01-30 09:09:53 -0800</bug_when>
    <thetext>(In reply to comment #3)
&gt; I think this is because quiet_NaN() is declared as 
&gt;   double quiet_NaN() throw()

I don&apos;t think that&apos;s why. The CTI throw code has nothing to do with C++ exceptions; it&apos;s about JavaScript exceptions.

I don&apos;t think we should define a new named NAN constant in MathExtras.h. I think we should change our C++ code to use the standard quiet_NaN() directly.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>107709</commentid>
    <comment_count>6</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2009-01-30 09:12:52 -0800</bug_when>
    <thetext>OK, this is a WONTFIX then.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>