
(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 11 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 (or (<= t -3.15e+65) (not (<= t 2800000000.0))) (+ (- x (* a (/ y t))) (* y (/ z t))) (fma (- z t) (/ y (- t a)) (+ x y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -3.15e+65) || !(t <= 2800000000.0)) {
tmp = (x - (a * (y / t))) + (y * (z / t));
} else {
tmp = fma((z - t), (y / (t - a)), (x + y));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -3.15e+65) || !(t <= 2800000000.0)) tmp = Float64(Float64(x - Float64(a * Float64(y / t))) + Float64(y * Float64(z / t))); else tmp = fma(Float64(z - t), Float64(y / Float64(t - a)), Float64(x + y)); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -3.15e+65], N[Not[LessEqual[t, 2800000000.0]], $MachinePrecision]], N[(N[(x - N[(a * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z - t), $MachinePrecision] * N[(y / N[(t - a), $MachinePrecision]), $MachinePrecision] + N[(x + y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.15 \cdot 10^{+65} \lor \neg \left(t \leq 2800000000\right):\\
\;\;\;\;\left(x - a \cdot \frac{y}{t}\right) + y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z - t, \frac{y}{t - a}, x + y\right)\\
\end{array}
\end{array}
if t < -3.14999999999999999e65 or 2.8e9 < t Initial program 55.5%
Taylor expanded in t around inf 85.1%
sub-neg85.1%
mul-1-neg85.1%
unsub-neg85.1%
associate-/l*86.0%
mul-1-neg86.0%
remove-double-neg86.0%
associate-/l*90.0%
Simplified90.0%
if -3.14999999999999999e65 < t < 2.8e9Initial program 93.8%
sub-neg93.8%
+-commutative93.8%
distribute-frac-neg93.8%
distribute-rgt-neg-out93.8%
associate-/l*95.8%
fma-define95.9%
distribute-frac-neg95.9%
distribute-neg-frac295.9%
sub-neg95.9%
distribute-neg-in95.9%
remove-double-neg95.9%
+-commutative95.9%
sub-neg95.9%
Simplified95.9%
Final simplification93.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -8.8e+63) (not (<= t 2300000000.0))) (+ (- x (* a (/ y t))) (* y (/ z t))) (+ (+ x y) (* z (/ y (- t a))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -8.8e+63) || !(t <= 2300000000.0)) {
tmp = (x - (a * (y / t))) + (y * (z / t));
} else {
tmp = (x + y) + (z * (y / (t - 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 <= (-8.8d+63)) .or. (.not. (t <= 2300000000.0d0))) then
tmp = (x - (a * (y / t))) + (y * (z / t))
else
tmp = (x + y) + (z * (y / (t - 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 <= -8.8e+63) || !(t <= 2300000000.0)) {
tmp = (x - (a * (y / t))) + (y * (z / t));
} else {
tmp = (x + y) + (z * (y / (t - a)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -8.8e+63) or not (t <= 2300000000.0): tmp = (x - (a * (y / t))) + (y * (z / t)) else: tmp = (x + y) + (z * (y / (t - a))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -8.8e+63) || !(t <= 2300000000.0)) tmp = Float64(Float64(x - Float64(a * Float64(y / t))) + Float64(y * Float64(z / t))); else tmp = Float64(Float64(x + y) + Float64(z * Float64(y / Float64(t - a)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -8.8e+63) || ~((t <= 2300000000.0))) tmp = (x - (a * (y / t))) + (y * (z / t)); else tmp = (x + y) + (z * (y / (t - a))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -8.8e+63], N[Not[LessEqual[t, 2300000000.0]], $MachinePrecision]], N[(N[(x - N[(a * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x + y), $MachinePrecision] + N[(z * N[(y / N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -8.8 \cdot 10^{+63} \lor \neg \left(t \leq 2300000000\right):\\
\;\;\;\;\left(x - a \cdot \frac{y}{t}\right) + y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;\left(x + y\right) + z \cdot \frac{y}{t - a}\\
\end{array}
\end{array}
if t < -8.7999999999999995e63 or 2.3e9 < t Initial program 55.5%
Taylor expanded in t around inf 85.1%
sub-neg85.1%
mul-1-neg85.1%
unsub-neg85.1%
associate-/l*86.0%
mul-1-neg86.0%
remove-double-neg86.0%
associate-/l*90.0%
Simplified90.0%
if -8.7999999999999995e63 < t < 2.3e9Initial program 93.8%
associate-/l*95.8%
*-commutative95.8%
Applied egg-rr95.8%
Taylor expanded in z around inf 95.9%
Final simplification93.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -3.4e+66) (not (<= t 2600000000.0))) (+ x (/ (- (* y z) (* a y)) t)) (+ (+ x y) (* z (/ y (- t a))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -3.4e+66) || !(t <= 2600000000.0)) {
tmp = x + (((y * z) - (a * y)) / t);
} else {
tmp = (x + y) + (z * (y / (t - 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 <= (-3.4d+66)) .or. (.not. (t <= 2600000000.0d0))) then
tmp = x + (((y * z) - (a * y)) / t)
else
tmp = (x + y) + (z * (y / (t - 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 <= -3.4e+66) || !(t <= 2600000000.0)) {
tmp = x + (((y * z) - (a * y)) / t);
} else {
tmp = (x + y) + (z * (y / (t - a)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -3.4e+66) or not (t <= 2600000000.0): tmp = x + (((y * z) - (a * y)) / t) else: tmp = (x + y) + (z * (y / (t - a))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -3.4e+66) || !(t <= 2600000000.0)) tmp = Float64(x + Float64(Float64(Float64(y * z) - Float64(a * y)) / t)); else tmp = Float64(Float64(x + y) + Float64(z * Float64(y / Float64(t - a)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -3.4e+66) || ~((t <= 2600000000.0))) tmp = x + (((y * z) - (a * y)) / t); else tmp = (x + y) + (z * (y / (t - a))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -3.4e+66], N[Not[LessEqual[t, 2600000000.0]], $MachinePrecision]], N[(x + N[(N[(N[(y * z), $MachinePrecision] - N[(a * y), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(N[(x + y), $MachinePrecision] + N[(z * N[(y / N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.4 \cdot 10^{+66} \lor \neg \left(t \leq 2600000000\right):\\
\;\;\;\;x + \frac{y \cdot z - a \cdot y}{t}\\
\mathbf{else}:\\
\;\;\;\;\left(x + y\right) + z \cdot \frac{y}{t - a}\\
\end{array}
\end{array}
if t < -3.4000000000000003e66 or 2.6e9 < t Initial program 55.5%
Taylor expanded in t around -inf 85.1%
if -3.4000000000000003e66 < t < 2.6e9Initial program 93.8%
associate-/l*95.8%
*-commutative95.8%
Applied egg-rr95.8%
Taylor expanded in z around inf 95.9%
Final simplification91.0%
(FPCore (x y z t a)
:precision binary64
(if (<= t -4.3e+188)
(- x (* y (/ a t)))
(if (<= t 2800000000.0)
(+ (+ x y) (* z (/ y (- t a))))
(+ x (/ (* y z) t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -4.3e+188) {
tmp = x - (y * (a / t));
} else if (t <= 2800000000.0) {
tmp = (x + y) + (z * (y / (t - a)));
} 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 (t <= (-4.3d+188)) then
tmp = x - (y * (a / t))
else if (t <= 2800000000.0d0) then
tmp = (x + y) + (z * (y / (t - a)))
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 (t <= -4.3e+188) {
tmp = x - (y * (a / t));
} else if (t <= 2800000000.0) {
tmp = (x + y) + (z * (y / (t - a)));
} else {
tmp = x + ((y * z) / t);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -4.3e+188: tmp = x - (y * (a / t)) elif t <= 2800000000.0: tmp = (x + y) + (z * (y / (t - a))) else: tmp = x + ((y * z) / t) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -4.3e+188) tmp = Float64(x - Float64(y * Float64(a / t))); elseif (t <= 2800000000.0) tmp = Float64(Float64(x + y) + Float64(z * Float64(y / Float64(t - a)))); 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 (t <= -4.3e+188) tmp = x - (y * (a / t)); elseif (t <= 2800000000.0) tmp = (x + y) + (z * (y / (t - a))); else tmp = x + ((y * z) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -4.3e+188], N[(x - N[(y * N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2800000000.0], N[(N[(x + y), $MachinePrecision] + N[(z * N[(y / N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.3 \cdot 10^{+188}:\\
\;\;\;\;x - y \cdot \frac{a}{t}\\
\mathbf{elif}\;t \leq 2800000000:\\
\;\;\;\;\left(x + y\right) + z \cdot \frac{y}{t - a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot z}{t}\\
\end{array}
\end{array}
if t < -4.29999999999999985e188Initial program 65.9%
Taylor expanded in t around -inf 93.2%
Taylor expanded in z around 0 86.8%
mul-1-neg86.8%
unsub-neg86.8%
*-commutative86.8%
associate-/l*86.8%
Simplified86.8%
if -4.29999999999999985e188 < t < 2.8e9Initial program 88.0%
associate-/l*91.9%
*-commutative91.9%
Applied egg-rr91.9%
Taylor expanded in z around inf 92.0%
if 2.8e9 < t Initial program 48.4%
sub-neg48.4%
+-commutative48.4%
distribute-frac-neg48.4%
distribute-rgt-neg-out48.4%
associate-/l*56.0%
fma-define55.9%
distribute-frac-neg55.9%
distribute-neg-frac255.9%
sub-neg55.9%
distribute-neg-in55.9%
remove-double-neg55.9%
+-commutative55.9%
sub-neg55.9%
Simplified55.9%
Taylor expanded in a around 0 56.9%
Taylor expanded in y around 0 77.6%
Final simplification88.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -60000000.0) (not (<= t 2500000000.0))) (+ x (/ (* y z) t)) (- (+ x y) (* y (/ z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -60000000.0) || !(t <= 2500000000.0)) {
tmp = x + ((y * z) / 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 <= (-60000000.0d0)) .or. (.not. (t <= 2500000000.0d0))) then
tmp = x + ((y * z) / 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 <= -60000000.0) || !(t <= 2500000000.0)) {
tmp = x + ((y * z) / t);
} else {
tmp = (x + y) - (y * (z / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -60000000.0) or not (t <= 2500000000.0): tmp = x + ((y * z) / t) else: tmp = (x + y) - (y * (z / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -60000000.0) || !(t <= 2500000000.0)) tmp = Float64(x + Float64(Float64(y * z) / t)); else tmp = Float64(Float64(x + y) - Float64(y * Float64(z / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -60000000.0) || ~((t <= 2500000000.0))) tmp = x + ((y * z) / t); else tmp = (x + y) - (y * (z / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -60000000.0], N[Not[LessEqual[t, 2500000000.0]], $MachinePrecision]], N[(x + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(N[(x + y), $MachinePrecision] - N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -60000000 \lor \neg \left(t \leq 2500000000\right):\\
\;\;\;\;x + \frac{y \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;\left(x + y\right) - y \cdot \frac{z}{a}\\
\end{array}
\end{array}
if t < -6e7 or 2.5e9 < t Initial program 58.0%
sub-neg58.0%
+-commutative58.0%
distribute-frac-neg58.0%
distribute-rgt-neg-out58.0%
associate-/l*66.1%
fma-define66.1%
distribute-frac-neg66.1%
distribute-neg-frac266.1%
sub-neg66.1%
distribute-neg-in66.1%
remove-double-neg66.1%
+-commutative66.1%
sub-neg66.1%
Simplified66.1%
Taylor expanded in a around 0 60.9%
Taylor expanded in y around 0 77.8%
if -6e7 < t < 2.5e9Initial program 93.5%
Taylor expanded in t around 0 87.3%
+-commutative87.3%
associate-/l*88.7%
Simplified88.7%
Final simplification83.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -48000000.0) (not (<= t 2600000000.0))) (+ x (/ (* y z) t)) (- (+ x y) (* z (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -48000000.0) || !(t <= 2600000000.0)) {
tmp = x + ((y * z) / t);
} else {
tmp = (x + y) - (z * (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 ((t <= (-48000000.0d0)) .or. (.not. (t <= 2600000000.0d0))) then
tmp = x + ((y * z) / t)
else
tmp = (x + y) - (z * (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 ((t <= -48000000.0) || !(t <= 2600000000.0)) {
tmp = x + ((y * z) / t);
} else {
tmp = (x + y) - (z * (y / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -48000000.0) or not (t <= 2600000000.0): tmp = x + ((y * z) / t) else: tmp = (x + y) - (z * (y / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -48000000.0) || !(t <= 2600000000.0)) tmp = Float64(x + Float64(Float64(y * z) / t)); else tmp = Float64(Float64(x + y) - Float64(z * Float64(y / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -48000000.0) || ~((t <= 2600000000.0))) tmp = x + ((y * z) / t); else tmp = (x + y) - (z * (y / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -48000000.0], N[Not[LessEqual[t, 2600000000.0]], $MachinePrecision]], N[(x + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(N[(x + y), $MachinePrecision] - N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -48000000 \lor \neg \left(t \leq 2600000000\right):\\
\;\;\;\;x + \frac{y \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;\left(x + y\right) - z \cdot \frac{y}{a}\\
\end{array}
\end{array}
if t < -4.8e7 or 2.6e9 < t Initial program 58.0%
sub-neg58.0%
+-commutative58.0%
distribute-frac-neg58.0%
distribute-rgt-neg-out58.0%
associate-/l*66.1%
fma-define66.1%
distribute-frac-neg66.1%
distribute-neg-frac266.1%
sub-neg66.1%
distribute-neg-in66.1%
remove-double-neg66.1%
+-commutative66.1%
sub-neg66.1%
Simplified66.1%
Taylor expanded in a around 0 60.9%
Taylor expanded in y around 0 77.8%
if -4.8e7 < t < 2.6e9Initial program 93.5%
associate-/l*95.6%
*-commutative95.6%
Applied egg-rr95.6%
Taylor expanded in z around inf 95.7%
Taylor expanded in a around inf 88.7%
Final simplification83.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -3.05e-47) (not (<= a 6e+22))) (+ x y) (+ x (/ (* y z) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -3.05e-47) || !(a <= 6e+22)) {
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 <= (-3.05d-47)) .or. (.not. (a <= 6d+22))) 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 <= -3.05e-47) || !(a <= 6e+22)) {
tmp = x + y;
} else {
tmp = x + ((y * z) / t);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -3.05e-47) or not (a <= 6e+22): tmp = x + y else: tmp = x + ((y * z) / t) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -3.05e-47) || !(a <= 6e+22)) 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 <= -3.05e-47) || ~((a <= 6e+22))) tmp = x + y; else tmp = x + ((y * z) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -3.05e-47], N[Not[LessEqual[a, 6e+22]], $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 -3.05 \cdot 10^{-47} \lor \neg \left(a \leq 6 \cdot 10^{+22}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot z}{t}\\
\end{array}
\end{array}
if a < -3.05e-47 or 6e22 < a Initial program 84.1%
Taylor expanded in a around inf 75.8%
+-commutative75.8%
Simplified75.8%
if -3.05e-47 < a < 6e22Initial program 69.0%
sub-neg69.0%
+-commutative69.0%
distribute-frac-neg69.0%
distribute-rgt-neg-out69.0%
associate-/l*72.9%
fma-define72.9%
distribute-frac-neg72.9%
distribute-neg-frac272.9%
sub-neg72.9%
distribute-neg-in72.9%
remove-double-neg72.9%
+-commutative72.9%
sub-neg72.9%
Simplified72.9%
Taylor expanded in a around 0 59.6%
Taylor expanded in y around 0 74.6%
Final simplification75.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -7e+210) (not (<= z 2.3e+99))) (* y (/ z (- t a))) (+ x y)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -7e+210) || !(z <= 2.3e+99)) {
tmp = y * (z / (t - a));
} else {
tmp = x + y;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((z <= (-7d+210)) .or. (.not. (z <= 2.3d+99))) then
tmp = y * (z / (t - a))
else
tmp = x + y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -7e+210) || !(z <= 2.3e+99)) {
tmp = y * (z / (t - a));
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -7e+210) or not (z <= 2.3e+99): tmp = y * (z / (t - a)) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -7e+210) || !(z <= 2.3e+99)) tmp = Float64(y * Float64(z / Float64(t - a))); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -7e+210) || ~((z <= 2.3e+99))) tmp = y * (z / (t - a)); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -7e+210], N[Not[LessEqual[z, 2.3e+99]], $MachinePrecision]], N[(y * N[(z / N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7 \cdot 10^{+210} \lor \neg \left(z \leq 2.3 \cdot 10^{+99}\right):\\
\;\;\;\;y \cdot \frac{z}{t - a}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -6.9999999999999999e210 or 2.30000000000000019e99 < z Initial program 82.4%
Taylor expanded in z around inf 54.8%
mul-1-neg54.8%
distribute-neg-frac254.8%
sub-neg54.8%
distribute-neg-in54.8%
remove-double-neg54.8%
+-commutative54.8%
sub-neg54.8%
associate-/l*57.1%
Simplified57.1%
if -6.9999999999999999e210 < z < 2.30000000000000019e99Initial program 74.2%
Taylor expanded in a around inf 67.7%
+-commutative67.7%
Simplified67.7%
Final simplification64.8%
(FPCore (x y z t a) :precision binary64 (if (<= t 8.5e+24) (+ x y) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 8.5e+24) {
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 <= 8.5d+24) 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 <= 8.5e+24) {
tmp = x + y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 8.5e+24: tmp = x + y else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 8.5e+24) 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 <= 8.5e+24) tmp = x + y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 8.5e+24], N[(x + y), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 8.5 \cdot 10^{+24}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < 8.49999999999999959e24Initial program 84.0%
Taylor expanded in a around inf 61.9%
+-commutative61.9%
Simplified61.9%
if 8.49999999999999959e24 < t Initial program 48.0%
Taylor expanded in x around inf 66.8%
Final simplification62.9%
(FPCore (x y z t a) :precision binary64 (if (<= y 7.5e+56) x y))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= 7.5e+56) {
tmp = x;
} else {
tmp = 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 (y <= 7.5d+56) then
tmp = x
else
tmp = y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= 7.5e+56) {
tmp = x;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= 7.5e+56: tmp = x else: tmp = y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= 7.5e+56) tmp = x; else tmp = y; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (y <= 7.5e+56) tmp = x; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, 7.5e+56], x, y]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 7.5 \cdot 10^{+56}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if y < 7.4999999999999999e56Initial program 77.3%
Taylor expanded in x around inf 61.7%
if 7.4999999999999999e56 < y Initial program 73.0%
Taylor expanded in a around inf 50.3%
+-commutative50.3%
Simplified50.3%
Taylor expanded in y around inf 35.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 76.4%
Taylor expanded in x around inf 53.5%
(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 2024118
(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))))