
(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 11 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 (/ (- z y) (+ (- t z) 1.0)) a x))
double code(double x, double y, double z, double t, double a) {
return fma(((z - y) / ((t - z) + 1.0)), a, x);
}
function code(x, y, z, t, a) return fma(Float64(Float64(z - y) / Float64(Float64(t - z) + 1.0)), a, x) end
code[x_, y_, z_, t_, a_] := N[(N[(N[(z - y), $MachinePrecision] / N[(N[(t - z), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{z - y}{\left(t - z\right) + 1}, a, x\right)
\end{array}
Initial program 97.3%
sub-neg97.3%
+-commutative97.3%
associate-/r/99.3%
distribute-lft-neg-in99.3%
fma-def99.3%
distribute-neg-frac99.3%
sub-neg99.3%
distribute-neg-in99.3%
remove-double-neg99.3%
+-commutative99.3%
sub-neg99.3%
Simplified99.3%
Final simplification99.3%
(FPCore (x y z t a)
:precision binary64
(if (<= t -1.9e+140)
(+ x (/ (- z y) (/ t a)))
(if (<= t 1.12e+128)
(- x (/ a (/ (- 1.0 z) (- y z))))
(+ x (* a (/ (- z y) t))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.9e+140) {
tmp = x + ((z - y) / (t / a));
} else if (t <= 1.12e+128) {
tmp = x - (a / ((1.0 - z) / (y - z)));
} else {
tmp = x + (a * ((z - y) / 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 (t <= (-1.9d+140)) then
tmp = x + ((z - y) / (t / a))
else if (t <= 1.12d+128) then
tmp = x - (a / ((1.0d0 - z) / (y - z)))
else
tmp = x + (a * ((z - y) / t))
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.9e+140) {
tmp = x + ((z - y) / (t / a));
} else if (t <= 1.12e+128) {
tmp = x - (a / ((1.0 - z) / (y - z)));
} else {
tmp = x + (a * ((z - y) / t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -1.9e+140: tmp = x + ((z - y) / (t / a)) elif t <= 1.12e+128: tmp = x - (a / ((1.0 - z) / (y - z))) else: tmp = x + (a * ((z - y) / t)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -1.9e+140) tmp = Float64(x + Float64(Float64(z - y) / Float64(t / a))); elseif (t <= 1.12e+128) tmp = Float64(x - Float64(a / Float64(Float64(1.0 - z) / Float64(y - z)))); else tmp = Float64(x + Float64(a * Float64(Float64(z - y) / t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -1.9e+140) tmp = x + ((z - y) / (t / a)); elseif (t <= 1.12e+128) tmp = x - (a / ((1.0 - z) / (y - z))); else tmp = x + (a * ((z - y) / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1.9e+140], N[(x + N[(N[(z - y), $MachinePrecision] / N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.12e+128], N[(x - N[(a / N[(N[(1.0 - z), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(a * N[(N[(z - y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.9 \cdot 10^{+140}:\\
\;\;\;\;x + \frac{z - y}{\frac{t}{a}}\\
\mathbf{elif}\;t \leq 1.12 \cdot 10^{+128}:\\
\;\;\;\;x - \frac{a}{\frac{1 - z}{y - z}}\\
\mathbf{else}:\\
\;\;\;\;x + a \cdot \frac{z - y}{t}\\
\end{array}
\end{array}
if t < -1.9e140Initial program 95.0%
Taylor expanded in t around inf 86.9%
if -1.9e140 < t < 1.1200000000000001e128Initial program 97.7%
associate-/r/100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in t around 0 81.2%
associate-/l*96.0%
Simplified96.0%
if 1.1200000000000001e128 < t Initial program 97.7%
associate-/r/98.2%
*-commutative98.2%
Simplified98.2%
Taylor expanded in t around inf 87.4%
Final simplification93.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -18000000000.0) (not (<= z 7.8e+27))) (+ x (/ (- z y) (/ (- z) a))) (- x (/ (* y a) (+ t 1.0)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -18000000000.0) || !(z <= 7.8e+27)) {
tmp = x + ((z - y) / (-z / a));
} else {
tmp = x - ((y * a) / (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 <= (-18000000000.0d0)) .or. (.not. (z <= 7.8d+27))) then
tmp = x + ((z - y) / (-z / a))
else
tmp = x - ((y * a) / (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 <= -18000000000.0) || !(z <= 7.8e+27)) {
tmp = x + ((z - y) / (-z / a));
} else {
tmp = x - ((y * a) / (t + 1.0));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -18000000000.0) or not (z <= 7.8e+27): tmp = x + ((z - y) / (-z / a)) else: tmp = x - ((y * a) / (t + 1.0)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -18000000000.0) || !(z <= 7.8e+27)) tmp = Float64(x + Float64(Float64(z - y) / Float64(Float64(-z) / a))); else tmp = Float64(x - Float64(Float64(y * a) / Float64(t + 1.0))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -18000000000.0) || ~((z <= 7.8e+27))) tmp = x + ((z - y) / (-z / a)); else tmp = x - ((y * a) / (t + 1.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -18000000000.0], N[Not[LessEqual[z, 7.8e+27]], $MachinePrecision]], N[(x + N[(N[(z - y), $MachinePrecision] / N[((-z) / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[(y * a), $MachinePrecision] / N[(t + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -18000000000 \lor \neg \left(z \leq 7.8 \cdot 10^{+27}\right):\\
\;\;\;\;x + \frac{z - y}{\frac{-z}{a}}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y \cdot a}{t + 1}\\
\end{array}
\end{array}
if z < -1.8e10 or 7.7999999999999997e27 < z Initial program 96.1%
Taylor expanded in z around inf 89.0%
mul-1-neg89.0%
distribute-neg-frac89.0%
Simplified89.0%
if -1.8e10 < z < 7.7999999999999997e27Initial program 98.5%
associate-/r/98.7%
*-commutative98.7%
Simplified98.7%
Taylor expanded in z around 0 87.6%
Final simplification88.3%
(FPCore (x y z t a)
:precision binary64
(if (<= z -1.7e-23)
(+ x (/ a (/ (+ (- t z) 1.0) z)))
(if (<= z 6.4e+28)
(- x (/ (* y a) (+ t 1.0)))
(+ x (/ (- z y) (/ (- z) a))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.7e-23) {
tmp = x + (a / (((t - z) + 1.0) / z));
} else if (z <= 6.4e+28) {
tmp = x - ((y * a) / (t + 1.0));
} else {
tmp = x + ((z - 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 <= (-1.7d-23)) then
tmp = x + (a / (((t - z) + 1.0d0) / z))
else if (z <= 6.4d+28) then
tmp = x - ((y * a) / (t + 1.0d0))
else
tmp = x + ((z - 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 <= -1.7e-23) {
tmp = x + (a / (((t - z) + 1.0) / z));
} else if (z <= 6.4e+28) {
tmp = x - ((y * a) / (t + 1.0));
} else {
tmp = x + ((z - y) / (-z / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.7e-23: tmp = x + (a / (((t - z) + 1.0) / z)) elif z <= 6.4e+28: tmp = x - ((y * a) / (t + 1.0)) else: tmp = x + ((z - y) / (-z / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.7e-23) tmp = Float64(x + Float64(a / Float64(Float64(Float64(t - z) + 1.0) / z))); elseif (z <= 6.4e+28) tmp = Float64(x - Float64(Float64(y * a) / Float64(t + 1.0))); else tmp = Float64(x + Float64(Float64(z - y) / Float64(Float64(-z) / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -1.7e-23) tmp = x + (a / (((t - z) + 1.0) / z)); elseif (z <= 6.4e+28) tmp = x - ((y * a) / (t + 1.0)); else tmp = x + ((z - y) / (-z / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.7e-23], N[(x + N[(a / N[(N[(N[(t - z), $MachinePrecision] + 1.0), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6.4e+28], N[(x - N[(N[(y * a), $MachinePrecision] / N[(t + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(z - y), $MachinePrecision] / N[((-z) / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.7 \cdot 10^{-23}:\\
\;\;\;\;x + \frac{a}{\frac{\left(t - z\right) + 1}{z}}\\
\mathbf{elif}\;z \leq 6.4 \cdot 10^{+28}:\\
\;\;\;\;x - \frac{y \cdot a}{t + 1}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z - y}{\frac{-z}{a}}\\
\end{array}
\end{array}
if z < -1.7e-23Initial program 95.7%
associate-/r/99.9%
*-commutative99.9%
Simplified99.9%
*-commutative99.9%
associate-/r/95.7%
div-inv95.6%
associate-/r*99.7%
Applied egg-rr99.7%
Taylor expanded in y around 0 60.7%
sub-neg60.7%
mul-1-neg60.7%
remove-double-neg60.7%
associate-/l*88.4%
associate--l+88.4%
Simplified88.4%
if -1.7e-23 < z < 6.4000000000000001e28Initial program 99.1%
associate-/r/98.6%
*-commutative98.6%
Simplified98.6%
Taylor expanded in z around 0 90.5%
if 6.4000000000000001e28 < z Initial program 95.6%
Taylor expanded in z around inf 92.1%
mul-1-neg92.1%
distribute-neg-frac92.1%
Simplified92.1%
Final simplification90.4%
(FPCore (x y z t a)
:precision binary64
(if (<= z -2.4e-22)
(- x a)
(if (<= z 2.1e-136)
(- x (* y a))
(if (<= z 1.46e+35) (- x (/ a (/ t y))) (- x a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.4e-22) {
tmp = x - a;
} else if (z <= 2.1e-136) {
tmp = x - (y * a);
} else if (z <= 1.46e+35) {
tmp = x - (a / (t / y));
} 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 <= (-2.4d-22)) then
tmp = x - a
else if (z <= 2.1d-136) then
tmp = x - (y * a)
else if (z <= 1.46d+35) then
tmp = x - (a / (t / y))
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 <= -2.4e-22) {
tmp = x - a;
} else if (z <= 2.1e-136) {
tmp = x - (y * a);
} else if (z <= 1.46e+35) {
tmp = x - (a / (t / y));
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -2.4e-22: tmp = x - a elif z <= 2.1e-136: tmp = x - (y * a) elif z <= 1.46e+35: tmp = x - (a / (t / y)) else: tmp = x - a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.4e-22) tmp = Float64(x - a); elseif (z <= 2.1e-136) tmp = Float64(x - Float64(y * a)); elseif (z <= 1.46e+35) tmp = Float64(x - Float64(a / Float64(t / y))); else tmp = Float64(x - a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -2.4e-22) tmp = x - a; elseif (z <= 2.1e-136) tmp = x - (y * a); elseif (z <= 1.46e+35) tmp = x - (a / (t / y)); else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.4e-22], N[(x - a), $MachinePrecision], If[LessEqual[z, 2.1e-136], N[(x - N[(y * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.46e+35], N[(x - N[(a / N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.4 \cdot 10^{-22}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 2.1 \cdot 10^{-136}:\\
\;\;\;\;x - y \cdot a\\
\mathbf{elif}\;z \leq 1.46 \cdot 10^{+35}:\\
\;\;\;\;x - \frac{a}{\frac{t}{y}}\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -2.40000000000000002e-22 or 1.4599999999999999e35 < z Initial program 95.6%
associate-/r/99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in z around inf 82.1%
if -2.40000000000000002e-22 < z < 2.0999999999999999e-136Initial program 98.8%
Taylor expanded in t around 0 77.6%
Taylor expanded in z around 0 74.8%
if 2.0999999999999999e-136 < z < 1.4599999999999999e35Initial program 100.0%
Taylor expanded in t around inf 73.8%
Taylor expanded in y around inf 75.0%
associate-/l*78.0%
Simplified78.0%
Final simplification78.9%
(FPCore (x y z t a) :precision binary64 (if (<= z -4.6e-18) (- x a) (if (<= z 6.5e+27) (- x (/ (* y a) (+ t 1.0))) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -4.6e-18) {
tmp = x - a;
} else if (z <= 6.5e+27) {
tmp = x - ((y * a) / (t + 1.0));
} 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 <= (-4.6d-18)) then
tmp = x - a
else if (z <= 6.5d+27) then
tmp = x - ((y * a) / (t + 1.0d0))
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 <= -4.6e-18) {
tmp = x - a;
} else if (z <= 6.5e+27) {
tmp = x - ((y * a) / (t + 1.0));
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -4.6e-18: tmp = x - a elif z <= 6.5e+27: tmp = x - ((y * a) / (t + 1.0)) else: tmp = x - a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -4.6e-18) tmp = Float64(x - a); elseif (z <= 6.5e+27) tmp = Float64(x - Float64(Float64(y * a) / Float64(t + 1.0))); else tmp = Float64(x - a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -4.6e-18) tmp = x - a; elseif (z <= 6.5e+27) tmp = x - ((y * a) / (t + 1.0)); else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -4.6e-18], N[(x - a), $MachinePrecision], If[LessEqual[z, 6.5e+27], N[(x - N[(N[(y * a), $MachinePrecision] / N[(t + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.6 \cdot 10^{-18}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 6.5 \cdot 10^{+27}:\\
\;\;\;\;x - \frac{y \cdot a}{t + 1}\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -4.6000000000000002e-18 or 6.5000000000000005e27 < z Initial program 96.2%
associate-/r/99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in z around inf 83.2%
if -4.6000000000000002e-18 < z < 6.5000000000000005e27Initial program 98.4%
associate-/r/98.6%
*-commutative98.6%
Simplified98.6%
Taylor expanded in z around 0 89.4%
Final simplification86.3%
(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 97.3%
associate-/r/99.3%
*-commutative99.3%
Simplified99.3%
Final simplification99.3%
(FPCore (x y z t a) :precision binary64 (if (<= z -2.35e+36) (- x a) (if (<= z 1.7e+29) (+ x (* z a)) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.35e+36) {
tmp = x - a;
} else if (z <= 1.7e+29) {
tmp = x + (z * a);
} 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 <= (-2.35d+36)) then
tmp = x - a
else if (z <= 1.7d+29) then
tmp = x + (z * a)
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 <= -2.35e+36) {
tmp = x - a;
} else if (z <= 1.7e+29) {
tmp = x + (z * a);
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -2.35e+36: tmp = x - a elif z <= 1.7e+29: tmp = x + (z * a) else: tmp = x - a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.35e+36) tmp = Float64(x - a); elseif (z <= 1.7e+29) tmp = Float64(x + Float64(z * a)); else tmp = Float64(x - a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -2.35e+36) tmp = x - a; elseif (z <= 1.7e+29) tmp = x + (z * a); else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.35e+36], N[(x - a), $MachinePrecision], If[LessEqual[z, 1.7e+29], N[(x + N[(z * a), $MachinePrecision]), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.35 \cdot 10^{+36}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 1.7 \cdot 10^{+29}:\\
\;\;\;\;x + z \cdot a\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -2.34999999999999994e36 or 1.69999999999999991e29 < z Initial program 95.9%
associate-/r/99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in z around inf 84.4%
if -2.34999999999999994e36 < z < 1.69999999999999991e29Initial program 98.5%
associate-/r/98.7%
*-commutative98.7%
Simplified98.7%
*-commutative98.7%
associate-/r/98.5%
div-inv98.5%
associate-/r*98.6%
Applied egg-rr98.6%
Taylor expanded in y around 0 69.9%
sub-neg69.9%
mul-1-neg69.9%
remove-double-neg69.9%
associate-/l*68.6%
associate--l+68.6%
Simplified68.6%
Taylor expanded in z around 0 69.9%
Taylor expanded in t around 0 65.2%
Final simplification74.1%
(FPCore (x y z t a) :precision binary64 (if (<= z -2.4e-22) (- x a) (if (<= z 2.95e-5) (- x (* y a)) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.4e-22) {
tmp = x - a;
} else if (z <= 2.95e-5) {
tmp = x - (y * a);
} 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 <= (-2.4d-22)) then
tmp = x - a
else if (z <= 2.95d-5) then
tmp = x - (y * a)
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 <= -2.4e-22) {
tmp = x - a;
} else if (z <= 2.95e-5) {
tmp = x - (y * a);
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -2.4e-22: tmp = x - a elif z <= 2.95e-5: tmp = x - (y * a) else: tmp = x - a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.4e-22) tmp = Float64(x - a); elseif (z <= 2.95e-5) tmp = Float64(x - Float64(y * a)); else tmp = Float64(x - a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -2.4e-22) tmp = x - a; elseif (z <= 2.95e-5) tmp = x - (y * a); else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.4e-22], N[(x - a), $MachinePrecision], If[LessEqual[z, 2.95e-5], N[(x - N[(y * a), $MachinePrecision]), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.4 \cdot 10^{-22}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 2.95 \cdot 10^{-5}:\\
\;\;\;\;x - y \cdot a\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -2.40000000000000002e-22 or 2.9499999999999999e-5 < z Initial program 95.7%
associate-/r/99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in z around inf 81.7%
if -2.40000000000000002e-22 < z < 2.9499999999999999e-5Initial program 99.1%
Taylor expanded in t around 0 75.2%
Taylor expanded in z around 0 71.1%
Final simplification76.6%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.85e+33) (- x a) (if (<= z 6.2e-70) x (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.85e+33) {
tmp = x - a;
} else if (z <= 6.2e-70) {
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 <= (-1.85d+33)) then
tmp = x - a
else if (z <= 6.2d-70) 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 <= -1.85e+33) {
tmp = x - a;
} else if (z <= 6.2e-70) {
tmp = x;
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.85e+33: tmp = x - a elif z <= 6.2e-70: tmp = x else: tmp = x - a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.85e+33) tmp = Float64(x - a); elseif (z <= 6.2e-70) 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 <= -1.85e+33) tmp = x - a; elseif (z <= 6.2e-70) tmp = x; else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.85e+33], N[(x - a), $MachinePrecision], If[LessEqual[z, 6.2e-70], x, N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.85 \cdot 10^{+33}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 6.2 \cdot 10^{-70}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -1.8499999999999999e33 or 6.2e-70 < z Initial program 96.4%
associate-/r/99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in z around inf 80.9%
if -1.8499999999999999e33 < z < 6.2e-70Initial program 98.3%
associate-/r/98.5%
*-commutative98.5%
Simplified98.5%
Taylor expanded in x around inf 63.2%
Final simplification72.7%
(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.3%
associate-/r/99.3%
*-commutative99.3%
Simplified99.3%
Taylor expanded in x around inf 58.1%
Final simplification58.1%
(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 2023290
(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))))