(FPCore (x y z t) :precision binary64 (+ x (/ (* y (- z x)) t)))
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ x (/ (* y (- z x)) t))))
(if (<= t_1 (- INFINITY))
(fma x 1.0 (* (- z x) (/ y t)))
(if (<= t_1 2e+307) t_1 (fma y (/ (- z x) t) x)))))double code(double x, double y, double z, double t) {
return x + ((y * (z - x)) / t);
}
double code(double x, double y, double z, double t) {
double t_1 = x + ((y * (z - x)) / t);
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = fma(x, 1.0, ((z - x) * (y / t)));
} else if (t_1 <= 2e+307) {
tmp = t_1;
} else {
tmp = fma(y, ((z - x) / t), x);
}
return tmp;
}
function code(x, y, z, t) return Float64(x + Float64(Float64(y * Float64(z - x)) / t)) end
function code(x, y, z, t) t_1 = Float64(x + Float64(Float64(y * Float64(z - x)) / t)) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = fma(x, 1.0, Float64(Float64(z - x) * Float64(y / t))); elseif (t_1 <= 2e+307) tmp = t_1; else tmp = fma(y, Float64(Float64(z - x) / t), x); end return tmp end
code[x_, y_, z_, t_] := N[(x + N[(N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(x * 1.0 + N[(N[(z - x), $MachinePrecision] * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+307], t$95$1, N[(y * N[(N[(z - x), $MachinePrecision] / t), $MachinePrecision] + x), $MachinePrecision]]]]
x + \frac{y \cdot \left(z - x\right)}{t}
\begin{array}{l}
t_1 := x + \frac{y \cdot \left(z - x\right)}{t}\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(x, 1, \left(z - x\right) \cdot \frac{y}{t}\right)\\
\mathbf{elif}\;t_1 \leq 2 \cdot 10^{+307}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z - x}{t}, x\right)\\
\end{array}
| Original | 6.2 |
|---|---|
| Target | 1.9 |
| Herbie | 0.7 |
if (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) < -inf.0Initial program 64.0
Simplified0.2
Applied egg-rr1.3
Applied egg-rr2.2
Applied egg-rr0.2
if -inf.0 < (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) < 1.99999999999999997e307Initial program 0.7
if 1.99999999999999997e307 < (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) Initial program 63.1
Simplified0.4
Taylor expanded in z around 0 63.1
Simplified0.4
Final simplification0.7
herbie shell --seed 2022190
(FPCore (x y z t)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, D"
:precision binary64
:herbie-target
(- x (+ (* x (/ y t)) (* (- z) (/ y t))))
(+ x (/ (* y (- z x)) t)))