
(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 (fma (/ (- y z) (+ -1.0 (- z t))) a x))
double code(double x, double y, double z, double t, double a) {
return fma(((y - z) / (-1.0 + (z - t))), a, x);
}
function code(x, y, z, t, a) return fma(Float64(Float64(y - z) / Float64(-1.0 + Float64(z - t))), a, x) end
code[x_, y_, z_, t_, a_] := N[(N[(N[(y - z), $MachinePrecision] / N[(-1.0 + N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{y - z}{-1 + \left(z - t\right)}, a, x\right)
\end{array}
Initial program 95.2%
lift--.f64N/A
lift--.f64N/A
lift-+.f64N/A
frac-2negN/A
frac-2negN/A
lift-/.f64N/A
lift-/.f64N/A
sub-negN/A
+-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
distribute-lft-neg-inN/A
distribute-frac-neg2N/A
lower-fma.f64N/A
Applied rewrites99.9%
Final simplification99.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (- y z) (/ (- a) t) x)))
(if (<= t -4.5e+89)
t_1
(if (<= t 6.4e+41) (fma (/ (- y z) (+ z -1.0)) a x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((y - z), (-a / t), x);
double tmp;
if (t <= -4.5e+89) {
tmp = t_1;
} else if (t <= 6.4e+41) {
tmp = fma(((y - z) / (z + -1.0)), a, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(y - z), Float64(Float64(-a) / t), x) tmp = 0.0 if (t <= -4.5e+89) tmp = t_1; elseif (t <= 6.4e+41) tmp = fma(Float64(Float64(y - z) / Float64(z + -1.0)), a, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y - z), $MachinePrecision] * N[((-a) / t), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[t, -4.5e+89], t$95$1, If[LessEqual[t, 6.4e+41], N[(N[(N[(y - z), $MachinePrecision] / N[(z + -1.0), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y - z, \frac{-a}{t}, x\right)\\
\mathbf{if}\;t \leq -4.5 \cdot 10^{+89}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 6.4 \cdot 10^{+41}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y - z}{z + -1}, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -4.5e89 or 6.40000000000000019e41 < t Initial program 96.8%
Taylor expanded in t around inf
mul-1-negN/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lower--.f64N/A
lower-neg.f64N/A
lower-/.f6486.4
Applied rewrites86.4%
if -4.5e89 < t < 6.40000000000000019e41Initial program 93.8%
lift--.f64N/A
lift--.f64N/A
lift-+.f64N/A
frac-2negN/A
frac-2negN/A
lift-/.f64N/A
lift-/.f64N/A
sub-negN/A
+-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
distribute-lft-neg-inN/A
distribute-frac-neg2N/A
lower-fma.f64N/A
Applied rewrites99.9%
Taylor expanded in t around 0
lower-/.f64N/A
lower--.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
lower-+.f6496.2
Applied rewrites96.2%
Final simplification91.8%
(FPCore (x y z t a) :precision binary64 (if (<= z -1e+80) (fma a (/ z (- t z)) x) (if (<= z 130000000.0) (fma a (/ y (- -1.0 t)) x) (fma (/ a z) (- y z) x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1e+80) {
tmp = fma(a, (z / (t - z)), x);
} else if (z <= 130000000.0) {
tmp = fma(a, (y / (-1.0 - t)), x);
} else {
tmp = fma((a / z), (y - z), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1e+80) tmp = fma(a, Float64(z / Float64(t - z)), x); elseif (z <= 130000000.0) tmp = fma(a, Float64(y / Float64(-1.0 - t)), x); else tmp = fma(Float64(a / z), Float64(y - z), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1e+80], N[(a * N[(z / N[(t - z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 130000000.0], N[(a * N[(y / N[(-1.0 - t), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(N[(a / z), $MachinePrecision] * N[(y - z), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \cdot 10^{+80}:\\
\;\;\;\;\mathsf{fma}\left(a, \frac{z}{t - z}, x\right)\\
\mathbf{elif}\;z \leq 130000000:\\
\;\;\;\;\mathsf{fma}\left(a, \frac{y}{-1 - t}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{a}{z}, y - z, x\right)\\
\end{array}
\end{array}
if z < -1e80Initial program 93.0%
Taylor expanded in y around 0
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
+-commutativeN/A
associate--l+N/A
lower-+.f64N/A
lower--.f6490.9
Applied rewrites90.9%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6490.9
Applied rewrites90.9%
if -1e80 < z < 1.3e8Initial program 98.3%
Taylor expanded in z around 0
sub-negN/A
+-commutativeN/A
associate-/l*N/A
distribute-rgt-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.5
Applied rewrites91.5%
if 1.3e8 < z Initial program 87.1%
lift--.f64N/A
lift--.f64N/A
lift-+.f64N/A
frac-2negN/A
frac-2negN/A
lift-/.f64N/A
lift-/.f64N/A
sub-negN/A
+-commutativeN/A
Applied rewrites87.9%
Taylor expanded in z around inf
lower-/.f6480.7
Applied rewrites80.7%
Final simplification89.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ a z) (- y z) x)))
(if (<= z -2.5e+76)
t_1
(if (<= z 130000000.0) (fma a (/ y (- -1.0 t)) 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 <= -2.5e+76) {
tmp = t_1;
} else if (z <= 130000000.0) {
tmp = fma(a, (y / (-1.0 - t)), 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 <= -2.5e+76) tmp = t_1; elseif (z <= 130000000.0) tmp = fma(a, Float64(y / Float64(-1.0 - t)), 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, -2.5e+76], t$95$1, If[LessEqual[z, 130000000.0], N[(a * N[(y / N[(-1.0 - t), $MachinePrecision]), $MachinePrecision] + 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 -2.5 \cdot 10^{+76}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 130000000:\\
\;\;\;\;\mathsf{fma}\left(a, \frac{y}{-1 - t}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.49999999999999996e76 or 1.3e8 < z Initial program 90.4%
lift--.f64N/A
lift--.f64N/A
lift-+.f64N/A
frac-2negN/A
frac-2negN/A
lift-/.f64N/A
lift-/.f64N/A
sub-negN/A
+-commutativeN/A
Applied rewrites91.3%
Taylor expanded in z around inf
lower-/.f6480.5
Applied rewrites80.5%
if -2.49999999999999996e76 < z < 1.3e8Initial program 98.2%
Taylor expanded in z around 0
sub-negN/A
+-commutativeN/A
associate-/l*N/A
distribute-rgt-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--.f6492.0
Applied rewrites92.0%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.6e+118) (- x a) (if (<= z 240000000.0) (fma a (/ y (- -1.0 t)) x) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.6e+118) {
tmp = x - a;
} else if (z <= 240000000.0) {
tmp = fma(a, (y / (-1.0 - t)), x);
} else {
tmp = x - a;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.6e+118) tmp = Float64(x - a); elseif (z <= 240000000.0) tmp = fma(a, Float64(y / Float64(-1.0 - t)), x); else tmp = Float64(x - a); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.6e+118], N[(x - a), $MachinePrecision], If[LessEqual[z, 240000000.0], N[(a * N[(y / N[(-1.0 - t), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.6 \cdot 10^{+118}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 240000000:\\
\;\;\;\;\mathsf{fma}\left(a, \frac{y}{-1 - t}, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -1.60000000000000008e118 or 2.4e8 < z Initial program 89.3%
Taylor expanded in z around inf
lower--.f6476.8
Applied rewrites76.8%
if -1.60000000000000008e118 < z < 2.4e8Initial program 98.3%
Taylor expanded in z around 0
sub-negN/A
+-commutativeN/A
associate-/l*N/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
distribute-neg-frac2N/A
lower-/.f64N/A
distribute-neg-inN/A
metadata-evalN/A
unsub-negN/A
lower--.f6490.2
Applied rewrites90.2%
(FPCore (x y z t a) :precision binary64 (if (<= z 1.85e+161) (fma (/ a (+ -1.0 (- z t))) (- y z) x) (fma (* (- y z) (/ 1.0 z)) a x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= 1.85e+161) {
tmp = fma((a / (-1.0 + (z - t))), (y - z), x);
} else {
tmp = fma(((y - z) * (1.0 / z)), a, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= 1.85e+161) tmp = fma(Float64(a / Float64(-1.0 + Float64(z - t))), Float64(y - z), x); else tmp = fma(Float64(Float64(y - z) * Float64(1.0 / z)), a, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, 1.85e+161], N[(N[(a / N[(-1.0 + N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(y - z), $MachinePrecision] + x), $MachinePrecision], N[(N[(N[(y - z), $MachinePrecision] * N[(1.0 / z), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.85 \cdot 10^{+161}:\\
\;\;\;\;\mathsf{fma}\left(\frac{a}{-1 + \left(z - t\right)}, y - z, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(y - z\right) \cdot \frac{1}{z}, a, x\right)\\
\end{array}
\end{array}
if z < 1.8499999999999999e161Initial program 96.8%
lift--.f64N/A
lift--.f64N/A
lift-+.f64N/A
frac-2negN/A
frac-2negN/A
lift-/.f64N/A
lift-/.f64N/A
sub-negN/A
+-commutativeN/A
Applied rewrites97.2%
if 1.8499999999999999e161 < z Initial program 76.0%
lift--.f64N/A
lift--.f64N/A
lift-+.f64N/A
frac-2negN/A
frac-2negN/A
lift-/.f64N/A
lift-/.f64N/A
sub-negN/A
+-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
distribute-lft-neg-inN/A
distribute-frac-neg2N/A
lower-fma.f64N/A
Applied rewrites99.8%
lift--.f64N/A
lift--.f64N/A
lift--.f64N/A
clear-numN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f6499.8
Applied rewrites99.8%
Taylor expanded in z around inf
lower-/.f6499.8
Applied rewrites99.8%
Final simplification97.4%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma a (/ y (- t)) x))) (if (<= t -6.0) t_1 (if (<= t 3.1e-19) (fma y (fma t a (- a)) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(a, (y / -t), x);
double tmp;
if (t <= -6.0) {
tmp = t_1;
} else if (t <= 3.1e-19) {
tmp = fma(y, fma(t, a, -a), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(a, Float64(y / Float64(-t)), x) tmp = 0.0 if (t <= -6.0) tmp = t_1; elseif (t <= 3.1e-19) tmp = fma(y, fma(t, a, Float64(-a)), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(a * N[(y / (-t)), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[t, -6.0], t$95$1, If[LessEqual[t, 3.1e-19], N[(y * N[(t * a + (-a)), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(a, \frac{y}{-t}, x\right)\\
\mathbf{if}\;t \leq -6:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 3.1 \cdot 10^{-19}:\\
\;\;\;\;\mathsf{fma}\left(y, \mathsf{fma}\left(t, a, -a\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -6 or 3.0999999999999999e-19 < t Initial program 96.1%
Taylor expanded in t around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6475.9
Applied rewrites75.9%
Taylor expanded in z around 0
sub-negN/A
+-commutativeN/A
associate-/l*N/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
distribute-neg-frac2N/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6477.2
Applied rewrites77.2%
if -6 < t < 3.0999999999999999e-19Initial program 94.1%
lift--.f64N/A
lift--.f64N/A
lift-+.f64N/A
frac-2negN/A
frac-2negN/A
lift-/.f64N/A
lift-/.f64N/A
sub-negN/A
+-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
distribute-lft-neg-inN/A
distribute-frac-neg2N/A
lower-fma.f64N/A
Applied rewrites99.9%
Taylor expanded in z around 0
mul-1-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
distribute-neg-inN/A
metadata-evalN/A
unsub-negN/A
lower--.f6469.2
Applied rewrites69.2%
Taylor expanded in t around 0
+-commutativeN/A
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
distribute-rgt-outN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f6469.2
Applied rewrites69.2%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (- x (* y (/ a t))))) (if (<= t -6.0) t_1 (if (<= t 3.1e-19) (fma y (fma t a (- a)) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x - (y * (a / t));
double tmp;
if (t <= -6.0) {
tmp = t_1;
} else if (t <= 3.1e-19) {
tmp = fma(y, fma(t, a, -a), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(x - Float64(y * Float64(a / t))) tmp = 0.0 if (t <= -6.0) tmp = t_1; elseif (t <= 3.1e-19) tmp = fma(y, fma(t, a, Float64(-a)), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x - N[(y * N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -6.0], t$95$1, If[LessEqual[t, 3.1e-19], N[(y * N[(t * a + (-a)), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x - y \cdot \frac{a}{t}\\
\mathbf{if}\;t \leq -6:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 3.1 \cdot 10^{-19}:\\
\;\;\;\;\mathsf{fma}\left(y, \mathsf{fma}\left(t, a, -a\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -6 or 3.0999999999999999e-19 < t Initial program 96.1%
Taylor expanded in t around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6475.9
Applied rewrites75.9%
Taylor expanded in y around inf
lower-/.f64N/A
lower-*.f6471.2
Applied rewrites71.2%
lift-*.f64N/A
lift-/.f64N/A
lift--.f6471.2
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6475.5
Applied rewrites75.5%
if -6 < t < 3.0999999999999999e-19Initial program 94.1%
lift--.f64N/A
lift--.f64N/A
lift-+.f64N/A
frac-2negN/A
frac-2negN/A
lift-/.f64N/A
lift-/.f64N/A
sub-negN/A
+-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
distribute-lft-neg-inN/A
distribute-frac-neg2N/A
lower-fma.f64N/A
Applied rewrites99.9%
Taylor expanded in z around 0
mul-1-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
distribute-neg-inN/A
metadata-evalN/A
unsub-negN/A
lower--.f6469.2
Applied rewrites69.2%
Taylor expanded in t around 0
+-commutativeN/A
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
distribute-rgt-outN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f6469.2
Applied rewrites69.2%
(FPCore (x y z t a) :precision binary64 (if (<= z -0.72) (- x a) (if (<= z 4.6e-13) (fma (fma z (- 1.0 y) (- y)) a x) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -0.72) {
tmp = x - a;
} else if (z <= 4.6e-13) {
tmp = fma(fma(z, (1.0 - y), -y), a, x);
} else {
tmp = x - a;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -0.72) tmp = Float64(x - a); elseif (z <= 4.6e-13) tmp = fma(fma(z, Float64(1.0 - y), Float64(-y)), a, x); else tmp = Float64(x - a); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -0.72], N[(x - a), $MachinePrecision], If[LessEqual[z, 4.6e-13], N[(N[(z * N[(1.0 - y), $MachinePrecision] + (-y)), $MachinePrecision] * a + x), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.72:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 4.6 \cdot 10^{-13}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(z, 1 - y, -y\right), a, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -0.71999999999999997 or 4.59999999999999958e-13 < z Initial program 92.1%
Taylor expanded in z around inf
lower--.f6473.8
Applied rewrites73.8%
if -0.71999999999999997 < z < 4.59999999999999958e-13Initial program 98.0%
lift--.f64N/A
lift--.f64N/A
lift-+.f64N/A
frac-2negN/A
frac-2negN/A
lift-/.f64N/A
lift-/.f64N/A
sub-negN/A
+-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
distribute-lft-neg-inN/A
distribute-frac-neg2N/A
lower-fma.f64N/A
Applied rewrites99.9%
Taylor expanded in t around 0
lower-/.f64N/A
lower--.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
lower-+.f6471.5
Applied rewrites71.5%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f6471.4
Applied rewrites71.4%
(FPCore (x y z t a) :precision binary64 (if (<= z -66.0) (- x a) (if (<= z 4.6e-13) (fma (fma z 1.0 (- y)) a x) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -66.0) {
tmp = x - a;
} else if (z <= 4.6e-13) {
tmp = fma(fma(z, 1.0, -y), a, x);
} else {
tmp = x - a;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -66.0) tmp = Float64(x - a); elseif (z <= 4.6e-13) tmp = fma(fma(z, 1.0, Float64(-y)), a, x); else tmp = Float64(x - a); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -66.0], N[(x - a), $MachinePrecision], If[LessEqual[z, 4.6e-13], N[(N[(z * 1.0 + (-y)), $MachinePrecision] * a + x), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -66:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 4.6 \cdot 10^{-13}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(z, 1, -y\right), a, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -66 or 4.59999999999999958e-13 < z Initial program 92.1%
Taylor expanded in z around inf
lower--.f6473.8
Applied rewrites73.8%
if -66 < z < 4.59999999999999958e-13Initial program 98.0%
lift--.f64N/A
lift--.f64N/A
lift-+.f64N/A
frac-2negN/A
frac-2negN/A
lift-/.f64N/A
lift-/.f64N/A
sub-negN/A
+-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
distribute-lft-neg-inN/A
distribute-frac-neg2N/A
lower-fma.f64N/A
Applied rewrites99.9%
Taylor expanded in t around 0
lower-/.f64N/A
lower--.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
lower-+.f6471.5
Applied rewrites71.5%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f6471.4
Applied rewrites71.4%
Taylor expanded in y around 0
Applied rewrites71.0%
(FPCore (x y z t a) :precision binary64 (if (<= z -1e-12) (- x a) (if (<= z 4.8e-78) (fma a z x) (if (<= z 4.6e-16) (* y (- a)) (- x a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1e-12) {
tmp = x - a;
} else if (z <= 4.8e-78) {
tmp = fma(a, z, x);
} else if (z <= 4.6e-16) {
tmp = y * -a;
} else {
tmp = x - a;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1e-12) tmp = Float64(x - a); elseif (z <= 4.8e-78) tmp = fma(a, z, x); elseif (z <= 4.6e-16) tmp = Float64(y * Float64(-a)); else tmp = Float64(x - a); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1e-12], N[(x - a), $MachinePrecision], If[LessEqual[z, 4.8e-78], N[(a * z + x), $MachinePrecision], If[LessEqual[z, 4.6e-16], N[(y * (-a)), $MachinePrecision], N[(x - a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \cdot 10^{-12}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 4.8 \cdot 10^{-78}:\\
\;\;\;\;\mathsf{fma}\left(a, z, x\right)\\
\mathbf{elif}\;z \leq 4.6 \cdot 10^{-16}:\\
\;\;\;\;y \cdot \left(-a\right)\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -9.9999999999999998e-13 or 4.5999999999999998e-16 < z Initial program 92.2%
Taylor expanded in z around inf
lower--.f6472.7
Applied rewrites72.7%
if -9.9999999999999998e-13 < z < 4.79999999999999999e-78Initial program 97.6%
lift--.f64N/A
lift--.f64N/A
lift-+.f64N/A
frac-2negN/A
frac-2negN/A
lift-/.f64N/A
lift-/.f64N/A
sub-negN/A
+-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
distribute-lft-neg-inN/A
distribute-frac-neg2N/A
lower-fma.f64N/A
Applied rewrites99.9%
Taylor expanded in t around 0
lower-/.f64N/A
lower--.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
lower-+.f6472.8
Applied rewrites72.8%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f6472.7
Applied rewrites72.7%
Taylor expanded in y around 0
+-commutativeN/A
lower-fma.f6464.2
Applied rewrites64.2%
if 4.79999999999999999e-78 < z < 4.5999999999999998e-16Initial program 100.0%
lift--.f64N/A
lift--.f64N/A
lift-+.f64N/A
frac-2negN/A
frac-2negN/A
lift-/.f64N/A
lift-/.f64N/A
sub-negN/A
+-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
distribute-lft-neg-inN/A
distribute-frac-neg2N/A
lower-fma.f64N/A
Applied rewrites99.8%
Taylor expanded in z around 0
mul-1-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
distribute-neg-inN/A
metadata-evalN/A
unsub-negN/A
lower--.f6479.0
Applied rewrites79.0%
Taylor expanded in t around 0
mul-1-negN/A
lower-neg.f6460.4
Applied rewrites60.4%
Taylor expanded in y around inf
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6444.2
Applied rewrites44.2%
Final simplification66.9%
(FPCore (x y z t a) :precision binary64 (if (<= z -66.0) (- x a) (if (<= z 4.6e-13) (fma (- y) a x) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -66.0) {
tmp = x - a;
} else if (z <= 4.6e-13) {
tmp = fma(-y, a, x);
} else {
tmp = x - a;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -66.0) tmp = Float64(x - a); elseif (z <= 4.6e-13) tmp = fma(Float64(-y), a, x); else tmp = Float64(x - a); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -66.0], N[(x - a), $MachinePrecision], If[LessEqual[z, 4.6e-13], N[((-y) * a + x), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -66:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 4.6 \cdot 10^{-13}:\\
\;\;\;\;\mathsf{fma}\left(-y, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -66 or 4.59999999999999958e-13 < z Initial program 92.1%
Taylor expanded in z around inf
lower--.f6473.8
Applied rewrites73.8%
if -66 < z < 4.59999999999999958e-13Initial program 98.0%
lift--.f64N/A
lift--.f64N/A
lift-+.f64N/A
frac-2negN/A
frac-2negN/A
lift-/.f64N/A
lift-/.f64N/A
sub-negN/A
+-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
distribute-lft-neg-inN/A
distribute-frac-neg2N/A
lower-fma.f64N/A
Applied rewrites99.9%
Taylor expanded in z around 0
mul-1-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
distribute-neg-inN/A
metadata-evalN/A
unsub-negN/A
lower--.f6492.4
Applied rewrites92.4%
Taylor expanded in t around 0
mul-1-negN/A
lower-neg.f6468.9
Applied rewrites68.9%
(FPCore (x y z t a) :precision binary64 (if (<= z -1e-12) (- x a) (if (<= z 1.3e-33) (fma a z x) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1e-12) {
tmp = x - a;
} else if (z <= 1.3e-33) {
tmp = fma(a, z, x);
} else {
tmp = x - a;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1e-12) tmp = Float64(x - a); elseif (z <= 1.3e-33) tmp = fma(a, z, x); else tmp = Float64(x - a); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1e-12], N[(x - a), $MachinePrecision], If[LessEqual[z, 1.3e-33], N[(a * z + x), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \cdot 10^{-12}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 1.3 \cdot 10^{-33}:\\
\;\;\;\;\mathsf{fma}\left(a, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -9.9999999999999998e-13 or 1.29999999999999997e-33 < z Initial program 92.4%
Taylor expanded in z around inf
lower--.f6471.0
Applied rewrites71.0%
if -9.9999999999999998e-13 < z < 1.29999999999999997e-33Initial program 97.9%
lift--.f64N/A
lift--.f64N/A
lift-+.f64N/A
frac-2negN/A
frac-2negN/A
lift-/.f64N/A
lift-/.f64N/A
sub-negN/A
+-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
distribute-lft-neg-inN/A
distribute-frac-neg2N/A
lower-fma.f64N/A
Applied rewrites99.9%
Taylor expanded in t around 0
lower-/.f64N/A
lower--.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
lower-+.f6471.2
Applied rewrites71.2%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f6471.1
Applied rewrites71.1%
Taylor expanded in y around 0
+-commutativeN/A
lower-fma.f6459.5
Applied rewrites59.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 95.2%
Taylor expanded in z around inf
lower--.f6456.3
Applied rewrites56.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 95.2%
Taylor expanded in z around inf
lower--.f6456.3
Applied rewrites56.3%
Taylor expanded in x around 0
mul-1-negN/A
lower-neg.f6413.0
Applied rewrites13.0%
(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 2024219
(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))))