| Alternative 1 | |
|---|---|
| Error | 11.4 |
| Cost | 840 |
\[\begin{array}{l}
\mathbf{if}\;t \leq -4.3 \cdot 10^{+17}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;t \leq 1.6 \cdot 10^{+45}:\\
\;\;\;\;x + \frac{y \cdot z}{a - t}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\]
(FPCore (x y z t a) :precision binary64 (+ x (/ (* y (- z t)) (- a t))))
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (/ (* y (- z t)) (- a t)))) (if (<= t_1 (- INFINITY)) (+ x y) (if (<= t_1 1e+293) (+ x t_1) (+ x y)))))
double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / (a - t));
}
double code(double x, double y, double z, double t, double a) {
double t_1 = (y * (z - t)) / (a - t);
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = x + y;
} else if (t_1 <= 1e+293) {
tmp = x + t_1;
} else {
tmp = x + y;
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / (a - t));
}
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (y * (z - t)) / (a - t);
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = x + y;
} else if (t_1 <= 1e+293) {
tmp = x + t_1;
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): return x + ((y * (z - t)) / (a - t))
def code(x, y, z, t, a): t_1 = (y * (z - t)) / (a - t) tmp = 0 if t_1 <= -math.inf: tmp = x + y elif t_1 <= 1e+293: tmp = x + t_1 else: tmp = x + y return tmp
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y * Float64(z - t)) / Float64(a - t))) end
function code(x, y, z, t, a) t_1 = Float64(Float64(y * Float64(z - t)) / Float64(a - t)) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(x + y); elseif (t_1 <= 1e+293) tmp = Float64(x + t_1); else tmp = Float64(x + y); end return tmp end
function tmp = code(x, y, z, t, a) tmp = x + ((y * (z - t)) / (a - t)); end
function tmp_2 = code(x, y, z, t, a) t_1 = (y * (z - t)) / (a - t); tmp = 0.0; if (t_1 <= -Inf) tmp = x + y; elseif (t_1 <= 1e+293) tmp = x + t_1; else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(x + y), $MachinePrecision], If[LessEqual[t$95$1, 1e+293], N[(x + t$95$1), $MachinePrecision], N[(x + y), $MachinePrecision]]]]
x + \frac{y \cdot \left(z - t\right)}{a - t}
\begin{array}{l}
t_1 := \frac{y \cdot \left(z - t\right)}{a - t}\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;x + y\\
\mathbf{elif}\;t_1 \leq 10^{+293}:\\
\;\;\;\;x + t_1\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
Results
| Original | 10.6 |
|---|---|
| Target | 1.3 |
| Herbie | 4.2 |
if (/.f64 (*.f64 y (-.f64 z t)) (-.f64 a t)) < -inf.0 or 9.9999999999999992e292 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 a t)) Initial program 62.3
Taylor expanded in t around inf 23.9
if -inf.0 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 a t)) < 9.9999999999999992e292Initial program 0.2
Final simplification4.2
| Alternative 1 | |
|---|---|
| Error | 11.4 |
| Cost | 840 |
| Alternative 2 | |
|---|---|
| Error | 14.9 |
| Cost | 712 |
| Alternative 3 | |
|---|---|
| Error | 19.8 |
| Cost | 456 |
| Alternative 4 | |
|---|---|
| Error | 28.5 |
| Cost | 64 |
herbie shell --seed 2023090
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTicks from plot-0.2.3.4, B"
:precision binary64
:herbie-target
(+ x (/ y (/ (- a t) (- z t))))
(+ x (/ (* y (- z t)) (- a t))))