Re: [Flightgear-devel] Re: finite
On Friday 06 May 2005 16:12, Martin Spott wrote: Durk Talsma wrote: I would like to keep this check around a little longer, until I'm more convinced I got everything nailed down. If there are portability issues though, I don't see any strong reasons for keeping it. It's your decision. If you want to keep it, then let's add the Solaris workaround as well, Martin. I don't have a strong preference either way. Since it looks like your patch is pretty small, I'd say keep the finite check for now, until we have ironed out the bugs completely. (To give you a bit of a background: The original AI code was designed under the assumption that speeds would always be positive, which seems a reasonable assumption for aircraft :-). I added some cases with negative speed, to allow for on-ground push backs. I some cases, this could lead speeds to get down to zero, with some of the math (turn-radius, etc, etc), blowing up. The finite check is one that I added to see if things were still going as planned, because a non-zero check didn't always work. Cheers, Durk ___ Flightgear-devel mailing list Flightgear-devel@flightgear.org http://mail.flightgear.org/mailman/listinfo/flightgear-devel 2f585eeea02e2c79d7b1d8c4963bae2d
[Flightgear-devel] Re: finite
* Martin Spott -- Friday 06 May 2005 08:33: where is 'finite' expected to be declared ? I don't find a matching declaration on my Solaris box: $ man finite NAME isinf, isnan, finite - test for infinity or not-a-number (NaN) SYNOPSIS #include math.h int isinf(double value); int isnan(double value); int finite(double value); DESCRIPTION The isinf() function returns -1 if value represents negative infinity, 1 if value represents positive infinity, and 0 otherwise. The isnan() function returns a non-zero value if value is not-a-number (NaN), and 0 otherwise. The finite() function returns a non-zero value if value is neither infinite nor a not-a-number (NaN) value, and 0 otherwise. NOTE C99 provides additional macros, such as the type-independent fpclassify(), isinf() and isnan(). CONFORMING TO BSD 4.3 Eeew ... BSD standard? m. ___ Flightgear-devel mailing list Flightgear-devel@flightgear.org http://mail.flightgear.org/mailman/listinfo/flightgear-devel 2f585eeea02e2c79d7b1d8c4963bae2d
Re: [Flightgear-devel] Re: finite
Melchior FRANZ wrote: $ man finite NAME isinf, isnan, finite - test for infinity or not-a-number (NaN) SYNOPSIS #include math.h Ooops : foehn: 13:47:03 ~ uname -a SunOS foehn 5.8 Generic_117000-03 sun4m sparc foehn: 13:47:06 ~ find /usr/include/ -name math\.h /usr/include/math.h foehn: 13:47:09 ~ grep finite /usr/include/math.h foehn: 13:47:11 ~ man finite NAME isnan, isnand, isnanf, finite, fpclass, unordered - deter- mine type of floating-point number SYNOPSIS #include ieeefp.h int isnand(double dsrc); int isnanf(float fsrc); int finite(double dsrc); [...] I'll investigate if it works, Martin. -- Unix _IS_ user friendly - it's just selective about who its friends are ! -- ___ Flightgear-devel mailing list Flightgear-devel@flightgear.org http://mail.flightgear.org/mailman/listinfo/flightgear-devel 2f585eeea02e2c79d7b1d8c4963bae2d
Re: [Flightgear-devel] Re: finite
Martin Spott wrote: foehn: 13:47:11 ~ man finite NAME isnan, isnand, isnanf, finite, fpclass, unordered - deter- mine type of floating-point number SYNOPSIS #include ieeefp.h If there's no suitable replacement for 'finite' then I'd suggest the following patch: --- FlightGear/src/AIModel/AIAircraft.cxx~ 2005-05-06 13:53:21.620009000 +0200 +++ FlightGear/src/AIModel/AIAircraft.cxx 2005-05-06 13:53:18.312280850 +0200 @@ -32,6 +32,8 @@ #include string #include math.h +#if defined(sun) + #include ieeefp.h +#endif #include time.h #ifdef _MSC_VER # include float.h Martin. -- Unix _IS_ user friendly - it's just selective about who its friends are ! -- ___ Flightgear-devel mailing list Flightgear-devel@flightgear.org http://mail.flightgear.org/mailman/listinfo/flightgear-devel 2f585eeea02e2c79d7b1d8c4963bae2d
Re: [Flightgear-devel] Re: finite
On Friday 06 May 2005 14:00, Martin Spott wrote: Martin Spott wrote: foehn: 13:47:11 ~ man finite NAME isnan, isnand, isnanf, finite, fpclass, unordered - deter- mine type of floating-point number SYNOPSIS #include ieeefp.h If there's no suitable replacement for 'finite' then I'd suggest the following patch: Hi Martin, The finite check was added by me, while I was tracking down the possible cause(s) of a division by zero error in the AIAircraft code. I think I have nailed the problem in the latest release, but I opted to leave the finite check in there, just in case there were additional problems, assuming that this would be a portable function. I would like to keep this check around a little longer, until I'm more convinced I got everything nailed down. If there are portability issues though, I don't see any strong reasons for keeping it. Cheers, Durk ___ Flightgear-devel mailing list Flightgear-devel@flightgear.org http://mail.flightgear.org/mailman/listinfo/flightgear-devel 2f585eeea02e2c79d7b1d8c4963bae2d
Re: [Flightgear-devel] Re: finite
Martin Spott wrote: If there's no suitable replacement for 'finite' then I'd suggest the following patch: Alternatively we can just use something like the following (untested) code. All modern CPUs (and certainly all the ones we support) use IEEE format for their floating point values. int finite(double d) { int exp = ((*(uint64_t*)d) 52) 0x7ff; return (exp != 0x7ff) (exp != 0); } Andy ___ Flightgear-devel mailing list Flightgear-devel@flightgear.org http://mail.flightgear.org/mailman/listinfo/flightgear-devel 2f585eeea02e2c79d7b1d8c4963bae2d
Re: [Flightgear-devel] Re: finite
Durk Talsma wrote: I would like to keep this check around a little longer, until I'm more convinced I got everything nailed down. If there are portability issues though, I don't see any strong reasons for keeping it. It's your decision. If you want to keep it, then let's add the Solaris workaround as well, Martin. -- Unix _IS_ user friendly - it's just selective about who its friends are ! -- ___ Flightgear-devel mailing list Flightgear-devel@flightgear.org http://mail.flightgear.org/mailman/listinfo/flightgear-devel 2f585eeea02e2c79d7b1d8c4963bae2d