This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

SH FIPR Precision

The FIPR instruction is intended for speed rather than accuracy, and therefore the results will differ from those obtained by using a combination of FADD and FMUL instructions. The FIPR execution sequence is as follows:

1) Multiplies all terms. The results are 28 bits long.
2) Aligns these results, rounding them to fit within 30 bits.
3) Adds the aligned values.
4) Performs normalization and rounding.

what does 28 bits long and fit within 30 bits mean?

when I'm testing 0x407fffff (3.9999997615814208984375 / 01000000011111111111111111111111) * 1.0 + 0.0 + 0.0 + 0.0, I got 0x407fffff also.

if I try to fill all the inputs with value 0x3F7FFFD5 (0.999997437000274658203125), I got 0x407FFFAA (3.999979496002197265625), looks like no precision is loss at all.

but sometimes the precision differs a lot, e.g. fipr(46.351589, 68.036201, -91.735298, -50.511566, -25.173294, 72.041527, 72.575272, -57.887852); 
it would return 0x3f66cc00 (0.90155029296875), instead of 0x3f66c9ea (0.90151846408843994140625)

[locked by: Cindy H at 13:33 (GMT 0) on 14 Dec 2023]