(FPCore (x y z t) :precision binary64 (/ (* x (- y z)) (- t z)))
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (* x (- y z)) (- t z))))
(if (<= t_1 (- INFINITY))
(/ x (* (- t z) (/ 1.0 (- y z))))
(if (<= t_1 2e+206)
(- (/ (* x y) (- t z)) (/ (* x z) (- t z)))
(* x (/ (- y z) (- t z)))))))double code(double x, double y, double z, double t) {
return (x * (y - z)) / (t - z);
}
double code(double x, double y, double z, double t) {
double t_1 = (x * (y - z)) / (t - z);
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = x / ((t - z) * (1.0 / (y - z)));
} else if (t_1 <= 2e+206) {
tmp = ((x * y) / (t - z)) - ((x * z) / (t - z));
} else {
tmp = x * ((y - z) / (t - z));
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
return (x * (y - z)) / (t - z);
}
public static double code(double x, double y, double z, double t) {
double t_1 = (x * (y - z)) / (t - z);
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = x / ((t - z) * (1.0 / (y - z)));
} else if (t_1 <= 2e+206) {
tmp = ((x * y) / (t - z)) - ((x * z) / (t - z));
} else {
tmp = x * ((y - z) / (t - z));
}
return tmp;
}
def code(x, y, z, t): return (x * (y - z)) / (t - z)
def code(x, y, z, t): t_1 = (x * (y - z)) / (t - z) tmp = 0 if t_1 <= -math.inf: tmp = x / ((t - z) * (1.0 / (y - z))) elif t_1 <= 2e+206: tmp = ((x * y) / (t - z)) - ((x * z) / (t - z)) else: tmp = x * ((y - z) / (t - z)) return tmp
function code(x, y, z, t) return Float64(Float64(x * Float64(y - z)) / Float64(t - z)) end
function code(x, y, z, t) t_1 = Float64(Float64(x * Float64(y - z)) / Float64(t - z)) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(x / Float64(Float64(t - z) * Float64(1.0 / Float64(y - z)))); elseif (t_1 <= 2e+206) tmp = Float64(Float64(Float64(x * y) / Float64(t - z)) - Float64(Float64(x * z) / Float64(t - z))); else tmp = Float64(x * Float64(Float64(y - z) / Float64(t - z))); end return tmp end
function tmp = code(x, y, z, t) tmp = (x * (y - z)) / (t - z); end
function tmp_2 = code(x, y, z, t) t_1 = (x * (y - z)) / (t - z); tmp = 0.0; if (t_1 <= -Inf) tmp = x / ((t - z) * (1.0 / (y - z))); elseif (t_1 <= 2e+206) tmp = ((x * y) / (t - z)) - ((x * z) / (t - z)); else tmp = x * ((y - z) / (t - z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := N[(N[(x * N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(x / N[(N[(t - z), $MachinePrecision] * N[(1.0 / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+206], N[(N[(N[(x * y), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision] - N[(N[(x * z), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(y - z), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\frac{x \cdot \left(y - z\right)}{t - z}
\begin{array}{l}
t_1 := \frac{x \cdot \left(y - z\right)}{t - z}\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;\frac{x}{\left(t - z\right) \cdot \frac{1}{y - z}}\\
\mathbf{elif}\;t_1 \leq 2 \cdot 10^{+206}:\\
\;\;\;\;\frac{x \cdot y}{t - z} - \frac{x \cdot z}{t - z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y - z}{t - z}\\
\end{array}
Results
| Original | 11.7 |
|---|---|
| Target | 2.1 |
| Herbie | 1.3 |
if (/.f64 (*.f64 x (-.f64 y z)) (-.f64 t z)) < -inf.0Initial program 64.0
Simplified0.1
Applied egg-rr0.1
Applied egg-rr0.3
if -inf.0 < (/.f64 (*.f64 x (-.f64 y z)) (-.f64 t z)) < 2.0000000000000001e206Initial program 1.3
Simplified2.4
Taylor expanded in y around 0 1.3
if 2.0000000000000001e206 < (/.f64 (*.f64 x (-.f64 y z)) (-.f64 t z)) Initial program 47.8
Simplified2.3
Final simplification1.3
herbie shell --seed 2022192
(FPCore (x y z t)
:name "Graphics.Rendering.Chart.Plot.AreaSpots:renderAreaSpots4D from Chart-1.5.3"
:precision binary64
:herbie-target
(/ x (/ (- t z) (- y z)))
(/ (* x (- y z)) (- t z)))