fma_test2

?

Percentage Accurate: 34.4% → 99.6%
Time: 6.4s
Precision: binary64
Cost: 6592

?

\[1.9 \leq t \land t \leq 2.1\]
\[1.7 \cdot 10^{+308} \cdot t - 1.7 \cdot 10^{+308} \]
\[\mathsf{fma}\left(1.7 \cdot 10^{+308}, t, -1.7 \cdot 10^{+308}\right) \]
(FPCore (t) :precision binary64 (- (* 1.7e+308 t) 1.7e+308))
(FPCore (t) :precision binary64 (fma 1.7e+308 t -1.7e+308))
double code(double t) {
	return (1.7e+308 * t) - 1.7e+308;
}
double code(double t) {
	return fma(1.7e+308, t, -1.7e+308);
}
function code(t)
	return Float64(Float64(1.7e+308 * t) - 1.7e+308)
end
function code(t)
	return fma(1.7e+308, t, -1.7e+308)
end
code[t_] := N[(N[(1.7e+308 * t), $MachinePrecision] - 1.7e+308), $MachinePrecision]
code[t_] := N[(1.7e+308 * t + -1.7e+308), $MachinePrecision]
1.7 \cdot 10^{+308} \cdot t - 1.7 \cdot 10^{+308}
\mathsf{fma}\left(1.7 \cdot 10^{+308}, t, -1.7 \cdot 10^{+308}\right)

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Herbie found 3 alternatives:

AlternativeAccuracySpeedup

Accuracy vs Speed

The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Bogosity?

Bogosity

Target

Original34.4%
Target99.6%
Herbie99.6%
\[\mathsf{fma}\left(1.7 \cdot 10^{+308}, t, -1.7 \cdot 10^{+308}\right) \]

Derivation?

  1. Initial program 34.2%

    \[1.7 \cdot 10^{+308} \cdot t - 1.7 \cdot 10^{+308} \]
  2. Simplified99.6%

    \[\leadsto \color{blue}{\mathsf{fma}\left(1.7 \cdot 10^{+308}, t, -1.7 \cdot 10^{+308}\right)} \]
    Step-by-step derivation

    [Start]34.2%

    \[ 1.7 \cdot 10^{+308} \cdot t - 1.7 \cdot 10^{+308} \]

    fma-neg [=>]99.6%

    \[ \color{blue}{\mathsf{fma}\left(1.7 \cdot 10^{+308}, t, -1.7 \cdot 10^{+308}\right)} \]

    metadata-eval [=>]99.6%

    \[ \mathsf{fma}\left(1.7 \cdot 10^{+308}, t, \color{blue}{-1.7 \cdot 10^{+308}}\right) \]
  3. Final simplification99.6%

    \[\leadsto \mathsf{fma}\left(1.7 \cdot 10^{+308}, t, -1.7 \cdot 10^{+308}\right) \]

Alternatives

Alternative 1
Accuracy99.6%
Cost6592
\[\mathsf{fma}\left(1.7 \cdot 10^{+308}, t, -1.7 \cdot 10^{+308}\right) \]
Alternative 2
Accuracy34.4%
Cost192
\[1.7 \cdot 10^{+308} \cdot t \]
Alternative 3
Accuracy0.0%
Cost64
\[-1.7 \cdot 10^{+308} \]

Reproduce?

herbie shell --seed 2023178 
(FPCore (t)
  :name "fma_test2"
  :precision binary64
  :pre (and (<= 1.9 t) (<= t 2.1))

  :herbie-target
  (fma 1.7e+308 t (- 1.7e+308))

  (- (* 1.7e+308 t) 1.7e+308))