
(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 97.7%
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.2
Applied egg-rr99.2%
Final simplification99.2%
(FPCore (x y z t a)
:precision binary64
(if (<= z -2.65e+188)
(- x a)
(if (<= z -46000.0)
(fma a (/ y z) x)
(if (<= z 3e+44)
(fma a (/ y (- -1.0 t)) x)
(if (<= z 2.4e+148) (fma (/ a z) y x) (- x a))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.65e+188) {
tmp = x - a;
} else if (z <= -46000.0) {
tmp = fma(a, (y / z), x);
} else if (z <= 3e+44) {
tmp = fma(a, (y / (-1.0 - t)), x);
} else if (z <= 2.4e+148) {
tmp = fma((a / z), y, x);
} else {
tmp = x - a;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.65e+188) tmp = Float64(x - a); elseif (z <= -46000.0) tmp = fma(a, Float64(y / z), x); elseif (z <= 3e+44) tmp = fma(a, Float64(y / Float64(-1.0 - t)), x); elseif (z <= 2.4e+148) tmp = fma(Float64(a / z), y, x); else tmp = Float64(x - a); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.65e+188], N[(x - a), $MachinePrecision], If[LessEqual[z, -46000.0], N[(a * N[(y / z), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 3e+44], N[(a * N[(y / N[(-1.0 - t), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 2.4e+148], N[(N[(a / z), $MachinePrecision] * y + x), $MachinePrecision], N[(x - a), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.65 \cdot 10^{+188}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq -46000:\\
\;\;\;\;\mathsf{fma}\left(a, \frac{y}{z}, x\right)\\
\mathbf{elif}\;z \leq 3 \cdot 10^{+44}:\\
\;\;\;\;\mathsf{fma}\left(a, \frac{y}{-1 - t}, x\right)\\
\mathbf{elif}\;z \leq 2.4 \cdot 10^{+148}:\\
\;\;\;\;\mathsf{fma}\left(\frac{a}{z}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -2.64999999999999994e188 or 2.39999999999999995e148 < z Initial program 97.1%
Taylor expanded in z around inf
Simplified87.2%
if -2.64999999999999994e188 < z < -46000Initial program 90.6%
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-rr92.9%
Taylor expanded in y around inf
Simplified76.2%
Taylor expanded in z around inf
+-commutativeN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f6476.5
Simplified76.5%
if -46000 < z < 2.99999999999999987e44Initial program 99.2%
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--.f6489.0
Simplified89.0%
if 2.99999999999999987e44 < z < 2.39999999999999995e148Initial program 100.0%
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-rr100.0%
Taylor expanded in y around inf
Simplified93.2%
Taylor expanded in z around inf
/-lowering-/.f6493.2
Simplified93.2%
(FPCore (x y z t a)
:precision binary64
(if (<= z -2.65e+188)
(- x a)
(if (<= z -0.82)
(fma a (/ y z) x)
(if (<= z 1e-18)
(fma (- a) (fma y z y) x)
(if (<= z 2.7e+148) (fma (/ a z) y x) (- x a))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.65e+188) {
tmp = x - a;
} else if (z <= -0.82) {
tmp = fma(a, (y / z), x);
} else if (z <= 1e-18) {
tmp = fma(-a, fma(y, z, y), x);
} else if (z <= 2.7e+148) {
tmp = fma((a / z), y, x);
} else {
tmp = x - a;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.65e+188) tmp = Float64(x - a); elseif (z <= -0.82) tmp = fma(a, Float64(y / z), x); elseif (z <= 1e-18) tmp = fma(Float64(-a), fma(y, z, y), x); elseif (z <= 2.7e+148) tmp = fma(Float64(a / z), y, x); else tmp = Float64(x - a); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.65e+188], N[(x - a), $MachinePrecision], If[LessEqual[z, -0.82], N[(a * N[(y / z), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 1e-18], N[((-a) * N[(y * z + y), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 2.7e+148], N[(N[(a / z), $MachinePrecision] * y + x), $MachinePrecision], N[(x - a), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.65 \cdot 10^{+188}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq -0.82:\\
\;\;\;\;\mathsf{fma}\left(a, \frac{y}{z}, x\right)\\
\mathbf{elif}\;z \leq 10^{-18}:\\
\;\;\;\;\mathsf{fma}\left(-a, \mathsf{fma}\left(y, z, y\right), x\right)\\
\mathbf{elif}\;z \leq 2.7 \cdot 10^{+148}:\\
\;\;\;\;\mathsf{fma}\left(\frac{a}{z}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -2.64999999999999994e188 or 2.70000000000000019e148 < z Initial program 97.1%
Taylor expanded in z around inf
Simplified87.2%
if -2.64999999999999994e188 < z < -0.819999999999999951Initial program 90.6%
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-rr92.9%
Taylor expanded in y around inf
Simplified76.2%
Taylor expanded in z around inf
+-commutativeN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f6476.5
Simplified76.5%
if -0.819999999999999951 < z < 1.0000000000000001e-18Initial program 99.9%
Taylor expanded in t around 0
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
--lowering--.f6472.4
Simplified72.4%
Taylor expanded in y around inf
Simplified70.4%
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-lowering-neg.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f6470.3
Simplified70.3%
if 1.0000000000000001e-18 < z < 2.70000000000000019e148Initial program 97.2%
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 y around inf
Simplified83.6%
Taylor expanded in z around inf
/-lowering-/.f6473.0
Simplified73.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma a (/ y z) x)))
(if (<= z -2.7e+188)
(- x a)
(if (<= z -0.76)
t_1
(if (<= z 0.000106)
(fma (- a) (fma y z y) x)
(if (<= z 2.5e+148) t_1 (- x a)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(a, (y / z), x);
double tmp;
if (z <= -2.7e+188) {
tmp = x - a;
} else if (z <= -0.76) {
tmp = t_1;
} else if (z <= 0.000106) {
tmp = fma(-a, fma(y, z, y), x);
} else if (z <= 2.5e+148) {
tmp = t_1;
} else {
tmp = x - a;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(a, Float64(y / z), x) tmp = 0.0 if (z <= -2.7e+188) tmp = Float64(x - a); elseif (z <= -0.76) tmp = t_1; elseif (z <= 0.000106) tmp = fma(Float64(-a), fma(y, z, y), x); elseif (z <= 2.5e+148) tmp = t_1; else tmp = Float64(x - a); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(a * N[(y / z), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[z, -2.7e+188], N[(x - a), $MachinePrecision], If[LessEqual[z, -0.76], t$95$1, If[LessEqual[z, 0.000106], N[((-a) * N[(y * z + y), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 2.5e+148], t$95$1, N[(x - a), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(a, \frac{y}{z}, x\right)\\
\mathbf{if}\;z \leq -2.7 \cdot 10^{+188}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq -0.76:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 0.000106:\\
\;\;\;\;\mathsf{fma}\left(-a, \mathsf{fma}\left(y, z, y\right), x\right)\\
\mathbf{elif}\;z \leq 2.5 \cdot 10^{+148}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -2.7e188 or 2.50000000000000012e148 < z Initial program 97.1%
Taylor expanded in z around inf
Simplified87.2%
if -2.7e188 < z < -0.76000000000000001 or 1.06e-4 < z < 2.50000000000000012e148Initial program 93.8%
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-rr95.0%
Taylor expanded in y around inf
Simplified83.8%
Taylor expanded in z around inf
+-commutativeN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f6479.2
Simplified79.2%
if -0.76000000000000001 < z < 1.06e-4Initial program 99.9%
Taylor expanded in t around 0
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
--lowering--.f6471.8
Simplified71.8%
Taylor expanded in y around inf
Simplified68.2%
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-lowering-neg.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f6468.1
Simplified68.1%
(FPCore (x y z t a) :precision binary64 (if (<= (/ (- y z) (/ (+ (- t z) 1.0) a)) -1.5e+59) (- a) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (((y - z) / (((t - z) + 1.0) / a)) <= -1.5e+59) {
tmp = -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 (((y - z) / (((t - z) + 1.0d0) / a)) <= (-1.5d+59)) then
tmp = -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 (((y - z) / (((t - z) + 1.0) / a)) <= -1.5e+59) {
tmp = -a;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if ((y - z) / (((t - z) + 1.0) / a)) <= -1.5e+59: tmp = -a else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (Float64(Float64(y - z) / Float64(Float64(Float64(t - z) + 1.0) / a)) <= -1.5e+59) tmp = Float64(-a); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (((y - z) / (((t - z) + 1.0) / a)) <= -1.5e+59) tmp = -a; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[N[(N[(y - z), $MachinePrecision] / N[(N[(N[(t - z), $MachinePrecision] + 1.0), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], -1.5e+59], (-a), x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{y - z}{\frac{\left(t - z\right) + 1}{a}} \leq -1.5 \cdot 10^{+59}:\\
\;\;\;\;-a\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if (/.f64 (-.f64 y z) (/.f64 (+.f64 (-.f64 t z) #s(literal 1 binary64)) a)) < -1.5e59Initial program 99.7%
Taylor expanded in z around inf
Simplified42.3%
Taylor expanded in x around 0
mul-1-negN/A
neg-lowering-neg.f6432.2
Simplified32.2%
if -1.5e59 < (/.f64 (-.f64 y z) (/.f64 (+.f64 (-.f64 t z) #s(literal 1 binary64)) a)) Initial program 97.0%
Taylor expanded in x around inf
Simplified65.7%
(FPCore (x y z t a)
:precision binary64
(if (<= z -1.75e+67)
(fma (/ (- y z) z) a x)
(if (<= z 3.3e+148)
(fma (/ a (+ -1.0 (- z t))) y x)
(fma a (/ z (- t (+ z -1.0))) x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.75e+67) {
tmp = fma(((y - z) / z), a, x);
} else if (z <= 3.3e+148) {
tmp = fma((a / (-1.0 + (z - t))), y, x);
} else {
tmp = fma(a, (z / (t - (z + -1.0))), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.75e+67) tmp = fma(Float64(Float64(y - z) / z), a, x); elseif (z <= 3.3e+148) tmp = fma(Float64(a / Float64(-1.0 + Float64(z - t))), y, x); else tmp = fma(a, Float64(z / Float64(t - Float64(z + -1.0))), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.75e+67], N[(N[(N[(y - z), $MachinePrecision] / z), $MachinePrecision] * a + x), $MachinePrecision], If[LessEqual[z, 3.3e+148], N[(N[(a / N[(-1.0 + N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision], N[(a * N[(z / N[(t - N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.75 \cdot 10^{+67}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y - z}{z}, a, x\right)\\
\mathbf{elif}\;z \leq 3.3 \cdot 10^{+148}:\\
\;\;\;\;\mathsf{fma}\left(\frac{a}{-1 + \left(z - t\right)}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, \frac{z}{t - \left(z + -1\right)}, x\right)\\
\end{array}
\end{array}
if z < -1.75e67Initial program 94.6%
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
Simplified94.4%
if -1.75e67 < z < 3.3000000000000001e148Initial program 98.8%
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-rr99.3%
Taylor expanded in y around inf
Simplified90.9%
if 3.3000000000000001e148 < z Initial program 97.1%
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--.f6498.1
Simplified98.1%
Final simplification92.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (- y z) (/ a (- t)) x)))
(if (<= t -3.2e+79)
t_1
(if (<= t 3.6e+126) (fma (- y z) (/ a (+ z -1.0)) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((y - z), (a / -t), x);
double tmp;
if (t <= -3.2e+79) {
tmp = t_1;
} else if (t <= 3.6e+126) {
tmp = fma((y - z), (a / (z + -1.0)), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(y - z), Float64(a / Float64(-t)), x) tmp = 0.0 if (t <= -3.2e+79) tmp = t_1; elseif (t <= 3.6e+126) tmp = fma(Float64(y - z), Float64(a / Float64(z + -1.0)), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y - z), $MachinePrecision] * N[(a / (-t)), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[t, -3.2e+79], t$95$1, If[LessEqual[t, 3.6e+126], N[(N[(y - z), $MachinePrecision] * N[(a / N[(z + -1.0), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y - z, \frac{a}{-t}, x\right)\\
\mathbf{if}\;t \leq -3.2 \cdot 10^{+79}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 3.6 \cdot 10^{+126}:\\
\;\;\;\;\mathsf{fma}\left(y - z, \frac{a}{z + -1}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -3.20000000000000003e79 or 3.6e126 < t Initial program 96.9%
Taylor expanded in t around inf
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6479.1
Simplified79.1%
sub-negN/A
+-commutativeN/A
div-invN/A
div-invN/A
*-commutativeN/A
associate-/l*N/A
distribute-rgt-neg-inN/A
accelerator-lowering-fma.f64N/A
--lowering--.f64N/A
neg-lowering-neg.f64N/A
/-lowering-/.f6489.5
Applied egg-rr89.5%
if -3.20000000000000003e79 < t < 3.6e126Initial program 98.1%
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 t around 0
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
remove-double-negN/A
mul-1-negN/A
sub-negN/A
metadata-evalN/A
distribute-lft-inN/A
mul-1-negN/A
metadata-evalN/A
+-commutativeN/A
sub-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
accelerator-lowering-fma.f64N/A
Simplified94.2%
Final simplification92.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ (- y z) z) a x)))
(if (<= z -3.25e+41)
t_1
(if (<= z 3.5e+44) (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 <= -3.25e+41) {
tmp = t_1;
} else if (z <= 3.5e+44) {
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 <= -3.25e+41) tmp = t_1; elseif (z <= 3.5e+44) 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, -3.25e+41], t$95$1, If[LessEqual[z, 3.5e+44], 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 -3.25 \cdot 10^{+41}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 3.5 \cdot 10^{+44}:\\
\;\;\;\;\mathsf{fma}\left(a, \frac{y}{-1 - t}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.24999999999999988e41 or 3.4999999999999999e44 < z Initial program 95.6%
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
Simplified93.0%
if -3.24999999999999988e41 < z < 3.4999999999999999e44Initial program 99.2%
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--.f6488.7
Simplified88.7%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma (/ a z) (- y z) x))) (if (<= z -3e+41) t_1 (if (<= z 2.7e+44) (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((a / z), (y - z), x);
double tmp;
if (z <= -3e+41) {
tmp = t_1;
} else if (z <= 2.7e+44) {
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(a / z), Float64(y - z), x) tmp = 0.0 if (z <= -3e+41) tmp = t_1; elseif (z <= 2.7e+44) 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[(a / z), $MachinePrecision] * N[(y - z), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[z, -3e+41], t$95$1, If[LessEqual[z, 2.7e+44], 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{a}{z}, y - z, x\right)\\
\mathbf{if}\;z \leq -3 \cdot 10^{+41}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.7 \cdot 10^{+44}:\\
\;\;\;\;\mathsf{fma}\left(a, \frac{y}{-1 - t}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.9999999999999998e41 or 2.7e44 < z Initial program 95.6%
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-/.f6490.2
Simplified90.2%
if -2.9999999999999998e41 < z < 2.7e44Initial program 99.2%
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--.f6488.7
Simplified88.7%
(FPCore (x y z t a) :precision binary64 (fma (/ a (+ -1.0 (- z t))) (- y z) x))
double code(double x, double y, double z, double t, double a) {
return fma((a / (-1.0 + (z - t))), (y - z), x);
}
function code(x, y, z, t, a) return fma(Float64(a / Float64(-1.0 + Float64(z - t))), Float64(y - z), x) end
code[x_, y_, z_, t_, a_] := N[(N[(a / N[(-1.0 + N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(y - z), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{a}{-1 + \left(z - t\right)}, y - z, x\right)
\end{array}
Initial program 97.7%
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.9%
Final simplification97.9%
(FPCore (x y z t a) :precision binary64 (if (<= z -3.7e+41) (- x a) (if (<= z 7.5e+22) (- x (* y a)) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.7e+41) {
tmp = x - a;
} else if (z <= 7.5e+22) {
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 <= (-3.7d+41)) then
tmp = x - a
else if (z <= 7.5d+22) 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 <= -3.7e+41) {
tmp = x - a;
} else if (z <= 7.5e+22) {
tmp = x - (y * a);
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -3.7e+41: tmp = x - a elif z <= 7.5e+22: tmp = x - (y * a) else: tmp = x - a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -3.7e+41) tmp = Float64(x - a); elseif (z <= 7.5e+22) 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 <= -3.7e+41) tmp = x - a; elseif (z <= 7.5e+22) tmp = x - (y * a); else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -3.7e+41], N[(x - a), $MachinePrecision], If[LessEqual[z, 7.5e+22], N[(x - N[(y * a), $MachinePrecision]), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.7 \cdot 10^{+41}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 7.5 \cdot 10^{+22}:\\
\;\;\;\;x - y \cdot a\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -3.69999999999999981e41 or 7.5000000000000002e22 < z Initial program 95.0%
Taylor expanded in z around inf
Simplified73.6%
if -3.69999999999999981e41 < z < 7.5000000000000002e22Initial program 99.9%
Taylor expanded in t around 0
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
--lowering--.f6472.9
Simplified72.9%
Taylor expanded in z around 0
--lowering--.f64N/A
*-lowering-*.f6467.3
Simplified67.3%
Final simplification70.2%
(FPCore (x y z t a) :precision binary64 (if (<= z -5.5e-77) (- x a) (if (<= z 7.5e+22) x (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -5.5e-77) {
tmp = x - a;
} else if (z <= 7.5e+22) {
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 <= (-5.5d-77)) then
tmp = x - a
else if (z <= 7.5d+22) 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 <= -5.5e-77) {
tmp = x - a;
} else if (z <= 7.5e+22) {
tmp = x;
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -5.5e-77: tmp = x - a elif z <= 7.5e+22: tmp = x else: tmp = x - a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -5.5e-77) tmp = Float64(x - a); elseif (z <= 7.5e+22) 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 <= -5.5e-77) tmp = x - a; elseif (z <= 7.5e+22) tmp = x; else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -5.5e-77], N[(x - a), $MachinePrecision], If[LessEqual[z, 7.5e+22], x, N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.5 \cdot 10^{-77}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 7.5 \cdot 10^{+22}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -5.49999999999999998e-77 or 7.5000000000000002e22 < z Initial program 95.7%
Taylor expanded in z around inf
Simplified69.5%
if -5.49999999999999998e-77 < z < 7.5000000000000002e22Initial program 99.9%
Taylor expanded in x around inf
Simplified61.0%
(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 97.7%
Taylor expanded in x around inf
Simplified53.1%
(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 2024199
(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))))