
(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 12 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 (/ a (- -1.0 (- t z))) (- y z) x))
double code(double x, double y, double z, double t, double a) {
return fma((a / (-1.0 - (t - z))), (y - z), x);
}
function code(x, y, z, t, a) return fma(Float64(a / Float64(-1.0 - Float64(t - z))), Float64(y - z), x) end
code[x_, y_, z_, t_, a_] := N[(N[(a / N[(-1.0 - N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(y - z), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{a}{-1 - \left(t - z\right)}, y - z, x\right)
\end{array}
Initial program 98.7%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lift-/.f64N/A
clear-numN/A
distribute-lft-neg-inN/A
clear-numN/A
lift-/.f64N/A
distribute-frac-neg2N/A
lower-fma.f64N/A
Applied rewrites99.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ a z) (- y z) x)))
(if (<= z -4.1e+15)
t_1
(if (<= z 1.65)
(fma (/ y (- -1.0 t)) a x)
(if (<= z 3.4e+168) (fma z (/ a (- (- t -1.0) z)) 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 <= -4.1e+15) {
tmp = t_1;
} else if (z <= 1.65) {
tmp = fma((y / (-1.0 - t)), a, x);
} else if (z <= 3.4e+168) {
tmp = fma(z, (a / ((t - -1.0) - z)), 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 <= -4.1e+15) tmp = t_1; elseif (z <= 1.65) tmp = fma(Float64(y / Float64(-1.0 - t)), a, x); elseif (z <= 3.4e+168) tmp = fma(z, Float64(a / Float64(Float64(t - -1.0) - z)), 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, -4.1e+15], t$95$1, If[LessEqual[z, 1.65], N[(N[(y / N[(-1.0 - t), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision], If[LessEqual[z, 3.4e+168], N[(z * N[(a / N[(N[(t - -1.0), $MachinePrecision] - z), $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 -4.1 \cdot 10^{+15}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.65:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{-1 - t}, a, x\right)\\
\mathbf{elif}\;z \leq 3.4 \cdot 10^{+168}:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{a}{\left(t - -1\right) - z}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -4.1e15 or 3.40000000000000003e168 < z Initial program 97.7%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lift-/.f64N/A
clear-numN/A
distribute-lft-neg-inN/A
clear-numN/A
lift-/.f64N/A
distribute-frac-neg2N/A
lower-fma.f64N/A
Applied rewrites97.8%
Taylor expanded in z around inf
lower-/.f6486.9
Applied rewrites86.9%
if -4.1e15 < z < 1.6499999999999999Initial program 99.9%
Taylor expanded in z around 0
sub-negN/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
distribute-neg-frac2N/A
lower-/.f64N/A
distribute-neg-inN/A
metadata-evalN/A
unsub-negN/A
lower--.f6491.6
Applied rewrites91.6%
if 1.6499999999999999 < z < 3.40000000000000003e168Initial program 97.4%
Taylor expanded in y around 0
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f6492.9
Applied rewrites92.9%
Applied rewrites92.7%
Final simplification90.0%
(FPCore (x y z t a)
:precision binary64
(if (<= z -5800000000.0)
(- x a)
(if (<= z 8.5e-236)
(- x (* (fma z a a) (- y z)))
(if (<= z 2.2) (- x (* (/ a t) y)) (- x a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -5800000000.0) {
tmp = x - a;
} else if (z <= 8.5e-236) {
tmp = x - (fma(z, a, a) * (y - z));
} else if (z <= 2.2) {
tmp = x - ((a / t) * y);
} else {
tmp = x - a;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -5800000000.0) tmp = Float64(x - a); elseif (z <= 8.5e-236) tmp = Float64(x - Float64(fma(z, a, a) * Float64(y - z))); elseif (z <= 2.2) tmp = Float64(x - Float64(Float64(a / t) * y)); else tmp = Float64(x - a); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -5800000000.0], N[(x - a), $MachinePrecision], If[LessEqual[z, 8.5e-236], N[(x - N[(N[(z * a + a), $MachinePrecision] * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.2], N[(x - N[(N[(a / t), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], N[(x - a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5800000000:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 8.5 \cdot 10^{-236}:\\
\;\;\;\;x - \mathsf{fma}\left(z, a, a\right) \cdot \left(y - z\right)\\
\mathbf{elif}\;z \leq 2.2:\\
\;\;\;\;x - \frac{a}{t} \cdot y\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -5.8e9 or 2.2000000000000002 < z Initial program 97.7%
Taylor expanded in z around inf
lower--.f6477.4
Applied rewrites77.4%
if -5.8e9 < z < 8.49999999999999929e-236Initial program 99.9%
Taylor expanded in t around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6482.0
Applied rewrites82.0%
Taylor expanded in z around 0
Applied rewrites82.0%
if 8.49999999999999929e-236 < z < 2.2000000000000002Initial program 99.9%
Taylor expanded in t around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6480.2
Applied rewrites80.2%
Taylor expanded in z around 0
Applied rewrites83.2%
Final simplification79.8%
(FPCore (x y z t a)
:precision binary64
(if (<= z -5800000000.0)
(- x a)
(if (<= z 8.5e-236)
(- x (* (fma z a a) (- y z)))
(if (<= z 2.2) (fma (/ y t) (- a) x) (- x a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -5800000000.0) {
tmp = x - a;
} else if (z <= 8.5e-236) {
tmp = x - (fma(z, a, a) * (y - z));
} else if (z <= 2.2) {
tmp = fma((y / t), -a, x);
} else {
tmp = x - a;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -5800000000.0) tmp = Float64(x - a); elseif (z <= 8.5e-236) tmp = Float64(x - Float64(fma(z, a, a) * Float64(y - z))); elseif (z <= 2.2) tmp = fma(Float64(y / t), Float64(-a), x); else tmp = Float64(x - a); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -5800000000.0], N[(x - a), $MachinePrecision], If[LessEqual[z, 8.5e-236], N[(x - N[(N[(z * a + a), $MachinePrecision] * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.2], N[(N[(y / t), $MachinePrecision] * (-a) + x), $MachinePrecision], N[(x - a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5800000000:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 8.5 \cdot 10^{-236}:\\
\;\;\;\;x - \mathsf{fma}\left(z, a, a\right) \cdot \left(y - z\right)\\
\mathbf{elif}\;z \leq 2.2:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{t}, -a, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -5.8e9 or 2.2000000000000002 < z Initial program 97.7%
Taylor expanded in z around inf
lower--.f6477.4
Applied rewrites77.4%
if -5.8e9 < z < 8.49999999999999929e-236Initial program 99.9%
Taylor expanded in t around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6482.0
Applied rewrites82.0%
Taylor expanded in z around 0
Applied rewrites82.0%
if 8.49999999999999929e-236 < z < 2.2000000000000002Initial program 99.9%
Taylor expanded in t around inf
mul-1-negN/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-neg.f6475.4
Applied rewrites75.4%
Taylor expanded in z around 0
Applied rewrites80.9%
Final simplification79.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ a (- t)) (- y z) x)))
(if (<= t -2.7e+28)
t_1
(if (<= t 1.4e+49) (fma (/ a (- z 1.0)) (- y z) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((a / -t), (y - z), x);
double tmp;
if (t <= -2.7e+28) {
tmp = t_1;
} else if (t <= 1.4e+49) {
tmp = fma((a / (z - 1.0)), (y - z), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(a / Float64(-t)), Float64(y - z), x) tmp = 0.0 if (t <= -2.7e+28) tmp = t_1; elseif (t <= 1.4e+49) tmp = fma(Float64(a / Float64(z - 1.0)), Float64(y - z), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(a / (-t)), $MachinePrecision] * N[(y - z), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[t, -2.7e+28], t$95$1, If[LessEqual[t, 1.4e+49], N[(N[(a / N[(z - 1.0), $MachinePrecision]), $MachinePrecision] * N[(y - z), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{a}{-t}, y - z, x\right)\\
\mathbf{if}\;t \leq -2.7 \cdot 10^{+28}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.4 \cdot 10^{+49}:\\
\;\;\;\;\mathsf{fma}\left(\frac{a}{z - 1}, y - z, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -2.7000000000000002e28 or 1.3999999999999999e49 < t Initial program 99.8%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lift-/.f64N/A
clear-numN/A
distribute-lft-neg-inN/A
clear-numN/A
lift-/.f64N/A
distribute-frac-neg2N/A
lower-fma.f64N/A
Applied rewrites99.8%
Taylor expanded in t around inf
mul-1-negN/A
lower-neg.f6485.3
Applied rewrites85.3%
if -2.7000000000000002e28 < t < 1.3999999999999999e49Initial program 98.0%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lift-/.f64N/A
clear-numN/A
distribute-lft-neg-inN/A
clear-numN/A
lift-/.f64N/A
distribute-frac-neg2N/A
lower-fma.f64N/A
Applied rewrites98.6%
Taylor expanded in t around 0
lower--.f6497.2
Applied rewrites97.2%
(FPCore (x y z t a)
:precision binary64
(if (<= z -4.1e+15)
(fma (/ a z) (- y z) x)
(if (<= z 1.65)
(fma (/ y (- -1.0 t)) a x)
(fma (/ z (- (- t -1.0) z)) a x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -4.1e+15) {
tmp = fma((a / z), (y - z), x);
} else if (z <= 1.65) {
tmp = fma((y / (-1.0 - t)), a, x);
} else {
tmp = fma((z / ((t - -1.0) - z)), a, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -4.1e+15) tmp = fma(Float64(a / z), Float64(y - z), x); elseif (z <= 1.65) tmp = fma(Float64(y / Float64(-1.0 - t)), a, x); else tmp = fma(Float64(z / Float64(Float64(t - -1.0) - z)), a, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -4.1e+15], N[(N[(a / z), $MachinePrecision] * N[(y - z), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 1.65], N[(N[(y / N[(-1.0 - t), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision], N[(N[(z / N[(N[(t - -1.0), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.1 \cdot 10^{+15}:\\
\;\;\;\;\mathsf{fma}\left(\frac{a}{z}, y - z, x\right)\\
\mathbf{elif}\;z \leq 1.65:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{-1 - t}, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{\left(t - -1\right) - z}, a, x\right)\\
\end{array}
\end{array}
if z < -4.1e15Initial program 99.9%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lift-/.f64N/A
clear-numN/A
distribute-lft-neg-inN/A
clear-numN/A
lift-/.f64N/A
distribute-frac-neg2N/A
lower-fma.f64N/A
Applied rewrites99.8%
Taylor expanded in z around inf
lower-/.f6482.2
Applied rewrites82.2%
if -4.1e15 < z < 1.6499999999999999Initial program 99.9%
Taylor expanded in z around 0
sub-negN/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
distribute-neg-frac2N/A
lower-/.f64N/A
distribute-neg-inN/A
metadata-evalN/A
unsub-negN/A
lower--.f6491.6
Applied rewrites91.6%
if 1.6499999999999999 < z Initial program 96.1%
Taylor expanded in y around 0
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f6489.9
Applied rewrites89.9%
Final simplification89.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ a z) (- y z) x)))
(if (<= z -4.1e+15)
t_1
(if (<= z 420000.0) (fma (/ y (- -1.0 t)) a 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 <= -4.1e+15) {
tmp = t_1;
} else if (z <= 420000.0) {
tmp = fma((y / (-1.0 - t)), a, 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 <= -4.1e+15) tmp = t_1; elseif (z <= 420000.0) tmp = fma(Float64(y / Float64(-1.0 - t)), a, 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, -4.1e+15], t$95$1, If[LessEqual[z, 420000.0], N[(N[(y / N[(-1.0 - t), $MachinePrecision]), $MachinePrecision] * a + 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 -4.1 \cdot 10^{+15}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 420000:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{-1 - t}, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -4.1e15 or 4.2e5 < z Initial program 97.6%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lift-/.f64N/A
clear-numN/A
distribute-lft-neg-inN/A
clear-numN/A
lift-/.f64N/A
distribute-frac-neg2N/A
lower-fma.f64N/A
Applied rewrites98.3%
Taylor expanded in z around inf
lower-/.f6486.2
Applied rewrites86.2%
if -4.1e15 < z < 4.2e5Initial program 99.9%
Taylor expanded in z around 0
sub-negN/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
distribute-neg-frac2N/A
lower-/.f64N/A
distribute-neg-inN/A
metadata-evalN/A
unsub-negN/A
lower--.f6490.2
Applied rewrites90.2%
(FPCore (x y z t a) :precision binary64 (if (<= z -9.5e+42) (- x a) (if (<= z 7.8) (fma (/ y (- -1.0 t)) a x) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -9.5e+42) {
tmp = x - a;
} else if (z <= 7.8) {
tmp = fma((y / (-1.0 - t)), a, x);
} else {
tmp = x - a;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -9.5e+42) tmp = Float64(x - a); elseif (z <= 7.8) tmp = fma(Float64(y / Float64(-1.0 - t)), a, x); else tmp = Float64(x - a); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -9.5e+42], N[(x - a), $MachinePrecision], If[LessEqual[z, 7.8], N[(N[(y / N[(-1.0 - t), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.5 \cdot 10^{+42}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 7.8:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{-1 - t}, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -9.50000000000000019e42 or 7.79999999999999982 < z Initial program 97.4%
Taylor expanded in z around inf
lower--.f6479.0
Applied rewrites79.0%
if -9.50000000000000019e42 < z < 7.79999999999999982Initial program 99.9%
Taylor expanded in z around 0
sub-negN/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
distribute-neg-frac2N/A
lower-/.f64N/A
distribute-neg-inN/A
metadata-evalN/A
unsub-negN/A
lower--.f6489.4
Applied rewrites89.4%
(FPCore (x y z t a) :precision binary64 (if (<= z -5800000000.0) (- x a) (if (<= z 0.046) (- x (* (fma z a a) (- y z))) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -5800000000.0) {
tmp = x - a;
} else if (z <= 0.046) {
tmp = x - (fma(z, a, a) * (y - z));
} else {
tmp = x - a;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -5800000000.0) tmp = Float64(x - a); elseif (z <= 0.046) tmp = Float64(x - Float64(fma(z, a, a) * Float64(y - z))); else tmp = Float64(x - a); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -5800000000.0], N[(x - a), $MachinePrecision], If[LessEqual[z, 0.046], N[(x - N[(N[(z * a + a), $MachinePrecision] * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5800000000:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 0.046:\\
\;\;\;\;x - \mathsf{fma}\left(z, a, a\right) \cdot \left(y - z\right)\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -5.8e9 or 0.045999999999999999 < z Initial program 97.7%
Taylor expanded in z around inf
lower--.f6476.9
Applied rewrites76.9%
if -5.8e9 < z < 0.045999999999999999Initial program 99.9%
Taylor expanded in t around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6478.9
Applied rewrites78.9%
Taylor expanded in z around 0
Applied rewrites78.5%
Final simplification77.7%
(FPCore (x y z t a) :precision binary64 (if (<= z -430000000.0) (- x a) (if (<= z 28.0) (- x (* y a)) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -430000000.0) {
tmp = x - a;
} else if (z <= 28.0) {
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 <= (-430000000.0d0)) then
tmp = x - a
else if (z <= 28.0d0) 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 <= -430000000.0) {
tmp = x - a;
} else if (z <= 28.0) {
tmp = x - (y * a);
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -430000000.0: tmp = x - a elif z <= 28.0: tmp = x - (y * a) else: tmp = x - a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -430000000.0) tmp = Float64(x - a); elseif (z <= 28.0) 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 <= -430000000.0) tmp = x - a; elseif (z <= 28.0) tmp = x - (y * a); else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -430000000.0], N[(x - a), $MachinePrecision], If[LessEqual[z, 28.0], N[(x - N[(y * a), $MachinePrecision]), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -430000000:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 28:\\
\;\;\;\;x - y \cdot a\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -4.3e8 or 28 < z Initial program 97.7%
Taylor expanded in z around inf
lower--.f6477.3
Applied rewrites77.3%
if -4.3e8 < z < 28Initial program 99.9%
Taylor expanded in t around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6478.4
Applied rewrites78.4%
Taylor expanded in z around 0
Applied rewrites72.8%
(FPCore (x y z t a) :precision binary64 (- x a))
double code(double x, double y, double z, double t, double a) {
return x - 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 - a
end function
public static double code(double x, double y, double z, double t, double a) {
return x - a;
}
def code(x, y, z, t, a): return x - a
function code(x, y, z, t, a) return Float64(x - a) end
function tmp = code(x, y, z, t, a) tmp = x - a; end
code[x_, y_, z_, t_, a_] := N[(x - a), $MachinePrecision]
\begin{array}{l}
\\
x - a
\end{array}
Initial program 98.7%
Taylor expanded in z around inf
lower--.f6460.8
Applied rewrites60.8%
(FPCore (x y z t a) :precision binary64 (- a))
double code(double x, double y, double z, double t, double a) {
return -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 = -a
end function
public static double code(double x, double y, double z, double t, double a) {
return -a;
}
def code(x, y, z, t, a): return -a
function code(x, y, z, t, a) return Float64(-a) end
function tmp = code(x, y, z, t, a) tmp = -a; end
code[x_, y_, z_, t_, a_] := (-a)
\begin{array}{l}
\\
-a
\end{array}
Initial program 98.7%
Taylor expanded in z around inf
lower--.f6460.8
Applied rewrites60.8%
Taylor expanded in a around inf
Applied rewrites18.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 2024270
(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))))