
(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 (/ (- 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 97.6%
sub-neg97.6%
+-commutative97.6%
associate-/r/99.1%
distribute-lft-neg-in99.1%
fma-define99.2%
distribute-neg-frac299.2%
distribute-neg-in99.2%
sub-neg99.2%
distribute-neg-in99.2%
remove-double-neg99.2%
+-commutative99.2%
sub-neg99.2%
metadata-eval99.2%
Simplified99.2%
Final simplification99.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* z (/ a (- (+ t 1.0) z))))))
(if (<= z -7.8e-10)
t_1
(if (<= z 1.06e-32)
(- x (* a (/ y (+ t 1.0))))
(if (<= z 2.6e+45) t_1 (+ x (* a (+ -1.0 (/ y z)))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (z * (a / ((t + 1.0) - z)));
double tmp;
if (z <= -7.8e-10) {
tmp = t_1;
} else if (z <= 1.06e-32) {
tmp = x - (a * (y / (t + 1.0)));
} else if (z <= 2.6e+45) {
tmp = t_1;
} else {
tmp = x + (a * (-1.0 + (y / 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) :: t_1
real(8) :: tmp
t_1 = x + (z * (a / ((t + 1.0d0) - z)))
if (z <= (-7.8d-10)) then
tmp = t_1
else if (z <= 1.06d-32) then
tmp = x - (a * (y / (t + 1.0d0)))
else if (z <= 2.6d+45) then
tmp = t_1
else
tmp = x + (a * ((-1.0d0) + (y / z)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = x + (z * (a / ((t + 1.0) - z)));
double tmp;
if (z <= -7.8e-10) {
tmp = t_1;
} else if (z <= 1.06e-32) {
tmp = x - (a * (y / (t + 1.0)));
} else if (z <= 2.6e+45) {
tmp = t_1;
} else {
tmp = x + (a * (-1.0 + (y / z)));
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + (z * (a / ((t + 1.0) - z))) tmp = 0 if z <= -7.8e-10: tmp = t_1 elif z <= 1.06e-32: tmp = x - (a * (y / (t + 1.0))) elif z <= 2.6e+45: tmp = t_1 else: tmp = x + (a * (-1.0 + (y / z))) return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(z * Float64(a / Float64(Float64(t + 1.0) - z)))) tmp = 0.0 if (z <= -7.8e-10) tmp = t_1; elseif (z <= 1.06e-32) tmp = Float64(x - Float64(a * Float64(y / Float64(t + 1.0)))); elseif (z <= 2.6e+45) tmp = t_1; else tmp = Float64(x + Float64(a * Float64(-1.0 + Float64(y / z)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + (z * (a / ((t + 1.0) - z))); tmp = 0.0; if (z <= -7.8e-10) tmp = t_1; elseif (z <= 1.06e-32) tmp = x - (a * (y / (t + 1.0))); elseif (z <= 2.6e+45) tmp = t_1; else tmp = x + (a * (-1.0 + (y / z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(z * N[(a / N[(N[(t + 1.0), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -7.8e-10], t$95$1, If[LessEqual[z, 1.06e-32], N[(x - N[(a * N[(y / N[(t + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.6e+45], t$95$1, N[(x + N[(a * N[(-1.0 + N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + z \cdot \frac{a}{\left(t + 1\right) - z}\\
\mathbf{if}\;z \leq -7.8 \cdot 10^{-10}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.06 \cdot 10^{-32}:\\
\;\;\;\;x - a \cdot \frac{y}{t + 1}\\
\mathbf{elif}\;z \leq 2.6 \cdot 10^{+45}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x + a \cdot \left(-1 + \frac{y}{z}\right)\\
\end{array}
\end{array}
if z < -7.7999999999999999e-10 or 1.05999999999999994e-32 < z < 2.60000000000000007e45Initial program 94.9%
associate-/r/99.8%
Simplified99.8%
Taylor expanded in y around 0 75.9%
mul-1-neg75.9%
*-commutative75.9%
associate--l+75.9%
+-commutative75.9%
associate-*r/86.9%
distribute-rgt-neg-in86.9%
distribute-neg-frac86.9%
+-commutative86.9%
associate--l+86.9%
Simplified86.9%
if -7.7999999999999999e-10 < z < 1.05999999999999994e-32Initial program 99.8%
associate-/r/98.4%
Simplified98.4%
Taylor expanded in z around 0 94.5%
if 2.60000000000000007e45 < z Initial program 96.5%
associate-/r/99.8%
Simplified99.8%
Taylor expanded in z around inf 87.7%
associate--l+87.7%
associate-*r/87.7%
associate-*r/87.7%
mul-1-neg87.7%
div-sub87.7%
mul-1-neg87.7%
distribute-lft-out--87.7%
associate-*r/87.7%
mul-1-neg87.7%
unsub-neg87.7%
sub-neg87.7%
mul-1-neg87.7%
distribute-lft-in87.7%
metadata-eval87.7%
mul-1-neg87.7%
unsub-neg87.7%
Simplified87.7%
Taylor expanded in y around inf 90.3%
Final simplification91.2%
(FPCore (x y z t a)
:precision binary64
(if (<= t -1.2e+66)
(- x (/ (- y z) (/ t a)))
(if (<= t -6.5e-11)
(+ x (* a (+ -1.0 (/ y z))))
(if (<= t 3.1e+34)
(+ x (/ (* (- y z) a) (+ z -1.0)))
(+ x (* (/ a t) (- z y)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.2e+66) {
tmp = x - ((y - z) / (t / a));
} else if (t <= -6.5e-11) {
tmp = x + (a * (-1.0 + (y / z)));
} else if (t <= 3.1e+34) {
tmp = x + (((y - z) * a) / (z + -1.0));
} else {
tmp = x + ((a / t) * (z - 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 (t <= (-1.2d+66)) then
tmp = x - ((y - z) / (t / a))
else if (t <= (-6.5d-11)) then
tmp = x + (a * ((-1.0d0) + (y / z)))
else if (t <= 3.1d+34) then
tmp = x + (((y - z) * a) / (z + (-1.0d0)))
else
tmp = x + ((a / t) * (z - y))
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.2e+66) {
tmp = x - ((y - z) / (t / a));
} else if (t <= -6.5e-11) {
tmp = x + (a * (-1.0 + (y / z)));
} else if (t <= 3.1e+34) {
tmp = x + (((y - z) * a) / (z + -1.0));
} else {
tmp = x + ((a / t) * (z - y));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -1.2e+66: tmp = x - ((y - z) / (t / a)) elif t <= -6.5e-11: tmp = x + (a * (-1.0 + (y / z))) elif t <= 3.1e+34: tmp = x + (((y - z) * a) / (z + -1.0)) else: tmp = x + ((a / t) * (z - y)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -1.2e+66) tmp = Float64(x - Float64(Float64(y - z) / Float64(t / a))); elseif (t <= -6.5e-11) tmp = Float64(x + Float64(a * Float64(-1.0 + Float64(y / z)))); elseif (t <= 3.1e+34) tmp = Float64(x + Float64(Float64(Float64(y - z) * a) / Float64(z + -1.0))); else tmp = Float64(x + Float64(Float64(a / t) * Float64(z - y))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -1.2e+66) tmp = x - ((y - z) / (t / a)); elseif (t <= -6.5e-11) tmp = x + (a * (-1.0 + (y / z))); elseif (t <= 3.1e+34) tmp = x + (((y - z) * a) / (z + -1.0)); else tmp = x + ((a / t) * (z - y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1.2e+66], N[(x - N[(N[(y - z), $MachinePrecision] / N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -6.5e-11], N[(x + N[(a * N[(-1.0 + N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 3.1e+34], N[(x + N[(N[(N[(y - z), $MachinePrecision] * a), $MachinePrecision] / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(a / t), $MachinePrecision] * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.2 \cdot 10^{+66}:\\
\;\;\;\;x - \frac{y - z}{\frac{t}{a}}\\
\mathbf{elif}\;t \leq -6.5 \cdot 10^{-11}:\\
\;\;\;\;x + a \cdot \left(-1 + \frac{y}{z}\right)\\
\mathbf{elif}\;t \leq 3.1 \cdot 10^{+34}:\\
\;\;\;\;x + \frac{\left(y - z\right) \cdot a}{z + -1}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{a}{t} \cdot \left(z - y\right)\\
\end{array}
\end{array}
if t < -1.2000000000000001e66Initial program 95.6%
Taylor expanded in t around inf 88.2%
if -1.2000000000000001e66 < t < -6.49999999999999953e-11Initial program 94.3%
associate-/r/99.7%
Simplified99.7%
Taylor expanded in z around inf 82.3%
associate--l+82.3%
associate-*r/82.3%
associate-*r/82.3%
mul-1-neg82.3%
div-sub82.3%
mul-1-neg82.3%
distribute-lft-out--82.3%
associate-*r/82.3%
mul-1-neg82.3%
unsub-neg82.3%
sub-neg82.3%
mul-1-neg82.3%
distribute-lft-in82.3%
metadata-eval82.3%
mul-1-neg82.3%
unsub-neg82.3%
Simplified82.3%
Taylor expanded in y around inf 82.8%
if -6.49999999999999953e-11 < t < 3.09999999999999977e34Initial program 98.6%
associate-/r/100.0%
Simplified100.0%
Taylor expanded in t around 0 91.0%
if 3.09999999999999977e34 < t Initial program 97.7%
associate-/r/97.6%
Simplified97.6%
Taylor expanded in t around inf 79.7%
*-commutative79.7%
*-un-lft-identity79.7%
times-frac87.8%
Applied egg-rr87.8%
Final simplification89.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -14.2) (not (<= z 2.4e-5))) (+ x (* a (+ -1.0 (/ y z)))) (- x (* a (/ y (+ t 1.0))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -14.2) || !(z <= 2.4e-5)) {
tmp = x + (a * (-1.0 + (y / z)));
} else {
tmp = x - (a * (y / (t + 1.0)));
}
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 <= (-14.2d0)) .or. (.not. (z <= 2.4d-5))) then
tmp = x + (a * ((-1.0d0) + (y / z)))
else
tmp = x - (a * (y / (t + 1.0d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -14.2) || !(z <= 2.4e-5)) {
tmp = x + (a * (-1.0 + (y / z)));
} else {
tmp = x - (a * (y / (t + 1.0)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -14.2) or not (z <= 2.4e-5): tmp = x + (a * (-1.0 + (y / z))) else: tmp = x - (a * (y / (t + 1.0))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -14.2) || !(z <= 2.4e-5)) tmp = Float64(x + Float64(a * Float64(-1.0 + Float64(y / z)))); else tmp = Float64(x - Float64(a * Float64(y / Float64(t + 1.0)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -14.2) || ~((z <= 2.4e-5))) tmp = x + (a * (-1.0 + (y / z))); else tmp = x - (a * (y / (t + 1.0))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -14.2], N[Not[LessEqual[z, 2.4e-5]], $MachinePrecision]], N[(x + N[(a * N[(-1.0 + N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(a * N[(y / N[(t + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -14.2 \lor \neg \left(z \leq 2.4 \cdot 10^{-5}\right):\\
\;\;\;\;x + a \cdot \left(-1 + \frac{y}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;x - a \cdot \frac{y}{t + 1}\\
\end{array}
\end{array}
if z < -14.199999999999999 or 2.4000000000000001e-5 < z Initial program 95.3%
associate-/r/99.8%
Simplified99.8%
Taylor expanded in z around inf 80.7%
associate--l+80.7%
associate-*r/80.7%
associate-*r/80.7%
mul-1-neg80.7%
div-sub80.7%
mul-1-neg80.7%
distribute-lft-out--80.7%
associate-*r/80.7%
mul-1-neg80.7%
unsub-neg80.7%
sub-neg80.7%
mul-1-neg80.7%
distribute-lft-in80.7%
metadata-eval80.7%
mul-1-neg80.7%
unsub-neg80.7%
Simplified80.7%
Taylor expanded in y around inf 82.1%
if -14.199999999999999 < z < 2.4000000000000001e-5Initial program 99.8%
associate-/r/98.5%
Simplified98.5%
Taylor expanded in z around 0 93.2%
Final simplification87.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -6.5e-25) (not (<= z 2.4e-5))) (+ x (* a (+ -1.0 (/ y z)))) (- x (* y a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -6.5e-25) || !(z <= 2.4e-5)) {
tmp = x + (a * (-1.0 + (y / z)));
} else {
tmp = x - (y * 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 <= (-6.5d-25)) .or. (.not. (z <= 2.4d-5))) then
tmp = x + (a * ((-1.0d0) + (y / z)))
else
tmp = x - (y * 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 <= -6.5e-25) || !(z <= 2.4e-5)) {
tmp = x + (a * (-1.0 + (y / z)));
} else {
tmp = x - (y * a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -6.5e-25) or not (z <= 2.4e-5): tmp = x + (a * (-1.0 + (y / z))) else: tmp = x - (y * a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -6.5e-25) || !(z <= 2.4e-5)) tmp = Float64(x + Float64(a * Float64(-1.0 + Float64(y / z)))); else tmp = Float64(x - Float64(y * a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -6.5e-25) || ~((z <= 2.4e-5))) tmp = x + (a * (-1.0 + (y / z))); else tmp = x - (y * a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -6.5e-25], N[Not[LessEqual[z, 2.4e-5]], $MachinePrecision]], N[(x + N[(a * N[(-1.0 + N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(y * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.5 \cdot 10^{-25} \lor \neg \left(z \leq 2.4 \cdot 10^{-5}\right):\\
\;\;\;\;x + a \cdot \left(-1 + \frac{y}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;x - y \cdot a\\
\end{array}
\end{array}
if z < -6.5e-25 or 2.4000000000000001e-5 < z Initial program 95.5%
associate-/r/99.8%
Simplified99.8%
Taylor expanded in z around inf 79.2%
associate--l+79.2%
associate-*r/79.2%
associate-*r/79.2%
mul-1-neg79.2%
div-sub79.2%
mul-1-neg79.2%
distribute-lft-out--79.2%
associate-*r/79.2%
mul-1-neg79.2%
unsub-neg79.2%
sub-neg79.2%
mul-1-neg79.2%
distribute-lft-in79.2%
metadata-eval79.2%
mul-1-neg79.2%
unsub-neg79.2%
Simplified79.2%
Taylor expanded in y around inf 80.7%
if -6.5e-25 < z < 2.4000000000000001e-5Initial program 99.8%
associate-/r/98.4%
Simplified98.4%
Taylor expanded in t around 0 79.1%
Taylor expanded in z around 0 76.2%
Final simplification78.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -7.5e-9) (not (<= z 2.4e-5))) (- x a) (- x (* y a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -7.5e-9) || !(z <= 2.4e-5)) {
tmp = x - a;
} else {
tmp = x - (y * 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 <= (-7.5d-9)) .or. (.not. (z <= 2.4d-5))) then
tmp = x - a
else
tmp = x - (y * 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 <= -7.5e-9) || !(z <= 2.4e-5)) {
tmp = x - a;
} else {
tmp = x - (y * a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -7.5e-9) or not (z <= 2.4e-5): tmp = x - a else: tmp = x - (y * a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -7.5e-9) || !(z <= 2.4e-5)) tmp = Float64(x - a); else tmp = Float64(x - Float64(y * a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -7.5e-9) || ~((z <= 2.4e-5))) tmp = x - a; else tmp = x - (y * a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -7.5e-9], N[Not[LessEqual[z, 2.4e-5]], $MachinePrecision]], N[(x - a), $MachinePrecision], N[(x - N[(y * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.5 \cdot 10^{-9} \lor \neg \left(z \leq 2.4 \cdot 10^{-5}\right):\\
\;\;\;\;x - a\\
\mathbf{else}:\\
\;\;\;\;x - y \cdot a\\
\end{array}
\end{array}
if z < -7.49999999999999933e-9 or 2.4000000000000001e-5 < z Initial program 95.4%
associate-/r/99.8%
Simplified99.8%
Taylor expanded in z around inf 72.8%
if -7.49999999999999933e-9 < z < 2.4000000000000001e-5Initial program 99.8%
associate-/r/98.4%
Simplified98.4%
Taylor expanded in t around 0 79.6%
Taylor expanded in z around 0 76.0%
Final simplification74.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -9.4e-26) (not (<= z 2.4e-5))) (- x a) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -9.4e-26) || !(z <= 2.4e-5)) {
tmp = x - a;
} else {
tmp = 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 <= (-9.4d-26)) .or. (.not. (z <= 2.4d-5))) then
tmp = x - a
else
tmp = 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 <= -9.4e-26) || !(z <= 2.4e-5)) {
tmp = x - a;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -9.4e-26) or not (z <= 2.4e-5): tmp = x - a else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -9.4e-26) || !(z <= 2.4e-5)) tmp = Float64(x - a); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -9.4e-26) || ~((z <= 2.4e-5))) tmp = x - a; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -9.4e-26], N[Not[LessEqual[z, 2.4e-5]], $MachinePrecision]], N[(x - a), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.4 \cdot 10^{-26} \lor \neg \left(z \leq 2.4 \cdot 10^{-5}\right):\\
\;\;\;\;x - a\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -9.39999999999999979e-26 or 2.4000000000000001e-5 < z Initial program 95.5%
associate-/r/99.8%
Simplified99.8%
Taylor expanded in z around inf 72.0%
if -9.39999999999999979e-26 < z < 2.4000000000000001e-5Initial program 99.8%
sub-neg99.8%
+-commutative99.8%
associate-/r/98.4%
distribute-lft-neg-in98.4%
fma-define98.4%
distribute-neg-frac298.4%
distribute-neg-in98.4%
sub-neg98.4%
distribute-neg-in98.4%
remove-double-neg98.4%
+-commutative98.4%
sub-neg98.4%
metadata-eval98.4%
Simplified98.4%
Taylor expanded in t around inf 50.2%
Final simplification61.5%
(FPCore (x y z t a) :precision binary64 (+ x (* a (/ (- y z) (+ -1.0 (- z t))))))
double code(double x, double y, double z, double t, double a) {
return x + (a * ((y - z) / (-1.0 + (z - t))));
}
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 * ((y - z) / ((-1.0d0) + (z - t))))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (a * ((y - z) / (-1.0 + (z - t))));
}
def code(x, y, z, t, a): return x + (a * ((y - z) / (-1.0 + (z - t))))
function code(x, y, z, t, a) return Float64(x + Float64(a * Float64(Float64(y - z) / Float64(-1.0 + Float64(z - t))))) end
function tmp = code(x, y, z, t, a) tmp = x + (a * ((y - z) / (-1.0 + (z - t)))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(a * N[(N[(y - z), $MachinePrecision] / N[(-1.0 + N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + a \cdot \frac{y - z}{-1 + \left(z - t\right)}
\end{array}
Initial program 97.6%
associate-/r/99.1%
Simplified99.1%
Final simplification99.1%
(FPCore (x y z t a) :precision binary64 (if (<= x -3.8e-237) x (if (<= x 4.3e-175) (- a) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -3.8e-237) {
tmp = x;
} else if (x <= 4.3e-175) {
tmp = -a;
} else {
tmp = 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 (x <= (-3.8d-237)) then
tmp = x
else if (x <= 4.3d-175) then
tmp = -a
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -3.8e-237) {
tmp = x;
} else if (x <= 4.3e-175) {
tmp = -a;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -3.8e-237: tmp = x elif x <= 4.3e-175: tmp = -a else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -3.8e-237) tmp = x; elseif (x <= 4.3e-175) tmp = Float64(-a); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (x <= -3.8e-237) tmp = x; elseif (x <= 4.3e-175) tmp = -a; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -3.8e-237], x, If[LessEqual[x, 4.3e-175], (-a), x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.8 \cdot 10^{-237}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 4.3 \cdot 10^{-175}:\\
\;\;\;\;-a\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -3.80000000000000024e-237 or 4.29999999999999998e-175 < x Initial program 98.9%
sub-neg98.9%
+-commutative98.9%
associate-/r/99.5%
distribute-lft-neg-in99.5%
fma-define99.5%
distribute-neg-frac299.5%
distribute-neg-in99.5%
sub-neg99.5%
distribute-neg-in99.5%
remove-double-neg99.5%
+-commutative99.5%
sub-neg99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in t around inf 58.5%
if -3.80000000000000024e-237 < x < 4.29999999999999998e-175Initial program 92.2%
sub-neg92.2%
+-commutative92.2%
associate-/r/97.9%
distribute-lft-neg-in97.9%
fma-define97.9%
distribute-neg-frac297.9%
distribute-neg-in97.9%
sub-neg97.9%
distribute-neg-in97.9%
remove-double-neg97.9%
+-commutative97.9%
sub-neg97.9%
metadata-eval97.9%
Simplified97.9%
Taylor expanded in a around inf 94.3%
div-sub94.3%
Simplified94.3%
Taylor expanded in z around inf 36.8%
neg-mul-136.8%
Simplified36.8%
(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 97.6%
sub-neg97.6%
+-commutative97.6%
associate-/r/99.1%
distribute-lft-neg-in99.1%
fma-define99.2%
distribute-neg-frac299.2%
distribute-neg-in99.2%
sub-neg99.2%
distribute-neg-in99.2%
remove-double-neg99.2%
+-commutative99.2%
sub-neg99.2%
metadata-eval99.2%
Simplified99.2%
Taylor expanded in t around inf 48.3%
(FPCore (x y z t a) :precision binary64 (- x (* (/ (- y z) (+ (- t z) 1.0)) a)))
double code(double x, double y, double z, double t, double a) {
return x - (((y - z) / ((t - z) + 1.0)) * a);
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x - (((y - z) / ((t - z) + 1.0d0)) * a)
end function
public static double code(double x, double y, double z, double t, double a) {
return x - (((y - z) / ((t - z) + 1.0)) * a);
}
def code(x, y, z, t, a): return x - (((y - z) / ((t - z) + 1.0)) * a)
function code(x, y, z, t, a) return Float64(x - Float64(Float64(Float64(y - z) / Float64(Float64(t - z) + 1.0)) * a)) end
function tmp = code(x, y, z, t, a) tmp = x - (((y - z) / ((t - z) + 1.0)) * a); end
code[x_, y_, z_, t_, a_] := N[(x - N[(N[(N[(y - z), $MachinePrecision] / N[(N[(t - z), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{y - z}{\left(t - z\right) + 1} \cdot a
\end{array}
herbie shell --seed 2024137
(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))))