
(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 (- t z))) a x))
double code(double x, double y, double z, double t, double a) {
return fma(((y - z) / (-1.0 - (t - z))), a, x);
}
function code(x, y, z, t, a) return fma(Float64(Float64(y - z) / Float64(-1.0 - Float64(t - z))), a, x) end
code[x_, y_, z_, t_, a_] := N[(N[(N[(y - z), $MachinePrecision] / N[(-1.0 - N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{y - z}{-1 - \left(t - z\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
(if (<= z -2.2e-8)
(+ x (/ a (+ -1.0 (/ t z))))
(if (<= z 1.06e-32)
(+ x (* a (/ y (- -1.0 t))))
(if (<= z 2.6e+45)
(+ x (* z (/ a (- (+ t 1.0) z))))
(+ x (- (* a (/ y z)) a))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.2e-8) {
tmp = x + (a / (-1.0 + (t / z)));
} else if (z <= 1.06e-32) {
tmp = x + (a * (y / (-1.0 - t)));
} else if (z <= 2.6e+45) {
tmp = x + (z * (a / ((t + 1.0) - z)));
} else {
tmp = x + ((a * (y / z)) - 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 <= (-2.2d-8)) then
tmp = x + (a / ((-1.0d0) + (t / z)))
else if (z <= 1.06d-32) then
tmp = x + (a * (y / ((-1.0d0) - t)))
else if (z <= 2.6d+45) then
tmp = x + (z * (a / ((t + 1.0d0) - z)))
else
tmp = x + ((a * (y / z)) - 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 <= -2.2e-8) {
tmp = x + (a / (-1.0 + (t / z)));
} else if (z <= 1.06e-32) {
tmp = x + (a * (y / (-1.0 - t)));
} else if (z <= 2.6e+45) {
tmp = x + (z * (a / ((t + 1.0) - z)));
} else {
tmp = x + ((a * (y / z)) - a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -2.2e-8: tmp = x + (a / (-1.0 + (t / z))) elif z <= 1.06e-32: tmp = x + (a * (y / (-1.0 - t))) elif z <= 2.6e+45: tmp = x + (z * (a / ((t + 1.0) - z))) else: tmp = x + ((a * (y / z)) - a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.2e-8) tmp = Float64(x + Float64(a / Float64(-1.0 + Float64(t / z)))); elseif (z <= 1.06e-32) tmp = Float64(x + Float64(a * Float64(y / Float64(-1.0 - t)))); elseif (z <= 2.6e+45) tmp = Float64(x + Float64(z * Float64(a / Float64(Float64(t + 1.0) - z)))); else tmp = Float64(x + Float64(Float64(a * Float64(y / z)) - a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -2.2e-8) tmp = x + (a / (-1.0 + (t / z))); elseif (z <= 1.06e-32) tmp = x + (a * (y / (-1.0 - t))); elseif (z <= 2.6e+45) tmp = x + (z * (a / ((t + 1.0) - z))); else tmp = x + ((a * (y / z)) - a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.2e-8], N[(x + N[(a / N[(-1.0 + N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.06e-32], N[(x + N[(a * N[(y / N[(-1.0 - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.6e+45], N[(x + N[(z * N[(a / N[(N[(t + 1.0), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(a * N[(y / z), $MachinePrecision]), $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.2 \cdot 10^{-8}:\\
\;\;\;\;x + \frac{a}{-1 + \frac{t}{z}}\\
\mathbf{elif}\;z \leq 1.06 \cdot 10^{-32}:\\
\;\;\;\;x + a \cdot \frac{y}{-1 - t}\\
\mathbf{elif}\;z \leq 2.6 \cdot 10^{+45}:\\
\;\;\;\;x + z \cdot \frac{a}{\left(t + 1\right) - z}\\
\mathbf{else}:\\
\;\;\;\;x + \left(a \cdot \frac{y}{z} - a\right)\\
\end{array}
\end{array}
if z < -2.1999999999999998e-8Initial program 93.9%
associate-/r/99.8%
Simplified99.8%
*-commutative99.8%
clear-num99.7%
un-div-inv99.8%
Applied egg-rr99.8%
Taylor expanded in z around inf 91.2%
associate--l+91.2%
associate-*r/91.2%
associate-*r/91.2%
mul-1-neg91.2%
div-sub91.2%
sub-neg91.2%
distribute-lft-in91.2%
metadata-eval91.2%
mul-1-neg91.2%
unsub-neg91.2%
remove-double-neg91.2%
Simplified91.2%
Taylor expanded in t around inf 89.6%
associate-*r/89.6%
neg-mul-189.6%
Simplified89.6%
if -2.1999999999999998e-8 < z < 1.05999999999999994e-32Initial program 99.8%
associate-/r/98.4%
Simplified98.4%
Taylor expanded in z around 0 94.5%
if 1.05999999999999994e-32 < z < 2.60000000000000007e45Initial program 99.8%
associate-/r/99.7%
Simplified99.7%
Taylor expanded in y around 0 87.6%
mul-1-neg87.6%
*-commutative87.6%
associate--l+87.6%
+-commutative87.6%
associate-*r/87.7%
distribute-rgt-neg-in87.7%
distribute-neg-frac287.7%
associate-+l-87.7%
sub-neg87.7%
metadata-eval87.7%
+-commutative87.7%
Simplified87.7%
Taylor expanded in a around 0 87.7%
if 2.60000000000000007e45 < z Initial program 96.5%
Taylor expanded in z around inf 88.8%
neg-mul-188.8%
Simplified88.8%
Taylor expanded in y around 0 84.5%
mul-1-neg84.5%
unsub-neg84.5%
associate-/l*90.3%
Simplified90.3%
Final simplification92.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -48.0) (not (<= z 2.4e-5))) (+ x (- (* a (/ y z)) a)) (+ x (* a (/ y (- -1.0 t))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -48.0) || !(z <= 2.4e-5)) {
tmp = x + ((a * (y / z)) - a);
} else {
tmp = x + (a * (y / (-1.0 - 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 <= (-48.0d0)) .or. (.not. (z <= 2.4d-5))) then
tmp = x + ((a * (y / z)) - a)
else
tmp = x + (a * (y / ((-1.0d0) - 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 <= -48.0) || !(z <= 2.4e-5)) {
tmp = x + ((a * (y / z)) - a);
} else {
tmp = x + (a * (y / (-1.0 - t)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -48.0) or not (z <= 2.4e-5): tmp = x + ((a * (y / z)) - a) else: tmp = x + (a * (y / (-1.0 - t))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -48.0) || !(z <= 2.4e-5)) tmp = Float64(x + Float64(Float64(a * Float64(y / z)) - a)); else tmp = Float64(x + Float64(a * Float64(y / Float64(-1.0 - t)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -48.0) || ~((z <= 2.4e-5))) tmp = x + ((a * (y / z)) - a); else tmp = x + (a * (y / (-1.0 - t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -48.0], N[Not[LessEqual[z, 2.4e-5]], $MachinePrecision]], N[(x + N[(N[(a * N[(y / z), $MachinePrecision]), $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision], N[(x + N[(a * N[(y / N[(-1.0 - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -48 \lor \neg \left(z \leq 2.4 \cdot 10^{-5}\right):\\
\;\;\;\;x + \left(a \cdot \frac{y}{z} - a\right)\\
\mathbf{else}:\\
\;\;\;\;x + a \cdot \frac{y}{-1 - t}\\
\end{array}
\end{array}
if z < -48 or 2.4000000000000001e-5 < z Initial program 95.3%
Taylor expanded in z around inf 79.4%
neg-mul-179.4%
Simplified79.4%
Taylor expanded in y around 0 75.3%
mul-1-neg75.3%
unsub-neg75.3%
associate-/l*82.1%
Simplified82.1%
if -48 < 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 -2.15e+52) (not (<= z 2.4e-5))) (- x a) (+ x (* a (/ y (- -1.0 t))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2.15e+52) || !(z <= 2.4e-5)) {
tmp = x - a;
} else {
tmp = x + (a * (y / (-1.0 - 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 <= (-2.15d+52)) .or. (.not. (z <= 2.4d-5))) then
tmp = x - a
else
tmp = x + (a * (y / ((-1.0d0) - 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 <= -2.15e+52) || !(z <= 2.4e-5)) {
tmp = x - a;
} else {
tmp = x + (a * (y / (-1.0 - t)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -2.15e+52) or not (z <= 2.4e-5): tmp = x - a else: tmp = x + (a * (y / (-1.0 - t))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -2.15e+52) || !(z <= 2.4e-5)) tmp = Float64(x - a); else tmp = Float64(x + Float64(a * Float64(y / Float64(-1.0 - t)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -2.15e+52) || ~((z <= 2.4e-5))) tmp = x - a; else tmp = x + (a * (y / (-1.0 - t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -2.15e+52], N[Not[LessEqual[z, 2.4e-5]], $MachinePrecision]], N[(x - a), $MachinePrecision], N[(x + N[(a * N[(y / N[(-1.0 - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.15 \cdot 10^{+52} \lor \neg \left(z \leq 2.4 \cdot 10^{-5}\right):\\
\;\;\;\;x - a\\
\mathbf{else}:\\
\;\;\;\;x + a \cdot \frac{y}{-1 - t}\\
\end{array}
\end{array}
if z < -2.15e52 or 2.4000000000000001e-5 < z Initial program 95.0%
associate-/r/99.8%
Simplified99.8%
Taylor expanded in z around inf 76.2%
if -2.15e52 < z < 2.4000000000000001e-5Initial program 99.8%
associate-/r/98.5%
Simplified98.5%
Taylor expanded in z around 0 89.3%
Final simplification83.2%
(FPCore (x y z t a) :precision binary64 (if (<= z -2.8e-9) (+ x (/ a (+ -1.0 (/ t z)))) (if (<= z 2.4e-5) (+ x (* a (/ y (- -1.0 t)))) (+ x (- (* a (/ y z)) a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.8e-9) {
tmp = x + (a / (-1.0 + (t / z)));
} else if (z <= 2.4e-5) {
tmp = x + (a * (y / (-1.0 - t)));
} else {
tmp = x + ((a * (y / z)) - 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 <= (-2.8d-9)) then
tmp = x + (a / ((-1.0d0) + (t / z)))
else if (z <= 2.4d-5) then
tmp = x + (a * (y / ((-1.0d0) - t)))
else
tmp = x + ((a * (y / z)) - 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 <= -2.8e-9) {
tmp = x + (a / (-1.0 + (t / z)));
} else if (z <= 2.4e-5) {
tmp = x + (a * (y / (-1.0 - t)));
} else {
tmp = x + ((a * (y / z)) - a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -2.8e-9: tmp = x + (a / (-1.0 + (t / z))) elif z <= 2.4e-5: tmp = x + (a * (y / (-1.0 - t))) else: tmp = x + ((a * (y / z)) - a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.8e-9) tmp = Float64(x + Float64(a / Float64(-1.0 + Float64(t / z)))); elseif (z <= 2.4e-5) tmp = Float64(x + Float64(a * Float64(y / Float64(-1.0 - t)))); else tmp = Float64(x + Float64(Float64(a * Float64(y / z)) - a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -2.8e-9) tmp = x + (a / (-1.0 + (t / z))); elseif (z <= 2.4e-5) tmp = x + (a * (y / (-1.0 - t))); else tmp = x + ((a * (y / z)) - a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.8e-9], N[(x + N[(a / N[(-1.0 + N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.4e-5], N[(x + N[(a * N[(y / N[(-1.0 - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(a * N[(y / z), $MachinePrecision]), $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.8 \cdot 10^{-9}:\\
\;\;\;\;x + \frac{a}{-1 + \frac{t}{z}}\\
\mathbf{elif}\;z \leq 2.4 \cdot 10^{-5}:\\
\;\;\;\;x + a \cdot \frac{y}{-1 - t}\\
\mathbf{else}:\\
\;\;\;\;x + \left(a \cdot \frac{y}{z} - a\right)\\
\end{array}
\end{array}
if z < -2.79999999999999984e-9Initial program 93.9%
associate-/r/99.8%
Simplified99.8%
*-commutative99.8%
clear-num99.7%
un-div-inv99.8%
Applied egg-rr99.8%
Taylor expanded in z around inf 91.2%
associate--l+91.2%
associate-*r/91.2%
associate-*r/91.2%
mul-1-neg91.2%
div-sub91.2%
sub-neg91.2%
distribute-lft-in91.2%
metadata-eval91.2%
mul-1-neg91.2%
unsub-neg91.2%
remove-double-neg91.2%
Simplified91.2%
Taylor expanded in t around inf 89.6%
associate-*r/89.6%
neg-mul-189.6%
Simplified89.6%
if -2.79999999999999984e-9 < z < 2.4000000000000001e-5Initial program 99.8%
associate-/r/98.4%
Simplified98.4%
Taylor expanded in z around 0 93.9%
if 2.4000000000000001e-5 < z Initial program 97.1%
Taylor expanded in z around inf 82.4%
neg-mul-182.4%
Simplified82.4%
Taylor expanded in y around 0 79.0%
mul-1-neg79.0%
unsub-neg79.0%
associate-/l*83.7%
Simplified83.7%
Final simplification90.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -2.2e-8) (not (<= z 1.65e-5))) (- x a) (- x (* y a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2.2e-8) || !(z <= 1.65e-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 <= (-2.2d-8)) .or. (.not. (z <= 1.65d-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 <= -2.2e-8) || !(z <= 1.65e-5)) {
tmp = x - a;
} else {
tmp = x - (y * a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -2.2e-8) or not (z <= 1.65e-5): tmp = x - a else: tmp = x - (y * a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -2.2e-8) || !(z <= 1.65e-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 <= -2.2e-8) || ~((z <= 1.65e-5))) tmp = x - a; else tmp = x - (y * a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -2.2e-8], N[Not[LessEqual[z, 1.65e-5]], $MachinePrecision]], N[(x - a), $MachinePrecision], N[(x - N[(y * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.2 \cdot 10^{-8} \lor \neg \left(z \leq 1.65 \cdot 10^{-5}\right):\\
\;\;\;\;x - a\\
\mathbf{else}:\\
\;\;\;\;x - y \cdot a\\
\end{array}
\end{array}
if z < -2.1999999999999998e-8 or 1.6500000000000001e-5 < z Initial program 95.4%
associate-/r/99.8%
Simplified99.8%
Taylor expanded in z around inf 72.8%
if -2.1999999999999998e-8 < z < 1.6500000000000001e-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 -4e-25) (not (<= z 2.4e-5))) (- x a) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -4e-25) || !(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 <= (-4d-25)) .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 <= -4e-25) || !(z <= 2.4e-5)) {
tmp = x - a;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -4e-25) 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 <= -4e-25) || !(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 <= -4e-25) || ~((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, -4e-25], N[Not[LessEqual[z, 2.4e-5]], $MachinePrecision]], N[(x - a), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4 \cdot 10^{-25} \lor \neg \left(z \leq 2.4 \cdot 10^{-5}\right):\\
\;\;\;\;x - a\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -4.00000000000000015e-25 or 2.4000000000000001e-5 < z Initial program 95.5%
associate-/r/99.8%
Simplified99.8%
Taylor expanded in z around inf 72.0%
if -4.00000000000000015e-25 < z < 2.4000000000000001e-5Initial program 99.8%
associate-/r/98.4%
Simplified98.4%
Taylor expanded in x around inf 50.2%
Final simplification61.5%
(FPCore (x y z t a) :precision binary64 (+ x (* a (/ (- y z) (- -1.0 (- t z))))))
double code(double x, double y, double z, double t, double a) {
return x + (a * ((y - z) / (-1.0 - (t - z))));
}
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) - (t - z))))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (a * ((y - z) / (-1.0 - (t - z))));
}
def code(x, y, z, t, a): return x + (a * ((y - z) / (-1.0 - (t - z))))
function code(x, y, z, t, a) return Float64(x + Float64(a * Float64(Float64(y - z) / Float64(-1.0 - Float64(t - z))))) end
function tmp = code(x, y, z, t, a) tmp = x + (a * ((y - z) / (-1.0 - (t - z)))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(a * N[(N[(y - z), $MachinePrecision] / N[(-1.0 - N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + a \cdot \frac{y - z}{-1 - \left(t - z\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 -2.3e-241) x (if (<= x 3.7e-174) (- a) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -2.3e-241) {
tmp = x;
} else if (x <= 3.7e-174) {
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 <= (-2.3d-241)) then
tmp = x
else if (x <= 3.7d-174) 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 <= -2.3e-241) {
tmp = x;
} else if (x <= 3.7e-174) {
tmp = -a;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -2.3e-241: tmp = x elif x <= 3.7e-174: tmp = -a else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -2.3e-241) tmp = x; elseif (x <= 3.7e-174) tmp = Float64(-a); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (x <= -2.3e-241) tmp = x; elseif (x <= 3.7e-174) tmp = -a; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -2.3e-241], x, If[LessEqual[x, 3.7e-174], (-a), x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.3 \cdot 10^{-241}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 3.7 \cdot 10^{-174}:\\
\;\;\;\;-a\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -2.2999999999999999e-241 or 3.7000000000000001e-174 < x Initial program 98.9%
associate-/r/99.5%
Simplified99.5%
Taylor expanded in x around inf 58.5%
if -2.2999999999999999e-241 < x < 3.7000000000000001e-174Initial program 92.2%
associate-/r/97.9%
Simplified97.9%
Taylor expanded in z around inf 36.8%
Taylor expanded in x around 0 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%
associate-/r/99.1%
Simplified99.1%
Taylor expanded in x 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))))