
(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
(let* ((t_1 (- (- z t) 1.0)) (t_2 (fma (/ a t_1) (- y z) x)))
(if (<= a -6e-39)
t_2
(if (<= a 28500000000.0) (- x (/ (* (- z y) a) t_1)) t_2))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) - 1.0;
double t_2 = fma((a / t_1), (y - z), x);
double tmp;
if (a <= -6e-39) {
tmp = t_2;
} else if (a <= 28500000000.0) {
tmp = x - (((z - y) * a) / t_1);
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) - 1.0) t_2 = fma(Float64(a / t_1), Float64(y - z), x) tmp = 0.0 if (a <= -6e-39) tmp = t_2; elseif (a <= 28500000000.0) tmp = Float64(x - Float64(Float64(Float64(z - y) * a) / t_1)); else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] - 1.0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(a / t$95$1), $MachinePrecision] * N[(y - z), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -6e-39], t$95$2, If[LessEqual[a, 28500000000.0], N[(x - N[(N[(N[(z - y), $MachinePrecision] * a), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(z - t\right) - 1\\
t_2 := \mathsf{fma}\left(\frac{a}{t\_1}, y - z, x\right)\\
\mathbf{if}\;a \leq -6 \cdot 10^{-39}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;a \leq 28500000000:\\
\;\;\;\;x - \frac{\left(z - y\right) \cdot a}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if a < -6.00000000000000055e-39 or 2.85e10 < a 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.9%
if -6.00000000000000055e-39 < a < 2.85e10Initial program 92.6%
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64100.0
lift-+.f64N/A
+-commutativeN/A
lower-+.f64100.0
Applied rewrites100.0%
Final simplification99.9%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (* (- y) a)) (t_2 (- x (/ (- y z) (/ (- (- t z) -1.0) a))))) (if (<= t_2 (- INFINITY)) t_1 (if (<= t_2 5e+301) (- x a) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = -y * a;
double t_2 = x - ((y - z) / (((t - z) - -1.0) / a));
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_2 <= 5e+301) {
tmp = x - a;
} else {
tmp = t_1;
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a) {
double t_1 = -y * a;
double t_2 = x - ((y - z) / (((t - z) - -1.0) / a));
double tmp;
if (t_2 <= -Double.POSITIVE_INFINITY) {
tmp = t_1;
} else if (t_2 <= 5e+301) {
tmp = x - a;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = -y * a t_2 = x - ((y - z) / (((t - z) - -1.0) / a)) tmp = 0 if t_2 <= -math.inf: tmp = t_1 elif t_2 <= 5e+301: tmp = x - a else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(-y) * a) t_2 = Float64(x - Float64(Float64(y - z) / Float64(Float64(Float64(t - z) - -1.0) / a))) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_1; elseif (t_2 <= 5e+301) tmp = Float64(x - a); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = -y * a; t_2 = x - ((y - z) / (((t - z) - -1.0) / a)); tmp = 0.0; if (t_2 <= -Inf) tmp = t_1; elseif (t_2 <= 5e+301) tmp = x - a; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[((-y) * a), $MachinePrecision]}, Block[{t$95$2 = N[(x - N[(N[(y - z), $MachinePrecision] / N[(N[(N[(t - z), $MachinePrecision] - -1.0), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$1, If[LessEqual[t$95$2, 5e+301], N[(x - a), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(-y\right) \cdot a\\
t_2 := x - \frac{y - z}{\frac{\left(t - z\right) - -1}{a}}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+301}:\\
\;\;\;\;x - a\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (-.f64 x (/.f64 (-.f64 y z) (/.f64 (+.f64 (-.f64 t z) #s(literal 1 binary64)) a))) < -inf.0 or 5.0000000000000004e301 < (-.f64 x (/.f64 (-.f64 y z) (/.f64 (+.f64 (-.f64 t z) #s(literal 1 binary64)) a))) Initial 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--.f6488.9
Applied rewrites88.9%
Taylor expanded in y around inf
Applied rewrites88.9%
Taylor expanded in z around 0
Applied rewrites72.2%
if -inf.0 < (-.f64 x (/.f64 (-.f64 y z) (/.f64 (+.f64 (-.f64 t z) #s(literal 1 binary64)) a))) < 5.0000000000000004e301Initial program 95.8%
Taylor expanded in z around inf
lower--.f6466.2
Applied rewrites66.2%
Final simplification66.6%
(FPCore (x y z t a)
:precision binary64
(if (<= t -8e+103)
(fma (- y z) (/ (- a) t) x)
(if (<= t 1.7e+94)
(fma (/ (- z y) (- 1.0 z)) 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 (t <= -8e+103) {
tmp = fma((y - z), (-a / t), x);
} else if (t <= 1.7e+94) {
tmp = fma(((z - y) / (1.0 - z)), 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 (t <= -8e+103) tmp = fma(Float64(y - z), Float64(Float64(-a) / t), x); elseif (t <= 1.7e+94) tmp = fma(Float64(Float64(z - y) / Float64(1.0 - z)), 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[t, -8e+103], N[(N[(y - z), $MachinePrecision] * N[((-a) / t), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t, 1.7e+94], N[(N[(N[(z - y), $MachinePrecision] / N[(1.0 - z), $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}\;t \leq -8 \cdot 10^{+103}:\\
\;\;\;\;\mathsf{fma}\left(y - z, \frac{-a}{t}, x\right)\\
\mathbf{elif}\;t \leq 1.7 \cdot 10^{+94}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - y}{1 - z}, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{\left(t - -1\right) - z}, a, x\right)\\
\end{array}
\end{array}
if t < -8e103Initial program 99.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.f6488.8
Applied rewrites88.8%
Applied rewrites93.3%
if -8e103 < t < 1.7000000000000001e94Initial program 95.6%
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--.f6495.3
Applied rewrites95.3%
if 1.7000000000000001e94 < t Initial program 94.3%
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-+.f6488.3
Applied rewrites88.3%
Final simplification94.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ z (- (- t -1.0) z)) a x)))
(if (<= z -1.9e-30)
t_1
(if (<= z 3.3e-21) (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.9e-30) {
tmp = t_1;
} else if (z <= 3.3e-21) {
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.9e-30) tmp = t_1; elseif (z <= 3.3e-21) 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.9e-30], t$95$1, If[LessEqual[z, 3.3e-21], 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.9 \cdot 10^{-30}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 3.3 \cdot 10^{-21}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{-1 - t}, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.9000000000000002e-30 or 3.30000000000000009e-21 < z Initial program 94.2%
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-+.f6485.0
Applied rewrites85.0%
if -1.9000000000000002e-30 < z < 3.30000000000000009e-21Initial program 98.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--.f6493.1
Applied rewrites93.1%
Final simplification88.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma z (/ a (- (- t z) -1.0)) x)))
(if (<= z -1.9e-30)
t_1
(if (<= z 3.3e-21) (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, (a / ((t - z) - -1.0)), x);
double tmp;
if (z <= -1.9e-30) {
tmp = t_1;
} else if (z <= 3.3e-21) {
tmp = fma((y / (-1.0 - t)), a, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(z, Float64(a / Float64(Float64(t - z) - -1.0)), x) tmp = 0.0 if (z <= -1.9e-30) tmp = t_1; elseif (z <= 3.3e-21) 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[(z * N[(a / N[(N[(t - z), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[z, -1.9e-30], t$95$1, If[LessEqual[z, 3.3e-21], 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(z, \frac{a}{\left(t - z\right) - -1}, x\right)\\
\mathbf{if}\;z \leq -1.9 \cdot 10^{-30}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 3.3 \cdot 10^{-21}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{-1 - t}, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.9000000000000002e-30 or 3.30000000000000009e-21 < z Initial program 94.2%
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-+.f6485.0
Applied rewrites85.0%
Applied rewrites80.7%
if -1.9000000000000002e-30 < z < 3.30000000000000009e-21Initial program 98.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--.f6493.1
Applied rewrites93.1%
Final simplification85.7%
(FPCore (x y z t a) :precision binary64 (- x (/ a (/ (- (- z t) 1.0) (- z y)))))
double code(double x, double y, double z, double t, double a) {
return x - (a / (((z - t) - 1.0) / (z - y)));
}
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 / (((z - t) - 1.0d0) / (z - y)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x - (a / (((z - t) - 1.0) / (z - y)));
}
def code(x, y, z, t, a): return x - (a / (((z - t) - 1.0) / (z - y)))
function code(x, y, z, t, a) return Float64(x - Float64(a / Float64(Float64(Float64(z - t) - 1.0) / Float64(z - y)))) end
function tmp = code(x, y, z, t, a) tmp = x - (a / (((z - t) - 1.0) / (z - y))); end
code[x_, y_, z_, t_, a_] := N[(x - N[(a / N[(N[(N[(z - t), $MachinePrecision] - 1.0), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{a}{\frac{\left(z - t\right) - 1}{z - y}}
\end{array}
Initial program 96.1%
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
*-commutativeN/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6499.0
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.0
Applied rewrites99.0%
Final simplification99.0%
(FPCore (x y z t a) :precision binary64 (if (<= z -2e+46) (- x a) (if (<= z 3.3e-21) (fma (/ y (- -1.0 t)) a x) (fma (/ z (- 1.0 z)) a x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2e+46) {
tmp = x - a;
} else if (z <= 3.3e-21) {
tmp = fma((y / (-1.0 - t)), a, x);
} else {
tmp = fma((z / (1.0 - z)), a, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2e+46) tmp = Float64(x - a); elseif (z <= 3.3e-21) tmp = fma(Float64(y / Float64(-1.0 - t)), a, x); else tmp = fma(Float64(z / Float64(1.0 - z)), a, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2e+46], N[(x - a), $MachinePrecision], If[LessEqual[z, 3.3e-21], N[(N[(y / N[(-1.0 - t), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision], N[(N[(z / N[(1.0 - z), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2 \cdot 10^{+46}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 3.3 \cdot 10^{-21}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{-1 - t}, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{1 - z}, a, x\right)\\
\end{array}
\end{array}
if z < -2e46Initial program 95.3%
Taylor expanded in z around inf
lower--.f6478.4
Applied rewrites78.4%
if -2e46 < z < 3.30000000000000009e-21Initial program 99.0%
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.8
Applied rewrites90.8%
if 3.30000000000000009e-21 < z Initial program 92.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-+.f6486.3
Applied rewrites86.3%
Taylor expanded in t around 0
Applied rewrites80.1%
(FPCore (x y z t a) :precision binary64 (if (<= z -2e+46) (- x a) (if (<= z 1.75e-15) (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 <= -2e+46) {
tmp = x - a;
} else if (z <= 1.75e-15) {
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 <= -2e+46) tmp = Float64(x - a); elseif (z <= 1.75e-15) 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, -2e+46], N[(x - a), $MachinePrecision], If[LessEqual[z, 1.75e-15], 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 \cdot 10^{+46}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 1.75 \cdot 10^{-15}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{-1 - t}, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -2e46 or 1.75e-15 < z Initial program 93.5%
Taylor expanded in z around inf
lower--.f6478.6
Applied rewrites78.6%
if -2e46 < z < 1.75e-15Initial program 99.0%
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.5
Applied rewrites89.5%
(FPCore (x y z t a) :precision binary64 (if (<= z -14.0) (- x a) (if (<= z 1.75e-15) (fma (fma (- 1.0 y) z (- y)) a x) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -14.0) {
tmp = x - a;
} else if (z <= 1.75e-15) {
tmp = fma(fma((1.0 - y), z, -y), a, x);
} else {
tmp = x - a;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -14.0) tmp = Float64(x - a); elseif (z <= 1.75e-15) tmp = fma(fma(Float64(1.0 - y), z, Float64(-y)), a, x); else tmp = Float64(x - a); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -14.0], N[(x - a), $MachinePrecision], If[LessEqual[z, 1.75e-15], N[(N[(N[(1.0 - y), $MachinePrecision] * z + (-y)), $MachinePrecision] * a + x), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -14:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 1.75 \cdot 10^{-15}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(1 - y, z, -y\right), a, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -14 or 1.75e-15 < z Initial program 93.9%
Taylor expanded in z around inf
lower--.f6476.8
Applied rewrites76.8%
if -14 < z < 1.75e-15Initial program 98.9%
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--.f6471.9
Applied rewrites71.9%
Taylor expanded in z around 0
Applied rewrites71.9%
(FPCore (x y z t a) :precision binary64 (fma (/ a (- (- z t) 1.0)) (- y z) x))
double code(double x, double y, double z, double t, double a) {
return fma((a / ((z - t) - 1.0)), (y - z), x);
}
function code(x, y, z, t, a) return fma(Float64(a / Float64(Float64(z - t) - 1.0)), Float64(y - z), x) end
code[x_, y_, z_, t_, a_] := N[(N[(a / N[(N[(z - t), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision] * N[(y - z), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{a}{\left(z - t\right) - 1}, y - z, x\right)
\end{array}
Initial program 96.1%
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 rewrites96.5%
Final simplification96.5%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.75e+46) (- x a) (if (<= z 1.75e-15) (fma (- y) a x) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.75e+46) {
tmp = x - a;
} else if (z <= 1.75e-15) {
tmp = fma(-y, a, x);
} else {
tmp = x - a;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.75e+46) tmp = Float64(x - a); elseif (z <= 1.75e-15) tmp = fma(Float64(-y), a, x); else tmp = Float64(x - a); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.75e+46], N[(x - a), $MachinePrecision], If[LessEqual[z, 1.75e-15], N[((-y) * a + x), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.75 \cdot 10^{+46}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 1.75 \cdot 10^{-15}:\\
\;\;\;\;\mathsf{fma}\left(-y, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -1.74999999999999992e46 or 1.75e-15 < z Initial program 93.5%
Taylor expanded in z around inf
lower--.f6478.6
Applied rewrites78.6%
if -1.74999999999999992e46 < z < 1.75e-15Initial program 99.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--.f6471.8
Applied rewrites71.8%
Taylor expanded in z around 0
Applied rewrites67.1%
(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.1%
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.1%
Taylor expanded in z around inf
lower--.f6461.8
Applied rewrites61.8%
Taylor expanded in a around inf
Applied rewrites17.3%
(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 2024249
(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))))