Jonathan Polley wrote:
> 
> My C training goes back to circa 1985, at which time all floats were
> passed as doubles.

Yes, they were.

>  In fact, the modern C/C++ compilers to which I have
> access still do this (I don't use gcc, except to rebuild FlightGear).

Oh?  Which compilers?

>  All
> floating-point co-processors do their work in extended precision (usually
> 80-96 bits) and "shorten" the numbers back to the range desired by the
> user,

Certainly some do.  I'm pretty sure that not all do, at least not for functions that 
can be done significantly faster at lower precision.

> and the single-precision math libraries I have used just cast the
> results of the double-precision routines to be single-precision (it saves
> on duplicated code).

At work we use an Intermetrics C compiler ("Intertools" for NEC V20 series processors) 
that is supplied with a standard software floating-point library that includes 
separate single and double-precision versions of most of the routines.  There is also 
an alternate version of the library which uses the same data sizes (4 and 8 bytes) but 
does not calculate to the full accuracy, and is considerably faster.  You can choose 
the most appropriate library for your application.

> I must be older than anyone else here, but my collegiate C training drove
> home the fact that mixing integer and floating-point can give you
> unpredictable results.  Granted, this was pre-ANSI C.

Maybe it was unpredictable before standardisation, but I feel that's unlikely; I don't 
have the original (K&R) reference book to check.  Another possibility is that the 
teacher couldn't predict the results because he/she didn't know the language well 
enough ... that's quite common, unfortunately.

- Julian

_______________________________________________
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel

Reply via email to