
(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 11 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 96.5%
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%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (* (- y) a)) (t_2 (/ (- z y) (/ (- -1.0 (- t z)) a)))) (if (<= t_2 -2e+307) t_1 (if (<= t_2 5e+302) (- x a) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = -y * a;
double t_2 = (z - y) / ((-1.0 - (t - z)) / a);
double tmp;
if (t_2 <= -2e+307) {
tmp = t_1;
} else if (t_2 <= 5e+302) {
tmp = x - a;
} else {
tmp = t_1;
}
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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = -y * a
t_2 = (z - y) / (((-1.0d0) - (t - z)) / a)
if (t_2 <= (-2d+307)) then
tmp = t_1
else if (t_2 <= 5d+302) then
tmp = x - a
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = -y * a;
double t_2 = (z - y) / ((-1.0 - (t - z)) / a);
double tmp;
if (t_2 <= -2e+307) {
tmp = t_1;
} else if (t_2 <= 5e+302) {
tmp = x - a;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = -y * a t_2 = (z - y) / ((-1.0 - (t - z)) / a) tmp = 0 if t_2 <= -2e+307: tmp = t_1 elif t_2 <= 5e+302: 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(Float64(z - y) / Float64(Float64(-1.0 - Float64(t - z)) / a)) tmp = 0.0 if (t_2 <= -2e+307) tmp = t_1; elseif (t_2 <= 5e+302) 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 = (z - y) / ((-1.0 - (t - z)) / a); tmp = 0.0; if (t_2 <= -2e+307) tmp = t_1; elseif (t_2 <= 5e+302) 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[(N[(z - y), $MachinePrecision] / N[(N[(-1.0 - N[(t - z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -2e+307], t$95$1, If[LessEqual[t$95$2, 5e+302], N[(x - a), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(-y\right) \cdot a\\
t_2 := \frac{z - y}{\frac{-1 - \left(t - z\right)}{a}}\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+307}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+302}:\\
\;\;\;\;x - a\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 (-.f64 y z) (/.f64 (+.f64 (-.f64 t z) #s(literal 1 binary64)) a)) < -1.99999999999999997e307 or 5e302 < (/.f64 (-.f64 y z) (/.f64 (+.f64 (-.f64 t z) #s(literal 1 binary64)) a)) Initial program 99.9%
Taylor expanded in y around inf
mul-1-negN/A
*-commutativeN/A
associate-*r/N/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f6497.4
Applied rewrites97.4%
Taylor expanded in z around 0
Applied rewrites80.2%
Taylor expanded in t around 0
Applied rewrites67.4%
if -1.99999999999999997e307 < (/.f64 (-.f64 y z) (/.f64 (+.f64 (-.f64 t z) #s(literal 1 binary64)) a)) < 5e302Initial program 96.3%
Taylor expanded in z around inf
lower--.f6465.9
Applied rewrites65.9%
Final simplification66.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma a (fma (- 1.0 y) z (- y)) x)))
(if (<= z -0.92)
(- x a)
(if (<= z -6e-102)
t_1
(if (<= z 1.4e-254)
(fma (/ y t) (- a) x)
(if (<= z 33000000.0) t_1 (- x a)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(a, fma((1.0 - y), z, -y), x);
double tmp;
if (z <= -0.92) {
tmp = x - a;
} else if (z <= -6e-102) {
tmp = t_1;
} else if (z <= 1.4e-254) {
tmp = fma((y / t), -a, x);
} else if (z <= 33000000.0) {
tmp = t_1;
} else {
tmp = x - a;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(a, fma(Float64(1.0 - y), z, Float64(-y)), x) tmp = 0.0 if (z <= -0.92) tmp = Float64(x - a); elseif (z <= -6e-102) tmp = t_1; elseif (z <= 1.4e-254) tmp = fma(Float64(y / t), Float64(-a), x); elseif (z <= 33000000.0) 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[(N[(1.0 - y), $MachinePrecision] * z + (-y)), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[z, -0.92], N[(x - a), $MachinePrecision], If[LessEqual[z, -6e-102], t$95$1, If[LessEqual[z, 1.4e-254], N[(N[(y / t), $MachinePrecision] * (-a) + x), $MachinePrecision], If[LessEqual[z, 33000000.0], t$95$1, N[(x - a), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(a, \mathsf{fma}\left(1 - y, z, -y\right), x\right)\\
\mathbf{if}\;z \leq -0.92:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq -6 \cdot 10^{-102}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.4 \cdot 10^{-254}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{t}, -a, x\right)\\
\mathbf{elif}\;z \leq 33000000:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -0.92000000000000004 or 3.3e7 < z Initial program 94.4%
Taylor expanded in z around inf
lower--.f6480.6
Applied rewrites80.6%
if -0.92000000000000004 < z < -6e-102 or 1.39999999999999992e-254 < z < 3.3e7Initial program 96.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 rewrites97.1%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6477.9
Applied rewrites77.9%
Taylor expanded in z around 0
Applied rewrites77.2%
if -6e-102 < z < 1.39999999999999992e-254Initial 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.f6484.5
Applied rewrites84.5%
Taylor expanded in z around 0
Applied rewrites83.0%
(FPCore (x y z t a)
:precision binary64
(if (<= t -2.85e+65)
(fma (/ (- y z) t) (- a) x)
(if (<= t 1e+73)
(fma a (/ (- y z) (- z 1.0)) x)
(fma (/ a (- t)) (- y z) x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -2.85e+65) {
tmp = fma(((y - z) / t), -a, x);
} else if (t <= 1e+73) {
tmp = fma(a, ((y - z) / (z - 1.0)), x);
} else {
tmp = fma((a / -t), (y - z), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -2.85e+65) tmp = fma(Float64(Float64(y - z) / t), Float64(-a), x); elseif (t <= 1e+73) tmp = fma(a, Float64(Float64(y - z) / Float64(z - 1.0)), x); else tmp = fma(Float64(a / Float64(-t)), Float64(y - z), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -2.85e+65], N[(N[(N[(y - z), $MachinePrecision] / t), $MachinePrecision] * (-a) + x), $MachinePrecision], If[LessEqual[t, 1e+73], N[(a * N[(N[(y - z), $MachinePrecision] / N[(z - 1.0), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(N[(a / (-t)), $MachinePrecision] * N[(y - z), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.85 \cdot 10^{+65}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y - z}{t}, -a, x\right)\\
\mathbf{elif}\;t \leq 10^{+73}:\\
\;\;\;\;\mathsf{fma}\left(a, \frac{y - z}{z - 1}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{a}{-t}, y - z, x\right)\\
\end{array}
\end{array}
if t < -2.85e65Initial program 90.5%
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.f6490.2
Applied rewrites90.2%
if -2.85e65 < t < 9.99999999999999983e72Initial program 98.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 rewrites98.2%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6496.8
Applied rewrites96.8%
if 9.99999999999999983e72 < t 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 rewrites97.6%
Taylor expanded in t around inf
mul-1-negN/A
lower-neg.f6489.0
Applied rewrites89.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ a z) (- y z) x)))
(if (<= z -11.5)
t_1
(if (<= z 112000000.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 <= -11.5) {
tmp = t_1;
} else if (z <= 112000000.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 <= -11.5) tmp = t_1; elseif (z <= 112000000.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, -11.5], t$95$1, If[LessEqual[z, 112000000.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 -11.5:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 112000000:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{-1 - t}, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -11.5 or 1.12e8 < z Initial program 94.4%
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 rewrites94.3%
Taylor expanded in z around inf
lower-/.f6484.6
Applied rewrites84.6%
if -11.5 < z < 1.12e8Initial program 98.3%
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.3
Applied rewrites91.3%
(FPCore (x y z t a) :precision binary64 (if (<= z -11.5) (fma (/ z (- 1.0 z)) a x) (if (<= z 2.45e+82) (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 <= -11.5) {
tmp = fma((z / (1.0 - z)), a, x);
} else if (z <= 2.45e+82) {
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 <= -11.5) tmp = fma(Float64(z / Float64(1.0 - z)), a, x); elseif (z <= 2.45e+82) 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, -11.5], N[(N[(z / N[(1.0 - z), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision], If[LessEqual[z, 2.45e+82], 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 -11.5:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{1 - z}, a, x\right)\\
\mathbf{elif}\;z \leq 2.45 \cdot 10^{+82}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{-1 - t}, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -11.5Initial program 94.0%
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%
Taylor expanded in t around 0
Applied rewrites85.6%
if -11.5 < z < 2.45e82Initial program 97.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--.f6487.8
Applied rewrites87.8%
if 2.45e82 < z Initial program 95.3%
Taylor expanded in z around inf
lower--.f6484.6
Applied rewrites84.6%
(FPCore (x y z t a) :precision binary64 (if (<= z -7.8e+83) (- x a) (if (<= z 2.45e+82) (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 <= -7.8e+83) {
tmp = x - a;
} else if (z <= 2.45e+82) {
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 <= -7.8e+83) tmp = Float64(x - a); elseif (z <= 2.45e+82) 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, -7.8e+83], N[(x - a), $MachinePrecision], If[LessEqual[z, 2.45e+82], 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 -7.8 \cdot 10^{+83}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 2.45 \cdot 10^{+82}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{-1 - t}, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -7.8000000000000003e83 or 2.45e82 < z Initial program 93.7%
Taylor expanded in z around inf
lower--.f6486.2
Applied rewrites86.2%
if -7.8000000000000003e83 < z < 2.45e82Initial program 98.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--.f6486.9
Applied rewrites86.9%
(FPCore (x y z t a) :precision binary64 (if (<= z -0.92) (- x a) (if (<= z 33000000.0) (fma a (fma (- 1.0 y) z (- y)) x) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -0.92) {
tmp = x - a;
} else if (z <= 33000000.0) {
tmp = fma(a, fma((1.0 - y), z, -y), x);
} else {
tmp = x - a;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -0.92) tmp = Float64(x - a); elseif (z <= 33000000.0) tmp = fma(a, fma(Float64(1.0 - y), z, Float64(-y)), x); else tmp = Float64(x - a); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -0.92], N[(x - a), $MachinePrecision], If[LessEqual[z, 33000000.0], N[(a * N[(N[(1.0 - y), $MachinePrecision] * z + (-y)), $MachinePrecision] + x), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.92:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 33000000:\\
\;\;\;\;\mathsf{fma}\left(a, \mathsf{fma}\left(1 - y, z, -y\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -0.92000000000000004 or 3.3e7 < z Initial program 94.4%
Taylor expanded in z around inf
lower--.f6480.6
Applied rewrites80.6%
if -0.92000000000000004 < z < 3.3e7Initial program 98.3%
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.4%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6470.8
Applied rewrites70.8%
Taylor expanded in z around 0
Applied rewrites70.4%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.55) (- x a) (if (<= z 34000000.0) (fma a (- y) x) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.55) {
tmp = x - a;
} else if (z <= 34000000.0) {
tmp = fma(a, -y, x);
} else {
tmp = x - a;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.55) tmp = Float64(x - a); elseif (z <= 34000000.0) tmp = fma(a, Float64(-y), x); else tmp = Float64(x - a); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.55], N[(x - a), $MachinePrecision], If[LessEqual[z, 34000000.0], N[(a * (-y) + x), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.55:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 34000000:\\
\;\;\;\;\mathsf{fma}\left(a, -y, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -1.55000000000000004 or 3.4e7 < z Initial program 94.4%
Taylor expanded in z around inf
lower--.f6480.6
Applied rewrites80.6%
if -1.55000000000000004 < z < 3.4e7Initial program 98.3%
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.4%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6470.8
Applied rewrites70.8%
Taylor expanded in z around 0
Applied rewrites68.2%
(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.5%
Taylor expanded in z around inf
lower--.f6461.5
Applied rewrites61.5%
(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.5%
Taylor expanded in z around inf
lower--.f6461.5
Applied rewrites61.5%
Taylor expanded in a around inf
Applied rewrites17.9%
(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 2024244
(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))))