
(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 15 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 (if (<= z -3.4e+202) (- x (fma a (/ (- (+ 1.0 t) y) z) a)) (- x (* (- y z) (/ a (+ 1.0 (- t z)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.4e+202) {
tmp = x - fma(a, (((1.0 + t) - y) / z), a);
} else {
tmp = x - ((y - z) * (a / (1.0 + (t - z))));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -3.4e+202) tmp = Float64(x - fma(a, Float64(Float64(Float64(1.0 + t) - y) / z), a)); else tmp = Float64(x - Float64(Float64(y - z) * Float64(a / Float64(1.0 + Float64(t - z))))); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -3.4e+202], N[(x - N[(a * N[(N[(N[(1.0 + t), $MachinePrecision] - y), $MachinePrecision] / z), $MachinePrecision] + a), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[(y - z), $MachinePrecision] * N[(a / N[(1.0 + N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.4 \cdot 10^{+202}:\\
\;\;\;\;x - \mathsf{fma}\left(a, \frac{\left(1 + t\right) - y}{z}, a\right)\\
\mathbf{else}:\\
\;\;\;\;x - \left(y - z\right) \cdot \frac{a}{1 + \left(t - z\right)}\\
\end{array}
\end{array}
if z < -3.4e202Initial program 84.3%
Taylor expanded in z around inf
associate--l+N/A
distribute-lft-out--N/A
div-subN/A
+-commutativeN/A
Applied rewrites97.4%
if -3.4e202 < z Initial program 98.2%
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
associate-*l/N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6498.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6498.9
Applied rewrites98.9%
(FPCore (x y z t a)
:precision binary64
(if (<= z -1.9e+182)
(- x a)
(if (<= z -1.16e-63)
(- x (* (/ (- y) z) a))
(if (<= z 1e-274)
(- x (* y (/ a t)))
(if (<= z 7.2e-177)
(- x (* (fma (- y) t y) a))
(if (<= z 6.6e+63) (- x (* (/ y t) a)) (- x a)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.9e+182) {
tmp = x - a;
} else if (z <= -1.16e-63) {
tmp = x - ((-y / z) * a);
} else if (z <= 1e-274) {
tmp = x - (y * (a / t));
} else if (z <= 7.2e-177) {
tmp = x - (fma(-y, t, y) * a);
} else if (z <= 6.6e+63) {
tmp = x - ((y / t) * a);
} else {
tmp = x - a;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.9e+182) tmp = Float64(x - a); elseif (z <= -1.16e-63) tmp = Float64(x - Float64(Float64(Float64(-y) / z) * a)); elseif (z <= 1e-274) tmp = Float64(x - Float64(y * Float64(a / t))); elseif (z <= 7.2e-177) tmp = Float64(x - Float64(fma(Float64(-y), t, y) * a)); elseif (z <= 6.6e+63) tmp = Float64(x - Float64(Float64(y / t) * a)); else tmp = Float64(x - a); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.9e+182], N[(x - a), $MachinePrecision], If[LessEqual[z, -1.16e-63], N[(x - N[(N[((-y) / z), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1e-274], N[(x - N[(y * N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7.2e-177], N[(x - N[(N[((-y) * t + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6.6e+63], N[(x - N[(N[(y / t), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], N[(x - a), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.9 \cdot 10^{+182}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq -1.16 \cdot 10^{-63}:\\
\;\;\;\;x - \frac{-y}{z} \cdot a\\
\mathbf{elif}\;z \leq 10^{-274}:\\
\;\;\;\;x - y \cdot \frac{a}{t}\\
\mathbf{elif}\;z \leq 7.2 \cdot 10^{-177}:\\
\;\;\;\;x - \mathsf{fma}\left(-y, t, y\right) \cdot a\\
\mathbf{elif}\;z \leq 6.6 \cdot 10^{+63}:\\
\;\;\;\;x - \frac{y}{t} \cdot a\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -1.90000000000000006e182 or 6.6000000000000003e63 < z Initial program 91.6%
Taylor expanded in z around inf
lower--.f6488.4
Applied rewrites88.4%
if -1.90000000000000006e182 < z < -1.16e-63Initial program 98.1%
Taylor expanded in y around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f6489.3
Applied rewrites89.3%
Taylor expanded in z around inf
Applied rewrites78.6%
if -1.16e-63 < z < 9.99999999999999966e-275Initial 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-+.f6491.5
Applied rewrites91.5%
Taylor expanded in t around inf
Applied rewrites66.4%
Applied rewrites71.2%
if 9.99999999999999966e-275 < z < 7.19999999999999965e-177Initial program 99.8%
Taylor expanded in z around 0
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6499.9
Applied rewrites99.9%
Taylor expanded in t around 0
Applied rewrites89.5%
if 7.19999999999999965e-177 < z < 6.6000000000000003e63Initial program 97.6%
Taylor expanded in y around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f6485.8
Applied rewrites85.8%
Taylor expanded in t around inf
Applied rewrites75.3%
(FPCore (x y z t a)
:precision binary64
(if (<= z -1.44e+172)
(- x a)
(if (<= z 1e-274)
(- x (* y (/ a t)))
(if (<= z 7.2e-177)
(- x (* (fma (- y) t y) a))
(if (<= z 6.6e+63) (- x (* (/ y t) a)) (- x a))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.44e+172) {
tmp = x - a;
} else if (z <= 1e-274) {
tmp = x - (y * (a / t));
} else if (z <= 7.2e-177) {
tmp = x - (fma(-y, t, y) * a);
} else if (z <= 6.6e+63) {
tmp = x - ((y / t) * a);
} else {
tmp = x - a;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.44e+172) tmp = Float64(x - a); elseif (z <= 1e-274) tmp = Float64(x - Float64(y * Float64(a / t))); elseif (z <= 7.2e-177) tmp = Float64(x - Float64(fma(Float64(-y), t, y) * a)); elseif (z <= 6.6e+63) tmp = Float64(x - Float64(Float64(y / t) * a)); else tmp = Float64(x - a); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.44e+172], N[(x - a), $MachinePrecision], If[LessEqual[z, 1e-274], N[(x - N[(y * N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7.2e-177], N[(x - N[(N[((-y) * t + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6.6e+63], N[(x - N[(N[(y / t), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], N[(x - a), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.44 \cdot 10^{+172}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 10^{-274}:\\
\;\;\;\;x - y \cdot \frac{a}{t}\\
\mathbf{elif}\;z \leq 7.2 \cdot 10^{-177}:\\
\;\;\;\;x - \mathsf{fma}\left(-y, t, y\right) \cdot a\\
\mathbf{elif}\;z \leq 6.6 \cdot 10^{+63}:\\
\;\;\;\;x - \frac{y}{t} \cdot a\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -1.44000000000000007e172 or 6.6000000000000003e63 < z Initial program 92.0%
Taylor expanded in z around inf
lower--.f6487.9
Applied rewrites87.9%
if -1.44000000000000007e172 < z < 9.99999999999999966e-275Initial program 99.0%
Taylor expanded in y around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f6490.1
Applied rewrites90.1%
Taylor expanded in t around inf
Applied rewrites63.8%
Applied rewrites66.6%
if 9.99999999999999966e-275 < z < 7.19999999999999965e-177Initial program 99.8%
Taylor expanded in z around 0
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6499.9
Applied rewrites99.9%
Taylor expanded in t around 0
Applied rewrites89.5%
if 7.19999999999999965e-177 < z < 6.6000000000000003e63Initial program 97.6%
Taylor expanded in y around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f6485.8
Applied rewrites85.8%
Taylor expanded in t around inf
Applied rewrites75.3%
(FPCore (x y z t a)
:precision binary64
(if (<= z -1.44e+172)
(- x a)
(if (<= z 1e-274)
(- x (* y (/ a t)))
(if (<= z 7.2e-177)
(- x (* (fma (- y) t y) a))
(if (<= z 5.2e+63) (- x (/ (* a y) t)) (- x a))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.44e+172) {
tmp = x - a;
} else if (z <= 1e-274) {
tmp = x - (y * (a / t));
} else if (z <= 7.2e-177) {
tmp = x - (fma(-y, t, y) * a);
} else if (z <= 5.2e+63) {
tmp = x - ((a * y) / t);
} else {
tmp = x - a;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.44e+172) tmp = Float64(x - a); elseif (z <= 1e-274) tmp = Float64(x - Float64(y * Float64(a / t))); elseif (z <= 7.2e-177) tmp = Float64(x - Float64(fma(Float64(-y), t, y) * a)); elseif (z <= 5.2e+63) tmp = Float64(x - Float64(Float64(a * y) / t)); else tmp = Float64(x - a); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.44e+172], N[(x - a), $MachinePrecision], If[LessEqual[z, 1e-274], N[(x - N[(y * N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7.2e-177], N[(x - N[(N[((-y) * t + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.2e+63], N[(x - N[(N[(a * y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(x - a), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.44 \cdot 10^{+172}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 10^{-274}:\\
\;\;\;\;x - y \cdot \frac{a}{t}\\
\mathbf{elif}\;z \leq 7.2 \cdot 10^{-177}:\\
\;\;\;\;x - \mathsf{fma}\left(-y, t, y\right) \cdot a\\
\mathbf{elif}\;z \leq 5.2 \cdot 10^{+63}:\\
\;\;\;\;x - \frac{a \cdot y}{t}\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -1.44000000000000007e172 or 5.2000000000000002e63 < z Initial program 92.0%
Taylor expanded in z around inf
lower--.f6487.9
Applied rewrites87.9%
if -1.44000000000000007e172 < z < 9.99999999999999966e-275Initial program 99.0%
Taylor expanded in y around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f6490.1
Applied rewrites90.1%
Taylor expanded in t around inf
Applied rewrites63.8%
Applied rewrites66.6%
if 9.99999999999999966e-275 < z < 7.19999999999999965e-177Initial program 99.8%
Taylor expanded in z around 0
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6499.9
Applied rewrites99.9%
Taylor expanded in t around 0
Applied rewrites89.5%
if 7.19999999999999965e-177 < z < 5.2000000000000002e63Initial program 97.6%
Taylor expanded in y around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f6485.8
Applied rewrites85.8%
Taylor expanded in t around inf
Applied rewrites75.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.9e+182) (not (<= z 6e+80))) (- x (fma a (/ (- (+ 1.0 t) y) z) a)) (- x (* (/ y (- (+ 1.0 t) z)) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.9e+182) || !(z <= 6e+80)) {
tmp = x - fma(a, (((1.0 + t) - y) / z), a);
} else {
tmp = x - ((y / ((1.0 + t) - z)) * a);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.9e+182) || !(z <= 6e+80)) tmp = Float64(x - fma(a, Float64(Float64(Float64(1.0 + t) - y) / z), a)); else tmp = Float64(x - Float64(Float64(y / Float64(Float64(1.0 + t) - z)) * a)); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.9e+182], N[Not[LessEqual[z, 6e+80]], $MachinePrecision]], N[(x - N[(a * N[(N[(N[(1.0 + t), $MachinePrecision] - y), $MachinePrecision] / z), $MachinePrecision] + a), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[(y / N[(N[(1.0 + t), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.9 \cdot 10^{+182} \lor \neg \left(z \leq 6 \cdot 10^{+80}\right):\\
\;\;\;\;x - \mathsf{fma}\left(a, \frac{\left(1 + t\right) - y}{z}, a\right)\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y}{\left(1 + t\right) - z} \cdot a\\
\end{array}
\end{array}
if z < -1.90000000000000006e182 or 5.99999999999999974e80 < z Initial program 91.3%
Taylor expanded in z around inf
associate--l+N/A
distribute-lft-out--N/A
div-subN/A
+-commutativeN/A
Applied rewrites96.2%
if -1.90000000000000006e182 < z < 5.99999999999999974e80Initial program 98.8%
Taylor expanded in y around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f6490.6
Applied rewrites90.6%
Final simplification92.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -1.08e+86) (not (<= t 9.6e+42))) (- x (* (- y z) (/ a t))) (- x (* (- y z) (/ a (- 1.0 z))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -1.08e+86) || !(t <= 9.6e+42)) {
tmp = x - ((y - z) * (a / t));
} else {
tmp = x - ((y - z) * (a / (1.0 - z)));
}
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 ((t <= (-1.08d+86)) .or. (.not. (t <= 9.6d+42))) then
tmp = x - ((y - z) * (a / t))
else
tmp = x - ((y - z) * (a / (1.0d0 - z)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -1.08e+86) || !(t <= 9.6e+42)) {
tmp = x - ((y - z) * (a / t));
} else {
tmp = x - ((y - z) * (a / (1.0 - z)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -1.08e+86) or not (t <= 9.6e+42): tmp = x - ((y - z) * (a / t)) else: tmp = x - ((y - z) * (a / (1.0 - z))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -1.08e+86) || !(t <= 9.6e+42)) tmp = Float64(x - Float64(Float64(y - z) * Float64(a / t))); else tmp = Float64(x - Float64(Float64(y - z) * Float64(a / Float64(1.0 - z)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -1.08e+86) || ~((t <= 9.6e+42))) tmp = x - ((y - z) * (a / t)); else tmp = x - ((y - z) * (a / (1.0 - z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -1.08e+86], N[Not[LessEqual[t, 9.6e+42]], $MachinePrecision]], N[(x - N[(N[(y - z), $MachinePrecision] * N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[(y - z), $MachinePrecision] * N[(a / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.08 \cdot 10^{+86} \lor \neg \left(t \leq 9.6 \cdot 10^{+42}\right):\\
\;\;\;\;x - \left(y - z\right) \cdot \frac{a}{t}\\
\mathbf{else}:\\
\;\;\;\;x - \left(y - z\right) \cdot \frac{a}{1 - z}\\
\end{array}
\end{array}
if t < -1.07999999999999993e86 or 9.5999999999999994e42 < t Initial program 97.0%
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
associate-*l/N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6497.6
lift-+.f64N/A
+-commutativeN/A
lower-+.f6497.6
Applied rewrites97.6%
Taylor expanded in t around inf
lower-/.f6488.2
Applied rewrites88.2%
if -1.07999999999999993e86 < t < 9.5999999999999994e42Initial program 95.8%
Taylor expanded in t around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6494.3
Applied rewrites94.3%
Final simplification92.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -8.8e+149) (not (<= z 1.15e-67))) (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 <= -8.8e+149) || !(z <= 1.15e-67)) {
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 <= -8.8e+149) || !(z <= 1.15e-67)) 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, -8.8e+149], N[Not[LessEqual[z, 1.15e-67]], $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 -8.8 \cdot 10^{+149} \lor \neg \left(z \leq 1.15 \cdot 10^{-67}\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 < -8.8e149 or 1.15e-67 < z Initial program 93.1%
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.9
Applied rewrites88.9%
if -8.8e149 < z < 1.15e-67Initial program 99.2%
Taylor expanded in z around 0
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6487.9
Applied rewrites87.9%
Final simplification88.4%
(FPCore (x y z t a)
:precision binary64
(if (<= z -1.65e+31)
(- x (* (- y z) (/ (- a) z)))
(if (<= z 1.15e-67)
(- x (* (/ y (+ 1.0 t)) a))
(fma (/ z (- (+ 1.0 t) z)) a x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.65e+31) {
tmp = x - ((y - z) * (-a / z));
} else if (z <= 1.15e-67) {
tmp = x - ((y / (1.0 + t)) * a);
} else {
tmp = fma((z / ((1.0 + t) - z)), a, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.65e+31) tmp = Float64(x - Float64(Float64(y - z) * Float64(Float64(-a) / z))); elseif (z <= 1.15e-67) tmp = Float64(x - Float64(Float64(y / Float64(1.0 + t)) * a)); else tmp = fma(Float64(z / Float64(Float64(1.0 + t) - z)), a, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.65e+31], N[(x - N[(N[(y - z), $MachinePrecision] * N[((-a) / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.15e-67], N[(x - N[(N[(y / N[(1.0 + t), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], N[(N[(z / N[(N[(1.0 + t), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.65 \cdot 10^{+31}:\\
\;\;\;\;x - \left(y - z\right) \cdot \frac{-a}{z}\\
\mathbf{elif}\;z \leq 1.15 \cdot 10^{-67}:\\
\;\;\;\;x - \frac{y}{1 + t} \cdot a\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{\left(1 + t\right) - z}, a, x\right)\\
\end{array}
\end{array}
if z < -1.64999999999999996e31Initial program 90.7%
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
associate-*l/N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6491.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6491.8
Applied rewrites91.8%
Taylor expanded in z around inf
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6487.6
Applied rewrites87.6%
if -1.64999999999999996e31 < z < 1.15e-67Initial program 99.8%
Taylor expanded in z around 0
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6491.1
Applied rewrites91.1%
if 1.15e-67 < z Initial program 96.1%
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-+.f6486.8
Applied rewrites86.8%
(FPCore (x y z t a)
:precision binary64
(if (<= z -1.44e+172)
(- x a)
(if (<= z 1.15e-67)
(- x (* (/ y (+ 1.0 t)) a))
(fma z (/ a (- (+ t 1.0) z)) x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.44e+172) {
tmp = x - a;
} else if (z <= 1.15e-67) {
tmp = x - ((y / (1.0 + t)) * a);
} else {
tmp = fma(z, (a / ((t + 1.0) - z)), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.44e+172) tmp = Float64(x - a); elseif (z <= 1.15e-67) tmp = Float64(x - Float64(Float64(y / Float64(1.0 + t)) * a)); else tmp = fma(z, Float64(a / Float64(Float64(t + 1.0) - z)), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.44e+172], N[(x - a), $MachinePrecision], If[LessEqual[z, 1.15e-67], N[(x - N[(N[(y / N[(1.0 + t), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], N[(z * N[(a / N[(N[(t + 1.0), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.44 \cdot 10^{+172}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 1.15 \cdot 10^{-67}:\\
\;\;\;\;x - \frac{y}{1 + t} \cdot a\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{a}{\left(t + 1\right) - z}, x\right)\\
\end{array}
\end{array}
if z < -1.44000000000000007e172Initial program 87.1%
Taylor expanded in z around inf
lower--.f6491.3
Applied rewrites91.3%
if -1.44000000000000007e172 < z < 1.15e-67Initial program 99.2%
Taylor expanded in z around 0
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6487.7
Applied rewrites87.7%
if 1.15e-67 < z Initial program 96.1%
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-+.f6486.8
Applied rewrites86.8%
Applied rewrites85.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.44e+172) (not (<= z 6.6e+63))) (- x a) (- x (* (/ y (+ 1.0 t)) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.44e+172) || !(z <= 6.6e+63)) {
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 <= (-1.44d+172)) .or. (.not. (z <= 6.6d+63))) 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 <= -1.44e+172) || !(z <= 6.6e+63)) {
tmp = x - a;
} else {
tmp = x - ((y / (1.0 + t)) * a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.44e+172) or not (z <= 6.6e+63): 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 <= -1.44e+172) || !(z <= 6.6e+63)) 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 <= -1.44e+172) || ~((z <= 6.6e+63))) 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, -1.44e+172], N[Not[LessEqual[z, 6.6e+63]], $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 -1.44 \cdot 10^{+172} \lor \neg \left(z \leq 6.6 \cdot 10^{+63}\right):\\
\;\;\;\;x - a\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y}{1 + t} \cdot a\\
\end{array}
\end{array}
if z < -1.44000000000000007e172 or 6.6000000000000003e63 < z Initial program 92.0%
Taylor expanded in z around inf
lower--.f6487.9
Applied rewrites87.9%
if -1.44000000000000007e172 < z < 6.6000000000000003e63Initial program 98.7%
Taylor expanded in z around 0
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6485.3
Applied rewrites85.3%
Final simplification86.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.44e+172) (not (<= z 6.6e+63))) (- x a) (- x (* y (/ a t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.44e+172) || !(z <= 6.6e+63)) {
tmp = x - a;
} else {
tmp = x - (y * (a / t));
}
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 <= (-1.44d+172)) .or. (.not. (z <= 6.6d+63))) then
tmp = x - a
else
tmp = x - (y * (a / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.44e+172) || !(z <= 6.6e+63)) {
tmp = x - a;
} else {
tmp = x - (y * (a / t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.44e+172) or not (z <= 6.6e+63): tmp = x - a else: tmp = x - (y * (a / t)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.44e+172) || !(z <= 6.6e+63)) tmp = Float64(x - a); else tmp = Float64(x - Float64(y * Float64(a / t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -1.44e+172) || ~((z <= 6.6e+63))) tmp = x - a; else tmp = x - (y * (a / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.44e+172], N[Not[LessEqual[z, 6.6e+63]], $MachinePrecision]], N[(x - a), $MachinePrecision], N[(x - N[(y * N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.44 \cdot 10^{+172} \lor \neg \left(z \leq 6.6 \cdot 10^{+63}\right):\\
\;\;\;\;x - a\\
\mathbf{else}:\\
\;\;\;\;x - y \cdot \frac{a}{t}\\
\end{array}
\end{array}
if z < -1.44000000000000007e172 or 6.6000000000000003e63 < z Initial program 92.0%
Taylor expanded in z around inf
lower--.f6487.9
Applied rewrites87.9%
if -1.44000000000000007e172 < z < 6.6000000000000003e63Initial program 98.7%
Taylor expanded in y around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f6490.2
Applied rewrites90.2%
Taylor expanded in t around inf
Applied rewrites65.1%
Applied rewrites66.2%
Final simplification74.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -3.3e+52) (not (<= z 2.3e-29))) (- x a) (- x (* (fma (- y) t y) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -3.3e+52) || !(z <= 2.3e-29)) {
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 <= -3.3e+52) || !(z <= 2.3e-29)) 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, -3.3e+52], N[Not[LessEqual[z, 2.3e-29]], $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 -3.3 \cdot 10^{+52} \lor \neg \left(z \leq 2.3 \cdot 10^{-29}\right):\\
\;\;\;\;x - a\\
\mathbf{else}:\\
\;\;\;\;x - \mathsf{fma}\left(-y, t, y\right) \cdot a\\
\end{array}
\end{array}
if z < -3.3e52 or 2.29999999999999991e-29 < z Initial program 93.2%
Taylor expanded in z around inf
lower--.f6478.7
Applied rewrites78.7%
if -3.3e52 < z < 2.29999999999999991e-29Initial program 99.8%
Taylor expanded in z around 0
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6490.9
Applied rewrites90.9%
Taylor expanded in t around 0
Applied rewrites63.1%
Final simplification71.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -4.2e+175) (not (<= z 4.8e+63))) (- x a) (* 1.0 x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -4.2e+175) || !(z <= 4.8e+63)) {
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 <= (-4.2d+175)) .or. (.not. (z <= 4.8d+63))) 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 <= -4.2e+175) || !(z <= 4.8e+63)) {
tmp = x - a;
} else {
tmp = 1.0 * x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -4.2e+175) or not (z <= 4.8e+63): tmp = x - a else: tmp = 1.0 * x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -4.2e+175) || !(z <= 4.8e+63)) 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 <= -4.2e+175) || ~((z <= 4.8e+63))) tmp = x - a; else tmp = 1.0 * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -4.2e+175], N[Not[LessEqual[z, 4.8e+63]], $MachinePrecision]], N[(x - a), $MachinePrecision], N[(1.0 * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.2 \cdot 10^{+175} \lor \neg \left(z \leq 4.8 \cdot 10^{+63}\right):\\
\;\;\;\;x - a\\
\mathbf{else}:\\
\;\;\;\;1 \cdot x\\
\end{array}
\end{array}
if z < -4.1999999999999998e175 or 4.8e63 < z Initial program 91.8%
Taylor expanded in z around inf
lower--.f6487.7
Applied rewrites87.7%
if -4.1999999999999998e175 < z < 4.8e63Initial program 98.7%
Taylor expanded in z around inf
lower--.f6444.0
Applied rewrites44.0%
Taylor expanded in x around inf
Applied rewrites45.1%
Taylor expanded in x around inf
Applied rewrites57.5%
Final simplification68.5%
(FPCore (x y z t a) :precision binary64 (- x a))
double code(double x, double y, double z, double t, double a) {
return x - a;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x - a
end function
public static double code(double x, double y, double z, double t, double a) {
return x - a;
}
def code(x, y, z, t, a): return x - a
function code(x, y, z, t, a) return Float64(x - a) end
function tmp = code(x, y, z, t, a) tmp = x - a; end
code[x_, y_, z_, t_, a_] := N[(x - a), $MachinePrecision]
\begin{array}{l}
\\
x - a
\end{array}
Initial program 96.2%
Taylor expanded in z around inf
lower--.f6459.9
Applied rewrites59.9%
(FPCore (x y z t a) :precision binary64 (- a))
double code(double x, double y, double z, double t, double a) {
return -a;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = -a
end function
public static double code(double x, double y, double z, double t, double a) {
return -a;
}
def code(x, y, z, t, a): return -a
function code(x, y, z, t, a) return Float64(-a) end
function tmp = code(x, y, z, t, a) tmp = -a; end
code[x_, y_, z_, t_, a_] := (-a)
\begin{array}{l}
\\
-a
\end{array}
Initial program 96.2%
Taylor expanded in z around inf
lower--.f6459.9
Applied rewrites59.9%
Taylor expanded in x around 0
Applied rewrites21.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 2024326
(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))))