
(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 9 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 -1.2e+83)
(- x (* y (- (/ a t) (/ z t))))
(if (<= t 1.12e+80)
(+ (+ x y) (* (- z t) (/ y (- 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 <= -1.2e+83) {
tmp = x - (y * ((a / t) - (z / t)));
} else if (t <= 1.12e+80) {
tmp = (x + y) + ((z - t) * (y / (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 <= (-1.2d+83)) then
tmp = x - (y * ((a / t) - (z / t)))
else if (t <= 1.12d+80) then
tmp = (x + y) + ((z - t) * (y / (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 <= -1.2e+83) {
tmp = x - (y * ((a / t) - (z / t)));
} else if (t <= 1.12e+80) {
tmp = (x + y) + ((z - t) * (y / (t - a)));
} else {
tmp = x - ((a * (y / t)) - (y * (z / t)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -1.2e+83: tmp = x - (y * ((a / t) - (z / t))) elif t <= 1.12e+80: tmp = (x + y) + ((z - t) * (y / (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 <= -1.2e+83) tmp = Float64(x - Float64(y * Float64(Float64(a / t) - Float64(z / t)))); elseif (t <= 1.12e+80) tmp = Float64(Float64(x + y) + Float64(Float64(z - t) * Float64(y / Float64(t - a)))); else tmp = Float64(x - Float64(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 <= -1.2e+83) tmp = x - (y * ((a / t) - (z / t))); elseif (t <= 1.12e+80) tmp = (x + y) + ((z - t) * (y / (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, -1.2e+83], N[(x - N[(y * N[(N[(a / t), $MachinePrecision] - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.12e+80], N[(N[(x + y), $MachinePrecision] + N[(N[(z - t), $MachinePrecision] * N[(y / N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[(a * N[(y / t), $MachinePrecision]), $MachinePrecision] - N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.2 \cdot 10^{+83}:\\
\;\;\;\;x - y \cdot \left(\frac{a}{t} - \frac{z}{t}\right)\\
\mathbf{elif}\;t \leq 1.12 \cdot 10^{+80}:\\
\;\;\;\;\left(x + y\right) + \left(z - t\right) \cdot \frac{y}{t - a}\\
\mathbf{else}:\\
\;\;\;\;x - \left(a \cdot \frac{y}{t} - y \cdot \frac{z}{t}\right)\\
\end{array}
\end{array}
if t < -1.19999999999999996e83Initial program 69.2%
sub-neg69.2%
+-commutative69.2%
distribute-frac-neg69.2%
distribute-rgt-neg-out69.2%
associate-/l*67.8%
fma-define68.4%
distribute-frac-neg68.4%
distribute-neg-frac268.4%
sub-neg68.4%
distribute-neg-in68.4%
remove-double-neg68.4%
+-commutative68.4%
sub-neg68.4%
Simplified68.4%
Taylor expanded in t around inf 85.3%
associate--l+85.3%
associate-+r+92.3%
distribute-rgt1-in92.3%
metadata-eval92.3%
mul0-lft92.3%
associate-/l*96.8%
associate-/l*94.5%
Simplified94.5%
Taylor expanded in y around 0 96.8%
if -1.19999999999999996e83 < t < 1.12e80Initial program 89.2%
associate-/l*93.8%
*-commutative93.8%
Applied egg-rr93.8%
if 1.12e80 < t Initial program 56.1%
sub-neg56.1%
+-commutative56.1%
distribute-frac-neg56.1%
distribute-rgt-neg-out56.1%
associate-/l*61.4%
fma-define61.6%
distribute-frac-neg61.6%
distribute-neg-frac261.6%
sub-neg61.6%
distribute-neg-in61.6%
remove-double-neg61.6%
+-commutative61.6%
sub-neg61.6%
Simplified61.6%
Taylor expanded in t around inf 78.1%
associate--l+78.1%
associate-+r+85.4%
distribute-rgt1-in85.4%
metadata-eval85.4%
mul0-lft85.4%
associate-/l*88.8%
associate-/l*92.8%
Simplified92.8%
Final simplification94.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -6.4e+83) (not (<= t 9.5e+77))) (- x (* y (- (/ a t) (/ z t)))) (+ (+ x y) (* (- z t) (/ y (- t a))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -6.4e+83) || !(t <= 9.5e+77)) {
tmp = x - (y * ((a / t) - (z / t)));
} else {
tmp = (x + y) + ((z - t) * (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 <= (-6.4d+83)) .or. (.not. (t <= 9.5d+77))) then
tmp = x - (y * ((a / t) - (z / t)))
else
tmp = (x + y) + ((z - t) * (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 <= -6.4e+83) || !(t <= 9.5e+77)) {
tmp = x - (y * ((a / t) - (z / t)));
} else {
tmp = (x + y) + ((z - t) * (y / (t - a)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -6.4e+83) or not (t <= 9.5e+77): tmp = x - (y * ((a / t) - (z / t))) else: tmp = (x + y) + ((z - t) * (y / (t - a))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -6.4e+83) || !(t <= 9.5e+77)) tmp = Float64(x - Float64(y * Float64(Float64(a / t) - Float64(z / t)))); else tmp = Float64(Float64(x + y) + Float64(Float64(z - t) * Float64(y / Float64(t - a)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -6.4e+83) || ~((t <= 9.5e+77))) tmp = x - (y * ((a / t) - (z / t))); else tmp = (x + y) + ((z - t) * (y / (t - a))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -6.4e+83], N[Not[LessEqual[t, 9.5e+77]], $MachinePrecision]], N[(x - N[(y * N[(N[(a / t), $MachinePrecision] - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x + y), $MachinePrecision] + N[(N[(z - t), $MachinePrecision] * N[(y / N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -6.4 \cdot 10^{+83} \lor \neg \left(t \leq 9.5 \cdot 10^{+77}\right):\\
\;\;\;\;x - y \cdot \left(\frac{a}{t} - \frac{z}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x + y\right) + \left(z - t\right) \cdot \frac{y}{t - a}\\
\end{array}
\end{array}
if t < -6.3999999999999998e83 or 9.4999999999999998e77 < t Initial program 61.9%
sub-neg61.9%
+-commutative61.9%
distribute-frac-neg61.9%
distribute-rgt-neg-out61.9%
associate-/l*64.2%
fma-define64.6%
distribute-frac-neg64.6%
distribute-neg-frac264.6%
sub-neg64.6%
distribute-neg-in64.6%
remove-double-neg64.6%
+-commutative64.6%
sub-neg64.6%
Simplified64.6%
Taylor expanded in t around inf 81.3%
associate--l+81.3%
associate-+r+88.4%
distribute-rgt1-in88.4%
metadata-eval88.4%
mul0-lft88.4%
associate-/l*92.4%
associate-/l*93.6%
Simplified93.6%
Taylor expanded in y around 0 94.5%
if -6.3999999999999998e83 < t < 9.4999999999999998e77Initial program 89.2%
associate-/l*93.8%
*-commutative93.8%
Applied egg-rr93.8%
Final simplification94.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -4.2e+49) (not (<= t 3.2e+73))) (- x (* y (- (/ a t) (/ z t)))) (- (+ x y) (* y (/ z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -4.2e+49) || !(t <= 3.2e+73)) {
tmp = x - (y * ((a / t) - (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 <= (-4.2d+49)) .or. (.not. (t <= 3.2d+73))) then
tmp = x - (y * ((a / t) - (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 <= -4.2e+49) || !(t <= 3.2e+73)) {
tmp = x - (y * ((a / t) - (z / t)));
} else {
tmp = (x + y) - (y * (z / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -4.2e+49) or not (t <= 3.2e+73): tmp = x - (y * ((a / t) - (z / t))) else: tmp = (x + y) - (y * (z / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -4.2e+49) || !(t <= 3.2e+73)) tmp = Float64(x - Float64(y * Float64(Float64(a / t) - Float64(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 <= -4.2e+49) || ~((t <= 3.2e+73))) tmp = x - (y * ((a / t) - (z / t))); else tmp = (x + y) - (y * (z / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -4.2e+49], N[Not[LessEqual[t, 3.2e+73]], $MachinePrecision]], N[(x - N[(y * N[(N[(a / t), $MachinePrecision] - N[(z / t), $MachinePrecision]), $MachinePrecision]), $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 -4.2 \cdot 10^{+49} \lor \neg \left(t \leq 3.2 \cdot 10^{+73}\right):\\
\;\;\;\;x - y \cdot \left(\frac{a}{t} - \frac{z}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x + y\right) - y \cdot \frac{z}{a}\\
\end{array}
\end{array}
if t < -4.20000000000000022e49 or 3.19999999999999982e73 < t Initial program 63.9%
sub-neg63.9%
+-commutative63.9%
distribute-frac-neg63.9%
distribute-rgt-neg-out63.9%
associate-/l*66.1%
fma-define66.4%
distribute-frac-neg66.4%
distribute-neg-frac266.4%
sub-neg66.4%
distribute-neg-in66.4%
remove-double-neg66.4%
+-commutative66.4%
sub-neg66.4%
Simplified66.4%
Taylor expanded in t around inf 81.3%
associate--l+81.3%
associate-+r+88.0%
distribute-rgt1-in88.0%
metadata-eval88.0%
mul0-lft88.0%
associate-/l*91.8%
associate-/l*93.9%
Simplified93.9%
Taylor expanded in y around 0 93.8%
if -4.20000000000000022e49 < t < 3.19999999999999982e73Initial program 88.9%
Taylor expanded in t around 0 78.9%
+-commutative78.9%
associate-/l*82.3%
Simplified82.3%
Final simplification86.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -5.8e+65) (not (<= a 3.6e+15))) (+ x y) (+ x (/ (* y (- z a)) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -5.8e+65) || !(a <= 3.6e+15)) {
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 <= (-5.8d+65)) .or. (.not. (a <= 3.6d+15))) 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 <= -5.8e+65) || !(a <= 3.6e+15)) {
tmp = x + y;
} else {
tmp = x + ((y * (z - a)) / t);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -5.8e+65) or not (a <= 3.6e+15): tmp = x + y else: tmp = x + ((y * (z - a)) / t) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -5.8e+65) || !(a <= 3.6e+15)) tmp = Float64(x + y); else tmp = Float64(x + Float64(Float64(y * Float64(z - a)) / t)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -5.8e+65) || ~((a <= 3.6e+15))) 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, -5.8e+65], N[Not[LessEqual[a, 3.6e+15]], $MachinePrecision]], N[(x + y), $MachinePrecision], N[(x + N[(N[(y * N[(z - a), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -5.8 \cdot 10^{+65} \lor \neg \left(a \leq 3.6 \cdot 10^{+15}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot \left(z - a\right)}{t}\\
\end{array}
\end{array}
if a < -5.8000000000000001e65 or 3.6e15 < a Initial program 81.1%
Taylor expanded in a around inf 79.7%
+-commutative79.7%
Simplified79.7%
if -5.8000000000000001e65 < a < 3.6e15Initial program 77.9%
Taylor expanded in t around inf 82.6%
associate--l+82.6%
distribute-lft-out--82.6%
div-sub83.3%
mul-1-neg83.3%
unsub-neg83.3%
*-commutative83.3%
distribute-lft-out--83.3%
Simplified83.3%
Final simplification81.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -5.8e-5) (not (<= a 27000000000.0))) (- (+ x y) (* y (/ z a))) (+ x (/ (* y (- z a)) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -5.8e-5) || !(a <= 27000000000.0)) {
tmp = (x + y) - (y * (z / a));
} 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 <= (-5.8d-5)) .or. (.not. (a <= 27000000000.0d0))) then
tmp = (x + y) - (y * (z / a))
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 <= -5.8e-5) || !(a <= 27000000000.0)) {
tmp = (x + y) - (y * (z / a));
} else {
tmp = x + ((y * (z - a)) / t);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -5.8e-5) or not (a <= 27000000000.0): tmp = (x + y) - (y * (z / a)) else: tmp = x + ((y * (z - a)) / t) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -5.8e-5) || !(a <= 27000000000.0)) tmp = Float64(Float64(x + y) - Float64(y * Float64(z / a))); else tmp = Float64(x + Float64(Float64(y * Float64(z - a)) / t)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -5.8e-5) || ~((a <= 27000000000.0))) tmp = (x + y) - (y * (z / a)); else tmp = x + ((y * (z - a)) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -5.8e-5], N[Not[LessEqual[a, 27000000000.0]], $MachinePrecision]], N[(N[(x + y), $MachinePrecision] - N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y * N[(z - a), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -5.8 \cdot 10^{-5} \lor \neg \left(a \leq 27000000000\right):\\
\;\;\;\;\left(x + y\right) - y \cdot \frac{z}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot \left(z - a\right)}{t}\\
\end{array}
\end{array}
if a < -5.8e-5 or 2.7e10 < a Initial program 79.9%
Taylor expanded in t around 0 79.5%
+-commutative79.5%
associate-/l*87.0%
Simplified87.0%
if -5.8e-5 < a < 2.7e10Initial program 78.8%
Taylor expanded in t around inf 85.1%
associate--l+85.1%
distribute-lft-out--85.1%
div-sub85.9%
mul-1-neg85.9%
unsub-neg85.9%
*-commutative85.9%
distribute-lft-out--85.9%
Simplified85.9%
Final simplification86.5%
(FPCore (x y z t a)
:precision binary64
(if (<= a -3.2e-194)
(+ x y)
(if (<= a -5.9e-294)
(* y (/ z (- t a)))
(if (<= a 14000000000.0) x (+ x y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -3.2e-194) {
tmp = x + y;
} else if (a <= -5.9e-294) {
tmp = y * (z / (t - a));
} else if (a <= 14000000000.0) {
tmp = x;
} 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 (a <= (-3.2d-194)) then
tmp = x + y
else if (a <= (-5.9d-294)) then
tmp = y * (z / (t - a))
else if (a <= 14000000000.0d0) then
tmp = x
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 (a <= -3.2e-194) {
tmp = x + y;
} else if (a <= -5.9e-294) {
tmp = y * (z / (t - a));
} else if (a <= 14000000000.0) {
tmp = x;
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -3.2e-194: tmp = x + y elif a <= -5.9e-294: tmp = y * (z / (t - a)) elif a <= 14000000000.0: tmp = x else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -3.2e-194) tmp = Float64(x + y); elseif (a <= -5.9e-294) tmp = Float64(y * Float64(z / Float64(t - a))); elseif (a <= 14000000000.0) tmp = x; else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -3.2e-194) tmp = x + y; elseif (a <= -5.9e-294) tmp = y * (z / (t - a)); elseif (a <= 14000000000.0) tmp = x; else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -3.2e-194], N[(x + y), $MachinePrecision], If[LessEqual[a, -5.9e-294], N[(y * N[(z / N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 14000000000.0], x, N[(x + y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.2 \cdot 10^{-194}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;a \leq -5.9 \cdot 10^{-294}:\\
\;\;\;\;y \cdot \frac{z}{t - a}\\
\mathbf{elif}\;a \leq 14000000000:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if a < -3.2000000000000003e-194 or 1.4e10 < a Initial program 80.9%
Taylor expanded in a around inf 74.4%
+-commutative74.4%
Simplified74.4%
if -3.2000000000000003e-194 < a < -5.89999999999999994e-294Initial program 90.8%
sub-neg90.8%
+-commutative90.8%
distribute-frac-neg90.8%
distribute-rgt-neg-out90.8%
associate-/l*79.1%
fma-define78.9%
distribute-frac-neg78.9%
distribute-neg-frac278.9%
sub-neg78.9%
distribute-neg-in78.9%
remove-double-neg78.9%
+-commutative78.9%
sub-neg78.9%
Simplified78.9%
Taylor expanded in z around inf 72.5%
associate-/l*68.0%
Simplified68.0%
if -5.89999999999999994e-294 < a < 1.4e10Initial program 72.4%
Taylor expanded in x around inf 58.6%
Final simplification69.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -2.05e+86) (not (<= a 2.8e+15))) (+ x y) (+ x (/ (* y z) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -2.05e+86) || !(a <= 2.8e+15)) {
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 <= (-2.05d+86)) .or. (.not. (a <= 2.8d+15))) 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 <= -2.05e+86) || !(a <= 2.8e+15)) {
tmp = x + y;
} else {
tmp = x + ((y * z) / t);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -2.05e+86) or not (a <= 2.8e+15): tmp = x + y else: tmp = x + ((y * z) / t) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -2.05e+86) || !(a <= 2.8e+15)) 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 <= -2.05e+86) || ~((a <= 2.8e+15))) tmp = x + y; else tmp = x + ((y * z) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -2.05e+86], N[Not[LessEqual[a, 2.8e+15]], $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 -2.05 \cdot 10^{+86} \lor \neg \left(a \leq 2.8 \cdot 10^{+15}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot z}{t}\\
\end{array}
\end{array}
if a < -2.05e86 or 2.8e15 < a Initial program 81.3%
Taylor expanded in a around inf 79.8%
+-commutative79.8%
Simplified79.8%
if -2.05e86 < a < 2.8e15Initial program 77.9%
sub-neg77.9%
+-commutative77.9%
distribute-frac-neg77.9%
distribute-rgt-neg-out77.9%
associate-/l*78.3%
fma-define78.3%
distribute-frac-neg78.3%
distribute-neg-frac278.3%
sub-neg78.3%
distribute-neg-in78.3%
remove-double-neg78.3%
+-commutative78.3%
sub-neg78.3%
Simplified78.3%
Taylor expanded in t around inf 76.1%
associate--l+76.1%
associate-+r+81.9%
distribute-rgt1-in81.9%
metadata-eval81.9%
mul0-lft81.9%
associate-/l*81.0%
associate-/l*79.0%
Simplified79.0%
Taylor expanded in y around 0 81.1%
Taylor expanded in z around inf 79.4%
Final simplification79.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -1.4e+86) (not (<= a 17000000000.0))) (+ x y) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1.4e+86) || !(a <= 17000000000.0)) {
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 ((a <= (-1.4d+86)) .or. (.not. (a <= 17000000000.0d0))) 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 ((a <= -1.4e+86) || !(a <= 17000000000.0)) {
tmp = x + y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -1.4e+86) or not (a <= 17000000000.0): tmp = x + y else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -1.4e+86) || !(a <= 17000000000.0)) tmp = Float64(x + y); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -1.4e+86) || ~((a <= 17000000000.0))) tmp = x + y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -1.4e+86], N[Not[LessEqual[a, 17000000000.0]], $MachinePrecision]], N[(x + y), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.4 \cdot 10^{+86} \lor \neg \left(a \leq 17000000000\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -1.40000000000000002e86 or 1.7e10 < a Initial program 81.3%
Taylor expanded in a around inf 79.8%
+-commutative79.8%
Simplified79.8%
if -1.40000000000000002e86 < a < 1.7e10Initial program 77.9%
Taylor expanded in x around inf 57.8%
Final simplification67.9%
(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 79.4%
Taylor expanded in x around inf 53.3%
Final simplification53.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 2024055
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTick from plot-0.2.3.4, B"
:precision binary64
:alt
(if (< (- (+ x y) (/ (* (- z t) y) (- a t))) -1.3664970889390727e-7) (- (+ y x) (* (* (- z t) (/ 1.0 (- a t))) y)) (if (< (- (+ x y) (/ (* (- z t) y) (- a t))) 1.4754293444577233e-239) (/ (- (* y (- a z)) (* x t)) (- a t)) (- (+ y x) (* (* (- z t) (/ 1.0 (- a t))) y))))
(- (+ x y) (/ (* (- z t) y) (- a t))))