In article <2026…@mips.complang.tuwien.ac.at>, Anton Ertl <ant…@mips.complang.tuwien.ac.at> wrote:
>albe…@spenarnc.xs4all.nl writes:
>>In article <2026…@mips.complang.tuwien.ac.at>, >>Anton Ertl <ant…@mips.complang.tuwien.ac.at> wrote:
>>>A better way to think about them is: Each FP number has an exact >>>value, but in some cases conversions to FP and FP operations round, >>>because there is no FP value for the exact result; this rounding leads >>>to errors. The size of this error is the subject of numerical >>>analysis.
>> >>Exactly >>0.0001E0 DUP FSIN F-
> >I assume you mean FDUP here.
Good catch.
>
>>looses a whole lot of precision. >>Maybe "imprecise numbers" is not a bad name after all.
> >It is. It's not the numbers that are imprecise, it's the operations. >They round (but not in every case).
F- generates the exact result of the number that is supposed to represent 0.001 (maybe imprecisely) and the number that represents sin(0.001) imprecisely. The latter is bound to be imprecise because sin(0.001) is transcendental, so irrational. So F- is not to blame that the result is imprecise. : thou 0.001E0 ; OK HEX OK thou FS. 4.189374BC6A7EC00000_-3 OK thou FSIN FS. 4.18936948629841A800_-3 OK OK thou FSIN thou F- FDUP FS. -B.7407E67E5800000000_-9 OK Now it can be demonstrated by adding the thou back to the result, that F- doesn't introduce loss of precision. thou F+ FDUP FS. 4.18936948629841A800_-3 OK thou FSIN FS. 4.18936948629841A800_-3 OK Summary F- is working with precision on imprecise numbers.
>In the present case the conversion from the decimal string to the FP >number rounds (but that makes little difference for what follows), and >FSIN rounds. F- does not round in this case, but the absolute error >from the FSIN rounding is still present in the result and is >relatively larger compared to the result, so the number of significant >digits is smaller; this phenomenon is called cancellation.
FSIN doesn't round. It is not magically bound to the math sine function. It is defined as an operation that returns a rational number that is close within x ULP to the mathematical sine function. More succinctly: the sine function is beholden to be represented by an imprecise number. All operation results with imprecise numbers should be regarded with suspicion.
> >- anton
Groetjes Albert
-- The Chinese government is satisfied with its military superiority over USA. The next 5 year plan has as primary goal to advance life expectancy over 80 years, like Western Europe.