On Monday 03 November 2008 09:38:11 Andy Dougherty wrote:

> > 2.  4 of the tests appear to fail depending on how the OS 'spells'  
> > the negation of zero.  Could we address this in a hints file?

> This is a long-standing problem:  See [perl #28170] and [perl #30737]. The
> last time I looked at this, the it seemed we should probably use
> signbit(), if available.  (If it's not available, a fallback is needed,
> but it's likely to usually be available.)  However, I don't know why
> OpenBSD would differ from NetBSD in this regard.  Certainly the math.c
> platform files are nearly identical.  Are the underlying machines and
> perl5 configurations the same for the NetBSD and OpenBSD tests?  The
> 'myconfig' files from each configuration would be helpful in trying to
> assess what's the same and what's different.

I wonder if this patch fixes things.  Certainly it does no harm on my box.  
Parrot_signbit() already exists in the platform files, so we might as well 
use it.

> > 3.  1 of the tests appears to fail depending on how the OS initial-
> > cases 'Inf'.  Again, could this be addressed in a hints file?
>
> This too is a long-standing problem:  See [perl #19183].  It stalled
> pending a decision on whether or not parrot should try to enforce a single
> spelling of 'Inf' (and 'Nan', etc.) or whether the tests should patch over
> the issue.

A brief skim of src/bignum.c shows that we have code which intends to handle 
this, but we don't build or use it.

-- c

=== src/spf_render.c
==================================================================
--- src/spf_render.c	(revision 32475)
+++ src/spf_render.c	(local)
@@ -724,7 +724,12 @@
                             STRING *ts;
                             const HUGEFLOATVAL thefloat =
                                 obj->getfloat(interp, info.type, obj);
+                            const long double ld = (long double)thefloat;
 
+                            /* force negative float zero to -0.0 in output */
+                            if (fabsl(ld) == 0.0 && Parrot_signbit(ld))
+                                info.flags |= FLAG_MINUS;
+
                             /* turn -0.0 into 0.0 */
                             gen_sprintf_call(tc, &info, ch);
                             ts = cstr2pstr(tc);

Reply via email to