<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Sep 17, 2014 at 3:28 PM, Paul Bone <span dir="ltr"><<a href="mailto:paul@bone.id.au" target="_blank">paul@bone.id.au</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Wed, Sep 17, 2014 at 02:41:42PM +1000, Julien Fischer wrote:<br>
> diff --git a/library/float.m b/library/float.m<br>
> index bc263e3..bb3fd2b 100644<br>
> --- a/library/float.m<br>
> +++ b/library/float.m<br>
</span><span class="">> @@ -173,36 +181,45 @@<br>
> %<br>
> :- pred is_inf(float::in) is semidet.<br>
><br>
> - % Is the floating point number not a number?<br>
> + % True iff the argument is not-a-number (NaN).<br>
> %<br>
> :- pred is_nan(float::in) is semidet.<br>
><br>
> - % Is the floating point number not a number or of infinite magnitude?<br>
> + % True iff the argument is of infinite magnitude or not-a-number (NaN).<br>
> %<br>
> :- pred is_nan_or_infinite(float::in) is semidet.<br>
><br>
> - % Synonym for is_nan_or_inf/1.<br>
> + % Synonym for above.<br>
> %<br>
> :- pred is_nan_or_inf(float::in) is semidet.<br>
<br>
</span>"Synonym for *the* above"</blockquote><div><br></div><div>Fixed. </div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
> @@ -722,6 +739,20 @@ is_infinite(F) :-<br>
> SUCCESS_INDICATOR = false<br>
> ").<br>
><br>
> +:- pragma foreign_proc("C",<br>
> + is_finite(Flt::in),<br>
> + [will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,<br>
> + does_not_affect_liveness],<br>
> +"<br>
> + SUCCESS_INDICATOR = MR_is_finite(Flt);<br>
> +").<br>
> +<br>
> +is_finite(F) :-<br>
> + not is_infinite(F),<br>
> + not is_nan(F).<br>
> +<br>
> +is_zero(0.0).<br>
> +<br>
<br>
</span>I'm no floating point expert, but is -0.0 different from 0.0 </blockquote><div><br></div><div>Depends what you mean by different.</div><div> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">and if so do we<br>
need to test for it explicity or does floating point comparison take care of<br>
this for us?<br></blockquote><div><br></div><div>No, IEEE 754 says 0.0 and -0.0 compare as equal.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
> @@ -298,6 +298,7 @@<br>
> ** MR_HAVE_ISINF we have the isinf() function.<br>
> ** MR_HAVE_ISINFF we have the isinff() function.<br>
> ** MR_HAVE_FINITE we have the finite() function.<br>
> +** MR_HAVE_ISFINITE we have the isfinite() function.<br>
> ** MR_HAVE_FESETROUND we have the fesetround() function.<br>
> ** MR_HAVE_FMA we have the fma() function.<br>
> */<br>
<br>
</span>The use of tabe and spaces is inconsistent here.<br></blockquote><div><br></div><div>No it isn't. (In any case it's just doing what the surrounding lines do)</div><div><br></div><div>Thanks for that!</div><div><br></div><div>Cheers,</div><div>Julien.</div></div></div></div>