
(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 (- 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}
Initial program 96.2%
Final simplification96.2%
(FPCore (x y z t a) :precision binary64 (if (<= (/ (- y z) (/ (- (- t z) -1.0) a)) -5e+295) (* (- y) a) (- x a)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (((y - z) / (((t - z) - -1.0) / a)) <= -5e+295) {
tmp = -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 (((y - z) / (((t - z) - (-1.0d0)) / a)) <= (-5d+295)) then
tmp = -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 (((y - z) / (((t - z) - -1.0) / a)) <= -5e+295) {
tmp = -y * a;
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if ((y - z) / (((t - z) - -1.0) / a)) <= -5e+295: tmp = -y * a else: tmp = x - a 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)) <= -5e+295) tmp = Float64(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 (((y - z) / (((t - z) - -1.0) / a)) <= -5e+295) tmp = -y * a; else tmp = x - a; 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], -5e+295], N[((-y) * a), $MachinePrecision], N[(x - a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{y - z}{\frac{\left(t - z\right) - -1}{a}} \leq -5 \cdot 10^{+295}:\\
\;\;\;\;\left(-y\right) \cdot a\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if (/.f64 (-.f64 y z) (/.f64 (+.f64 (-.f64 t z) #s(literal 1 binary64)) a)) < -4.99999999999999991e295Initial program 100.0%
Taylor expanded in t around 0
sub-negN/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
distribute-neg-fracN/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f64N/A
lower--.f6490.1
Applied rewrites90.1%
Taylor expanded in z around 0
Applied rewrites90.1%
Taylor expanded in a around inf
Applied rewrites90.1%
Taylor expanded in z around 0
Applied rewrites79.0%
if -4.99999999999999991e295 < (/.f64 (-.f64 y z) (/.f64 (+.f64 (-.f64 t z) #s(literal 1 binary64)) a)) Initial program 96.1%
Taylor expanded in z around inf
lower--.f6464.0
Applied rewrites64.0%
Final simplification64.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ z (- (- t -1.0) z)) a x)))
(if (<= z -1.25e+63)
t_1
(if (<= z -5.4e-7)
(* (/ a (- 1.0 z)) (- z y))
(if (<= z 1.15e+109) (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((z / ((t - -1.0) - z)), a, x);
double tmp;
if (z <= -1.25e+63) {
tmp = t_1;
} else if (z <= -5.4e-7) {
tmp = (a / (1.0 - z)) * (z - y);
} else if (z <= 1.15e+109) {
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(z / Float64(Float64(t - -1.0) - z)), a, x) tmp = 0.0 if (z <= -1.25e+63) tmp = t_1; elseif (z <= -5.4e-7) tmp = Float64(Float64(a / Float64(1.0 - z)) * Float64(z - y)); elseif (z <= 1.15e+109) 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[(z / N[(N[(t - -1.0), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision]}, If[LessEqual[z, -1.25e+63], t$95$1, If[LessEqual[z, -5.4e-7], N[(N[(a / N[(1.0 - z), $MachinePrecision]), $MachinePrecision] * N[(z - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.15e+109], 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{z}{\left(t - -1\right) - z}, a, x\right)\\
\mathbf{if}\;z \leq -1.25 \cdot 10^{+63}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -5.4 \cdot 10^{-7}:\\
\;\;\;\;\frac{a}{1 - z} \cdot \left(z - y\right)\\
\mathbf{elif}\;z \leq 1.15 \cdot 10^{+109}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{-1 - t}, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.25000000000000003e63 or 1.15000000000000005e109 < z Initial program 93.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-+.f6493.0
Applied rewrites93.0%
if -1.25000000000000003e63 < z < -5.40000000000000018e-7Initial program 99.7%
Taylor expanded in t around 0
sub-negN/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
distribute-neg-fracN/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f64N/A
lower--.f6491.3
Applied rewrites91.3%
Taylor expanded in z around 0
Applied rewrites91.3%
Taylor expanded in a around inf
Applied rewrites83.3%
if -5.40000000000000018e-7 < z < 1.15000000000000005e109Initial program 98.1%
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--.f6488.8
Applied rewrites88.8%
Final simplification90.2%
(FPCore (x y z t a)
:precision binary64
(if (<= z -1.25e+63)
(- x a)
(if (<= z -5.4e-7)
(* (/ a (- 1.0 z)) (- z y))
(if (<= z 2.7e+109) (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 <= -1.25e+63) {
tmp = x - a;
} else if (z <= -5.4e-7) {
tmp = (a / (1.0 - z)) * (z - y);
} else if (z <= 2.7e+109) {
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 <= -1.25e+63) tmp = Float64(x - a); elseif (z <= -5.4e-7) tmp = Float64(Float64(a / Float64(1.0 - z)) * Float64(z - y)); elseif (z <= 2.7e+109) 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, -1.25e+63], N[(x - a), $MachinePrecision], If[LessEqual[z, -5.4e-7], N[(N[(a / N[(1.0 - z), $MachinePrecision]), $MachinePrecision] * N[(z - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.7e+109], 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 -1.25 \cdot 10^{+63}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq -5.4 \cdot 10^{-7}:\\
\;\;\;\;\frac{a}{1 - z} \cdot \left(z - y\right)\\
\mathbf{elif}\;z \leq 2.7 \cdot 10^{+109}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{-1 - t}, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -1.25000000000000003e63 or 2.70000000000000001e109 < z Initial program 93.1%
Taylor expanded in z around inf
lower--.f6487.8
Applied rewrites87.8%
if -1.25000000000000003e63 < z < -5.40000000000000018e-7Initial program 99.7%
Taylor expanded in t around 0
sub-negN/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
distribute-neg-fracN/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f64N/A
lower--.f6491.3
Applied rewrites91.3%
Taylor expanded in z around 0
Applied rewrites91.3%
Taylor expanded in a around inf
Applied rewrites83.3%
if -5.40000000000000018e-7 < z < 2.70000000000000001e109Initial program 98.1%
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--.f6488.8
Applied rewrites88.8%
Final simplification88.2%
(FPCore (x y z t a)
:precision binary64
(if (<= z -0.22)
(- x a)
(if (<= z 3.5e-32)
(- x (* (fma z a a) (- y z)))
(if (<= z 2.7e+109) (fma (/ y t) (- a) x) (- x a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -0.22) {
tmp = x - a;
} else if (z <= 3.5e-32) {
tmp = x - (fma(z, a, a) * (y - z));
} else if (z <= 2.7e+109) {
tmp = fma((y / t), -a, x);
} else {
tmp = x - a;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -0.22) tmp = Float64(x - a); elseif (z <= 3.5e-32) tmp = Float64(x - Float64(fma(z, a, a) * Float64(y - z))); elseif (z <= 2.7e+109) 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, -0.22], N[(x - a), $MachinePrecision], If[LessEqual[z, 3.5e-32], N[(x - N[(N[(z * a + a), $MachinePrecision] * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.7e+109], N[(N[(y / t), $MachinePrecision] * (-a) + x), $MachinePrecision], N[(x - a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.22:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 3.5 \cdot 10^{-32}:\\
\;\;\;\;x - \mathsf{fma}\left(z, a, a\right) \cdot \left(y - z\right)\\
\mathbf{elif}\;z \leq 2.7 \cdot 10^{+109}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{t}, -a, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -0.220000000000000001 or 2.70000000000000001e109 < z Initial program 93.7%
Taylor expanded in z around inf
lower--.f6482.3
Applied rewrites82.3%
if -0.220000000000000001 < z < 3.4999999999999999e-32Initial program 99.0%
Taylor expanded in t around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6477.0
Applied rewrites77.0%
Taylor expanded in z around 0
Applied rewrites76.8%
if 3.4999999999999999e-32 < z < 2.70000000000000001e109Initial program 94.1%
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.f6480.7
Applied rewrites80.7%
Taylor expanded in z around 0
Applied rewrites79.1%
Final simplification79.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ (- y z) t) (- a) x)))
(if (<= t -1.9e+112)
t_1
(if (<= t 3.7e+22) (fma (/ (- z y) (- 1.0 z)) a 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 (t <= -1.9e+112) {
tmp = t_1;
} else if (t <= 3.7e+22) {
tmp = fma(((z - y) / (1.0 - z)), a, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(Float64(y - z) / t), Float64(-a), x) tmp = 0.0 if (t <= -1.9e+112) tmp = t_1; elseif (t <= 3.7e+22) tmp = fma(Float64(Float64(z - y) / Float64(1.0 - z)), a, 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] / t), $MachinePrecision] * (-a) + x), $MachinePrecision]}, If[LessEqual[t, -1.9e+112], t$95$1, If[LessEqual[t, 3.7e+22], N[(N[(N[(z - y), $MachinePrecision] / N[(1.0 - z), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{y - z}{t}, -a, x\right)\\
\mathbf{if}\;t \leq -1.9 \cdot 10^{+112}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 3.7 \cdot 10^{+22}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - y}{1 - z}, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.90000000000000004e112 or 3.6999999999999998e22 < t Initial program 94.8%
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.f6489.8
Applied rewrites89.8%
if -1.90000000000000004e112 < t < 3.6999999999999998e22Initial program 97.2%
Taylor expanded in t around 0
sub-negN/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
distribute-neg-fracN/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f64N/A
lower--.f6494.8
Applied rewrites94.8%
Taylor expanded in z around 0
Applied rewrites94.8%
(FPCore (x y z t a) :precision binary64 (if (<= z -2.6e+20) (- x a) (if (<= z 2.7e+109) (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 <= -2.6e+20) {
tmp = x - a;
} else if (z <= 2.7e+109) {
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 <= -2.6e+20) tmp = Float64(x - a); elseif (z <= 2.7e+109) 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, -2.6e+20], N[(x - a), $MachinePrecision], If[LessEqual[z, 2.7e+109], 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 -2.6 \cdot 10^{+20}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 2.7 \cdot 10^{+109}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{-1 - t}, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -2.6e20 or 2.70000000000000001e109 < z Initial program 93.6%
Taylor expanded in z around inf
lower--.f6484.3
Applied rewrites84.3%
if -2.6e20 < z < 2.70000000000000001e109Initial program 98.2%
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--.f6488.2
Applied rewrites88.2%
(FPCore (x y z t a) :precision binary64 (if (<= z -2.6e+20) (- x a) (if (<= z 1e+104) (fma y (/ a (- -1.0 t)) x) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.6e+20) {
tmp = x - a;
} else if (z <= 1e+104) {
tmp = fma(y, (a / (-1.0 - t)), x);
} else {
tmp = x - a;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.6e+20) tmp = Float64(x - a); elseif (z <= 1e+104) tmp = fma(y, Float64(a / Float64(-1.0 - t)), x); else tmp = Float64(x - a); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.6e+20], N[(x - a), $MachinePrecision], If[LessEqual[z, 1e+104], N[(y * N[(a / N[(-1.0 - t), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.6 \cdot 10^{+20}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 10^{+104}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{a}{-1 - t}, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -2.6e20 or 1e104 < z Initial program 92.8%
Taylor expanded in z around inf
lower--.f6483.7
Applied rewrites83.7%
if -2.6e20 < z < 1e104Initial program 98.8%
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--.f6488.1
Applied rewrites88.1%
Applied rewrites87.0%
(FPCore (x y z t a) :precision binary64 (if (<= z -0.22) (- x a) (if (<= z 1800.0) (- 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 <= -0.22) {
tmp = x - a;
} else if (z <= 1800.0) {
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 <= -0.22) tmp = Float64(x - a); elseif (z <= 1800.0) 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, -0.22], N[(x - a), $MachinePrecision], If[LessEqual[z, 1800.0], 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 -0.22:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 1800:\\
\;\;\;\;x - \mathsf{fma}\left(z, a, a\right) \cdot \left(y - z\right)\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -0.220000000000000001 or 1800 < z Initial program 93.4%
Taylor expanded in z around inf
lower--.f6478.6
Applied rewrites78.6%
if -0.220000000000000001 < z < 1800Initial program 99.1%
Taylor expanded in t around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6475.3
Applied rewrites75.3%
Taylor expanded in z around 0
Applied rewrites74.7%
Final simplification76.6%
(FPCore (x y z t a) :precision binary64 (if (<= z -4.8e+46) (- x a) (if (<= z 3800.0) (fma (- y) a x) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -4.8e+46) {
tmp = x - a;
} else if (z <= 3800.0) {
tmp = fma(-y, a, x);
} else {
tmp = x - a;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -4.8e+46) tmp = Float64(x - a); elseif (z <= 3800.0) tmp = fma(Float64(-y), a, x); else tmp = Float64(x - a); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -4.8e+46], N[(x - a), $MachinePrecision], If[LessEqual[z, 3800.0], N[((-y) * a + x), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.8 \cdot 10^{+46}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 3800:\\
\;\;\;\;\mathsf{fma}\left(-y, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -4.80000000000000017e46 or 3800 < z Initial program 93.0%
Taylor expanded in z around inf
lower--.f6481.8
Applied rewrites81.8%
if -4.80000000000000017e46 < z < 3800Initial program 99.1%
Taylor expanded in t around 0
sub-negN/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
distribute-neg-fracN/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f64N/A
lower--.f6475.9
Applied rewrites75.9%
Taylor expanded in z around 0
Applied rewrites69.0%
(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 96.2%
Taylor expanded in z around inf
lower--.f6461.8
Applied rewrites61.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 96.2%
Taylor expanded in z around inf
lower--.f6461.8
Applied rewrites61.8%
Taylor expanded in a around inf
Applied rewrites14.5%
(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 2024277
(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))))