
(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 16 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 97.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.6e+18) (not (<= z 7.5e+97))) (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.6e+18) || !(z <= 7.5e+97)) {
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.6e+18) || !(z <= 7.5e+97)) 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.6e+18], N[Not[LessEqual[z, 7.5e+97]], $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.6 \cdot 10^{+18} \lor \neg \left(z \leq 7.5 \cdot 10^{+97}\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.6e18 or 7.5000000000000004e97 < z Initial program 95.5%
Taylor expanded in y around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
metadata-evalN/A
*-lft-identityN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f6490.6
Applied rewrites90.6%
if -1.6e18 < z < 7.5000000000000004e97Initial program 99.8%
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 simplification93.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (+ 1.0 t) z)))
(if (or (<= z -2e+14) (not (<= z 3.2e+98)))
(fma (/ z t_1) a x)
(- x (* (/ y t_1) a)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (1.0 + t) - z;
double tmp;
if ((z <= -2e+14) || !(z <= 3.2e+98)) {
tmp = fma((z / t_1), a, x);
} else {
tmp = x - ((y / t_1) * a);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(1.0 + t) - z) tmp = 0.0 if ((z <= -2e+14) || !(z <= 3.2e+98)) tmp = fma(Float64(z / t_1), a, x); else tmp = Float64(x - Float64(Float64(y / t_1) * a)); 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[z, -2e+14], N[Not[LessEqual[z, 3.2e+98]], $MachinePrecision]], N[(N[(z / t$95$1), $MachinePrecision] * a + x), $MachinePrecision], N[(x - N[(N[(y / t$95$1), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(1 + t\right) - z\\
\mathbf{if}\;z \leq -2 \cdot 10^{+14} \lor \neg \left(z \leq 3.2 \cdot 10^{+98}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{t\_1}, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y}{t\_1} \cdot a\\
\end{array}
\end{array}
if z < -2e14 or 3.2000000000000002e98 < z Initial program 95.6%
Taylor expanded in y around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
metadata-evalN/A
*-lft-identityN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f6491.6
Applied rewrites91.6%
if -2e14 < z < 3.2000000000000002e98Initial program 99.8%
Taylor expanded in y around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f6490.7
Applied rewrites90.7%
Final simplification91.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- y z) t)))
(if (<= t -5.6e+73)
(- x (* a t_1))
(if (<= t 1.95e+124)
(- x (* (- y z) (/ a (- 1.0 z))))
(fma (- a) t_1 x)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y - z) / t;
double tmp;
if (t <= -5.6e+73) {
tmp = x - (a * t_1);
} else if (t <= 1.95e+124) {
tmp = x - ((y - z) * (a / (1.0 - z)));
} else {
tmp = fma(-a, t_1, x);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(y - z) / t) tmp = 0.0 if (t <= -5.6e+73) tmp = Float64(x - Float64(a * t_1)); elseif (t <= 1.95e+124) tmp = Float64(x - Float64(Float64(y - z) * Float64(a / Float64(1.0 - z)))); else tmp = fma(Float64(-a), t_1, x); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y - z), $MachinePrecision] / t), $MachinePrecision]}, If[LessEqual[t, -5.6e+73], N[(x - N[(a * t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.95e+124], N[(x - N[(N[(y - z), $MachinePrecision] * N[(a / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-a) * t$95$1 + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y - z}{t}\\
\mathbf{if}\;t \leq -5.6 \cdot 10^{+73}:\\
\;\;\;\;x - a \cdot t\_1\\
\mathbf{elif}\;t \leq 1.95 \cdot 10^{+124}:\\
\;\;\;\;x - \left(y - z\right) \cdot \frac{a}{1 - z}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-a, t\_1, x\right)\\
\end{array}
\end{array}
if t < -5.60000000000000016e73Initial program 99.9%
Taylor expanded in t around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6479.1
Applied rewrites79.1%
Applied rewrites89.7%
if -5.60000000000000016e73 < t < 1.95e124Initial program 96.7%
Taylor expanded in t around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6490.8
Applied rewrites90.8%
if 1.95e124 < t Initial program 99.7%
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6476.3
lift-+.f64N/A
+-commutativeN/A
lower-+.f6476.3
Applied rewrites76.3%
Taylor expanded in t around inf
associate-*r/N/A
+-commutativeN/A
associate-*r/N/A
mul-1-negN/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--.f6488.7
Applied rewrites88.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.32e+14) (not (<= z 1.1e+81))) (fma (/ z (- (+ 1.0 t) z)) a x) (- x (* (/ y (+ 1.0 t)) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.32e+14) || !(z <= 1.1e+81)) {
tmp = fma((z / ((1.0 + t) - z)), a, x);
} else {
tmp = x - ((y / (1.0 + t)) * a);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.32e+14) || !(z <= 1.1e+81)) tmp = fma(Float64(z / Float64(Float64(1.0 + t) - z)), a, x); else tmp = Float64(x - Float64(Float64(y / Float64(1.0 + t)) * a)); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.32e+14], N[Not[LessEqual[z, 1.1e+81]], $MachinePrecision]], N[(N[(z / N[(N[(1.0 + t), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision], N[(x - N[(N[(y / N[(1.0 + t), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.32 \cdot 10^{+14} \lor \neg \left(z \leq 1.1 \cdot 10^{+81}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{\left(1 + t\right) - z}, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y}{1 + t} \cdot a\\
\end{array}
\end{array}
if z < -1.32e14 or 1.09999999999999993e81 < z Initial program 95.8%
Taylor expanded in y around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
metadata-evalN/A
*-lft-identityN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f6488.8
Applied rewrites88.8%
if -1.32e14 < z < 1.09999999999999993e81Initial program 99.8%
Taylor expanded in z around 0
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6490.1
Applied rewrites90.1%
Final simplification89.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.32e+14) (not (<= z 1.1e+81))) (fma (/ a (- (+ t 1.0) z)) z x) (- x (* (/ y (+ 1.0 t)) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.32e+14) || !(z <= 1.1e+81)) {
tmp = fma((a / ((t + 1.0) - z)), z, x);
} else {
tmp = x - ((y / (1.0 + t)) * a);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.32e+14) || !(z <= 1.1e+81)) tmp = fma(Float64(a / Float64(Float64(t + 1.0) - z)), z, x); else tmp = Float64(x - Float64(Float64(y / Float64(1.0 + t)) * a)); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.32e+14], N[Not[LessEqual[z, 1.1e+81]], $MachinePrecision]], N[(N[(a / N[(N[(t + 1.0), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] * z + x), $MachinePrecision], N[(x - N[(N[(y / N[(1.0 + t), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.32 \cdot 10^{+14} \lor \neg \left(z \leq 1.1 \cdot 10^{+81}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{a}{\left(t + 1\right) - z}, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y}{1 + t} \cdot a\\
\end{array}
\end{array}
if z < -1.32e14 or 1.09999999999999993e81 < z Initial program 95.8%
Taylor expanded in y around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
metadata-evalN/A
*-lft-identityN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f6488.8
Applied rewrites88.8%
Applied rewrites86.4%
if -1.32e14 < z < 1.09999999999999993e81Initial program 99.8%
Taylor expanded in z around 0
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6490.1
Applied rewrites90.1%
Final simplification88.4%
(FPCore (x y z t a)
:precision binary64
(if (<= z -2.75e+18)
(- x a)
(if (<= z -1.28e-34)
(fma (/ a t) z x)
(if (<= z 1.12e-26) (- x (* (- y z) (fma a z a))) (- x a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.75e+18) {
tmp = x - a;
} else if (z <= -1.28e-34) {
tmp = fma((a / t), z, x);
} else if (z <= 1.12e-26) {
tmp = x - ((y - z) * fma(a, z, a));
} else {
tmp = x - a;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.75e+18) tmp = Float64(x - a); elseif (z <= -1.28e-34) tmp = fma(Float64(a / t), z, x); elseif (z <= 1.12e-26) tmp = Float64(x - Float64(Float64(y - z) * fma(a, z, a))); else tmp = Float64(x - a); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.75e+18], N[(x - a), $MachinePrecision], If[LessEqual[z, -1.28e-34], N[(N[(a / t), $MachinePrecision] * z + x), $MachinePrecision], If[LessEqual[z, 1.12e-26], N[(x - N[(N[(y - z), $MachinePrecision] * N[(a * z + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.75 \cdot 10^{+18}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq -1.28 \cdot 10^{-34}:\\
\;\;\;\;\mathsf{fma}\left(\frac{a}{t}, z, x\right)\\
\mathbf{elif}\;z \leq 1.12 \cdot 10^{-26}:\\
\;\;\;\;x - \left(y - z\right) \cdot \mathsf{fma}\left(a, z, a\right)\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -2.75e18 or 1.12e-26 < z Initial program 96.3%
Taylor expanded in z around inf
lower--.f6475.2
Applied rewrites75.2%
if -2.75e18 < z < -1.2799999999999999e-34Initial program 99.7%
Taylor expanded in y around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
metadata-evalN/A
*-lft-identityN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f6491.1
Applied rewrites91.1%
Applied rewrites91.1%
Taylor expanded in t around inf
Applied rewrites91.1%
if -1.2799999999999999e-34 < z < 1.12e-26Initial program 99.7%
Taylor expanded in t around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6468.4
Applied rewrites68.4%
Taylor expanded in z around 0
Applied rewrites68.4%
Final simplification73.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -5e+17) (not (<= z 1.7e+81))) (- x a) (- x (* (/ y (+ 1.0 t)) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -5e+17) || !(z <= 1.7e+81)) {
tmp = x - a;
} else {
tmp = x - ((y / (1.0 + t)) * a);
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((z <= (-5d+17)) .or. (.not. (z <= 1.7d+81))) then
tmp = x - a
else
tmp = x - ((y / (1.0d0 + t)) * a)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -5e+17) || !(z <= 1.7e+81)) {
tmp = x - a;
} else {
tmp = x - ((y / (1.0 + t)) * a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -5e+17) or not (z <= 1.7e+81): tmp = x - a else: tmp = x - ((y / (1.0 + t)) * a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -5e+17) || !(z <= 1.7e+81)) tmp = Float64(x - a); else tmp = Float64(x - Float64(Float64(y / Float64(1.0 + t)) * a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -5e+17) || ~((z <= 1.7e+81))) tmp = x - a; else tmp = x - ((y / (1.0 + t)) * a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -5e+17], N[Not[LessEqual[z, 1.7e+81]], $MachinePrecision]], N[(x - a), $MachinePrecision], N[(x - N[(N[(y / N[(1.0 + t), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5 \cdot 10^{+17} \lor \neg \left(z \leq 1.7 \cdot 10^{+81}\right):\\
\;\;\;\;x - a\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y}{1 + t} \cdot a\\
\end{array}
\end{array}
if z < -5e17 or 1.70000000000000001e81 < z Initial program 95.7%
Taylor expanded in z around inf
lower--.f6477.7
Applied rewrites77.7%
if -5e17 < z < 1.70000000000000001e81Initial program 99.8%
Taylor expanded in z around 0
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6488.9
Applied rewrites88.9%
Final simplification83.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -4.8e+73) (not (<= t 3e+18))) (fma (- a) (/ (- y z) t) x) (- x (* a (/ y (- 1.0 z))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -4.8e+73) || !(t <= 3e+18)) {
tmp = fma(-a, ((y - z) / t), x);
} else {
tmp = x - (a * (y / (1.0 - z)));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -4.8e+73) || !(t <= 3e+18)) tmp = fma(Float64(-a), Float64(Float64(y - z) / t), x); else tmp = Float64(x - Float64(a * Float64(y / Float64(1.0 - z)))); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -4.8e+73], N[Not[LessEqual[t, 3e+18]], $MachinePrecision]], N[((-a) * N[(N[(y - z), $MachinePrecision] / t), $MachinePrecision] + x), $MachinePrecision], N[(x - N[(a * N[(y / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.8 \cdot 10^{+73} \lor \neg \left(t \leq 3 \cdot 10^{+18}\right):\\
\;\;\;\;\mathsf{fma}\left(-a, \frac{y - z}{t}, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - a \cdot \frac{y}{1 - z}\\
\end{array}
\end{array}
if t < -4.80000000000000004e73 or 3e18 < t Initial program 99.8%
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6478.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6478.8
Applied rewrites78.8%
Taylor expanded in t around inf
associate-*r/N/A
+-commutativeN/A
associate-*r/N/A
mul-1-negN/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--.f6482.7
Applied rewrites82.7%
if -4.80000000000000004e73 < t < 3e18Initial program 96.2%
Taylor expanded in t around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6493.3
Applied rewrites93.3%
Taylor expanded in y around inf
Applied rewrites73.5%
Final simplification78.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -6.2e+43) (not (<= t 6.5e+18))) (fma (- a) (/ (- y z) t) x) (fma (/ z (- 1.0 z)) a x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -6.2e+43) || !(t <= 6.5e+18)) {
tmp = fma(-a, ((y - z) / t), x);
} else {
tmp = fma((z / (1.0 - z)), a, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -6.2e+43) || !(t <= 6.5e+18)) tmp = fma(Float64(-a), Float64(Float64(y - z) / t), x); else tmp = fma(Float64(z / Float64(1.0 - z)), a, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -6.2e+43], N[Not[LessEqual[t, 6.5e+18]], $MachinePrecision]], N[((-a) * N[(N[(y - z), $MachinePrecision] / t), $MachinePrecision] + x), $MachinePrecision], N[(N[(z / N[(1.0 - z), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -6.2 \cdot 10^{+43} \lor \neg \left(t \leq 6.5 \cdot 10^{+18}\right):\\
\;\;\;\;\mathsf{fma}\left(-a, \frac{y - z}{t}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{1 - z}, a, x\right)\\
\end{array}
\end{array}
if t < -6.2000000000000003e43 or 6.5e18 < t Initial program 99.1%
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6479.0
lift-+.f64N/A
+-commutativeN/A
lower-+.f6479.0
Applied rewrites79.0%
Taylor expanded in t around inf
associate-*r/N/A
+-commutativeN/A
associate-*r/N/A
mul-1-negN/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--.f6481.3
Applied rewrites81.3%
if -6.2000000000000003e43 < t < 6.5e18Initial program 96.8%
Taylor expanded in y around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
metadata-evalN/A
*-lft-identityN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f6472.0
Applied rewrites72.0%
Taylor expanded in t around 0
Applied rewrites72.0%
Final simplification76.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- y z) t)))
(if (<= t -4.8e+73)
(- x (* a t_1))
(if (<= t 3e+18) (- x (* a (/ y (- 1.0 z)))) (fma (- a) t_1 x)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y - z) / t;
double tmp;
if (t <= -4.8e+73) {
tmp = x - (a * t_1);
} else if (t <= 3e+18) {
tmp = x - (a * (y / (1.0 - z)));
} else {
tmp = fma(-a, t_1, x);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(y - z) / t) tmp = 0.0 if (t <= -4.8e+73) tmp = Float64(x - Float64(a * t_1)); elseif (t <= 3e+18) tmp = Float64(x - Float64(a * Float64(y / Float64(1.0 - z)))); else tmp = fma(Float64(-a), t_1, x); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y - z), $MachinePrecision] / t), $MachinePrecision]}, If[LessEqual[t, -4.8e+73], N[(x - N[(a * t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 3e+18], N[(x - N[(a * N[(y / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-a) * t$95$1 + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y - z}{t}\\
\mathbf{if}\;t \leq -4.8 \cdot 10^{+73}:\\
\;\;\;\;x - a \cdot t\_1\\
\mathbf{elif}\;t \leq 3 \cdot 10^{+18}:\\
\;\;\;\;x - a \cdot \frac{y}{1 - z}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-a, t\_1, x\right)\\
\end{array}
\end{array}
if t < -4.80000000000000004e73Initial program 99.9%
Taylor expanded in t around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6479.1
Applied rewrites79.1%
Applied rewrites89.7%
if -4.80000000000000004e73 < t < 3e18Initial program 96.2%
Taylor expanded in t around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6493.3
Applied rewrites93.3%
Taylor expanded in y around inf
Applied rewrites73.5%
if 3e18 < t Initial program 99.8%
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6475.6
lift-+.f64N/A
+-commutativeN/A
lower-+.f6475.6
Applied rewrites75.6%
Taylor expanded in t around inf
associate-*r/N/A
+-commutativeN/A
associate-*r/N/A
mul-1-negN/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--.f6477.2
Applied rewrites77.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -2.75e+18) (not (<= z 2.3e-25))) (- x a) (fma (/ a t) z x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2.75e+18) || !(z <= 2.3e-25)) {
tmp = x - a;
} else {
tmp = fma((a / t), z, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -2.75e+18) || !(z <= 2.3e-25)) tmp = Float64(x - a); else tmp = fma(Float64(a / t), z, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -2.75e+18], N[Not[LessEqual[z, 2.3e-25]], $MachinePrecision]], N[(x - a), $MachinePrecision], N[(N[(a / t), $MachinePrecision] * z + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.75 \cdot 10^{+18} \lor \neg \left(z \leq 2.3 \cdot 10^{-25}\right):\\
\;\;\;\;x - a\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{a}{t}, z, x\right)\\
\end{array}
\end{array}
if z < -2.75e18 or 2.2999999999999999e-25 < z Initial program 96.3%
Taylor expanded in z around inf
lower--.f6475.8
Applied rewrites75.8%
if -2.75e18 < z < 2.2999999999999999e-25Initial program 99.7%
Taylor expanded in y around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
metadata-evalN/A
*-lft-identityN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f6461.3
Applied rewrites61.3%
Applied rewrites62.2%
Taylor expanded in t around inf
Applied rewrites58.4%
Final simplification67.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -2.7e-41) (not (<= z 2.05e-25))) (- x a) (- x (* (fma (- y) t y) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2.7e-41) || !(z <= 2.05e-25)) {
tmp = x - a;
} else {
tmp = x - (fma(-y, t, y) * a);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -2.7e-41) || !(z <= 2.05e-25)) tmp = Float64(x - a); else tmp = Float64(x - Float64(fma(Float64(-y), t, y) * a)); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -2.7e-41], N[Not[LessEqual[z, 2.05e-25]], $MachinePrecision]], N[(x - a), $MachinePrecision], N[(x - N[(N[((-y) * t + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.7 \cdot 10^{-41} \lor \neg \left(z \leq 2.05 \cdot 10^{-25}\right):\\
\;\;\;\;x - a\\
\mathbf{else}:\\
\;\;\;\;x - \mathsf{fma}\left(-y, t, y\right) \cdot a\\
\end{array}
\end{array}
if z < -2.7e-41 or 2.04999999999999994e-25 < z Initial program 96.6%
Taylor expanded in z around inf
lower--.f6472.8
Applied rewrites72.8%
if -2.7e-41 < z < 2.04999999999999994e-25Initial program 99.7%
Taylor expanded in z around 0
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6490.2
Applied rewrites90.2%
Taylor expanded in t around 0
Applied rewrites55.2%
Final simplification65.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -5.6e+14) (not (<= z 6.2e-54))) (- x a) (* 1.0 x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -5.6e+14) || !(z <= 6.2e-54)) {
tmp = x - a;
} else {
tmp = 1.0 * x;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((z <= (-5.6d+14)) .or. (.not. (z <= 6.2d-54))) then
tmp = x - a
else
tmp = 1.0d0 * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -5.6e+14) || !(z <= 6.2e-54)) {
tmp = x - a;
} else {
tmp = 1.0 * x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -5.6e+14) or not (z <= 6.2e-54): tmp = x - a else: tmp = 1.0 * x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -5.6e+14) || !(z <= 6.2e-54)) tmp = Float64(x - a); else tmp = Float64(1.0 * x); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -5.6e+14) || ~((z <= 6.2e-54))) tmp = x - a; else tmp = 1.0 * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -5.6e+14], N[Not[LessEqual[z, 6.2e-54]], $MachinePrecision]], N[(x - a), $MachinePrecision], N[(1.0 * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.6 \cdot 10^{+14} \lor \neg \left(z \leq 6.2 \cdot 10^{-54}\right):\\
\;\;\;\;x - a\\
\mathbf{else}:\\
\;\;\;\;1 \cdot x\\
\end{array}
\end{array}
if z < -5.6e14 or 6.20000000000000008e-54 < z Initial program 96.4%
Taylor expanded in z around inf
lower--.f6473.7
Applied rewrites73.7%
if -5.6e14 < z < 6.20000000000000008e-54Initial program 99.8%
Taylor expanded in z around inf
lower--.f6440.2
Applied rewrites40.2%
Taylor expanded in x around inf
Applied rewrites40.9%
Taylor expanded in x around inf
Applied rewrites53.4%
Final simplification64.3%
(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 97.9%
Taylor expanded in z around inf
lower--.f6458.3
Applied rewrites58.3%
Final simplification58.3%
(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 97.9%
Taylor expanded in z around inf
lower--.f6458.3
Applied rewrites58.3%
Taylor expanded in x around 0
Applied rewrites17.8%
Final simplification17.8%
(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 2024320
(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))))