
(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 -2.1e+77)
(+ (- x (/ a (/ t y))) (/ y (/ t z)))
(if (<= t 3.4e+176)
(fma (/ (- t z) (- a t)) y (+ x y))
(+ x (/ y (/ t (- z a)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -2.1e+77) {
tmp = (x - (a / (t / y))) + (y / (t / z));
} else if (t <= 3.4e+176) {
tmp = fma(((t - z) / (a - t)), y, (x + y));
} else {
tmp = x + (y / (t / (z - a)));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -2.1e+77) tmp = Float64(Float64(x - Float64(a / Float64(t / y))) + Float64(y / Float64(t / z))); elseif (t <= 3.4e+176) tmp = fma(Float64(Float64(t - z) / Float64(a - t)), y, Float64(x + y)); else tmp = Float64(x + Float64(y / Float64(t / Float64(z - a)))); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -2.1e+77], N[(N[(x - N[(a / N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 3.4e+176], N[(N[(N[(t - z), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision] * y + N[(x + y), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(t / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.1 \cdot 10^{+77}:\\
\;\;\;\;\left(x - \frac{a}{\frac{t}{y}}\right) + \frac{y}{\frac{t}{z}}\\
\mathbf{elif}\;t \leq 3.4 \cdot 10^{+176}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t - z}{a - t}, y, x + y\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z - a}}\\
\end{array}
\end{array}
if t < -2.0999999999999999e77Initial program 53.7%
associate-*l/62.1%
Simplified62.1%
Taylor expanded in t around inf 82.9%
sub-neg82.9%
mul-1-neg82.9%
unsub-neg82.9%
associate-/l*87.2%
mul-1-neg87.2%
remove-double-neg87.2%
associate-/l*89.2%
Simplified89.2%
if -2.0999999999999999e77 < t < 3.40000000000000014e176Initial program 88.8%
sub-neg88.8%
distribute-frac-neg88.8%
distribute-rgt-neg-out88.8%
+-commutative88.8%
distribute-rgt-neg-out88.8%
distribute-lft-neg-in88.8%
associate-/l*90.8%
associate-/r/90.9%
fma-def90.9%
sub-neg90.9%
distribute-neg-in90.9%
remove-double-neg90.9%
+-commutative90.9%
sub-neg90.9%
Simplified90.9%
if 3.40000000000000014e176 < t Initial program 44.6%
sub-neg44.6%
distribute-frac-neg44.6%
distribute-rgt-neg-out44.6%
+-commutative44.6%
distribute-rgt-neg-out44.6%
distribute-lft-neg-in44.6%
associate-/l*55.7%
associate-/r/58.9%
fma-def58.9%
sub-neg58.9%
distribute-neg-in58.9%
remove-double-neg58.9%
+-commutative58.9%
sub-neg58.9%
Simplified58.9%
Taylor expanded in t around inf 59.0%
associate-+r+75.7%
distribute-rgt1-in75.7%
metadata-eval75.7%
mul0-lft75.7%
associate-/l*92.6%
Simplified92.6%
Final simplification90.8%
(FPCore (x y z t a)
:precision binary64
(if (<= t -4e+77)
(+ (- x (/ a (/ t y))) (/ y (/ t z)))
(if (<= t 2.8e+176)
(+ (+ x y) (* y (/ (- t z) (- a t))))
(+ x (/ y (/ t (- z a)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -4e+77) {
tmp = (x - (a / (t / y))) + (y / (t / z));
} else if (t <= 2.8e+176) {
tmp = (x + y) + (y * ((t - z) / (a - t)));
} else {
tmp = x + (y / (t / (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 <= (-4d+77)) then
tmp = (x - (a / (t / y))) + (y / (t / z))
else if (t <= 2.8d+176) then
tmp = (x + y) + (y * ((t - z) / (a - t)))
else
tmp = x + (y / (t / (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 <= -4e+77) {
tmp = (x - (a / (t / y))) + (y / (t / z));
} else if (t <= 2.8e+176) {
tmp = (x + y) + (y * ((t - z) / (a - t)));
} else {
tmp = x + (y / (t / (z - a)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -4e+77: tmp = (x - (a / (t / y))) + (y / (t / z)) elif t <= 2.8e+176: tmp = (x + y) + (y * ((t - z) / (a - t))) else: tmp = x + (y / (t / (z - a))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -4e+77) tmp = Float64(Float64(x - Float64(a / Float64(t / y))) + Float64(y / Float64(t / z))); elseif (t <= 2.8e+176) tmp = Float64(Float64(x + y) + Float64(y * Float64(Float64(t - z) / Float64(a - t)))); else tmp = Float64(x + Float64(y / Float64(t / Float64(z - a)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -4e+77) tmp = (x - (a / (t / y))) + (y / (t / z)); elseif (t <= 2.8e+176) tmp = (x + y) + (y * ((t - z) / (a - t))); else tmp = x + (y / (t / (z - a))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -4e+77], N[(N[(x - N[(a / N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.8e+176], N[(N[(x + y), $MachinePrecision] + N[(y * N[(N[(t - z), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(t / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4 \cdot 10^{+77}:\\
\;\;\;\;\left(x - \frac{a}{\frac{t}{y}}\right) + \frac{y}{\frac{t}{z}}\\
\mathbf{elif}\;t \leq 2.8 \cdot 10^{+176}:\\
\;\;\;\;\left(x + y\right) + y \cdot \frac{t - z}{a - t}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z - a}}\\
\end{array}
\end{array}
if t < -3.99999999999999993e77Initial program 53.7%
associate-*l/62.1%
Simplified62.1%
Taylor expanded in t around inf 82.9%
sub-neg82.9%
mul-1-neg82.9%
unsub-neg82.9%
associate-/l*87.2%
mul-1-neg87.2%
remove-double-neg87.2%
associate-/l*89.2%
Simplified89.2%
if -3.99999999999999993e77 < t < 2.8000000000000002e176Initial program 88.8%
associate-*l/90.9%
Simplified90.9%
if 2.8000000000000002e176 < t Initial program 44.6%
sub-neg44.6%
distribute-frac-neg44.6%
distribute-rgt-neg-out44.6%
+-commutative44.6%
distribute-rgt-neg-out44.6%
distribute-lft-neg-in44.6%
associate-/l*55.7%
associate-/r/58.9%
fma-def58.9%
sub-neg58.9%
distribute-neg-in58.9%
remove-double-neg58.9%
+-commutative58.9%
sub-neg58.9%
Simplified58.9%
Taylor expanded in t around inf 59.0%
associate-+r+75.7%
distribute-rgt1-in75.7%
metadata-eval75.7%
mul0-lft75.7%
associate-/l*92.6%
Simplified92.6%
Final simplification90.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -0.00115) (not (<= a 9.2e-69))) (- (+ x y) (/ y (/ a z))) (+ x (/ (* y z) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -0.00115) || !(a <= 9.2e-69)) {
tmp = (x + y) - (y / (a / z));
} 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 <= (-0.00115d0)) .or. (.not. (a <= 9.2d-69))) then
tmp = (x + y) - (y / (a / z))
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 <= -0.00115) || !(a <= 9.2e-69)) {
tmp = (x + y) - (y / (a / z));
} else {
tmp = x + ((y * z) / t);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -0.00115) or not (a <= 9.2e-69): tmp = (x + y) - (y / (a / z)) else: tmp = x + ((y * z) / t) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -0.00115) || !(a <= 9.2e-69)) tmp = Float64(Float64(x + y) - Float64(y / Float64(a / z))); 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 <= -0.00115) || ~((a <= 9.2e-69))) tmp = (x + y) - (y / (a / z)); else tmp = x + ((y * z) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -0.00115], N[Not[LessEqual[a, 9.2e-69]], $MachinePrecision]], N[(N[(x + y), $MachinePrecision] - N[(y / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -0.00115 \lor \neg \left(a \leq 9.2 \cdot 10^{-69}\right):\\
\;\;\;\;\left(x + y\right) - \frac{y}{\frac{a}{z}}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot z}{t}\\
\end{array}
\end{array}
if a < -0.00115 or 9.2000000000000003e-69 < a Initial program 85.9%
associate-*l/92.8%
Simplified92.8%
Taylor expanded in t around 0 86.0%
associate-/l*89.2%
Simplified89.2%
if -0.00115 < a < 9.2000000000000003e-69Initial program 64.8%
sub-neg64.8%
distribute-frac-neg64.8%
distribute-rgt-neg-out64.8%
+-commutative64.8%
distribute-rgt-neg-out64.8%
distribute-lft-neg-in64.8%
associate-/l*64.4%
associate-/r/65.9%
fma-def65.9%
sub-neg65.9%
distribute-neg-in65.9%
remove-double-neg65.9%
+-commutative65.9%
sub-neg65.9%
Simplified65.9%
Taylor expanded in t around inf 70.0%
associate-+r+84.2%
distribute-rgt1-in84.2%
metadata-eval84.2%
mul0-lft84.2%
associate-/l*84.3%
Simplified84.3%
Taylor expanded in a around 0 81.2%
Final simplification86.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -0.00105) (not (<= a 2.7e+48))) (- (+ x y) (/ y (/ a z))) (+ x (/ y (/ t (- z a))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -0.00105) || !(a <= 2.7e+48)) {
tmp = (x + y) - (y / (a / z));
} else {
tmp = x + (y / (t / (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 ((a <= (-0.00105d0)) .or. (.not. (a <= 2.7d+48))) then
tmp = (x + y) - (y / (a / z))
else
tmp = x + (y / (t / (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 ((a <= -0.00105) || !(a <= 2.7e+48)) {
tmp = (x + y) - (y / (a / z));
} else {
tmp = x + (y / (t / (z - a)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -0.00105) or not (a <= 2.7e+48): tmp = (x + y) - (y / (a / z)) else: tmp = x + (y / (t / (z - a))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -0.00105) || !(a <= 2.7e+48)) tmp = Float64(Float64(x + y) - Float64(y / Float64(a / z))); else tmp = Float64(x + Float64(y / Float64(t / Float64(z - a)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -0.00105) || ~((a <= 2.7e+48))) tmp = (x + y) - (y / (a / z)); else tmp = x + (y / (t / (z - a))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -0.00105], N[Not[LessEqual[a, 2.7e+48]], $MachinePrecision]], N[(N[(x + y), $MachinePrecision] - N[(y / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(t / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -0.00105 \lor \neg \left(a \leq 2.7 \cdot 10^{+48}\right):\\
\;\;\;\;\left(x + y\right) - \frac{y}{\frac{a}{z}}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z - a}}\\
\end{array}
\end{array}
if a < -0.00104999999999999994 or 2.70000000000000004e48 < a Initial program 87.6%
associate-*l/95.0%
Simplified95.0%
Taylor expanded in t around 0 87.8%
associate-/l*91.2%
Simplified91.2%
if -0.00104999999999999994 < a < 2.70000000000000004e48Initial program 64.8%
sub-neg64.8%
distribute-frac-neg64.8%
distribute-rgt-neg-out64.8%
+-commutative64.8%
distribute-rgt-neg-out64.8%
distribute-lft-neg-in64.8%
associate-/l*65.3%
associate-/r/65.7%
fma-def65.8%
sub-neg65.8%
distribute-neg-in65.8%
remove-double-neg65.8%
+-commutative65.8%
sub-neg65.8%
Simplified65.8%
Taylor expanded in t around inf 67.8%
associate-+r+80.6%
distribute-rgt1-in80.6%
metadata-eval80.6%
mul0-lft80.6%
associate-/l*83.2%
Simplified83.2%
Final simplification87.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -4.6e+26) (not (<= a 1.9e+80))) (+ x y) (+ x (/ (* y z) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -4.6e+26) || !(a <= 1.9e+80)) {
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 <= (-4.6d+26)) .or. (.not. (a <= 1.9d+80))) 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 <= -4.6e+26) || !(a <= 1.9e+80)) {
tmp = x + y;
} else {
tmp = x + ((y * z) / t);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -4.6e+26) or not (a <= 1.9e+80): tmp = x + y else: tmp = x + ((y * z) / t) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -4.6e+26) || !(a <= 1.9e+80)) 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 <= -4.6e+26) || ~((a <= 1.9e+80))) tmp = x + y; else tmp = x + ((y * z) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -4.6e+26], N[Not[LessEqual[a, 1.9e+80]], $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 -4.6 \cdot 10^{+26} \lor \neg \left(a \leq 1.9 \cdot 10^{+80}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot z}{t}\\
\end{array}
\end{array}
if a < -4.6000000000000001e26 or 1.89999999999999999e80 < a Initial program 89.2%
associate-*l/96.9%
Simplified96.9%
Taylor expanded in a around inf 86.9%
+-commutative86.9%
Simplified86.9%
if -4.6000000000000001e26 < a < 1.89999999999999999e80Initial program 66.4%
sub-neg66.4%
distribute-frac-neg66.4%
distribute-rgt-neg-out66.4%
+-commutative66.4%
distribute-rgt-neg-out66.4%
distribute-lft-neg-in66.4%
associate-/l*67.6%
associate-/r/68.0%
fma-def68.0%
sub-neg68.0%
distribute-neg-in68.0%
remove-double-neg68.0%
+-commutative68.0%
sub-neg68.0%
Simplified68.0%
Taylor expanded in t around inf 64.0%
associate-+r+75.9%
distribute-rgt1-in75.9%
metadata-eval75.9%
mul0-lft75.9%
associate-/l*78.1%
Simplified78.1%
Taylor expanded in a around 0 74.2%
Final simplification80.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -3.6e-15) (not (<= a 1.16e+80))) (+ x y) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -3.6e-15) || !(a <= 1.16e+80)) {
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 <= (-3.6d-15)) .or. (.not. (a <= 1.16d+80))) 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 <= -3.6e-15) || !(a <= 1.16e+80)) {
tmp = x + y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -3.6e-15) or not (a <= 1.16e+80): tmp = x + y else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -3.6e-15) || !(a <= 1.16e+80)) 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 <= -3.6e-15) || ~((a <= 1.16e+80))) tmp = x + y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -3.6e-15], N[Not[LessEqual[a, 1.16e+80]], $MachinePrecision]], N[(x + y), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.6 \cdot 10^{-15} \lor \neg \left(a \leq 1.16 \cdot 10^{+80}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -3.6000000000000001e-15 or 1.15999999999999997e80 < a Initial program 89.0%
associate-*l/96.2%
Simplified96.2%
Taylor expanded in a around inf 83.0%
+-commutative83.0%
Simplified83.0%
if -3.6000000000000001e-15 < a < 1.15999999999999997e80Initial program 64.5%
associate-*l/66.2%
Simplified66.2%
Taylor expanded in x around inf 56.5%
Final simplification70.6%
(FPCore (x y z t a) :precision binary64 (if (<= y 7.2e+89) x y))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= 7.2e+89) {
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.2d+89) 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.2e+89) {
tmp = x;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= 7.2e+89: tmp = x else: tmp = y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= 7.2e+89) tmp = x; else tmp = y; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (y <= 7.2e+89) tmp = x; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, 7.2e+89], x, y]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 7.2 \cdot 10^{+89}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if y < 7.2e89Initial program 82.1%
associate-*l/83.6%
Simplified83.6%
Taylor expanded in x around inf 65.4%
if 7.2e89 < y Initial program 57.7%
associate-*l/75.6%
Simplified75.6%
Taylor expanded in x around 0 53.8%
sub-neg53.8%
associate-*r/65.6%
*-rgt-identity65.6%
distribute-rgt-neg-in65.6%
distribute-frac-neg65.6%
distribute-lft-in65.6%
distribute-frac-neg65.6%
sub-neg65.6%
Simplified65.6%
Taylor expanded in a around inf 39.9%
Final simplification60.6%
(FPCore (x y z t a) :precision binary64 0.0)
double code(double x, double y, double z, double t, double a) {
return 0.0;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = 0.0d0
end function
public static double code(double x, double y, double z, double t, double a) {
return 0.0;
}
def code(x, y, z, t, a): return 0.0
function code(x, y, z, t, a) return 0.0 end
function tmp = code(x, y, z, t, a) tmp = 0.0; end
code[x_, y_, z_, t_, a_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 77.5%
sub-neg77.5%
distribute-frac-neg77.5%
distribute-rgt-neg-out77.5%
+-commutative77.5%
distribute-rgt-neg-out77.5%
distribute-lft-neg-in77.5%
associate-/l*81.7%
associate-/r/82.1%
fma-def82.1%
sub-neg82.1%
distribute-neg-in82.1%
remove-double-neg82.1%
+-commutative82.1%
sub-neg82.1%
Simplified82.1%
Taylor expanded in x around 0 33.1%
associate-/l*36.6%
+-commutative36.6%
associate-/r/36.0%
fma-def36.3%
Simplified36.3%
Taylor expanded in t around inf 2.7%
distribute-rgt1-in2.7%
metadata-eval2.7%
mul0-lft2.7%
Simplified2.7%
Final simplification2.7%
(FPCore (x y z t a) :precision binary64 x)
double code(double x, double y, double z, double t, double a) {
return x;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x
end function
public static double code(double x, double y, double z, double t, double a) {
return x;
}
def code(x, y, z, t, a): return x
function code(x, y, z, t, a) return x end
function tmp = code(x, y, z, t, a) tmp = x; end
code[x_, y_, z_, t_, a_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 77.5%
associate-*l/82.1%
Simplified82.1%
Taylor expanded in x around inf 57.1%
Final simplification57.1%
(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 2023322
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTick from plot-0.2.3.4, B"
:precision binary64
:herbie-target
(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))))