
(FPCore (x y z t a) :precision binary64 (+ x (/ (* y (- z t)) (- a t))))
double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / (a - t));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + ((y * (z - t)) / (a - t))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / (a - t));
}
def code(x, y, z, t, a): return x + ((y * (z - t)) / (a - t))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y * Float64(z - t)) / Float64(a - t))) end
function tmp = code(x, y, z, t, a) tmp = x + ((y * (z - t)) / (a - t)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - t\right)}{a - t}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ x (/ (* y (- z t)) (- a t))))
double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / (a - t));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + ((y * (z - t)) / (a - t))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / (a - t));
}
def code(x, y, z, t, a): return x + ((y * (z - t)) / (a - t))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y * Float64(z - t)) / Float64(a - t))) end
function tmp = code(x, y, z, t, a) tmp = x + ((y * (z - t)) / (a - t)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - t\right)}{a - t}
\end{array}
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* y (- z t)) (- a t))))
(if (or (<= t_1 (- INFINITY)) (not (<= t_1 2e+260)))
(fma (+ a t) (* (/ y (+ a t)) (/ (- z t) (- a t))) x)
(+ x t_1))))
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)) || !(t_1 <= 2e+260)) {
tmp = fma((a + t), ((y / (a + t)) * ((z - t) / (a - t))), x);
} else {
tmp = x + t_1;
}
return tmp;
}
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)) || !(t_1 <= 2e+260)) tmp = fma(Float64(a + t), Float64(Float64(y / Float64(a + t)) * Float64(Float64(z - t) / Float64(a - t))), x); else tmp = Float64(x + t_1); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 2e+260]], $MachinePrecision]], N[(N[(a + t), $MachinePrecision] * N[(N[(y / N[(a + t), $MachinePrecision]), $MachinePrecision] * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(x + t$95$1), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y \cdot \left(z - t\right)}{a - t}\\
\mathbf{if}\;t\_1 \leq -\infty \lor \neg \left(t\_1 \leq 2 \cdot 10^{+260}\right):\\
\;\;\;\;\mathsf{fma}\left(a + t, \frac{y}{a + t} \cdot \frac{z - t}{a - t}, x\right)\\
\mathbf{else}:\\
\;\;\;\;x + t\_1\\
\end{array}
\end{array}
if (/.f64 (*.f64 y (-.f64 z t)) (-.f64 a t)) < -inf.0 or 2.00000000000000013e260 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 a t)) Initial program 30.2%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift--.f64N/A
flip--N/A
associate-/r/N/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
lift-*.f64N/A
difference-of-squaresN/A
lift--.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-/.f6499.8
Applied rewrites99.8%
if -inf.0 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 a t)) < 2.00000000000000013e260Initial program 99.8%
Final simplification99.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* y (- z t)) (- a t))))
(if (or (<= t_1 (- INFINITY)) (not (<= t_1 2e+260)))
(fma (* (/ -1.0 (- t a)) y) (- z t) x)
(+ x t_1))))
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)) || !(t_1 <= 2e+260)) {
tmp = fma(((-1.0 / (t - a)) * y), (z - t), x);
} else {
tmp = x + t_1;
}
return tmp;
}
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)) || !(t_1 <= 2e+260)) tmp = fma(Float64(Float64(-1.0 / Float64(t - a)) * y), Float64(z - t), x); else tmp = Float64(x + t_1); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 2e+260]], $MachinePrecision]], N[(N[(N[(-1.0 / N[(t - a), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision] * N[(z - t), $MachinePrecision] + x), $MachinePrecision], N[(x + t$95$1), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y \cdot \left(z - t\right)}{a - t}\\
\mathbf{if}\;t\_1 \leq -\infty \lor \neg \left(t\_1 \leq 2 \cdot 10^{+260}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{-1}{t - a} \cdot y, z - t, x\right)\\
\mathbf{else}:\\
\;\;\;\;x + t\_1\\
\end{array}
\end{array}
if (/.f64 (*.f64 y (-.f64 z t)) (-.f64 a t)) < -inf.0 or 2.00000000000000013e260 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 a t)) Initial program 30.2%
lift-/.f64N/A
clear-numN/A
frac-2negN/A
metadata-evalN/A
lower-/.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
neg-sub0N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
associate--r+N/A
neg-sub0N/A
remove-double-negN/A
lower--.f6430.1
lift-*.f64N/A
*-commutativeN/A
lower-*.f6430.1
Applied rewrites30.1%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-/.f6499.7
Applied rewrites99.7%
if -inf.0 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 a t)) < 2.00000000000000013e260Initial program 99.8%
Final simplification99.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* y (- z t)) (- a t))))
(if (<= t_1 (- INFINITY))
(fma (- 1.0 (/ z t)) y x)
(if (<= t_1 5e+270) (+ x t_1) (* (/ y (- a t)) (- z 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 = fma((1.0 - (z / t)), y, x);
} else if (t_1 <= 5e+270) {
tmp = x + t_1;
} else {
tmp = (y / (a - t)) * (z - t);
}
return tmp;
}
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 = fma(Float64(1.0 - Float64(z / t)), y, x); elseif (t_1 <= 5e+270) tmp = Float64(x + t_1); else tmp = Float64(Float64(y / Float64(a - t)) * Float64(z - t)); end return tmp end
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[(N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision], If[LessEqual[t$95$1, 5e+270], N[(x + t$95$1), $MachinePrecision], N[(N[(y / N[(a - t), $MachinePrecision]), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y \cdot \left(z - t\right)}{a - t}\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(1 - \frac{z}{t}, y, x\right)\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+270}:\\
\;\;\;\;x + t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a - t} \cdot \left(z - t\right)\\
\end{array}
\end{array}
if (/.f64 (*.f64 y (-.f64 z t)) (-.f64 a t)) < -inf.0Initial program 29.7%
Taylor expanded in a around 0
+-commutativeN/A
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
neg-sub0N/A
div-subN/A
*-inversesN/A
associate-+l-N/A
neg-sub0N/A
mul-1-negN/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-/.f6483.9
Applied rewrites83.9%
if -inf.0 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 a t)) < 4.99999999999999976e270Initial program 99.8%
if 4.99999999999999976e270 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 a t)) Initial program 28.4%
Taylor expanded in x around 0
associate-/l*N/A
div-subN/A
distribute-lft-out--N/A
associate-/l*N/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
associate-*l/N/A
*-commutativeN/A
distribute-lft-out--N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6496.9
Applied rewrites96.9%
Final simplification98.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -7.2e-84) (not (<= t 9.2e-27))) (fma (- 1.0 (/ z t)) y x) (fma y (/ (- z t) a) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -7.2e-84) || !(t <= 9.2e-27)) {
tmp = fma((1.0 - (z / t)), y, x);
} else {
tmp = fma(y, ((z - t) / a), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -7.2e-84) || !(t <= 9.2e-27)) tmp = fma(Float64(1.0 - Float64(z / t)), y, x); else tmp = fma(y, Float64(Float64(z - t) / a), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -7.2e-84], N[Not[LessEqual[t, 9.2e-27]], $MachinePrecision]], N[(N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision], N[(y * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -7.2 \cdot 10^{-84} \lor \neg \left(t \leq 9.2 \cdot 10^{-27}\right):\\
\;\;\;\;\mathsf{fma}\left(1 - \frac{z}{t}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z - t}{a}, x\right)\\
\end{array}
\end{array}
if t < -7.20000000000000007e-84 or 9.1999999999999998e-27 < t Initial program 77.6%
Taylor expanded in a around 0
+-commutativeN/A
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
neg-sub0N/A
div-subN/A
*-inversesN/A
associate-+l-N/A
neg-sub0N/A
mul-1-negN/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-/.f6487.8
Applied rewrites87.8%
if -7.20000000000000007e-84 < t < 9.1999999999999998e-27Initial program 93.4%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift--.f64N/A
flip--N/A
associate-/r/N/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
lift-*.f64N/A
difference-of-squaresN/A
lift--.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-/.f6494.9
Applied rewrites94.9%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6489.7
Applied rewrites89.7%
Final simplification88.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -1.9e-83) (not (<= t 9.2e-27))) (fma (- 1.0 (/ z t)) y x) (fma (- z t) (/ y a) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -1.9e-83) || !(t <= 9.2e-27)) {
tmp = fma((1.0 - (z / t)), y, x);
} else {
tmp = fma((z - t), (y / a), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -1.9e-83) || !(t <= 9.2e-27)) tmp = fma(Float64(1.0 - Float64(z / t)), y, x); else tmp = fma(Float64(z - t), Float64(y / a), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -1.9e-83], N[Not[LessEqual[t, 9.2e-27]], $MachinePrecision]], N[(N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision], N[(N[(z - t), $MachinePrecision] * N[(y / a), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.9 \cdot 10^{-83} \lor \neg \left(t \leq 9.2 \cdot 10^{-27}\right):\\
\;\;\;\;\mathsf{fma}\left(1 - \frac{z}{t}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z - t, \frac{y}{a}, x\right)\\
\end{array}
\end{array}
if t < -1.89999999999999988e-83 or 9.1999999999999998e-27 < t Initial program 77.6%
Taylor expanded in a around 0
+-commutativeN/A
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
neg-sub0N/A
div-subN/A
*-inversesN/A
associate-+l-N/A
neg-sub0N/A
mul-1-negN/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-/.f6487.8
Applied rewrites87.8%
if -1.89999999999999988e-83 < t < 9.1999999999999998e-27Initial program 93.4%
Taylor expanded in a around inf
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f6488.8
Applied rewrites88.8%
Final simplification88.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -2.5e-59) (not (<= t 9.2e-27))) (fma (- 1.0 (/ z t)) y x) (fma (/ z a) y x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -2.5e-59) || !(t <= 9.2e-27)) {
tmp = fma((1.0 - (z / t)), y, x);
} else {
tmp = fma((z / a), y, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -2.5e-59) || !(t <= 9.2e-27)) tmp = fma(Float64(1.0 - Float64(z / t)), y, x); else tmp = fma(Float64(z / a), y, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -2.5e-59], N[Not[LessEqual[t, 9.2e-27]], $MachinePrecision]], N[(N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision], N[(N[(z / a), $MachinePrecision] * y + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.5 \cdot 10^{-59} \lor \neg \left(t \leq 9.2 \cdot 10^{-27}\right):\\
\;\;\;\;\mathsf{fma}\left(1 - \frac{z}{t}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{a}, y, x\right)\\
\end{array}
\end{array}
if t < -2.5000000000000001e-59 or 9.1999999999999998e-27 < t Initial program 76.7%
Taylor expanded in a around 0
+-commutativeN/A
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
neg-sub0N/A
div-subN/A
*-inversesN/A
associate-+l-N/A
neg-sub0N/A
mul-1-negN/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-/.f6488.6
Applied rewrites88.6%
if -2.5000000000000001e-59 < t < 9.1999999999999998e-27Initial program 93.8%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6486.9
Applied rewrites86.9%
Final simplification87.9%
(FPCore (x y z t a) :precision binary64 (if (<= z -2.2e+187) (* (/ z (- a t)) y) (if (<= z 2.9e+72) (fma t (/ y (- t a)) x) (* (/ y (- a t)) z))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.2e+187) {
tmp = (z / (a - t)) * y;
} else if (z <= 2.9e+72) {
tmp = fma(t, (y / (t - a)), x);
} else {
tmp = (y / (a - t)) * z;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.2e+187) tmp = Float64(Float64(z / Float64(a - t)) * y); elseif (z <= 2.9e+72) tmp = fma(t, Float64(y / Float64(t - a)), x); else tmp = Float64(Float64(y / Float64(a - t)) * z); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.2e+187], N[(N[(z / N[(a - t), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[z, 2.9e+72], N[(t * N[(y / N[(t - a), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(N[(y / N[(a - t), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.2 \cdot 10^{+187}:\\
\;\;\;\;\frac{z}{a - t} \cdot y\\
\mathbf{elif}\;z \leq 2.9 \cdot 10^{+72}:\\
\;\;\;\;\mathsf{fma}\left(t, \frac{y}{t - a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a - t} \cdot z\\
\end{array}
\end{array}
if z < -2.1999999999999998e187Initial program 64.4%
Taylor expanded in z around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6481.4
Applied rewrites81.4%
if -2.1999999999999998e187 < z < 2.90000000000000017e72Initial program 87.1%
lift-/.f64N/A
clear-numN/A
frac-2negN/A
metadata-evalN/A
lower-/.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
neg-sub0N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
associate--r+N/A
neg-sub0N/A
remove-double-negN/A
lower--.f6487.1
lift-*.f64N/A
*-commutativeN/A
lower-*.f6487.1
Applied rewrites87.1%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6486.9
Applied rewrites86.9%
if 2.90000000000000017e72 < z Initial program 79.9%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift--.f64N/A
flip--N/A
associate-/r/N/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
lift-*.f64N/A
difference-of-squaresN/A
lift--.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-/.f6493.5
Applied rewrites93.5%
Taylor expanded in z around inf
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6465.2
Applied rewrites65.2%
Final simplification82.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -100000000000.0) (not (<= t 9.5e+66))) (+ y x) (fma (/ z a) y x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -100000000000.0) || !(t <= 9.5e+66)) {
tmp = y + x;
} else {
tmp = fma((z / a), y, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -100000000000.0) || !(t <= 9.5e+66)) tmp = Float64(y + x); else tmp = fma(Float64(z / a), y, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -100000000000.0], N[Not[LessEqual[t, 9.5e+66]], $MachinePrecision]], N[(y + x), $MachinePrecision], N[(N[(z / a), $MachinePrecision] * y + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -100000000000 \lor \neg \left(t \leq 9.5 \cdot 10^{+66}\right):\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{a}, y, x\right)\\
\end{array}
\end{array}
if t < -1e11 or 9.50000000000000051e66 < t Initial program 73.4%
Taylor expanded in t around inf
+-commutativeN/A
lower-+.f6476.8
Applied rewrites76.8%
if -1e11 < t < 9.50000000000000051e66Initial program 93.5%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6480.6
Applied rewrites80.6%
Final simplification78.8%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.05e+188) (* (/ z a) y) (+ y x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.05e+188) {
tmp = (z / a) * y;
} else {
tmp = y + x;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (z <= (-1.05d+188)) then
tmp = (z / a) * y
else
tmp = y + x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.05e+188) {
tmp = (z / a) * y;
} else {
tmp = y + x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.05e+188: tmp = (z / a) * y else: tmp = y + x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.05e+188) tmp = Float64(Float64(z / a) * y); else tmp = Float64(y + x); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -1.05e+188) tmp = (z / a) * y; else tmp = y + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.05e+188], N[(N[(z / a), $MachinePrecision] * y), $MachinePrecision], N[(y + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.05 \cdot 10^{+188}:\\
\;\;\;\;\frac{z}{a} \cdot y\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if z < -1.04999999999999993e188Initial program 64.4%
Taylor expanded in z around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6481.4
Applied rewrites81.4%
Taylor expanded in t around 0
Applied rewrites49.7%
if -1.04999999999999993e188 < z Initial program 85.5%
Taylor expanded in t around inf
+-commutativeN/A
lower-+.f6465.6
Applied rewrites65.6%
Final simplification64.3%
(FPCore (x y z t a) :precision binary64 (+ y x))
double code(double x, double y, double z, double t, double a) {
return y + x;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = y + x
end function
public static double code(double x, double y, double z, double t, double a) {
return y + x;
}
def code(x, y, z, t, a): return y + x
function code(x, y, z, t, a) return Float64(y + x) end
function tmp = code(x, y, z, t, a) tmp = y + x; end
code[x_, y_, z_, t_, a_] := N[(y + x), $MachinePrecision]
\begin{array}{l}
\\
y + x
\end{array}
Initial program 83.8%
Taylor expanded in t around inf
+-commutativeN/A
lower-+.f6461.8
Applied rewrites61.8%
Final simplification61.8%
(FPCore (x y z t a) :precision binary64 (+ x (/ y (/ (- a t) (- z t)))))
double code(double x, double y, double z, double t, double a) {
return x + (y / ((a - t) / (z - t)));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + (y / ((a - t) / (z - t)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y / ((a - t) / (z - t)));
}
def code(x, y, z, t, a): return x + (y / ((a - t) / (z - t)))
function code(x, y, z, t, a) return Float64(x + Float64(y / Float64(Float64(a - t) / Float64(z - t)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y / ((a - t) / (z - t))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y / N[(N[(a - t), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y}{\frac{a - t}{z - t}}
\end{array}
herbie shell --seed 2024299
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTicks from plot-0.2.3.4, B"
:precision binary64
:alt
(! :herbie-platform default (+ x (/ y (/ (- a t) (- z t)))))
(+ x (/ (* y (- z t)) (- a t))))