Strictfp only applies to intermediate computations [1]. With strictfp
all intermediates have to be represented with the same precision on
all platforms, thus under/overflow will occur at the same point in the
computation.

double a = Double.MAX_VALUE;
double b = 2;
double c = 3;
double y = a * b / c;

What is y?

If you store the intermediate with extended precision then y will be
finite. If the intermediate is allowed to overflow then the result is
Infinity. The wikipedia article has links to the JLS where usage of
extended precision computations are allowed [2]. It most cases it will
not make any difference. Only for extreme computations will this
ensure reproducibility.

Alex

[1] https://en.wikipedia.org/wiki/Strictfp
[2] https://docs.oracle.com/javase/specs/jls/se9/html/jls-4.html#jls-4.2.3

On Wed, 22 Sept 2021 at 13:14, Gilles Sadowski <gillese...@gmail.com> wrote:
>
> Hello.
>
> Le mer. 22 sept. 2021 à 14:00, Erik Svensson
> <erik.svens...@nasdaq.com> a écrit :
> >
> >
> >
> > Howdy gents!
> >
> >
> >
> > I’ve been preparing for a lecture on java 17 and noticed that all floating 
> > point operations will be strictfp (ie strictfp will be retired).
> >
> > In the long run, does this mean that the rationale for AccurateMath goes 
> > away?
>
> "strictfp" ensures reproducibility (independent of HW), but does it entail
> (1 ULP) accuracy?  If so, the answer seems to be "yes", at least when
> the minimal supported version is Java 17.  However, the answer could
> be applicable sooner if we have benchmarks reporting speed and accuracy
> on Java 8 and 11 (cf. previous posts on the subject)...
>
> Regards,
> Gilles
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
> For additional commands, e-mail: dev-h...@commons.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to