
(FPCore (x y z t a) :precision binary64 (- x (/ (- y z) (/ (+ (- t z) 1.0) a))))
double code(double x, double y, double z, double t, double a) {
return x - ((y - z) / (((t - z) + 1.0) / a));
}
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 - z) + 1.0d0) / a))
end function
public static double code(double x, double y, double z, double t, double a) {
return x - ((y - z) / (((t - z) + 1.0) / a));
}
def code(x, y, z, t, a): return x - ((y - z) / (((t - z) + 1.0) / a))
function code(x, y, z, t, a) return Float64(x - Float64(Float64(y - z) / Float64(Float64(Float64(t - z) + 1.0) / a))) end
function tmp = code(x, y, z, t, a) tmp = x - ((y - z) / (((t - z) + 1.0) / a)); end
code[x_, y_, z_, t_, a_] := N[(x - N[(N[(y - z), $MachinePrecision] / N[(N[(N[(t - z), $MachinePrecision] + 1.0), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{y - z}{\frac{\left(t - z\right) + 1}{a}}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (- x (/ (- y z) (/ (+ (- t z) 1.0) a))))
double code(double x, double y, double z, double t, double a) {
return x - ((y - z) / (((t - z) + 1.0) / a));
}
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 - z) + 1.0d0) / a))
end function
public static double code(double x, double y, double z, double t, double a) {
return x - ((y - z) / (((t - z) + 1.0) / a));
}
def code(x, y, z, t, a): return x - ((y - z) / (((t - z) + 1.0) / a))
function code(x, y, z, t, a) return Float64(x - Float64(Float64(y - z) / Float64(Float64(Float64(t - z) + 1.0) / a))) end
function tmp = code(x, y, z, t, a) tmp = x - ((y - z) / (((t - z) + 1.0) / a)); end
code[x_, y_, z_, t_, a_] := N[(x - N[(N[(y - z), $MachinePrecision] / N[(N[(N[(t - z), $MachinePrecision] + 1.0), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{y - z}{\frac{\left(t - z\right) + 1}{a}}
\end{array}
(FPCore (x y z t a) :precision binary64 (fma (/ (- y z) (+ -1.0 (- z t))) a x))
double code(double x, double y, double z, double t, double a) {
return fma(((y - z) / (-1.0 + (z - t))), a, x);
}
function code(x, y, z, t, a) return fma(Float64(Float64(y - z) / Float64(-1.0 + Float64(z - t))), a, x) end
code[x_, y_, z_, t_, a_] := N[(N[(N[(y - z), $MachinePrecision] / N[(-1.0 + N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{y - z}{-1 + \left(z - t\right)}, a, x\right)
\end{array}
Initial program 96.0%
sub-negN/A
+-commutativeN/A
associate-/r/N/A
distribute-lft-neg-inN/A
distribute-frac-neg2N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
+-commutativeN/A
distribute-neg-inN/A
metadata-evalN/A
unsub-negN/A
--lowering--.f64N/A
--lowering--.f6498.8
Applied egg-rr98.8%
Final simplification98.8%
(FPCore (x y z t a)
:precision binary64
(if (<= z -2.5e+67)
(- x a)
(if (<= z -5.8e-167)
(- x (* a (/ y t)))
(if (<= z 5.2e-237)
(fma (- 0.0 a) (fma y z y) x)
(if (<= z 4.1e+77) (- x (* y (/ a t))) (- x a))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.5e+67) {
tmp = x - a;
} else if (z <= -5.8e-167) {
tmp = x - (a * (y / t));
} else if (z <= 5.2e-237) {
tmp = fma((0.0 - a), fma(y, z, y), x);
} else if (z <= 4.1e+77) {
tmp = x - (y * (a / t));
} else {
tmp = x - a;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.5e+67) tmp = Float64(x - a); elseif (z <= -5.8e-167) tmp = Float64(x - Float64(a * Float64(y / t))); elseif (z <= 5.2e-237) tmp = fma(Float64(0.0 - a), fma(y, z, y), x); elseif (z <= 4.1e+77) tmp = Float64(x - Float64(y * Float64(a / t))); else tmp = Float64(x - a); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.5e+67], N[(x - a), $MachinePrecision], If[LessEqual[z, -5.8e-167], N[(x - N[(a * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.2e-237], N[(N[(0.0 - a), $MachinePrecision] * N[(y * z + y), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 4.1e+77], N[(x - N[(y * N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - a), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.5 \cdot 10^{+67}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq -5.8 \cdot 10^{-167}:\\
\;\;\;\;x - a \cdot \frac{y}{t}\\
\mathbf{elif}\;z \leq 5.2 \cdot 10^{-237}:\\
\;\;\;\;\mathsf{fma}\left(0 - a, \mathsf{fma}\left(y, z, y\right), x\right)\\
\mathbf{elif}\;z \leq 4.1 \cdot 10^{+77}:\\
\;\;\;\;x - y \cdot \frac{a}{t}\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -2.49999999999999988e67 or 4.1000000000000001e77 < z Initial program 90.8%
Taylor expanded in z around inf
Simplified85.8%
if -2.49999999999999988e67 < z < -5.80000000000000005e-167Initial program 97.4%
Taylor expanded in z around 0
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f6481.1
Simplified81.1%
Taylor expanded in t around inf
/-lowering-/.f6473.5
Simplified73.5%
if -5.80000000000000005e-167 < z < 5.2000000000000005e-237Initial program 99.7%
Taylor expanded in t around 0
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
--lowering--.f6482.5
Simplified82.5%
Taylor expanded in y around inf
Simplified82.5%
Taylor expanded in z around 0
sub-negN/A
mul-1-negN/A
associate-+l+N/A
+-commutativeN/A
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
distribute-lft-outN/A
accelerator-lowering-fma.f64N/A
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f6482.5
Simplified82.5%
if 5.2000000000000005e-237 < z < 4.1000000000000001e77Initial program 99.7%
Taylor expanded in z around 0
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f6483.0
Simplified83.0%
Taylor expanded in t around inf
/-lowering-/.f6467.7
Simplified67.7%
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f6469.8
Applied egg-rr69.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ a z) (- y z) x)))
(if (<= z -4e+21)
t_1
(if (<= z 6.5e+25)
(fma a (/ y (- -1.0 t)) x)
(if (<= z 3.9e+124) t_1 (fma a (/ z (- 1.0 z)) x))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((a / z), (y - z), x);
double tmp;
if (z <= -4e+21) {
tmp = t_1;
} else if (z <= 6.5e+25) {
tmp = fma(a, (y / (-1.0 - t)), x);
} else if (z <= 3.9e+124) {
tmp = t_1;
} else {
tmp = fma(a, (z / (1.0 - z)), x);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(a / z), Float64(y - z), x) tmp = 0.0 if (z <= -4e+21) tmp = t_1; elseif (z <= 6.5e+25) tmp = fma(a, Float64(y / Float64(-1.0 - t)), x); elseif (z <= 3.9e+124) tmp = t_1; else tmp = fma(a, Float64(z / Float64(1.0 - z)), x); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(a / z), $MachinePrecision] * N[(y - z), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[z, -4e+21], t$95$1, If[LessEqual[z, 6.5e+25], N[(a * N[(y / N[(-1.0 - t), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 3.9e+124], t$95$1, N[(a * N[(z / N[(1.0 - z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{a}{z}, y - z, x\right)\\
\mathbf{if}\;z \leq -4 \cdot 10^{+21}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 6.5 \cdot 10^{+25}:\\
\;\;\;\;\mathsf{fma}\left(a, \frac{y}{-1 - t}, x\right)\\
\mathbf{elif}\;z \leq 3.9 \cdot 10^{+124}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, \frac{z}{1 - z}, x\right)\\
\end{array}
\end{array}
if z < -4e21 or 6.50000000000000005e25 < z < 3.9e124Initial program 96.4%
sub-negN/A
+-commutativeN/A
clear-numN/A
associate-/r/N/A
clear-numN/A
distribute-lft-neg-inN/A
clear-numN/A
distribute-frac-neg2N/A
accelerator-lowering-fma.f64N/A
Applied egg-rr96.2%
Taylor expanded in z around inf
/-lowering-/.f6485.2
Simplified85.2%
if -4e21 < z < 6.50000000000000005e25Initial program 99.0%
Taylor expanded in z around 0
sub-negN/A
+-commutativeN/A
associate-/l*N/A
distribute-rgt-neg-inN/A
accelerator-lowering-fma.f64N/A
distribute-neg-frac2N/A
/-lowering-/.f64N/A
distribute-neg-inN/A
metadata-evalN/A
unsub-negN/A
--lowering--.f6490.9
Simplified90.9%
if 3.9e124 < z Initial program 84.3%
Taylor expanded in y around 0
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-commutativeN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
+-commutativeN/A
associate--l+N/A
+-lowering-+.f64N/A
--lowering--.f6497.5
Simplified97.5%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
--lowering--.f6489.9
Simplified89.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (- 0.0 (/ a t)) (- y z) x)))
(if (<= t -4.5e+88)
t_1
(if (<= t 240.0) (+ x (* (- y z) (/ a (+ z -1.0)))) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((0.0 - (a / t)), (y - z), x);
double tmp;
if (t <= -4.5e+88) {
tmp = t_1;
} else if (t <= 240.0) {
tmp = x + ((y - z) * (a / (z + -1.0)));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(0.0 - Float64(a / t)), Float64(y - z), x) tmp = 0.0 if (t <= -4.5e+88) tmp = t_1; elseif (t <= 240.0) tmp = Float64(x + Float64(Float64(y - z) * Float64(a / Float64(z + -1.0)))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(0.0 - N[(a / t), $MachinePrecision]), $MachinePrecision] * N[(y - z), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[t, -4.5e+88], t$95$1, If[LessEqual[t, 240.0], N[(x + N[(N[(y - z), $MachinePrecision] * N[(a / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(0 - \frac{a}{t}, y - z, x\right)\\
\mathbf{if}\;t \leq -4.5 \cdot 10^{+88}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 240:\\
\;\;\;\;x + \left(y - z\right) \cdot \frac{a}{z + -1}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -4.5e88 or 240 < t Initial program 97.3%
sub-negN/A
+-commutativeN/A
clear-numN/A
associate-/r/N/A
clear-numN/A
distribute-lft-neg-inN/A
clear-numN/A
distribute-frac-neg2N/A
accelerator-lowering-fma.f64N/A
Applied egg-rr97.3%
Taylor expanded in t around inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f6490.0
Simplified90.0%
if -4.5e88 < t < 240Initial program 94.9%
Taylor expanded in t around 0
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
--lowering--.f6485.9
Simplified85.9%
*-commutativeN/A
associate-/l*N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
/-lowering-/.f64N/A
--lowering--.f6491.6
Applied egg-rr91.6%
Final simplification90.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ (- y z) z) a x)))
(if (<= z -1.9e+21)
t_1
(if (<= z 6.4e+25) (fma a (/ y (- -1.0 t)) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(((y - z) / z), a, x);
double tmp;
if (z <= -1.9e+21) {
tmp = t_1;
} else if (z <= 6.4e+25) {
tmp = fma(a, (y / (-1.0 - t)), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(Float64(y - z) / z), a, x) tmp = 0.0 if (z <= -1.9e+21) tmp = t_1; elseif (z <= 6.4e+25) tmp = fma(a, Float64(y / Float64(-1.0 - t)), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(y - z), $MachinePrecision] / z), $MachinePrecision] * a + x), $MachinePrecision]}, If[LessEqual[z, -1.9e+21], t$95$1, If[LessEqual[z, 6.4e+25], N[(a * N[(y / N[(-1.0 - t), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{y - z}{z}, a, x\right)\\
\mathbf{if}\;z \leq -1.9 \cdot 10^{+21}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 6.4 \cdot 10^{+25}:\\
\;\;\;\;\mathsf{fma}\left(a, \frac{y}{-1 - t}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.9e21 or 6.3999999999999999e25 < z Initial program 92.4%
sub-negN/A
+-commutativeN/A
associate-/r/N/A
distribute-lft-neg-inN/A
distribute-frac-neg2N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
+-commutativeN/A
distribute-neg-inN/A
metadata-evalN/A
unsub-negN/A
--lowering--.f64N/A
--lowering--.f6499.9
Applied egg-rr99.9%
Taylor expanded in z around inf
Simplified90.0%
if -1.9e21 < z < 6.3999999999999999e25Initial program 99.0%
Taylor expanded in z around 0
sub-negN/A
+-commutativeN/A
associate-/l*N/A
distribute-rgt-neg-inN/A
accelerator-lowering-fma.f64N/A
distribute-neg-frac2N/A
/-lowering-/.f64N/A
distribute-neg-inN/A
metadata-evalN/A
unsub-negN/A
--lowering--.f6490.9
Simplified90.9%
(FPCore (x y z t a) :precision binary64 (if (<= z -2.1e+75) (- x a) (if (<= z 2.8e+68) (fma a (/ y (- -1.0 t)) x) (fma a (/ z (- 1.0 z)) x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.1e+75) {
tmp = x - a;
} else if (z <= 2.8e+68) {
tmp = fma(a, (y / (-1.0 - t)), x);
} else {
tmp = fma(a, (z / (1.0 - z)), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.1e+75) tmp = Float64(x - a); elseif (z <= 2.8e+68) tmp = fma(a, Float64(y / Float64(-1.0 - t)), x); else tmp = fma(a, Float64(z / Float64(1.0 - z)), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.1e+75], N[(x - a), $MachinePrecision], If[LessEqual[z, 2.8e+68], N[(a * N[(y / N[(-1.0 - t), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(a * N[(z / N[(1.0 - z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.1 \cdot 10^{+75}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 2.8 \cdot 10^{+68}:\\
\;\;\;\;\mathsf{fma}\left(a, \frac{y}{-1 - t}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, \frac{z}{1 - z}, x\right)\\
\end{array}
\end{array}
if z < -2.09999999999999999e75Initial program 93.9%
Taylor expanded in z around inf
Simplified88.9%
if -2.09999999999999999e75 < z < 2.8e68Initial program 99.1%
Taylor expanded in z around 0
sub-negN/A
+-commutativeN/A
associate-/l*N/A
distribute-rgt-neg-inN/A
accelerator-lowering-fma.f64N/A
distribute-neg-frac2N/A
/-lowering-/.f64N/A
distribute-neg-inN/A
metadata-evalN/A
unsub-negN/A
--lowering--.f6487.8
Simplified87.8%
if 2.8e68 < z Initial program 88.3%
Taylor expanded in y around 0
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-commutativeN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
+-commutativeN/A
associate--l+N/A
+-lowering-+.f64N/A
--lowering--.f6489.1
Simplified89.1%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
--lowering--.f6481.5
Simplified81.5%
(FPCore (x y z t a) :precision binary64 (if (<= z -7e+73) (- x a) (if (<= z 1.22e+70) (fma a (/ y (- -1.0 t)) x) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -7e+73) {
tmp = x - a;
} else if (z <= 1.22e+70) {
tmp = fma(a, (y / (-1.0 - t)), x);
} else {
tmp = x - a;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -7e+73) tmp = Float64(x - a); elseif (z <= 1.22e+70) tmp = fma(a, Float64(y / Float64(-1.0 - t)), x); else tmp = Float64(x - a); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -7e+73], N[(x - a), $MachinePrecision], If[LessEqual[z, 1.22e+70], N[(a * N[(y / N[(-1.0 - t), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7 \cdot 10^{+73}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 1.22 \cdot 10^{+70}:\\
\;\;\;\;\mathsf{fma}\left(a, \frac{y}{-1 - t}, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -7.00000000000000004e73 or 1.22e70 < z Initial program 90.9%
Taylor expanded in z around inf
Simplified85.0%
if -7.00000000000000004e73 < z < 1.22e70Initial program 99.1%
Taylor expanded in z around 0
sub-negN/A
+-commutativeN/A
associate-/l*N/A
distribute-rgt-neg-inN/A
accelerator-lowering-fma.f64N/A
distribute-neg-frac2N/A
/-lowering-/.f64N/A
distribute-neg-inN/A
metadata-evalN/A
unsub-negN/A
--lowering--.f6487.8
Simplified87.8%
(FPCore (x y z t a) :precision binary64 (if (<= z 8.2e+125) (fma (/ a (+ -1.0 (- z t))) (- y z) x) (fma a (/ z (+ t (- 1.0 z))) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= 8.2e+125) {
tmp = fma((a / (-1.0 + (z - t))), (y - z), x);
} else {
tmp = fma(a, (z / (t + (1.0 - z))), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= 8.2e+125) tmp = fma(Float64(a / Float64(-1.0 + Float64(z - t))), Float64(y - z), x); else tmp = fma(a, Float64(z / Float64(t + Float64(1.0 - z))), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, 8.2e+125], N[(N[(a / N[(-1.0 + N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(y - z), $MachinePrecision] + x), $MachinePrecision], N[(a * N[(z / N[(t + N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 8.2 \cdot 10^{+125}:\\
\;\;\;\;\mathsf{fma}\left(\frac{a}{-1 + \left(z - t\right)}, y - z, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, \frac{z}{t + \left(1 - z\right)}, x\right)\\
\end{array}
\end{array}
if z < 8.19999999999999983e125Initial program 98.1%
sub-negN/A
+-commutativeN/A
clear-numN/A
associate-/r/N/A
clear-numN/A
distribute-lft-neg-inN/A
clear-numN/A
distribute-frac-neg2N/A
accelerator-lowering-fma.f64N/A
Applied egg-rr98.1%
if 8.19999999999999983e125 < z Initial program 84.3%
Taylor expanded in y around 0
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-commutativeN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
+-commutativeN/A
associate--l+N/A
+-lowering-+.f64N/A
--lowering--.f6497.5
Simplified97.5%
Final simplification98.0%
(FPCore (x y z t a) :precision binary64 (if (<= z -2.7e+68) (- x a) (if (<= z 4.3e+77) (- x (* a (/ y t))) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.7e+68) {
tmp = x - a;
} else if (z <= 4.3e+77) {
tmp = x - (a * (y / t));
} else {
tmp = x - a;
}
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 <= (-2.7d+68)) then
tmp = x - a
else if (z <= 4.3d+77) then
tmp = x - (a * (y / t))
else
tmp = x - a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.7e+68) {
tmp = x - a;
} else if (z <= 4.3e+77) {
tmp = x - (a * (y / t));
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -2.7e+68: tmp = x - a elif z <= 4.3e+77: tmp = x - (a * (y / t)) else: tmp = x - a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.7e+68) tmp = Float64(x - a); elseif (z <= 4.3e+77) tmp = Float64(x - Float64(a * Float64(y / t))); else tmp = Float64(x - a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -2.7e+68) tmp = x - a; elseif (z <= 4.3e+77) tmp = x - (a * (y / t)); else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.7e+68], N[(x - a), $MachinePrecision], If[LessEqual[z, 4.3e+77], N[(x - N[(a * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.7 \cdot 10^{+68}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 4.3 \cdot 10^{+77}:\\
\;\;\;\;x - a \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -2.69999999999999991e68 or 4.29999999999999991e77 < z Initial program 90.8%
Taylor expanded in z around inf
Simplified85.8%
if -2.69999999999999991e68 < z < 4.29999999999999991e77Initial program 99.1%
Taylor expanded in z around 0
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f6487.2
Simplified87.2%
Taylor expanded in t around inf
/-lowering-/.f6468.9
Simplified68.9%
(FPCore (x y z t a) :precision binary64 (if (<= z -4.6e+64) (- x a) (if (<= z 4e+25) (- x (* y a)) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -4.6e+64) {
tmp = x - a;
} else if (z <= 4e+25) {
tmp = x - (y * a);
} else {
tmp = x - a;
}
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 <= (-4.6d+64)) then
tmp = x - a
else if (z <= 4d+25) then
tmp = x - (y * a)
else
tmp = x - a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -4.6e+64) {
tmp = x - a;
} else if (z <= 4e+25) {
tmp = x - (y * a);
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -4.6e+64: tmp = x - a elif z <= 4e+25: tmp = x - (y * a) else: tmp = x - a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -4.6e+64) tmp = Float64(x - a); elseif (z <= 4e+25) tmp = Float64(x - Float64(y * a)); else tmp = Float64(x - a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -4.6e+64) tmp = x - a; elseif (z <= 4e+25) tmp = x - (y * a); else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -4.6e+64], N[(x - a), $MachinePrecision], If[LessEqual[z, 4e+25], N[(x - N[(y * a), $MachinePrecision]), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.6 \cdot 10^{+64}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 4 \cdot 10^{+25}:\\
\;\;\;\;x - y \cdot a\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -4.6e64 or 4.00000000000000036e25 < z Initial program 91.8%
Taylor expanded in z around inf
Simplified81.7%
if -4.6e64 < z < 4.00000000000000036e25Initial program 99.1%
Taylor expanded in z around 0
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f6489.6
Simplified89.6%
Taylor expanded in t around 0
--lowering--.f64N/A
*-lowering-*.f6466.4
Simplified66.4%
Final simplification72.9%
(FPCore (x y z t a) :precision binary64 (if (<= z -2.1e+21) (- x a) (if (<= z 4.1e+25) x (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.1e+21) {
tmp = x - a;
} else if (z <= 4.1e+25) {
tmp = x;
} else {
tmp = x - a;
}
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 <= (-2.1d+21)) then
tmp = x - a
else if (z <= 4.1d+25) then
tmp = x
else
tmp = x - a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.1e+21) {
tmp = x - a;
} else if (z <= 4.1e+25) {
tmp = x;
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -2.1e+21: tmp = x - a elif z <= 4.1e+25: tmp = x else: tmp = x - a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.1e+21) tmp = Float64(x - a); elseif (z <= 4.1e+25) tmp = x; else tmp = Float64(x - a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -2.1e+21) tmp = x - a; elseif (z <= 4.1e+25) tmp = x; else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.1e+21], N[(x - a), $MachinePrecision], If[LessEqual[z, 4.1e+25], x, N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.1 \cdot 10^{+21}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 4.1 \cdot 10^{+25}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -2.1e21 or 4.09999999999999966e25 < z Initial program 92.4%
Taylor expanded in z around inf
Simplified80.0%
if -2.1e21 < z < 4.09999999999999966e25Initial program 99.0%
Taylor expanded in x around inf
Simplified57.7%
(FPCore (x y z t a) :precision binary64 (if (<= x -4.2e-187) x (if (<= x 5.5e-188) (- 0.0 a) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -4.2e-187) {
tmp = x;
} else if (x <= 5.5e-188) {
tmp = 0.0 - a;
} else {
tmp = 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 (x <= (-4.2d-187)) then
tmp = x
else if (x <= 5.5d-188) then
tmp = 0.0d0 - a
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -4.2e-187) {
tmp = x;
} else if (x <= 5.5e-188) {
tmp = 0.0 - a;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -4.2e-187: tmp = x elif x <= 5.5e-188: tmp = 0.0 - a else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -4.2e-187) tmp = x; elseif (x <= 5.5e-188) tmp = Float64(0.0 - a); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (x <= -4.2e-187) tmp = x; elseif (x <= 5.5e-188) tmp = 0.0 - a; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -4.2e-187], x, If[LessEqual[x, 5.5e-188], N[(0.0 - a), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.2 \cdot 10^{-187}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 5.5 \cdot 10^{-188}:\\
\;\;\;\;0 - a\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -4.19999999999999985e-187 or 5.5000000000000002e-188 < x Initial program 99.7%
Taylor expanded in x around inf
Simplified65.1%
if -4.19999999999999985e-187 < x < 5.5000000000000002e-188Initial program 79.6%
Taylor expanded in z around inf
Simplified38.1%
Taylor expanded in x around 0
mul-1-negN/A
neg-sub0N/A
--lowering--.f6435.3
Simplified35.3%
sub0-negN/A
neg-lowering-neg.f6435.3
Applied egg-rr35.3%
Final simplification59.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 96.0%
Taylor expanded in x around inf
Simplified56.2%
(FPCore (x y z t a) :precision binary64 (- x (* (/ (- y z) (+ (- t z) 1.0)) a)))
double code(double x, double y, double z, double t, double a) {
return x - (((y - z) / ((t - z) + 1.0)) * a);
}
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 - z) + 1.0d0)) * a)
end function
public static double code(double x, double y, double z, double t, double a) {
return x - (((y - z) / ((t - z) + 1.0)) * a);
}
def code(x, y, z, t, a): return x - (((y - z) / ((t - z) + 1.0)) * a)
function code(x, y, z, t, a) return Float64(x - Float64(Float64(Float64(y - z) / Float64(Float64(t - z) + 1.0)) * a)) end
function tmp = code(x, y, z, t, a) tmp = x - (((y - z) / ((t - z) + 1.0)) * a); end
code[x_, y_, z_, t_, a_] := N[(x - N[(N[(N[(y - z), $MachinePrecision] / N[(N[(t - z), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{y - z}{\left(t - z\right) + 1} \cdot a
\end{array}
herbie shell --seed 2024195
(FPCore (x y z t a)
:name "Graphics.Rendering.Chart.SparkLine:renderSparkLine from Chart-1.5.3"
:precision binary64
:alt
(! :herbie-platform default (- x (* (/ (- y z) (+ (- t z) 1)) a)))
(- x (/ (- y z) (/ (+ (- t z) 1.0) a))))