[libre-riscv-dev] [isa-dev] Re: FP transcendentals (trigonometry, root/exp/log) proposal
brucehoult at sifive.com
Wed Sep 11 21:18:15 BST 2019
On Wed, Sep 11, 2019 at 12:42 PM Allen Baum
<allen.baum at esperantotech.com> wrote:
> Argument reduction is a huge pain; maybe even slower than the evaluation once it's finished?
> HP calculators guaranteed accuracy to 1 LSdigit in the *input* argument (which is much, much larger than 2pi), not in the output
I think that makes a lot of sense. If you're doing sin(x) on an x
which is *so* large that the difference between x and the next higher
or lower representable value is great than 2*pi then it seems
reasonable for many applications to be able to return any value at all
between -1 and +1. For single precision that happens with input
arguments larger than 64,000,000 (epsilon of 4).
With regard to Luke's suggestion, it might be reasonable to add a mode
saying you're prepared to accept worse then 0.5 ULP accuracy, perhaps
with a few options: 1, 2, 4, 16 or something like that. An
implementation would always be free to calculate to a higher ULP than
you asked for.
We do intend to have half precision FP in the scalar instruction set,
as it doesn't make sense to have it in the vector instruction set but
not scalar. The problem is there are both FP16 (scaled down IEEE with
5 bit exponent and 10 bit fraction) and bfloat16 which is FP32 with
the lower 16 bits truncated (i.e. the same 8 exponent bits as FP32,
but 23-16 = 7 fraction bits).
More information about the libre-riscv-dev