Mailing List Archive


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

[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.)



Most of you can safely ignore this. 

Botond Botyanszki wrote:

> On Wed, 26 Jul 2006 13:07:46 -0400
> Jim <jep200404@example.com> wrote:

> > The use (or not) of a '387 _could_ have been related to his problem. 

That was a statement about the past, before I read Wikipedia. 

After I found out from Wikipedia that the '387 fully supported 
IEEE 754, that concern faded. 

> It's not.

Don't confuse past tense with present tense. 

> Even if the data was binary that is read from the device, it is stored
> in memory. 

Agreed. 

But even if one receives a floating point number in IEEE 754 format 
and stores said number in memory in IEEE 754, 
what guarantee is there that the C program accesses floats and 
doubles in IEEE 754 format? 

> The floating point number is coming from the device, not the
> (co)processor. 

Agreed. 

What guarantee is there that the C program uses IEEE 754 internally? 

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). 

This would even likely apply for C programs on computers for which 
a '387 could be installed, but is not installed. 

> No floating point operation is done (at least he didn't say 
> that it was used in some arithmetic operation before the printf).

No _obvious_ FLOP is done (as far as we know). 

Even if no FLOP is done, the format used by the available FPU(s), 
(even if not present) likely has a strong influence on what 
floating point format the C program uses internally. 

> 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. 

Optimized libraries (of which libc could very well be 
one), could avoid floating point operations while converting 
a binary floating point number to decimal floating point number 
for output. 

> Please don't fool people.

There is probably a minor misunderstanding about some detail 
and we probably agree about the substance. 



Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links