On Sat, 8 Nov 2008, chromatic wrote:

> On Monday 03 November 2008 09:38:11 Andy Dougherty wrote:
> 
> 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.

> --- 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;
> +

Unfortunately, whether or not signbit takes a double or a 'long double' 
appears to depend on the platform.  On Linux, signbit is a macro which 
is supposed to work for all floating point types.  On Solaris, there are 
separate signbitf(), signbit() and signbitl() types to deal with float, 
double, and long double respectively.  Probably whatever piece of
Configure figures out HUGEFLOATVAL should also figure out the
appropriate Parrot_signbitH() or some such to use with it.  (I'd guess
it's almost always Parrot_signbitl().)

(I'm not sure how portable fabsl() is either, though it may not matter.
I don't see any harm to just omitting it here.)

-- 
    Andy Dougherty              [EMAIL PROTECTED]

Reply via email to