2 ms·
Do you really think that C introduced that accidentally? Don't you think that it were also easier for all the compilers written in the last 40-50 years to simpl
by acqq 13y ago
Do you really think that C introduced that accidentally? Don't you think that it were also easier for all the compilers written in the last 40-50 years to simply have 1-1 correspondence between stored variables and partial results?
The reason they didn't do this was that the implementers knew that most of calculations turn out wrong if the partial results are too short.
- pcwalton 13y ago> Don't you think that it were also easier for all the compilers written in the last 40-50 years to simply have 1-1 correspondence between stored variables and partial results? Not really; the size of intermediate representations wasn't even specified prior to C99. It was easier to just leave 80-bit intermediate representations in e.g. the x87 FPU unit.
- acqq 13y agoYou're wrong regarding "80 bits." The intermediate was double at least twenty years: the practice is older than the standards, as I already claimed. You can check the code, I claim that the first thing C std libraries do on x86 with 80-bit registers is set the precision to 64-bits. The FPU unit has 80 bits registers but the computation can be fixed and it was. It's not "easier" to leave it at 80-bits: you get bad numerical outputs if you don't implement the spilling to 80-bits too and if you don't have proper language support. Numerics is hard but it should be done right. Note the practice. The standards were intentionally "almost useless" because they reflected the influences of those involved.
- pcwalton 13y agoNo, I was correct about the standards: http://www.altdevblogaday.com/2012/03/22/intermediate-floating-point-precision/ http://www.altdevblogaday.com/2012/03/22/intermediate-floati... C98: "5.10 The values of the floating operands and the results of floating expressions may be represented in greater precision and range than that required by the type; the types are not changed thereby." You're right that most compilers in practice changed the precision to double. I think we're in violent agreement (and I learned a lot from this debate!) :)