Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlug] Internal floating point formats used by 80387, IEEE 754 and C . . . . . (was Re: What does 80387 have to do with IEEE 754 issues? It's moot.)



On Wed, 26 Jul 2006 15:16:21 -0400
Jim <jep200404@example.com> wrote:

> If a program can use a FPU, the program will _likely_ use the 
> same floating point format as the FPU, so as to not have to support 
> two formats, to simplify the code and maintainance. 
> So, that a FPU supports IEEE 754, is an indication (not a guarantee) 
> that the C program probably also uses IEEE 754 to handle floating 
> point numbers outside the FPU (i.e., when stored in memory). 

Theoretically I agree with you. In practice it would be unlikely as
wikipedia and even the glibc manual[1] says:
"Modern computers implement the IEEE 754 standard for numerical
computations"

> > printf is a libc call and is not doing any floating point operations
> > either. 
> 
> That depends on how the library is implemented. 
> 
> It is very possible for  printf to use floating point operations 
> in the conversion of a binary floating point number to 
> decimal floating point number for output. 
Format string conversions mostly use shifts and other simple
operations[2]. Even if the conversion used a floating point operation
during the process, it wouldn't have any effect on the output in case the
underlying floating point representation would differ.

[1]
http://www.gnu.org/software/libc/manual/html_node/Floating-Point-Numbers.html#Floating-Point-Numbers
[2]
http://sources.redhat.com/cgi-bin/cvsweb.cgi/~checkout~/libc/stdio-common/printf_fp.c?rev=1.56.2.2&content-type=text/plain&cvsroot=glibc

Attachment: signature.asc
Description: PGP signature


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links