Average Error: 0.1 → 8.2
Time: 9.1s
Precision: binary64
Cost: 6984
\[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
\[\begin{array}{l} t_1 := \mathsf{fma}\left(t, x, 5 \cdot y\right)\\ \mathbf{if}\;t \leq -3.6452974772863675 \cdot 10^{+30}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 1.0138348239794386 \cdot 10^{+41}:\\ \;\;\;\;\left(x \cdot y + x \cdot \left(y + 2 \cdot z\right)\right) + 5 \cdot y\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (+ (* x (+ (+ (+ (+ y z) z) y) t)) (* y 5.0)))
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (fma t x (* 5.0 y))))
   (if (<= t -3.6452974772863675e+30)
     t_1
     (if (<= t 1.0138348239794386e+41)
       (+ (+ (* x y) (* x (+ y (* 2.0 z)))) (* 5.0 y))
       t_1))))
double code(double x, double y, double z, double t) {
	return (x * ((((y + z) + z) + y) + t)) + (y * 5.0);
}
double code(double x, double y, double z, double t) {
	double t_1 = fma(t, x, (5.0 * y));
	double tmp;
	if (t <= -3.6452974772863675e+30) {
		tmp = t_1;
	} else if (t <= 1.0138348239794386e+41) {
		tmp = ((x * y) + (x * (y + (2.0 * z)))) + (5.0 * y);
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(x, y, z, t)
	return Float64(Float64(x * Float64(Float64(Float64(Float64(y + z) + z) + y) + t)) + Float64(y * 5.0))
end
function code(x, y, z, t)
	t_1 = fma(t, x, Float64(5.0 * y))
	tmp = 0.0
	if (t <= -3.6452974772863675e+30)
		tmp = t_1;
	elseif (t <= 1.0138348239794386e+41)
		tmp = Float64(Float64(Float64(x * y) + Float64(x * Float64(y + Float64(2.0 * z)))) + Float64(5.0 * y));
	else
		tmp = t_1;
	end
	return tmp
end
code[x_, y_, z_, t_] := N[(N[(x * N[(N[(N[(N[(y + z), $MachinePrecision] + z), $MachinePrecision] + y), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t * x + N[(5.0 * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -3.6452974772863675e+30], t$95$1, If[LessEqual[t, 1.0138348239794386e+41], N[(N[(N[(x * y), $MachinePrecision] + N[(x * N[(y + N[(2.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(5.0 * y), $MachinePrecision]), $MachinePrecision], t$95$1]]]
x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5
\begin{array}{l}
t_1 := \mathsf{fma}\left(t, x, 5 \cdot y\right)\\
\mathbf{if}\;t \leq -3.6452974772863675 \cdot 10^{+30}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;t \leq 1.0138348239794386 \cdot 10^{+41}:\\
\;\;\;\;\left(x \cdot y + x \cdot \left(y + 2 \cdot z\right)\right) + 5 \cdot y\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}

Error

Derivation

  1. Split input into 2 regimes
  2. if t < -3.6452974772863675e30 or 1.0138348239794386e41 < t

    1. Initial program 0.1

      \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
    2. Taylor expanded in t around inf 11.5

      \[\leadsto \color{blue}{t \cdot x} + y \cdot 5 \]
    3. Applied egg-rr11.5

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, 5, t \cdot x\right)} \]
    4. Taylor expanded in y around 0 11.5

      \[\leadsto \color{blue}{t \cdot x + 5 \cdot y} \]
    5. Simplified11.5

      \[\leadsto \color{blue}{\mathsf{fma}\left(t, x, 5 \cdot y\right)} \]

    if -3.6452974772863675e30 < t < 1.0138348239794386e41

    1. Initial program 0.1

      \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
    2. Applied egg-rr0.1

      \[\leadsto \color{blue}{\left(x \cdot \left(y + \left(z + z\right)\right) + x \cdot \left(y + t\right)\right)} + y \cdot 5 \]
    3. Taylor expanded in t around 0 5.9

      \[\leadsto \color{blue}{\left(y \cdot x + \left(2 \cdot z + y\right) \cdot x\right)} + y \cdot 5 \]
  3. Recombined 2 regimes into one program.
  4. Final simplification8.2

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -3.6452974772863675 \cdot 10^{+30}:\\ \;\;\;\;\mathsf{fma}\left(t, x, 5 \cdot y\right)\\ \mathbf{elif}\;t \leq 1.0138348239794386 \cdot 10^{+41}:\\ \;\;\;\;\left(x \cdot y + x \cdot \left(y + 2 \cdot z\right)\right) + 5 \cdot y\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(t, x, 5 \cdot y\right)\\ \end{array} \]

Alternatives

Alternative 1
Error17.2
Cost1368
\[\begin{array}{l} t_1 := 5 \cdot y + 2 \cdot \left(x \cdot z\right)\\ t_2 := 5 \cdot y + t \cdot x\\ \mathbf{if}\;x \leq -28154542415326.434:\\ \;\;\;\;x \cdot \left(t + y \cdot 2\right)\\ \mathbf{elif}\;x \leq -6.56900574056967 \cdot 10^{-169}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 4.80606541478479 \cdot 10^{-235}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 1.1831674959570104 \cdot 10^{-181}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 1.2008995422443357 \cdot 10^{-96}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 4.982592018072647 \cdot 10^{-6}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(2 \cdot \left(y + z\right)\right)\\ \end{array} \]
Alternative 2
Error26.5
Cost1240
\[\begin{array}{l} t_1 := y \cdot \left(5 + x \cdot 2\right)\\ t_2 := 2 \cdot \left(x \cdot z\right)\\ \mathbf{if}\;y \leq -8.939448415538344 \cdot 10^{-18}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -3.3600117675051193 \cdot 10^{-102}:\\ \;\;\;\;x \cdot \left(t + y \cdot 2\right)\\ \mathbf{elif}\;y \leq 1.969283725163345 \cdot 10^{-275}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq 4.277057648091321 \cdot 10^{-224}:\\ \;\;\;\;t \cdot x\\ \mathbf{elif}\;y \leq 1.1292999485833846 \cdot 10^{-156}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq 1.1411206303798572 \cdot 10^{-154}:\\ \;\;\;\;t \cdot x\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 3
Error8.2
Cost1224
\[\begin{array}{l} t_1 := 5 \cdot y + t \cdot x\\ \mathbf{if}\;t \leq -3.6452974772863675 \cdot 10^{+30}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 1.0138348239794386 \cdot 10^{+41}:\\ \;\;\;\;\left(x \cdot y + x \cdot \left(y + 2 \cdot z\right)\right) + 5 \cdot y\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 4
Error35.3
Cost1116
\[\begin{array}{l} \mathbf{if}\;t \leq -2.0925616486035292 \cdot 10^{+127}:\\ \;\;\;\;t \cdot x\\ \mathbf{elif}\;t \leq -4.5899833804824124 \cdot 10^{+33}:\\ \;\;\;\;5 \cdot y\\ \mathbf{elif}\;t \leq -2.5295694552152724 \cdot 10^{-21}:\\ \;\;\;\;t \cdot x\\ \mathbf{elif}\;t \leq 3.413690548294177 \cdot 10^{+62}:\\ \;\;\;\;5 \cdot y\\ \mathbf{elif}\;t \leq 7.630452623909079 \cdot 10^{+102}:\\ \;\;\;\;t \cdot x\\ \mathbf{elif}\;t \leq 3.9 \cdot 10^{+188}:\\ \;\;\;\;5 \cdot y\\ \mathbf{elif}\;t \leq 3.8 \cdot 10^{+280}:\\ \;\;\;\;t \cdot x\\ \mathbf{else}:\\ \;\;\;\;5 \cdot y\\ \end{array} \]
Alternative 5
Error32.8
Cost984
\[\begin{array}{l} t_1 := 2 \cdot \left(x \cdot z\right)\\ \mathbf{if}\;y \leq -8.939448415538344 \cdot 10^{-18}:\\ \;\;\;\;5 \cdot y\\ \mathbf{elif}\;y \leq -3.3600117675051193 \cdot 10^{-102}:\\ \;\;\;\;t \cdot x\\ \mathbf{elif}\;y \leq 1.969283725163345 \cdot 10^{-275}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 4.277057648091321 \cdot 10^{-224}:\\ \;\;\;\;t \cdot x\\ \mathbf{elif}\;y \leq 1.1292999485833846 \cdot 10^{-156}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 1.1411206303798572 \cdot 10^{-154}:\\ \;\;\;\;t \cdot x\\ \mathbf{else}:\\ \;\;\;\;5 \cdot y\\ \end{array} \]
Alternative 6
Error26.5
Cost976
\[\begin{array}{l} t_1 := x \cdot \left(t + y \cdot 2\right)\\ \mathbf{if}\;x \leq -0.0006646614810350557:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 2.7939385697342204 \cdot 10^{-18}:\\ \;\;\;\;5 \cdot y\\ \mathbf{elif}\;x \leq 1.06 \cdot 10^{+84}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 2.1 \cdot 10^{+178}:\\ \;\;\;\;2 \cdot \left(x \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 7
Error17.5
Cost976
\[\begin{array}{l} t_1 := x \cdot \left(t + y \cdot 2\right)\\ \mathbf{if}\;x \leq -8.36043310335309 \cdot 10^{-16}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 0.007552452826315724:\\ \;\;\;\;5 \cdot y + t \cdot x\\ \mathbf{elif}\;x \leq 1.06 \cdot 10^{+84}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 2.1 \cdot 10^{+178}:\\ \;\;\;\;2 \cdot \left(x \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 8
Error16.9
Cost712
\[\begin{array}{l} \mathbf{if}\;x \leq -8.36043310335309 \cdot 10^{-16}:\\ \;\;\;\;x \cdot \left(t + y \cdot 2\right)\\ \mathbf{elif}\;x \leq 7.7 \cdot 10^{-13}:\\ \;\;\;\;5 \cdot y + t \cdot x\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(2 \cdot \left(y + z\right)\right)\\ \end{array} \]
Alternative 9
Error46.2
Cost192
\[t \cdot x \]

Error

Reproduce

herbie shell --seed 2022228 
(FPCore (x y z t)
  :name "Graphics.Rendering.Plot.Render.Plot.Legend:renderLegendOutside from plot-0.2.3.4, B"
  :precision binary64
  (+ (* x (+ (+ (+ (+ y z) z) y) t)) (* y 5.0)))