
(FPCore (x y z t a) :precision binary64 (- (+ x y) (/ (* (- z t) y) (- a t))))
double code(double x, double y, double z, double t, double a) {
return (x + y) - (((z - t) * y) / (a - 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 + y) - (((z - t) * y) / (a - t))
end function
public static double code(double x, double y, double z, double t, double a) {
return (x + y) - (((z - t) * y) / (a - t));
}
def code(x, y, z, t, a): return (x + y) - (((z - t) * y) / (a - t))
function code(x, y, z, t, a) return Float64(Float64(x + y) - Float64(Float64(Float64(z - t) * y) / Float64(a - t))) end
function tmp = code(x, y, z, t, a) tmp = (x + y) - (((z - t) * y) / (a - t)); end
code[x_, y_, z_, t_, a_] := N[(N[(x + y), $MachinePrecision] - N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (- (+ x y) (/ (* (- z t) y) (- a t))))
double code(double x, double y, double z, double t, double a) {
return (x + y) - (((z - t) * y) / (a - 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 + y) - (((z - t) * y) / (a - t))
end function
public static double code(double x, double y, double z, double t, double a) {
return (x + y) - (((z - t) * y) / (a - t));
}
def code(x, y, z, t, a): return (x + y) - (((z - t) * y) / (a - t))
function code(x, y, z, t, a) return Float64(Float64(x + y) - Float64(Float64(Float64(z - t) * y) / Float64(a - t))) end
function tmp = code(x, y, z, t, a) tmp = (x + y) - (((z - t) * y) / (a - t)); end
code[x_, y_, z_, t_, a_] := N[(N[(x + y), $MachinePrecision] - N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}
\end{array}
(FPCore (x y z t a)
:precision binary64
(if (<= t -2.8e+36)
(+ x (* y (/ (- z a) t)))
(if (<= t 8.5e+37)
(fma (- z t) (* y (/ -1.0 (- a t))) (+ x y))
(+ (- x (* a (/ y t))) (* y (/ z t))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -2.8e+36) {
tmp = x + (y * ((z - a) / t));
} else if (t <= 8.5e+37) {
tmp = fma((z - t), (y * (-1.0 / (a - t))), (x + y));
} else {
tmp = (x - (a * (y / t))) + (y * (z / t));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -2.8e+36) tmp = Float64(x + Float64(y * Float64(Float64(z - a) / t))); elseif (t <= 8.5e+37) tmp = fma(Float64(z - t), Float64(y * Float64(-1.0 / Float64(a - t))), Float64(x + y)); else tmp = Float64(Float64(x - Float64(a * Float64(y / t))) + Float64(y * Float64(z / t))); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -2.8e+36], N[(x + N[(y * N[(N[(z - a), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 8.5e+37], N[(N[(z - t), $MachinePrecision] * N[(y * N[(-1.0 / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x + y), $MachinePrecision]), $MachinePrecision], N[(N[(x - N[(a * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.8 \cdot 10^{+36}:\\
\;\;\;\;x + y \cdot \frac{z - a}{t}\\
\mathbf{elif}\;t \leq 8.5 \cdot 10^{+37}:\\
\;\;\;\;\mathsf{fma}\left(z - t, y \cdot \frac{-1}{a - t}, x + y\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x - a \cdot \frac{y}{t}\right) + y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if t < -2.8000000000000001e36Initial program 61.7%
Taylor expanded in t around -inf 78.3%
mul-1-neg78.3%
unsub-neg78.3%
*-commutative78.3%
Simplified78.3%
Taylor expanded in y around 0 78.5%
associate-*r/87.7%
Simplified87.7%
if -2.8000000000000001e36 < t < 8.4999999999999999e37Initial program 96.7%
sub-neg96.7%
+-commutative96.7%
distribute-frac-neg96.7%
distribute-rgt-neg-out96.7%
associate-/l*97.1%
fma-define97.1%
distribute-frac-neg97.1%
distribute-neg-frac297.1%
sub-neg97.1%
distribute-neg-in97.1%
remove-double-neg97.1%
+-commutative97.1%
sub-neg97.1%
Simplified97.1%
clear-num97.0%
associate-/r/97.1%
Applied egg-rr97.1%
if 8.4999999999999999e37 < t Initial program 60.8%
Taylor expanded in t around inf 80.2%
sub-neg80.2%
mul-1-neg80.2%
unsub-neg80.2%
associate-/l*88.2%
mul-1-neg88.2%
remove-double-neg88.2%
associate-/l*93.1%
Simplified93.1%
Final simplification93.9%
(FPCore (x y z t a)
:precision binary64
(if (<= t -6.5e+36)
(+ x (* y (/ (- z a) t)))
(if (<= t 5.2e+40)
(fma (- z t) (/ y (- t a)) (+ x y))
(+ (- x (* a (/ y t))) (* y (/ z t))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -6.5e+36) {
tmp = x + (y * ((z - a) / t));
} else if (t <= 5.2e+40) {
tmp = fma((z - t), (y / (t - a)), (x + y));
} else {
tmp = (x - (a * (y / t))) + (y * (z / t));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -6.5e+36) tmp = Float64(x + Float64(y * Float64(Float64(z - a) / t))); elseif (t <= 5.2e+40) tmp = fma(Float64(z - t), Float64(y / Float64(t - a)), Float64(x + y)); else tmp = Float64(Float64(x - Float64(a * Float64(y / t))) + Float64(y * Float64(z / t))); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -6.5e+36], N[(x + N[(y * N[(N[(z - a), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 5.2e+40], N[(N[(z - t), $MachinePrecision] * N[(y / N[(t - a), $MachinePrecision]), $MachinePrecision] + N[(x + y), $MachinePrecision]), $MachinePrecision], N[(N[(x - N[(a * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -6.5 \cdot 10^{+36}:\\
\;\;\;\;x + y \cdot \frac{z - a}{t}\\
\mathbf{elif}\;t \leq 5.2 \cdot 10^{+40}:\\
\;\;\;\;\mathsf{fma}\left(z - t, \frac{y}{t - a}, x + y\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x - a \cdot \frac{y}{t}\right) + y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if t < -6.4999999999999998e36Initial program 61.7%
Taylor expanded in t around -inf 78.3%
mul-1-neg78.3%
unsub-neg78.3%
*-commutative78.3%
Simplified78.3%
Taylor expanded in y around 0 78.5%
associate-*r/87.7%
Simplified87.7%
if -6.4999999999999998e36 < t < 5.2000000000000001e40Initial program 96.7%
sub-neg96.7%
+-commutative96.7%
distribute-frac-neg96.7%
distribute-rgt-neg-out96.7%
associate-/l*97.1%
fma-define97.1%
distribute-frac-neg97.1%
distribute-neg-frac297.1%
sub-neg97.1%
distribute-neg-in97.1%
remove-double-neg97.1%
+-commutative97.1%
sub-neg97.1%
Simplified97.1%
if 5.2000000000000001e40 < t Initial program 60.8%
Taylor expanded in t around inf 80.2%
sub-neg80.2%
mul-1-neg80.2%
unsub-neg80.2%
associate-/l*88.2%
mul-1-neg88.2%
remove-double-neg88.2%
associate-/l*93.1%
Simplified93.1%
Final simplification93.9%
(FPCore (x y z t a)
:precision binary64
(if (<= t -8.8e+36)
(+ x (* y (/ (- z a) t)))
(if (<= t 4.8e+40)
(+ (+ x y) (/ (* y (- z t)) (- t a)))
(+ (- x (* a (/ y t))) (* y (/ z t))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -8.8e+36) {
tmp = x + (y * ((z - a) / t));
} else if (t <= 4.8e+40) {
tmp = (x + y) + ((y * (z - t)) / (t - a));
} else {
tmp = (x - (a * (y / t))) + (y * (z / 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 <= (-8.8d+36)) then
tmp = x + (y * ((z - a) / t))
else if (t <= 4.8d+40) then
tmp = (x + y) + ((y * (z - t)) / (t - a))
else
tmp = (x - (a * (y / t))) + (y * (z / 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 <= -8.8e+36) {
tmp = x + (y * ((z - a) / t));
} else if (t <= 4.8e+40) {
tmp = (x + y) + ((y * (z - t)) / (t - a));
} else {
tmp = (x - (a * (y / t))) + (y * (z / t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -8.8e+36: tmp = x + (y * ((z - a) / t)) elif t <= 4.8e+40: tmp = (x + y) + ((y * (z - t)) / (t - a)) else: tmp = (x - (a * (y / t))) + (y * (z / t)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -8.8e+36) tmp = Float64(x + Float64(y * Float64(Float64(z - a) / t))); elseif (t <= 4.8e+40) tmp = Float64(Float64(x + y) + Float64(Float64(y * Float64(z - t)) / Float64(t - a))); else tmp = Float64(Float64(x - Float64(a * Float64(y / t))) + Float64(y * Float64(z / t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -8.8e+36) tmp = x + (y * ((z - a) / t)); elseif (t <= 4.8e+40) tmp = (x + y) + ((y * (z - t)) / (t - a)); else tmp = (x - (a * (y / t))) + (y * (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -8.8e+36], N[(x + N[(y * N[(N[(z - a), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 4.8e+40], N[(N[(x + y), $MachinePrecision] + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x - N[(a * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -8.8 \cdot 10^{+36}:\\
\;\;\;\;x + y \cdot \frac{z - a}{t}\\
\mathbf{elif}\;t \leq 4.8 \cdot 10^{+40}:\\
\;\;\;\;\left(x + y\right) + \frac{y \cdot \left(z - t\right)}{t - a}\\
\mathbf{else}:\\
\;\;\;\;\left(x - a \cdot \frac{y}{t}\right) + y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if t < -8.80000000000000002e36Initial program 61.7%
Taylor expanded in t around -inf 78.3%
mul-1-neg78.3%
unsub-neg78.3%
*-commutative78.3%
Simplified78.3%
Taylor expanded in y around 0 78.5%
associate-*r/87.7%
Simplified87.7%
if -8.80000000000000002e36 < t < 4.8e40Initial program 96.7%
if 4.8e40 < t Initial program 60.8%
Taylor expanded in t around inf 80.2%
sub-neg80.2%
mul-1-neg80.2%
unsub-neg80.2%
associate-/l*88.2%
mul-1-neg88.2%
remove-double-neg88.2%
associate-/l*93.1%
Simplified93.1%
Final simplification93.7%
(FPCore (x y z t a)
:precision binary64
(if (<= t -2.45e+14)
(+ x (* y (/ (- z a) t)))
(if (<= t 2.4e-12)
(- (+ x y) (/ (* y z) a))
(+ (- x (* a (/ y t))) (* y (/ z t))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -2.45e+14) {
tmp = x + (y * ((z - a) / t));
} else if (t <= 2.4e-12) {
tmp = (x + y) - ((y * z) / a);
} else {
tmp = (x - (a * (y / t))) + (y * (z / 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 <= (-2.45d+14)) then
tmp = x + (y * ((z - a) / t))
else if (t <= 2.4d-12) then
tmp = (x + y) - ((y * z) / a)
else
tmp = (x - (a * (y / t))) + (y * (z / 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 <= -2.45e+14) {
tmp = x + (y * ((z - a) / t));
} else if (t <= 2.4e-12) {
tmp = (x + y) - ((y * z) / a);
} else {
tmp = (x - (a * (y / t))) + (y * (z / t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -2.45e+14: tmp = x + (y * ((z - a) / t)) elif t <= 2.4e-12: tmp = (x + y) - ((y * z) / a) else: tmp = (x - (a * (y / t))) + (y * (z / t)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -2.45e+14) tmp = Float64(x + Float64(y * Float64(Float64(z - a) / t))); elseif (t <= 2.4e-12) tmp = Float64(Float64(x + y) - Float64(Float64(y * z) / a)); else tmp = Float64(Float64(x - Float64(a * Float64(y / t))) + Float64(y * Float64(z / t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -2.45e+14) tmp = x + (y * ((z - a) / t)); elseif (t <= 2.4e-12) tmp = (x + y) - ((y * z) / a); else tmp = (x - (a * (y / t))) + (y * (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -2.45e+14], N[(x + N[(y * N[(N[(z - a), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.4e-12], N[(N[(x + y), $MachinePrecision] - N[(N[(y * z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(N[(x - N[(a * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.45 \cdot 10^{+14}:\\
\;\;\;\;x + y \cdot \frac{z - a}{t}\\
\mathbf{elif}\;t \leq 2.4 \cdot 10^{-12}:\\
\;\;\;\;\left(x + y\right) - \frac{y \cdot z}{a}\\
\mathbf{else}:\\
\;\;\;\;\left(x - a \cdot \frac{y}{t}\right) + y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if t < -2.45e14Initial program 62.9%
Taylor expanded in t around -inf 79.0%
mul-1-neg79.0%
unsub-neg79.0%
*-commutative79.0%
Simplified79.0%
Taylor expanded in y around 0 79.2%
associate-*r/88.1%
Simplified88.1%
if -2.45e14 < t < 2.39999999999999987e-12Initial program 96.4%
Taylor expanded in t around 0 84.1%
if 2.39999999999999987e-12 < t Initial program 67.0%
Taylor expanded in t around inf 81.9%
sub-neg81.9%
mul-1-neg81.9%
unsub-neg81.9%
associate-/l*88.6%
mul-1-neg88.6%
remove-double-neg88.6%
associate-/l*92.7%
Simplified92.7%
Final simplification87.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -4.7e+14) (not (<= t 2.5e-13))) (+ x (* y (/ (- z a) t))) (- (+ x y) (/ (* y z) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -4.7e+14) || !(t <= 2.5e-13)) {
tmp = x + (y * ((z - a) / t));
} else {
tmp = (x + y) - ((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 ((t <= (-4.7d+14)) .or. (.not. (t <= 2.5d-13))) then
tmp = x + (y * ((z - a) / t))
else
tmp = (x + y) - ((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 ((t <= -4.7e+14) || !(t <= 2.5e-13)) {
tmp = x + (y * ((z - a) / t));
} else {
tmp = (x + y) - ((y * z) / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -4.7e+14) or not (t <= 2.5e-13): tmp = x + (y * ((z - a) / t)) else: tmp = (x + y) - ((y * z) / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -4.7e+14) || !(t <= 2.5e-13)) tmp = Float64(x + Float64(y * Float64(Float64(z - a) / t))); else tmp = Float64(Float64(x + y) - Float64(Float64(y * z) / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -4.7e+14) || ~((t <= 2.5e-13))) tmp = x + (y * ((z - a) / t)); else tmp = (x + y) - ((y * z) / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -4.7e+14], N[Not[LessEqual[t, 2.5e-13]], $MachinePrecision]], N[(x + N[(y * N[(N[(z - a), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x + y), $MachinePrecision] - N[(N[(y * z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.7 \cdot 10^{+14} \lor \neg \left(t \leq 2.5 \cdot 10^{-13}\right):\\
\;\;\;\;x + y \cdot \frac{z - a}{t}\\
\mathbf{else}:\\
\;\;\;\;\left(x + y\right) - \frac{y \cdot z}{a}\\
\end{array}
\end{array}
if t < -4.7e14 or 2.49999999999999995e-13 < t Initial program 65.0%
Taylor expanded in t around -inf 80.5%
mul-1-neg80.5%
unsub-neg80.5%
*-commutative80.5%
Simplified80.5%
Taylor expanded in y around 0 80.7%
associate-*r/89.1%
Simplified89.1%
if -4.7e14 < t < 2.49999999999999995e-13Initial program 96.4%
Taylor expanded in t around 0 84.1%
Final simplification86.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -1.45e-21) (not (<= a 6.4e-18))) (+ x y) (+ x (* y (/ (- z a) t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1.45e-21) || !(a <= 6.4e-18)) {
tmp = x + y;
} else {
tmp = x + (y * ((z - a) / 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 ((a <= (-1.45d-21)) .or. (.not. (a <= 6.4d-18))) then
tmp = x + y
else
tmp = x + (y * ((z - a) / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1.45e-21) || !(a <= 6.4e-18)) {
tmp = x + y;
} else {
tmp = x + (y * ((z - a) / t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -1.45e-21) or not (a <= 6.4e-18): tmp = x + y else: tmp = x + (y * ((z - a) / t)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -1.45e-21) || !(a <= 6.4e-18)) tmp = Float64(x + y); else tmp = Float64(x + Float64(y * Float64(Float64(z - a) / t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -1.45e-21) || ~((a <= 6.4e-18))) tmp = x + y; else tmp = x + (y * ((z - a) / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -1.45e-21], N[Not[LessEqual[a, 6.4e-18]], $MachinePrecision]], N[(x + y), $MachinePrecision], N[(x + N[(y * N[(N[(z - a), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.45 \cdot 10^{-21} \lor \neg \left(a \leq 6.4 \cdot 10^{-18}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z - a}{t}\\
\end{array}
\end{array}
if a < -1.45e-21 or 6.3999999999999998e-18 < a Initial program 84.4%
sub-neg84.4%
+-commutative84.4%
distribute-frac-neg84.4%
distribute-rgt-neg-out84.4%
associate-/l*89.7%
fma-define89.9%
distribute-frac-neg89.9%
distribute-neg-frac289.9%
sub-neg89.9%
distribute-neg-in89.9%
remove-double-neg89.9%
+-commutative89.9%
sub-neg89.9%
Simplified89.9%
Taylor expanded in a around inf 84.4%
+-commutative84.4%
Simplified84.4%
if -1.45e-21 < a < 6.3999999999999998e-18Initial program 74.8%
Taylor expanded in t around -inf 84.8%
mul-1-neg84.8%
unsub-neg84.8%
*-commutative84.8%
Simplified84.8%
Taylor expanded in y around 0 84.8%
associate-*r/84.7%
Simplified84.7%
Final simplification84.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -1.35e-28) (not (<= a 9e-18))) (+ x y) (+ x (/ (* y z) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1.35e-28) || !(a <= 9e-18)) {
tmp = x + y;
} else {
tmp = x + ((y * z) / 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 ((a <= (-1.35d-28)) .or. (.not. (a <= 9d-18))) then
tmp = x + y
else
tmp = x + ((y * z) / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1.35e-28) || !(a <= 9e-18)) {
tmp = x + y;
} else {
tmp = x + ((y * z) / t);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -1.35e-28) or not (a <= 9e-18): tmp = x + y else: tmp = x + ((y * z) / t) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -1.35e-28) || !(a <= 9e-18)) tmp = Float64(x + y); else tmp = Float64(x + Float64(Float64(y * z) / t)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -1.35e-28) || ~((a <= 9e-18))) tmp = x + y; else tmp = x + ((y * z) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -1.35e-28], N[Not[LessEqual[a, 9e-18]], $MachinePrecision]], N[(x + y), $MachinePrecision], N[(x + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.35 \cdot 10^{-28} \lor \neg \left(a \leq 9 \cdot 10^{-18}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot z}{t}\\
\end{array}
\end{array}
if a < -1.3499999999999999e-28 or 8.99999999999999987e-18 < a Initial program 83.9%
sub-neg83.9%
+-commutative83.9%
distribute-frac-neg83.9%
distribute-rgt-neg-out83.9%
associate-/l*89.1%
fma-define89.3%
distribute-frac-neg89.3%
distribute-neg-frac289.3%
sub-neg89.3%
distribute-neg-in89.3%
remove-double-neg89.3%
+-commutative89.3%
sub-neg89.3%
Simplified89.3%
Taylor expanded in a around inf 83.9%
+-commutative83.9%
Simplified83.9%
if -1.3499999999999999e-28 < a < 8.99999999999999987e-18Initial program 75.4%
Taylor expanded in t around -inf 84.7%
mul-1-neg84.7%
unsub-neg84.7%
*-commutative84.7%
Simplified84.7%
Taylor expanded in a around 0 83.2%
Final simplification83.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -1.86e-211) (not (<= a 8.2e-234))) (+ x y) (* z (/ y t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1.86e-211) || !(a <= 8.2e-234)) {
tmp = x + y;
} else {
tmp = 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 ((a <= (-1.86d-211)) .or. (.not. (a <= 8.2d-234))) then
tmp = x + y
else
tmp = 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 ((a <= -1.86e-211) || !(a <= 8.2e-234)) {
tmp = x + y;
} else {
tmp = z * (y / t);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -1.86e-211) or not (a <= 8.2e-234): tmp = x + y else: tmp = z * (y / t) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -1.86e-211) || !(a <= 8.2e-234)) tmp = Float64(x + y); else tmp = Float64(z * Float64(y / t)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -1.86e-211) || ~((a <= 8.2e-234))) tmp = x + y; else tmp = z * (y / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -1.86e-211], N[Not[LessEqual[a, 8.2e-234]], $MachinePrecision]], N[(x + y), $MachinePrecision], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.86 \cdot 10^{-211} \lor \neg \left(a \leq 8.2 \cdot 10^{-234}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\end{array}
\end{array}
if a < -1.85999999999999993e-211 or 8.20000000000000021e-234 < a Initial program 81.3%
sub-neg81.3%
+-commutative81.3%
distribute-frac-neg81.3%
distribute-rgt-neg-out81.3%
associate-/l*85.6%
fma-define85.8%
distribute-frac-neg85.8%
distribute-neg-frac285.8%
sub-neg85.8%
distribute-neg-in85.8%
remove-double-neg85.8%
+-commutative85.8%
sub-neg85.8%
Simplified85.8%
Taylor expanded in a around inf 72.3%
+-commutative72.3%
Simplified72.3%
if -1.85999999999999993e-211 < a < 8.20000000000000021e-234Initial program 73.0%
sub-neg73.0%
+-commutative73.0%
distribute-frac-neg73.0%
distribute-rgt-neg-out73.0%
associate-/l*82.5%
fma-define82.6%
distribute-frac-neg82.6%
distribute-neg-frac282.6%
sub-neg82.6%
distribute-neg-in82.6%
remove-double-neg82.6%
+-commutative82.6%
sub-neg82.6%
Simplified82.6%
Taylor expanded in z around inf 62.1%
associate-/l*59.4%
Simplified59.4%
Taylor expanded in t around inf 62.0%
*-commutative62.0%
associate-*r/66.7%
Simplified66.7%
Final simplification71.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -1.05e-211) (not (<= a 7.6e-234))) (+ x y) (* y (/ z t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1.05e-211) || !(a <= 7.6e-234)) {
tmp = x + y;
} else {
tmp = y * (z / 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 ((a <= (-1.05d-211)) .or. (.not. (a <= 7.6d-234))) then
tmp = x + y
else
tmp = y * (z / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1.05e-211) || !(a <= 7.6e-234)) {
tmp = x + y;
} else {
tmp = y * (z / t);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -1.05e-211) or not (a <= 7.6e-234): tmp = x + y else: tmp = y * (z / t) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -1.05e-211) || !(a <= 7.6e-234)) tmp = Float64(x + y); else tmp = Float64(y * Float64(z / t)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -1.05e-211) || ~((a <= 7.6e-234))) tmp = x + y; else tmp = y * (z / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -1.05e-211], N[Not[LessEqual[a, 7.6e-234]], $MachinePrecision]], N[(x + y), $MachinePrecision], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.05 \cdot 10^{-211} \lor \neg \left(a \leq 7.6 \cdot 10^{-234}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if a < -1.05000000000000004e-211 or 7.59999999999999968e-234 < a Initial program 81.3%
sub-neg81.3%
+-commutative81.3%
distribute-frac-neg81.3%
distribute-rgt-neg-out81.3%
associate-/l*85.6%
fma-define85.8%
distribute-frac-neg85.8%
distribute-neg-frac285.8%
sub-neg85.8%
distribute-neg-in85.8%
remove-double-neg85.8%
+-commutative85.8%
sub-neg85.8%
Simplified85.8%
Taylor expanded in a around inf 72.3%
+-commutative72.3%
Simplified72.3%
if -1.05000000000000004e-211 < a < 7.59999999999999968e-234Initial program 73.0%
sub-neg73.0%
+-commutative73.0%
distribute-frac-neg73.0%
distribute-rgt-neg-out73.0%
associate-/l*82.5%
fma-define82.6%
distribute-frac-neg82.6%
distribute-neg-frac282.6%
sub-neg82.6%
distribute-neg-in82.6%
remove-double-neg82.6%
+-commutative82.6%
sub-neg82.6%
Simplified82.6%
Taylor expanded in z around inf 62.1%
associate-/l*59.4%
Simplified59.4%
Taylor expanded in t around inf 59.4%
Final simplification70.4%
(FPCore (x y z t a) :precision binary64 (if (<= t 9.5e+197) (+ x y) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 9.5e+197) {
tmp = x + y;
} 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 (t <= 9.5d+197) then
tmp = x + y
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 (t <= 9.5e+197) {
tmp = x + y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 9.5e+197: tmp = x + y else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 9.5e+197) tmp = Float64(x + y); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 9.5e+197) tmp = x + y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 9.5e+197], N[(x + y), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 9.5 \cdot 10^{+197}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < 9.4999999999999997e197Initial program 82.7%
sub-neg82.7%
+-commutative82.7%
distribute-frac-neg82.7%
distribute-rgt-neg-out82.7%
associate-/l*87.4%
fma-define87.5%
distribute-frac-neg87.5%
distribute-neg-frac287.5%
sub-neg87.5%
distribute-neg-in87.5%
remove-double-neg87.5%
+-commutative87.5%
sub-neg87.5%
Simplified87.5%
Taylor expanded in a around inf 67.2%
+-commutative67.2%
Simplified67.2%
if 9.4999999999999997e197 < t Initial program 52.5%
sub-neg52.5%
+-commutative52.5%
distribute-frac-neg52.5%
distribute-rgt-neg-out52.5%
associate-/l*61.0%
fma-define62.1%
distribute-frac-neg62.1%
distribute-neg-frac262.1%
sub-neg62.1%
distribute-neg-in62.1%
remove-double-neg62.1%
+-commutative62.1%
sub-neg62.1%
Simplified62.1%
clear-num62.1%
associate-/r/62.2%
Applied egg-rr62.2%
Taylor expanded in t around inf 85.8%
distribute-rgt1-in85.8%
metadata-eval85.8%
mul0-lft85.8%
+-rgt-identity85.8%
Simplified85.8%
Final simplification68.8%
(FPCore (x y z t a) :precision binary64 (if (<= y -1.2e+149) y x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -1.2e+149) {
tmp = y;
} 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 (y <= (-1.2d+149)) then
tmp = y
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 (y <= -1.2e+149) {
tmp = y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= -1.2e+149: tmp = y else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= -1.2e+149) tmp = y; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (y <= -1.2e+149) tmp = y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -1.2e+149], y, x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.2 \cdot 10^{+149}:\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1.20000000000000006e149Initial program 56.7%
sub-neg56.7%
+-commutative56.7%
distribute-frac-neg56.7%
distribute-rgt-neg-out56.7%
associate-/l*62.1%
fma-define62.6%
distribute-frac-neg62.6%
distribute-neg-frac262.6%
sub-neg62.6%
distribute-neg-in62.6%
remove-double-neg62.6%
+-commutative62.6%
sub-neg62.6%
Simplified62.6%
Taylor expanded in a around inf 48.6%
+-commutative48.6%
Simplified48.6%
Taylor expanded in y around inf 42.0%
if -1.20000000000000006e149 < y Initial program 83.3%
sub-neg83.3%
+-commutative83.3%
distribute-frac-neg83.3%
distribute-rgt-neg-out83.3%
associate-/l*88.3%
fma-define88.4%
distribute-frac-neg88.4%
distribute-neg-frac288.4%
sub-neg88.4%
distribute-neg-in88.4%
remove-double-neg88.4%
+-commutative88.4%
sub-neg88.4%
Simplified88.4%
clear-num88.3%
associate-/r/88.4%
Applied egg-rr88.4%
Taylor expanded in t around inf 60.6%
distribute-rgt1-in60.6%
metadata-eval60.6%
mul0-lft60.6%
+-rgt-identity60.6%
Simplified60.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 80.1%
sub-neg80.1%
+-commutative80.1%
distribute-frac-neg80.1%
distribute-rgt-neg-out80.1%
associate-/l*85.1%
fma-define85.3%
distribute-frac-neg85.3%
distribute-neg-frac285.3%
sub-neg85.3%
distribute-neg-in85.3%
remove-double-neg85.3%
+-commutative85.3%
sub-neg85.3%
Simplified85.3%
clear-num85.2%
associate-/r/85.3%
Applied egg-rr85.3%
Taylor expanded in t around inf 54.3%
distribute-rgt1-in54.3%
metadata-eval54.3%
mul0-lft54.3%
+-rgt-identity54.3%
Simplified54.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (+ y x) (* (* (- z t) (/ 1.0 (- a t))) y)))
(t_2 (- (+ x y) (/ (* (- z t) y) (- a t)))))
(if (< t_2 -1.3664970889390727e-7)
t_1
(if (< t_2 1.4754293444577233e-239)
(/ (- (* y (- a z)) (* x t)) (- a t))
t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y + x) - (((z - t) * (1.0 / (a - t))) * y);
double t_2 = (x + y) - (((z - t) * y) / (a - t));
double tmp;
if (t_2 < -1.3664970889390727e-7) {
tmp = t_1;
} else if (t_2 < 1.4754293444577233e-239) {
tmp = ((y * (a - z)) - (x * t)) / (a - t);
} else {
tmp = t_1;
}
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 = (y + x) - (((z - t) * (1.0d0 / (a - t))) * y)
t_2 = (x + y) - (((z - t) * y) / (a - t))
if (t_2 < (-1.3664970889390727d-7)) then
tmp = t_1
else if (t_2 < 1.4754293444577233d-239) then
tmp = ((y * (a - z)) - (x * t)) / (a - t)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (y + x) - (((z - t) * (1.0 / (a - t))) * y);
double t_2 = (x + y) - (((z - t) * y) / (a - t));
double tmp;
if (t_2 < -1.3664970889390727e-7) {
tmp = t_1;
} else if (t_2 < 1.4754293444577233e-239) {
tmp = ((y * (a - z)) - (x * t)) / (a - t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y + x) - (((z - t) * (1.0 / (a - t))) * y) t_2 = (x + y) - (((z - t) * y) / (a - t)) tmp = 0 if t_2 < -1.3664970889390727e-7: tmp = t_1 elif t_2 < 1.4754293444577233e-239: tmp = ((y * (a - z)) - (x * t)) / (a - t) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y + x) - Float64(Float64(Float64(z - t) * Float64(1.0 / Float64(a - t))) * y)) t_2 = Float64(Float64(x + y) - Float64(Float64(Float64(z - t) * y) / Float64(a - t))) tmp = 0.0 if (t_2 < -1.3664970889390727e-7) tmp = t_1; elseif (t_2 < 1.4754293444577233e-239) tmp = Float64(Float64(Float64(y * Float64(a - z)) - Float64(x * t)) / Float64(a - t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y + x) - (((z - t) * (1.0 / (a - t))) * y); t_2 = (x + y) - (((z - t) * y) / (a - t)); tmp = 0.0; if (t_2 < -1.3664970889390727e-7) tmp = t_1; elseif (t_2 < 1.4754293444577233e-239) tmp = ((y * (a - z)) - (x * t)) / (a - t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y + x), $MachinePrecision] - N[(N[(N[(z - t), $MachinePrecision] * N[(1.0 / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x + y), $MachinePrecision] - N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[t$95$2, -1.3664970889390727e-7], t$95$1, If[Less[t$95$2, 1.4754293444577233e-239], N[(N[(N[(y * N[(a - z), $MachinePrecision]), $MachinePrecision] - N[(x * t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(y + x\right) - \left(\left(z - t\right) \cdot \frac{1}{a - t}\right) \cdot y\\
t_2 := \left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\\
\mathbf{if}\;t\_2 < -1.3664970889390727 \cdot 10^{-7}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 < 1.4754293444577233 \cdot 10^{-239}:\\
\;\;\;\;\frac{y \cdot \left(a - z\right) - x \cdot t}{a - t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
herbie shell --seed 2024144
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTick from plot-0.2.3.4, B"
:precision binary64
:alt
(! :herbie-platform default (if (< (- (+ x y) (/ (* (- z t) y) (- a t))) -13664970889390727/100000000000000000000000) (- (+ y x) (* (* (- z t) (/ 1 (- a t))) y)) (if (< (- (+ x y) (/ (* (- z t) y) (- a t))) 14754293444577233/1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (/ (- (* y (- a z)) (* x t)) (- a t)) (- (+ y x) (* (* (- z t) (/ 1 (- a t))) y)))))
(- (+ x y) (/ (* (- z t) y) (- a t))))