
(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 12 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 (+ 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}
Initial program 87.4%
associate-/l*N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
--lowering--.f6499.5
Applied egg-rr99.5%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma (/ y (- a t)) (- z t) x)) (t_2 (/ (* y (- z t)) (- a t)))) (if (<= t_2 (- INFINITY)) t_1 (if (<= t_2 1e+228) (+ x t_2) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((y / (a - t)), (z - t), x);
double t_2 = (y * (z - t)) / (a - t);
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_2 <= 1e+228) {
tmp = x + t_2;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(y / Float64(a - t)), Float64(z - t), x) t_2 = Float64(Float64(y * Float64(z - t)) / Float64(a - t)) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_1; elseif (t_2 <= 1e+228) tmp = Float64(x + t_2); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y / N[(a - t), $MachinePrecision]), $MachinePrecision] * N[(z - t), $MachinePrecision] + x), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$1, If[LessEqual[t$95$2, 1e+228], N[(x + t$95$2), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{y}{a - t}, z - t, x\right)\\
t_2 := \frac{y \cdot \left(z - t\right)}{a - t}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 10^{+228}:\\
\;\;\;\;x + t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 (*.f64 y (-.f64 z t)) (-.f64 a t)) < -inf.0 or 9.9999999999999992e227 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 a t)) Initial program 41.6%
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
--lowering--.f6499.8
Applied egg-rr99.8%
if -inf.0 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 a t)) < 9.9999999999999992e227Initial program 99.4%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (/ (* y (- z t)) (- a t)))) (if (<= t_1 -2000000000.0) y (if (<= t_1 2e+192) x y))))
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 <= -2000000000.0) {
tmp = y;
} else if (t_1 <= 2e+192) {
tmp = x;
} else {
tmp = y;
}
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) :: t_1
real(8) :: tmp
t_1 = (y * (z - t)) / (a - t)
if (t_1 <= (-2000000000.0d0)) then
tmp = y
else if (t_1 <= 2d+192) then
tmp = x
else
tmp = y
end if
code = tmp
end function
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 <= -2000000000.0) {
tmp = y;
} else if (t_1 <= 2e+192) {
tmp = x;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y * (z - t)) / (a - t) tmp = 0 if t_1 <= -2000000000.0: tmp = y elif t_1 <= 2e+192: tmp = x else: tmp = y 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 <= -2000000000.0) tmp = y; elseif (t_1 <= 2e+192) tmp = x; else tmp = y; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y * (z - t)) / (a - t); tmp = 0.0; if (t_1 <= -2000000000.0) tmp = y; elseif (t_1 <= 2e+192) tmp = x; else tmp = y; end tmp_2 = 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, -2000000000.0], y, If[LessEqual[t$95$1, 2e+192], x, y]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y \cdot \left(z - t\right)}{a - t}\\
\mathbf{if}\;t\_1 \leq -2000000000:\\
\;\;\;\;y\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+192}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if (/.f64 (*.f64 y (-.f64 z t)) (-.f64 a t)) < -2e9 or 2.00000000000000008e192 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 a t)) Initial program 67.0%
Taylor expanded in x around 0
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
--lowering--.f6460.0
Simplified60.0%
Taylor expanded in t around inf
Simplified28.5%
if -2e9 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 a t)) < 2.00000000000000008e192Initial program 99.3%
Taylor expanded in x around inf
Simplified72.5%
(FPCore (x y z t a)
:precision binary64
(if (<= y -3e+231)
(/ (* y z) a)
(if (<= y 2.1e+38)
(+ x y)
(if (<= y 2.7e+186) (* z (/ y a)) (fma a (/ y t) y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -3e+231) {
tmp = (y * z) / a;
} else if (y <= 2.1e+38) {
tmp = x + y;
} else if (y <= 2.7e+186) {
tmp = z * (y / a);
} else {
tmp = fma(a, (y / t), y);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (y <= -3e+231) tmp = Float64(Float64(y * z) / a); elseif (y <= 2.1e+38) tmp = Float64(x + y); elseif (y <= 2.7e+186) tmp = Float64(z * Float64(y / a)); else tmp = fma(a, Float64(y / t), y); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -3e+231], N[(N[(y * z), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[y, 2.1e+38], N[(x + y), $MachinePrecision], If[LessEqual[y, 2.7e+186], N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision], N[(a * N[(y / t), $MachinePrecision] + y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3 \cdot 10^{+231}:\\
\;\;\;\;\frac{y \cdot z}{a}\\
\mathbf{elif}\;y \leq 2.1 \cdot 10^{+38}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;y \leq 2.7 \cdot 10^{+186}:\\
\;\;\;\;z \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, \frac{y}{t}, y\right)\\
\end{array}
\end{array}
if y < -3.0000000000000002e231Initial program 78.9%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f6471.2
Simplified71.2%
Taylor expanded in y around inf
/-lowering-/.f64N/A
*-lowering-*.f6471.3
Simplified71.3%
if -3.0000000000000002e231 < y < 2.1e38Initial program 95.2%
Taylor expanded in t around inf
+-commutativeN/A
+-lowering-+.f6469.7
Simplified69.7%
if 2.1e38 < y < 2.6999999999999999e186Initial program 78.0%
Taylor expanded in x around 0
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
--lowering--.f6455.5
Simplified55.5%
associate-*l/N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
--lowering--.f6477.5
Applied egg-rr77.5%
Taylor expanded in a around inf
/-lowering-/.f6458.4
Simplified58.4%
Taylor expanded in z around inf
Simplified54.9%
if 2.6999999999999999e186 < y Initial program 49.9%
Taylor expanded in x around 0
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
--lowering--.f6439.5
Simplified39.5%
Taylor expanded in z around 0
mul-1-negN/A
*-commutativeN/A
associate-/l*N/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
distribute-neg-frac2N/A
mul-1-negN/A
/-lowering-/.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
--lowering--.f6452.5
Simplified52.5%
Taylor expanded in t around inf
+-commutativeN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f6454.5
Simplified54.5%
Final simplification66.4%
(FPCore (x y z t a) :precision binary64 (if (<= y -1.5e+231) (/ (* y z) a) (if (<= y 2e+38) (+ x y) (if (<= y 2.7e+187) (* z (/ y a)) (+ x y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -1.5e+231) {
tmp = (y * z) / a;
} else if (y <= 2e+38) {
tmp = x + y;
} else if (y <= 2.7e+187) {
tmp = z * (y / a);
} else {
tmp = x + y;
}
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 (y <= (-1.5d+231)) then
tmp = (y * z) / a
else if (y <= 2d+38) then
tmp = x + y
else if (y <= 2.7d+187) then
tmp = z * (y / a)
else
tmp = x + y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -1.5e+231) {
tmp = (y * z) / a;
} else if (y <= 2e+38) {
tmp = x + y;
} else if (y <= 2.7e+187) {
tmp = z * (y / a);
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= -1.5e+231: tmp = (y * z) / a elif y <= 2e+38: tmp = x + y elif y <= 2.7e+187: tmp = z * (y / a) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= -1.5e+231) tmp = Float64(Float64(y * z) / a); elseif (y <= 2e+38) tmp = Float64(x + y); elseif (y <= 2.7e+187) tmp = Float64(z * Float64(y / a)); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (y <= -1.5e+231) tmp = (y * z) / a; elseif (y <= 2e+38) tmp = x + y; elseif (y <= 2.7e+187) tmp = z * (y / a); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -1.5e+231], N[(N[(y * z), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[y, 2e+38], N[(x + y), $MachinePrecision], If[LessEqual[y, 2.7e+187], N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.5 \cdot 10^{+231}:\\
\;\;\;\;\frac{y \cdot z}{a}\\
\mathbf{elif}\;y \leq 2 \cdot 10^{+38}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;y \leq 2.7 \cdot 10^{+187}:\\
\;\;\;\;z \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if y < -1.5000000000000001e231Initial program 78.9%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f6471.2
Simplified71.2%
Taylor expanded in y around inf
/-lowering-/.f64N/A
*-lowering-*.f6471.3
Simplified71.3%
if -1.5000000000000001e231 < y < 1.99999999999999995e38 or 2.70000000000000008e187 < y Initial program 89.3%
Taylor expanded in t around inf
+-commutativeN/A
+-lowering-+.f6467.0
Simplified67.0%
if 1.99999999999999995e38 < y < 2.70000000000000008e187Initial program 78.0%
Taylor expanded in x around 0
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
--lowering--.f6455.5
Simplified55.5%
associate-*l/N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
--lowering--.f6477.5
Applied egg-rr77.5%
Taylor expanded in a around inf
/-lowering-/.f6458.4
Simplified58.4%
Taylor expanded in z around inf
Simplified54.9%
Final simplification65.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* z (/ y a))))
(if (<= y -2.2e+230)
t_1
(if (<= y 1.2e+38) (+ x y) (if (<= y 4.2e+187) t_1 (+ x y))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = z * (y / a);
double tmp;
if (y <= -2.2e+230) {
tmp = t_1;
} else if (y <= 1.2e+38) {
tmp = x + y;
} else if (y <= 4.2e+187) {
tmp = t_1;
} else {
tmp = x + y;
}
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) :: t_1
real(8) :: tmp
t_1 = z * (y / a)
if (y <= (-2.2d+230)) then
tmp = t_1
else if (y <= 1.2d+38) then
tmp = x + y
else if (y <= 4.2d+187) then
tmp = t_1
else
tmp = x + y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = z * (y / a);
double tmp;
if (y <= -2.2e+230) {
tmp = t_1;
} else if (y <= 1.2e+38) {
tmp = x + y;
} else if (y <= 4.2e+187) {
tmp = t_1;
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = z * (y / a) tmp = 0 if y <= -2.2e+230: tmp = t_1 elif y <= 1.2e+38: tmp = x + y elif y <= 4.2e+187: tmp = t_1 else: tmp = x + y return tmp
function code(x, y, z, t, a) t_1 = Float64(z * Float64(y / a)) tmp = 0.0 if (y <= -2.2e+230) tmp = t_1; elseif (y <= 1.2e+38) tmp = Float64(x + y); elseif (y <= 4.2e+187) tmp = t_1; else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = z * (y / a); tmp = 0.0; if (y <= -2.2e+230) tmp = t_1; elseif (y <= 1.2e+38) tmp = x + y; elseif (y <= 4.2e+187) tmp = t_1; else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.2e+230], t$95$1, If[LessEqual[y, 1.2e+38], N[(x + y), $MachinePrecision], If[LessEqual[y, 4.2e+187], t$95$1, N[(x + y), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \frac{y}{a}\\
\mathbf{if}\;y \leq -2.2 \cdot 10^{+230}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.2 \cdot 10^{+38}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;y \leq 4.2 \cdot 10^{+187}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if y < -2.2000000000000001e230 or 1.20000000000000009e38 < y < 4.2e187Initial program 78.3%
Taylor expanded in x around 0
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
--lowering--.f6462.6
Simplified62.6%
associate-*l/N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
--lowering--.f6482.2
Applied egg-rr82.2%
Taylor expanded in a around inf
/-lowering-/.f6464.5
Simplified64.5%
Taylor expanded in z around inf
Simplified59.8%
if -2.2000000000000001e230 < y < 1.20000000000000009e38 or 4.2e187 < y Initial program 89.3%
Taylor expanded in t around inf
+-commutativeN/A
+-lowering-+.f6467.0
Simplified67.0%
Final simplification65.8%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma y (/ (- z t) a) x))) (if (<= a -8.2e-41) t_1 (if (<= a 1.8e-29) (fma y (- 1.0 (/ z t)) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(y, ((z - t) / a), x);
double tmp;
if (a <= -8.2e-41) {
tmp = t_1;
} else if (a <= 1.8e-29) {
tmp = fma(y, (1.0 - (z / t)), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(y, Float64(Float64(z - t) / a), x) tmp = 0.0 if (a <= -8.2e-41) tmp = t_1; elseif (a <= 1.8e-29) tmp = fma(y, Float64(1.0 - Float64(z / t)), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -8.2e-41], t$95$1, If[LessEqual[a, 1.8e-29], N[(y * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, \frac{z - t}{a}, x\right)\\
\mathbf{if}\;a \leq -8.2 \cdot 10^{-41}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 1.8 \cdot 10^{-29}:\\
\;\;\;\;\mathsf{fma}\left(y, 1 - \frac{z}{t}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -8.20000000000000028e-41 or 1.79999999999999987e-29 < a Initial program 87.6%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
--lowering--.f6484.0
Simplified84.0%
if -8.20000000000000028e-41 < a < 1.79999999999999987e-29Initial program 87.2%
Taylor expanded in a around 0
+-commutativeN/A
mul-1-negN/A
associate-/l*N/A
distribute-rgt-neg-inN/A
accelerator-lowering-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
--lowering--.f64N/A
/-lowering-/.f6487.7
Simplified87.7%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma y (- 1.0 (/ z t)) x))) (if (<= t -2.2e+21) t_1 (if (<= t 0.0004) (fma y (/ z a) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(y, (1.0 - (z / t)), x);
double tmp;
if (t <= -2.2e+21) {
tmp = t_1;
} else if (t <= 0.0004) {
tmp = fma(y, (z / a), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(y, Float64(1.0 - Float64(z / t)), x) tmp = 0.0 if (t <= -2.2e+21) tmp = t_1; elseif (t <= 0.0004) tmp = fma(y, Float64(z / a), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[t, -2.2e+21], t$95$1, If[LessEqual[t, 0.0004], N[(y * N[(z / a), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, 1 - \frac{z}{t}, x\right)\\
\mathbf{if}\;t \leq -2.2 \cdot 10^{+21}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 0.0004:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -2.2e21 or 4.00000000000000019e-4 < t Initial program 80.1%
Taylor expanded in a around 0
+-commutativeN/A
mul-1-negN/A
associate-/l*N/A
distribute-rgt-neg-inN/A
accelerator-lowering-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
--lowering--.f64N/A
/-lowering-/.f6485.3
Simplified85.3%
if -2.2e21 < t < 4.00000000000000019e-4Initial program 94.2%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f6483.3
Simplified83.3%
(FPCore (x y z t a) :precision binary64 (if (<= t -4.6e+47) (+ x y) (if (<= t 1.86e+34) (fma y (/ z a) x) (+ x y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -4.6e+47) {
tmp = x + y;
} else if (t <= 1.86e+34) {
tmp = fma(y, (z / a), x);
} else {
tmp = x + y;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -4.6e+47) tmp = Float64(x + y); elseif (t <= 1.86e+34) tmp = fma(y, Float64(z / a), x); else tmp = Float64(x + y); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -4.6e+47], N[(x + y), $MachinePrecision], If[LessEqual[t, 1.86e+34], N[(y * N[(z / a), $MachinePrecision] + x), $MachinePrecision], N[(x + y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.6 \cdot 10^{+47}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;t \leq 1.86 \cdot 10^{+34}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if t < -4.5999999999999997e47 or 1.86e34 < t Initial program 78.0%
Taylor expanded in t around inf
+-commutativeN/A
+-lowering-+.f6477.2
Simplified77.2%
if -4.5999999999999997e47 < t < 1.86e34Initial program 94.2%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f6479.9
Simplified79.9%
Final simplification78.8%
(FPCore (x y z t a) :precision binary64 (if (<= t -1.3e+182) (fma y (- 1.0 (/ z t)) x) (fma (/ y (- a t)) (- z t) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.3e+182) {
tmp = fma(y, (1.0 - (z / t)), x);
} else {
tmp = fma((y / (a - t)), (z - t), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -1.3e+182) tmp = fma(y, Float64(1.0 - Float64(z / t)), x); else tmp = fma(Float64(y / Float64(a - t)), Float64(z - t), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1.3e+182], N[(y * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(N[(y / N[(a - t), $MachinePrecision]), $MachinePrecision] * N[(z - t), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.3 \cdot 10^{+182}:\\
\;\;\;\;\mathsf{fma}\left(y, 1 - \frac{z}{t}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a - t}, z - t, x\right)\\
\end{array}
\end{array}
if t < -1.3e182Initial program 69.6%
Taylor expanded in a around 0
+-commutativeN/A
mul-1-negN/A
associate-/l*N/A
distribute-rgt-neg-inN/A
accelerator-lowering-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
--lowering--.f64N/A
/-lowering-/.f6496.7
Simplified96.7%
if -1.3e182 < t Initial program 89.6%
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
--lowering--.f6496.0
Applied egg-rr96.0%
(FPCore (x y z t a) :precision binary64 (if (<= a -4.7e+151) x (+ x y)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -4.7e+151) {
tmp = x;
} else {
tmp = x + y;
}
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 (a <= (-4.7d+151)) then
tmp = x
else
tmp = x + y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -4.7e+151) {
tmp = x;
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -4.7e+151: tmp = x else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -4.7e+151) tmp = x; else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -4.7e+151) tmp = x; else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -4.7e+151], x, N[(x + y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -4.7 \cdot 10^{+151}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if a < -4.69999999999999989e151Initial program 86.1%
Taylor expanded in x around inf
Simplified76.5%
if -4.69999999999999989e151 < a Initial program 87.7%
Taylor expanded in t around inf
+-commutativeN/A
+-lowering-+.f6458.8
Simplified58.8%
Final simplification61.7%
(FPCore (x y z t a) :precision binary64 x)
double code(double x, double y, double z, double t, double a) {
return 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 = x
end function
public static double code(double x, double y, double z, double t, double a) {
return x;
}
def code(x, y, z, t, a): return x
function code(x, y, z, t, a) return x end
function tmp = code(x, y, z, t, a) tmp = x; end
code[x_, y_, z_, t_, a_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 87.4%
Taylor expanded in x around inf
Simplified50.2%
(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 2024205
(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))))