
(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 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (- x (/ (- y z) (/ (+ (- t z) 1.0) a))))
double code(double x, double y, double z, double t, double a) {
return x - ((y - z) / (((t - z) + 1.0) / a));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x - ((y - z) / (((t - z) + 1.0d0) / a))
end function
public static double code(double x, double y, double z, double t, double a) {
return x - ((y - z) / (((t - z) + 1.0) / a));
}
def code(x, y, z, t, a): return x - ((y - z) / (((t - z) + 1.0) / a))
function code(x, y, z, t, a) return Float64(x - Float64(Float64(y - z) / Float64(Float64(Float64(t - z) + 1.0) / a))) end
function tmp = code(x, y, z, t, a) tmp = x - ((y - z) / (((t - z) + 1.0) / a)); end
code[x_, y_, z_, t_, a_] := N[(x - N[(N[(y - z), $MachinePrecision] / N[(N[(N[(t - z), $MachinePrecision] + 1.0), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{y - z}{\frac{\left(t - z\right) + 1}{a}}
\end{array}
(FPCore (x y z t a) :precision binary64 (fma a (/ (- z y) (+ (- t z) 1.0)) x))
double code(double x, double y, double z, double t, double a) {
return fma(a, ((z - y) / ((t - z) + 1.0)), x);
}
function code(x, y, z, t, a) return fma(a, Float64(Float64(z - y) / Float64(Float64(t - z) + 1.0)), x) end
code[x_, y_, z_, t_, a_] := N[(a * N[(N[(z - y), $MachinePrecision] / N[(N[(t - z), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(a, \frac{z - y}{\left(t - z\right) + 1}, x\right)
\end{array}
Initial program 98.0%
sub-neg98.0%
+-commutative98.0%
associate-/r/99.5%
*-commutative99.5%
distribute-rgt-neg-in99.5%
fma-def99.5%
div-sub99.5%
sub-neg99.5%
+-commutative99.5%
distribute-neg-in99.5%
remove-double-neg99.5%
sub-neg99.5%
div-sub99.5%
Simplified99.5%
Final simplification99.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* y (- a))))
(if (<= z -9.5e+19)
(- x a)
(if (<= z -3.3e-225)
x
(if (<= z 2.25e-297)
t_1
(if (<= z 3e-223)
x
(if (<= z 2.1e-198) t_1 (if (<= z 2.7e-12) x (- x a)))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = y * -a;
double tmp;
if (z <= -9.5e+19) {
tmp = x - a;
} else if (z <= -3.3e-225) {
tmp = x;
} else if (z <= 2.25e-297) {
tmp = t_1;
} else if (z <= 3e-223) {
tmp = x;
} else if (z <= 2.1e-198) {
tmp = t_1;
} else if (z <= 2.7e-12) {
tmp = x;
} else {
tmp = x - a;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = y * -a
if (z <= (-9.5d+19)) then
tmp = x - a
else if (z <= (-3.3d-225)) then
tmp = x
else if (z <= 2.25d-297) then
tmp = t_1
else if (z <= 3d-223) then
tmp = x
else if (z <= 2.1d-198) then
tmp = t_1
else if (z <= 2.7d-12) then
tmp = x
else
tmp = x - a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = y * -a;
double tmp;
if (z <= -9.5e+19) {
tmp = x - a;
} else if (z <= -3.3e-225) {
tmp = x;
} else if (z <= 2.25e-297) {
tmp = t_1;
} else if (z <= 3e-223) {
tmp = x;
} else if (z <= 2.1e-198) {
tmp = t_1;
} else if (z <= 2.7e-12) {
tmp = x;
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = y * -a tmp = 0 if z <= -9.5e+19: tmp = x - a elif z <= -3.3e-225: tmp = x elif z <= 2.25e-297: tmp = t_1 elif z <= 3e-223: tmp = x elif z <= 2.1e-198: tmp = t_1 elif z <= 2.7e-12: tmp = x else: tmp = x - a return tmp
function code(x, y, z, t, a) t_1 = Float64(y * Float64(-a)) tmp = 0.0 if (z <= -9.5e+19) tmp = Float64(x - a); elseif (z <= -3.3e-225) tmp = x; elseif (z <= 2.25e-297) tmp = t_1; elseif (z <= 3e-223) tmp = x; elseif (z <= 2.1e-198) tmp = t_1; elseif (z <= 2.7e-12) tmp = x; else tmp = Float64(x - a); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = y * -a; tmp = 0.0; if (z <= -9.5e+19) tmp = x - a; elseif (z <= -3.3e-225) tmp = x; elseif (z <= 2.25e-297) tmp = t_1; elseif (z <= 3e-223) tmp = x; elseif (z <= 2.1e-198) tmp = t_1; elseif (z <= 2.7e-12) tmp = x; else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * (-a)), $MachinePrecision]}, If[LessEqual[z, -9.5e+19], N[(x - a), $MachinePrecision], If[LessEqual[z, -3.3e-225], x, If[LessEqual[z, 2.25e-297], t$95$1, If[LessEqual[z, 3e-223], x, If[LessEqual[z, 2.1e-198], t$95$1, If[LessEqual[z, 2.7e-12], x, N[(x - a), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(-a\right)\\
\mathbf{if}\;z \leq -9.5 \cdot 10^{+19}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq -3.3 \cdot 10^{-225}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 2.25 \cdot 10^{-297}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 3 \cdot 10^{-223}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 2.1 \cdot 10^{-198}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 2.7 \cdot 10^{-12}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -9.5e19 or 2.6999999999999998e-12 < z Initial program 95.9%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in z around inf 76.8%
if -9.5e19 < z < -3.3000000000000001e-225 or 2.24999999999999988e-297 < z < 2.99999999999999991e-223 or 2.09999999999999993e-198 < z < 2.6999999999999998e-12Initial program 99.8%
associate-/r/99.0%
Simplified99.0%
Taylor expanded in x around inf 63.3%
if -3.3000000000000001e-225 < z < 2.24999999999999988e-297 or 2.99999999999999991e-223 < z < 2.09999999999999993e-198Initial program 99.7%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in z around 0 100.0%
Taylor expanded in x around 0 78.8%
associate-*r/78.8%
*-commutative78.8%
associate-*r/78.8%
mul-1-neg78.8%
associate-*r/78.8%
*-commutative78.8%
distribute-rgt-neg-in78.8%
Simplified78.8%
Taylor expanded in t around 0 65.1%
associate-*r*65.1%
mul-1-neg65.1%
Simplified65.1%
Final simplification69.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- x (* a y))) (t_2 (- x (/ a (/ t y)))))
(if (<= t -19.5)
t_2
(if (<= t -4.5e-166)
t_1
(if (<= t -2.5e-294) (- x a) (if (<= t 2.85e-5) t_1 t_2))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x - (a * y);
double t_2 = x - (a / (t / y));
double tmp;
if (t <= -19.5) {
tmp = t_2;
} else if (t <= -4.5e-166) {
tmp = t_1;
} else if (t <= -2.5e-294) {
tmp = x - a;
} else if (t <= 2.85e-5) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = x - (a * y)
t_2 = x - (a / (t / y))
if (t <= (-19.5d0)) then
tmp = t_2
else if (t <= (-4.5d-166)) then
tmp = t_1
else if (t <= (-2.5d-294)) then
tmp = x - a
else if (t <= 2.85d-5) then
tmp = t_1
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = x - (a * y);
double t_2 = x - (a / (t / y));
double tmp;
if (t <= -19.5) {
tmp = t_2;
} else if (t <= -4.5e-166) {
tmp = t_1;
} else if (t <= -2.5e-294) {
tmp = x - a;
} else if (t <= 2.85e-5) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x - (a * y) t_2 = x - (a / (t / y)) tmp = 0 if t <= -19.5: tmp = t_2 elif t <= -4.5e-166: tmp = t_1 elif t <= -2.5e-294: tmp = x - a elif t <= 2.85e-5: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t, a) t_1 = Float64(x - Float64(a * y)) t_2 = Float64(x - Float64(a / Float64(t / y))) tmp = 0.0 if (t <= -19.5) tmp = t_2; elseif (t <= -4.5e-166) tmp = t_1; elseif (t <= -2.5e-294) tmp = Float64(x - a); elseif (t <= 2.85e-5) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x - (a * y); t_2 = x - (a / (t / y)); tmp = 0.0; if (t <= -19.5) tmp = t_2; elseif (t <= -4.5e-166) tmp = t_1; elseif (t <= -2.5e-294) tmp = x - a; elseif (t <= 2.85e-5) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x - N[(a * y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x - N[(a / N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -19.5], t$95$2, If[LessEqual[t, -4.5e-166], t$95$1, If[LessEqual[t, -2.5e-294], N[(x - a), $MachinePrecision], If[LessEqual[t, 2.85e-5], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x - a \cdot y\\
t_2 := x - \frac{a}{\frac{t}{y}}\\
\mathbf{if}\;t \leq -19.5:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t \leq -4.5 \cdot 10^{-166}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq -2.5 \cdot 10^{-294}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;t \leq 2.85 \cdot 10^{-5}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if t < -19.5 or 2.8500000000000002e-5 < t Initial program 99.1%
associate-/r/99.1%
Simplified99.1%
Taylor expanded in z around 0 75.6%
Taylor expanded in t around inf 75.4%
*-commutative75.4%
associate-/l*84.2%
Simplified84.2%
if -19.5 < t < -4.4999999999999998e-166 or -2.5000000000000001e-294 < t < 2.8500000000000002e-5Initial program 96.7%
associate-/r/100.0%
Simplified100.0%
Taylor expanded in z around 0 79.2%
Taylor expanded in t around 0 78.7%
if -4.4999999999999998e-166 < t < -2.5000000000000001e-294Initial program 97.1%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in z around inf 71.9%
Final simplification80.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -3.2e+24) (not (<= z 15000000000.0))) (+ x (/ (- z y) (/ (- z) a))) (- x (/ a (/ (+ t 1.0) y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -3.2e+24) || !(z <= 15000000000.0)) {
tmp = x + ((z - y) / (-z / a));
} else {
tmp = x - (a / ((t + 1.0) / y));
}
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 <= (-3.2d+24)) .or. (.not. (z <= 15000000000.0d0))) then
tmp = x + ((z - y) / (-z / a))
else
tmp = x - (a / ((t + 1.0d0) / y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -3.2e+24) || !(z <= 15000000000.0)) {
tmp = x + ((z - y) / (-z / a));
} else {
tmp = x - (a / ((t + 1.0) / y));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -3.2e+24) or not (z <= 15000000000.0): tmp = x + ((z - y) / (-z / a)) else: tmp = x - (a / ((t + 1.0) / y)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -3.2e+24) || !(z <= 15000000000.0)) tmp = Float64(x + Float64(Float64(z - y) / Float64(Float64(-z) / a))); else tmp = Float64(x - Float64(a / Float64(Float64(t + 1.0) / y))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -3.2e+24) || ~((z <= 15000000000.0))) tmp = x + ((z - y) / (-z / a)); else tmp = x - (a / ((t + 1.0) / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -3.2e+24], N[Not[LessEqual[z, 15000000000.0]], $MachinePrecision]], N[(x + N[(N[(z - y), $MachinePrecision] / N[((-z) / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(a / N[(N[(t + 1.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.2 \cdot 10^{+24} \lor \neg \left(z \leq 15000000000\right):\\
\;\;\;\;x + \frac{z - y}{\frac{-z}{a}}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{a}{\frac{t + 1}{y}}\\
\end{array}
\end{array}
if z < -3.1999999999999997e24 or 1.5e10 < z Initial program 95.8%
Taylor expanded in z around inf 83.0%
mul-1-neg83.0%
distribute-neg-frac83.0%
Simplified83.0%
if -3.1999999999999997e24 < z < 1.5e10Initial program 99.8%
associate-/r/99.2%
Simplified99.2%
Taylor expanded in z around 0 91.9%
associate-/l*96.5%
Simplified96.5%
Final simplification90.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.8e+98) (not (<= z 8.6e+145))) (- x a) (- x (/ a (/ (+ t 1.0) y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.8e+98) || !(z <= 8.6e+145)) {
tmp = x - a;
} else {
tmp = x - (a / ((t + 1.0) / y));
}
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.8d+98)) .or. (.not. (z <= 8.6d+145))) then
tmp = x - a
else
tmp = x - (a / ((t + 1.0d0) / y))
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.8e+98) || !(z <= 8.6e+145)) {
tmp = x - a;
} else {
tmp = x - (a / ((t + 1.0) / y));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.8e+98) or not (z <= 8.6e+145): tmp = x - a else: tmp = x - (a / ((t + 1.0) / y)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.8e+98) || !(z <= 8.6e+145)) tmp = Float64(x - a); else tmp = Float64(x - Float64(a / Float64(Float64(t + 1.0) / y))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -1.8e+98) || ~((z <= 8.6e+145))) tmp = x - a; else tmp = x - (a / ((t + 1.0) / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.8e+98], N[Not[LessEqual[z, 8.6e+145]], $MachinePrecision]], N[(x - a), $MachinePrecision], N[(x - N[(a / N[(N[(t + 1.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.8 \cdot 10^{+98} \lor \neg \left(z \leq 8.6 \cdot 10^{+145}\right):\\
\;\;\;\;x - a\\
\mathbf{else}:\\
\;\;\;\;x - \frac{a}{\frac{t + 1}{y}}\\
\end{array}
\end{array}
if z < -1.7999999999999999e98 or 8.59999999999999996e145 < z Initial program 95.0%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in z around inf 84.8%
if -1.7999999999999999e98 < z < 8.59999999999999996e145Initial program 99.3%
associate-/r/99.3%
Simplified99.3%
Taylor expanded in z around 0 85.2%
associate-/l*90.9%
Simplified90.9%
Final simplification89.1%
(FPCore (x y z t a) :precision binary64 (+ x (* a (/ (- z y) (+ (- t z) 1.0)))))
double code(double x, double y, double z, double t, double a) {
return x + (a * ((z - y) / ((t - z) + 1.0)));
}
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 * ((z - y) / ((t - z) + 1.0d0)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (a * ((z - y) / ((t - z) + 1.0)));
}
def code(x, y, z, t, a): return x + (a * ((z - y) / ((t - z) + 1.0)))
function code(x, y, z, t, a) return Float64(x + Float64(a * Float64(Float64(z - y) / Float64(Float64(t - z) + 1.0)))) end
function tmp = code(x, y, z, t, a) tmp = x + (a * ((z - y) / ((t - z) + 1.0))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(a * N[(N[(z - y), $MachinePrecision] / N[(N[(t - z), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + a \cdot \frac{z - y}{\left(t - z\right) + 1}
\end{array}
Initial program 98.0%
associate-/r/99.5%
Simplified99.5%
Final simplification99.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -80000.0) (not (<= z 3e-12))) (- x a) (- x (* a y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -80000.0) || !(z <= 3e-12)) {
tmp = x - a;
} else {
tmp = x - (a * y);
}
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 <= (-80000.0d0)) .or. (.not. (z <= 3d-12))) then
tmp = x - a
else
tmp = x - (a * y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -80000.0) || !(z <= 3e-12)) {
tmp = x - a;
} else {
tmp = x - (a * y);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -80000.0) or not (z <= 3e-12): tmp = x - a else: tmp = x - (a * y) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -80000.0) || !(z <= 3e-12)) tmp = Float64(x - a); else tmp = Float64(x - Float64(a * y)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -80000.0) || ~((z <= 3e-12))) tmp = x - a; else tmp = x - (a * y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -80000.0], N[Not[LessEqual[z, 3e-12]], $MachinePrecision]], N[(x - a), $MachinePrecision], N[(x - N[(a * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -80000 \lor \neg \left(z \leq 3 \cdot 10^{-12}\right):\\
\;\;\;\;x - a\\
\mathbf{else}:\\
\;\;\;\;x - a \cdot y\\
\end{array}
\end{array}
if z < -8e4 or 3.0000000000000001e-12 < z Initial program 96.0%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in z around inf 76.0%
if -8e4 < z < 3.0000000000000001e-12Initial program 99.8%
associate-/r/99.2%
Simplified99.2%
Taylor expanded in z around 0 93.5%
Taylor expanded in t around 0 74.5%
Final simplification75.2%
(FPCore (x y z t a) :precision binary64 (if (<= z -2e+19) (- x a) (if (<= z 1.85e-12) x (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2e+19) {
tmp = x - a;
} else if (z <= 1.85e-12) {
tmp = x;
} else {
tmp = x - a;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (z <= (-2d+19)) then
tmp = x - a
else if (z <= 1.85d-12) then
tmp = x
else
tmp = x - a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2e+19) {
tmp = x - a;
} else if (z <= 1.85e-12) {
tmp = x;
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -2e+19: tmp = x - a elif z <= 1.85e-12: tmp = x else: tmp = x - a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2e+19) tmp = Float64(x - a); elseif (z <= 1.85e-12) tmp = x; else tmp = Float64(x - a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -2e+19) tmp = x - a; elseif (z <= 1.85e-12) tmp = x; else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2e+19], N[(x - a), $MachinePrecision], If[LessEqual[z, 1.85e-12], x, N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2 \cdot 10^{+19}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 1.85 \cdot 10^{-12}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -2e19 or 1.84999999999999999e-12 < z Initial program 95.9%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in z around inf 76.8%
if -2e19 < z < 1.84999999999999999e-12Initial program 99.8%
associate-/r/99.2%
Simplified99.2%
Taylor expanded in x around inf 54.3%
Final simplification64.7%
(FPCore (x y z t a) :precision binary64 (if (<= a 2.25e+176) x (- a)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= 2.25e+176) {
tmp = x;
} else {
tmp = -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 (a <= 2.25d+176) then
tmp = x
else
tmp = -a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= 2.25e+176) {
tmp = x;
} else {
tmp = -a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= 2.25e+176: tmp = x else: tmp = -a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= 2.25e+176) tmp = x; else tmp = Float64(-a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= 2.25e+176) tmp = x; else tmp = -a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, 2.25e+176], x, (-a)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 2.25 \cdot 10^{+176}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;-a\\
\end{array}
\end{array}
if a < 2.25000000000000002e176Initial program 97.7%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in x around inf 58.8%
if 2.25000000000000002e176 < a Initial program 99.8%
sub-neg99.8%
+-commutative99.8%
associate-/r/96.8%
*-commutative96.8%
distribute-rgt-neg-in96.8%
fma-def96.8%
div-sub96.8%
sub-neg96.8%
+-commutative96.8%
distribute-neg-in96.8%
remove-double-neg96.8%
sub-neg96.8%
div-sub96.8%
Simplified96.8%
Taylor expanded in a around -inf 47.0%
associate-/l*83.1%
associate-/r/86.1%
associate--l+86.1%
Simplified86.1%
Taylor expanded in z around inf 32.8%
mul-1-neg32.8%
Simplified32.8%
Final simplification55.6%
(FPCore (x y z t a) :precision binary64 x)
double code(double x, double y, double z, double t, double a) {
return x;
}
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
end function
public static double code(double x, double y, double z, double t, double a) {
return x;
}
def code(x, y, z, t, a): return x
function code(x, y, z, t, a) return x end
function tmp = code(x, y, z, t, a) tmp = x; end
code[x_, y_, z_, t_, a_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 98.0%
associate-/r/99.5%
Simplified99.5%
Taylor expanded in x around inf 53.2%
Final simplification53.2%
(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 2023240
(FPCore (x y z t a)
:name "Graphics.Rendering.Chart.SparkLine:renderSparkLine from Chart-1.5.3"
:precision binary64
:herbie-target
(- x (* (/ (- y z) (+ (- t z) 1.0)) a))
(- x (/ (- y z) (/ (+ (- t z) 1.0) a))))