
(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.9%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (/ (- y z) (/ (+ (- t z) 1.0) a)))) (if (or (<= t_1 -1e+267) (not (<= t_1 1e+306))) (* a (- y)) (- x a))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y - z) / (((t - z) + 1.0) / a);
double tmp;
if ((t_1 <= -1e+267) || !(t_1 <= 1e+306)) {
tmp = a * -y;
} 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) :: t_1
real(8) :: tmp
t_1 = (y - z) / (((t - z) + 1.0d0) / a)
if ((t_1 <= (-1d+267)) .or. (.not. (t_1 <= 1d+306))) then
tmp = a * -y
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 t_1 = (y - z) / (((t - z) + 1.0) / a);
double tmp;
if ((t_1 <= -1e+267) || !(t_1 <= 1e+306)) {
tmp = a * -y;
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y - z) / (((t - z) + 1.0) / a) tmp = 0 if (t_1 <= -1e+267) or not (t_1 <= 1e+306): tmp = a * -y else: tmp = x - a return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y - z) / Float64(Float64(Float64(t - z) + 1.0) / a)) tmp = 0.0 if ((t_1 <= -1e+267) || !(t_1 <= 1e+306)) tmp = Float64(a * Float64(-y)); else tmp = Float64(x - a); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y - z) / (((t - z) + 1.0) / a); tmp = 0.0; if ((t_1 <= -1e+267) || ~((t_1 <= 1e+306))) tmp = a * -y; else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y - z), $MachinePrecision] / N[(N[(N[(t - z), $MachinePrecision] + 1.0), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -1e+267], N[Not[LessEqual[t$95$1, 1e+306]], $MachinePrecision]], N[(a * (-y)), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y - z}{\frac{\left(t - z\right) + 1}{a}}\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+267} \lor \neg \left(t\_1 \leq 10^{+306}\right):\\
\;\;\;\;a \cdot \left(-y\right)\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if (/.f64 (-.f64 y z) (/.f64 (+.f64 (-.f64 t z) #s(literal 1 binary64)) a)) < -9.9999999999999997e266 or 1.00000000000000002e306 < (/.f64 (-.f64 y z) (/.f64 (+.f64 (-.f64 t z) #s(literal 1 binary64)) a)) Initial program 100.0%
Taylor expanded in z around 0
sub-negN/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
lower-+.f64100.0
Applied rewrites100.0%
Taylor expanded in x around 0
Applied rewrites100.0%
Taylor expanded in t around 0
Applied rewrites76.5%
if -9.9999999999999997e266 < (/.f64 (-.f64 y z) (/.f64 (+.f64 (-.f64 t z) #s(literal 1 binary64)) a)) < 1.00000000000000002e306Initial program 96.7%
Taylor expanded in z around inf
lower--.f6461.2
Applied rewrites61.2%
Final simplification62.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.35e+182) (not (<= z 4.4e+192))) (fma (/ z (- (+ 1.0 t) z)) a x) (- x (/ (* (- y z) a) (+ 1.0 (- t z))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.35e+182) || !(z <= 4.4e+192)) {
tmp = fma((z / ((1.0 + t) - z)), a, x);
} else {
tmp = x - (((y - z) * a) / (1.0 + (t - z)));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.35e+182) || !(z <= 4.4e+192)) tmp = fma(Float64(z / Float64(Float64(1.0 + t) - z)), a, x); else tmp = Float64(x - Float64(Float64(Float64(y - z) * a) / Float64(1.0 + Float64(t - z)))); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.35e+182], N[Not[LessEqual[z, 4.4e+192]], $MachinePrecision]], N[(N[(z / N[(N[(1.0 + t), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision], N[(x - N[(N[(N[(y - z), $MachinePrecision] * a), $MachinePrecision] / N[(1.0 + N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.35 \cdot 10^{+182} \lor \neg \left(z \leq 4.4 \cdot 10^{+192}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{\left(1 + t\right) - z}, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - \frac{\left(y - z\right) \cdot a}{1 + \left(t - z\right)}\\
\end{array}
\end{array}
if z < -1.3500000000000001e182 or 4.4000000000000001e192 < z Initial program 94.5%
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
lower-+.f6496.3
Applied rewrites96.3%
if -1.3500000000000001e182 < z < 4.4000000000000001e192Initial program 97.6%
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6494.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6494.8
Applied rewrites94.8%
Final simplification95.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (+ 1.0 t) z)))
(if (or (<= y -1.4e+118) (not (<= y 2.05e-38)))
(- x (* (/ y t_1) a))
(fma (/ z t_1) a x))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (1.0 + t) - z;
double tmp;
if ((y <= -1.4e+118) || !(y <= 2.05e-38)) {
tmp = x - ((y / t_1) * a);
} else {
tmp = fma((z / t_1), a, x);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(1.0 + t) - z) tmp = 0.0 if ((y <= -1.4e+118) || !(y <= 2.05e-38)) tmp = Float64(x - Float64(Float64(y / t_1) * a)); else tmp = fma(Float64(z / t_1), a, x); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(1.0 + t), $MachinePrecision] - z), $MachinePrecision]}, If[Or[LessEqual[y, -1.4e+118], N[Not[LessEqual[y, 2.05e-38]], $MachinePrecision]], N[(x - N[(N[(y / t$95$1), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], N[(N[(z / t$95$1), $MachinePrecision] * a + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(1 + t\right) - z\\
\mathbf{if}\;y \leq -1.4 \cdot 10^{+118} \lor \neg \left(y \leq 2.05 \cdot 10^{-38}\right):\\
\;\;\;\;x - \frac{y}{t\_1} \cdot a\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{t\_1}, a, x\right)\\
\end{array}
\end{array}
if y < -1.39999999999999993e118 or 2.0499999999999999e-38 < y Initial program 95.2%
Taylor expanded in y around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f6493.3
Applied rewrites93.3%
if -1.39999999999999993e118 < y < 2.0499999999999999e-38Initial program 98.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
lower-+.f6493.9
Applied rewrites93.9%
Final simplification93.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1900000000.0) (not (<= z 5800000000000.0))) (fma (/ z (- (+ 1.0 t) z)) a x) (fma (- y) (/ a (+ 1.0 t)) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1900000000.0) || !(z <= 5800000000000.0)) {
tmp = fma((z / ((1.0 + t) - z)), a, x);
} else {
tmp = fma(-y, (a / (1.0 + t)), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1900000000.0) || !(z <= 5800000000000.0)) tmp = fma(Float64(z / Float64(Float64(1.0 + t) - z)), a, x); else tmp = fma(Float64(-y), Float64(a / Float64(1.0 + t)), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1900000000.0], N[Not[LessEqual[z, 5800000000000.0]], $MachinePrecision]], N[(N[(z / N[(N[(1.0 + t), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision], N[((-y) * N[(a / N[(1.0 + t), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1900000000 \lor \neg \left(z \leq 5800000000000\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{\left(1 + t\right) - z}, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-y, \frac{a}{1 + t}, x\right)\\
\end{array}
\end{array}
if z < -1.9e9 or 5.8e12 < z Initial program 93.6%
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
lower-+.f6491.1
Applied rewrites91.1%
if -1.9e9 < z < 5.8e12Initial program 99.8%
Taylor expanded in z around 0
sub-negN/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
lower-+.f6492.6
Applied rewrites92.6%
Final simplification91.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -2.4e+15) (not (<= z 3.8e+16))) (- x a) (fma (- y) (/ a (+ 1.0 t)) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2.4e+15) || !(z <= 3.8e+16)) {
tmp = x - a;
} else {
tmp = fma(-y, (a / (1.0 + t)), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -2.4e+15) || !(z <= 3.8e+16)) tmp = Float64(x - a); else tmp = fma(Float64(-y), Float64(a / Float64(1.0 + t)), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -2.4e+15], N[Not[LessEqual[z, 3.8e+16]], $MachinePrecision]], N[(x - a), $MachinePrecision], N[((-y) * N[(a / N[(1.0 + t), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.4 \cdot 10^{+15} \lor \neg \left(z \leq 3.8 \cdot 10^{+16}\right):\\
\;\;\;\;x - a\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-y, \frac{a}{1 + t}, x\right)\\
\end{array}
\end{array}
if z < -2.4e15 or 3.8e16 < z Initial program 93.6%
Taylor expanded in z around inf
lower--.f6478.6
Applied rewrites78.6%
if -2.4e15 < z < 3.8e16Initial program 99.8%
Taylor expanded in z around 0
sub-negN/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
lower-+.f6492.6
Applied rewrites92.6%
Final simplification86.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -0.00041) (not (<= t 5e-15))) (fma (- a) (/ (- y z) t) x) (fma y (fma a t (- a)) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -0.00041) || !(t <= 5e-15)) {
tmp = fma(-a, ((y - z) / t), x);
} else {
tmp = fma(y, fma(a, t, -a), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -0.00041) || !(t <= 5e-15)) tmp = fma(Float64(-a), Float64(Float64(y - z) / t), x); else tmp = fma(y, fma(a, t, Float64(-a)), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -0.00041], N[Not[LessEqual[t, 5e-15]], $MachinePrecision]], N[((-a) * N[(N[(y - z), $MachinePrecision] / t), $MachinePrecision] + x), $MachinePrecision], N[(y * N[(a * t + (-a)), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -0.00041 \lor \neg \left(t \leq 5 \cdot 10^{-15}\right):\\
\;\;\;\;\mathsf{fma}\left(-a, \frac{y - z}{t}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, \mathsf{fma}\left(a, t, -a\right), x\right)\\
\end{array}
\end{array}
if t < -4.0999999999999999e-4 or 4.99999999999999999e-15 < t Initial program 95.6%
Taylor expanded in t around inf
mul-1-negN/A
+-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
lower-/.f64N/A
lower--.f6488.1
Applied rewrites88.1%
if -4.0999999999999999e-4 < t < 4.99999999999999999e-15Initial program 98.3%
Taylor expanded in z around 0
sub-negN/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
lower-+.f6470.4
Applied rewrites70.4%
Taylor expanded in t around 0
Applied rewrites70.1%
Final simplification79.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -33500000000000.0) (not (<= z 3.6e+16))) (- x a) (fma (- y) (/ a t) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -33500000000000.0) || !(z <= 3.6e+16)) {
tmp = x - a;
} else {
tmp = fma(-y, (a / t), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -33500000000000.0) || !(z <= 3.6e+16)) tmp = Float64(x - a); else tmp = fma(Float64(-y), Float64(a / t), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -33500000000000.0], N[Not[LessEqual[z, 3.6e+16]], $MachinePrecision]], N[(x - a), $MachinePrecision], N[((-y) * N[(a / t), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -33500000000000 \lor \neg \left(z \leq 3.6 \cdot 10^{+16}\right):\\
\;\;\;\;x - a\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-y, \frac{a}{t}, x\right)\\
\end{array}
\end{array}
if z < -3.35e13 or 3.6e16 < z Initial program 93.6%
Taylor expanded in z around inf
lower--.f6478.6
Applied rewrites78.6%
if -3.35e13 < z < 3.6e16Initial program 99.8%
Taylor expanded in z around 0
sub-negN/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
lower-+.f6492.6
Applied rewrites92.6%
Taylor expanded in t around inf
Applied rewrites72.3%
Final simplification75.2%
(FPCore (x y z t a) :precision binary64 (if (<= t -0.00041) (fma (- y) (/ a t) x) (if (<= t 5e-15) (fma y (fma a t (- a)) x) (- x (* (/ y t) a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -0.00041) {
tmp = fma(-y, (a / t), x);
} else if (t <= 5e-15) {
tmp = fma(y, fma(a, t, -a), x);
} else {
tmp = x - ((y / t) * a);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -0.00041) tmp = fma(Float64(-y), Float64(a / t), x); elseif (t <= 5e-15) tmp = fma(y, fma(a, t, Float64(-a)), x); else tmp = Float64(x - Float64(Float64(y / t) * a)); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -0.00041], N[((-y) * N[(a / t), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t, 5e-15], N[(y * N[(a * t + (-a)), $MachinePrecision] + x), $MachinePrecision], N[(x - N[(N[(y / t), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -0.00041:\\
\;\;\;\;\mathsf{fma}\left(-y, \frac{a}{t}, x\right)\\
\mathbf{elif}\;t \leq 5 \cdot 10^{-15}:\\
\;\;\;\;\mathsf{fma}\left(y, \mathsf{fma}\left(a, t, -a\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y}{t} \cdot a\\
\end{array}
\end{array}
if t < -4.0999999999999999e-4Initial program 99.9%
Taylor expanded in z around 0
sub-negN/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
lower-+.f6478.4
Applied rewrites78.4%
Taylor expanded in t around inf
Applied rewrites78.1%
if -4.0999999999999999e-4 < t < 4.99999999999999999e-15Initial program 98.3%
Taylor expanded in z around 0
sub-negN/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
lower-+.f6470.4
Applied rewrites70.4%
Taylor expanded in t around 0
Applied rewrites70.1%
if 4.99999999999999999e-15 < t Initial program 91.5%
Taylor expanded in y around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f6484.4
Applied rewrites84.4%
Taylor expanded in t around inf
Applied rewrites84.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -140.0) (not (<= z 75.0))) (- x a) (fma (- y) a x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -140.0) || !(z <= 75.0)) {
tmp = x - a;
} else {
tmp = fma(-y, a, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -140.0) || !(z <= 75.0)) tmp = Float64(x - a); else tmp = fma(Float64(-y), a, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -140.0], N[Not[LessEqual[z, 75.0]], $MachinePrecision]], N[(x - a), $MachinePrecision], N[((-y) * a + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -140 \lor \neg \left(z \leq 75\right):\\
\;\;\;\;x - a\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-y, a, x\right)\\
\end{array}
\end{array}
if z < -140 or 75 < z Initial program 93.8%
Taylor expanded in z around inf
lower--.f6477.7
Applied rewrites77.7%
if -140 < z < 75Initial program 99.8%
Taylor expanded in z around 0
sub-negN/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
lower-+.f6492.4
Applied rewrites92.4%
Taylor expanded in t around 0
Applied rewrites67.2%
Final simplification72.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.9%
Taylor expanded in z around inf
lower--.f6457.4
Applied rewrites57.4%
(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.9%
Taylor expanded in z around inf
lower--.f6457.4
Applied rewrites57.4%
Taylor expanded in x around 0
Applied rewrites13.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 2024324
(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))))