<div dir="ltr">Hi Piotr,<div class="gmail_extra"><br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Please don't send unrelated changes in one patch, please split it into 2 patches.<br></blockquote><div><br></div><div>Done. Thanks :)</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
  float CDECL MSVCRT__copysignf( float num, float sign )<br>
  {<br>
-    /* FIXME: Behaviour for Nan/Inf? */<br>
-    if (sign < 0.0)<br>
-        return num < 0.0 ? num : -num;<br>
-    return num < 0.0 ? -num : num;<br>
+    /* FIXME: Behaviour for signbit(NAN) is different in Linux and<br>
+     *        Windows, where Windows gives a zero for -NAN<br>
+     */<br>
+    if (signbit(sign))<br>
+        return signbit(num) ? num : -num;<br>
+    return signbit(num) ? -num : num;<br>
  }<br>
</blockquote></span>
Why don't you add an isnan() check? Is there any reason for returning "signbit(num) ? -num : num" instead of returning num?</blockquote><div><br></div><div>Linux and Windows treats NAN differently and I am not quite sure which I should follow here, so I just leave it for now...<br></div><div>I think the _copysignf() is supposed to return a (-num) when (num < 0 && sign >0), so I think this "signbit(num) ? -num : num" might be right.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
It would be nice to also change signbit definition on systems that doesn't support it, so it at least works for normal numbers.<br></blockquote><div><br></div><div>The signbit() function is actually part of C99, not my implementation, so I think it should be supported on most systems? Though I am not quite sure...<br></div><div><br></div><div> </div><div>Thanks,</div><div>Kevin</div></div><br></div></div>