
(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
(let* ((t_1 (+ (+ x y) (/ (* y (- z t)) (- t a)))))
(if (or (<= t_1 -2e-192) (not (<= t_1 1e-157)))
(fma (- z t) (/ y (- t a)) (+ x y))
(+ x (/ (- (* y z) (* y a)) t)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (x + y) + ((y * (z - t)) / (t - a));
double tmp;
if ((t_1 <= -2e-192) || !(t_1 <= 1e-157)) {
tmp = fma((z - t), (y / (t - a)), (x + y));
} else {
tmp = x + (((y * z) - (y * a)) / t);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(x + y) + Float64(Float64(y * Float64(z - t)) / Float64(t - a))) tmp = 0.0 if ((t_1 <= -2e-192) || !(t_1 <= 1e-157)) tmp = fma(Float64(z - t), Float64(y / Float64(t - a)), Float64(x + y)); else tmp = Float64(x + Float64(Float64(Float64(y * z) - Float64(y * a)) / t)); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x + y), $MachinePrecision] + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -2e-192], N[Not[LessEqual[t$95$1, 1e-157]], $MachinePrecision]], N[(N[(z - t), $MachinePrecision] * N[(y / N[(t - a), $MachinePrecision]), $MachinePrecision] + N[(x + y), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(N[(y * z), $MachinePrecision] - N[(y * a), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x + y\right) + \frac{y \cdot \left(z - t\right)}{t - a}\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{-192} \lor \neg \left(t\_1 \leq 10^{-157}\right):\\
\;\;\;\;\mathsf{fma}\left(z - t, \frac{y}{t - a}, x + y\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot z - y \cdot a}{t}\\
\end{array}
\end{array}
if (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < -2.0000000000000002e-192 or 9.99999999999999943e-158 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) Initial program 77.9%
sub-neg77.9%
+-commutative77.9%
distribute-frac-neg77.9%
distribute-rgt-neg-out77.9%
associate-/l*87.5%
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%
if -2.0000000000000002e-192 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < 9.99999999999999943e-158Initial program 34.5%
Taylor expanded in t around -inf 93.9%
mul-1-neg93.9%
unsub-neg93.9%
*-commutative93.9%
Simplified93.9%
Final simplification88.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ (+ x y) (/ (* y (- z t)) (- t a)))))
(if (or (<= t_1 -2e-192) (not (<= t_1 1e-157)))
(+ (+ x y) (/ 1.0 (/ (/ (- a t) y) (- t z))))
(+ x (/ (- (* y z) (* y a)) t)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (x + y) + ((y * (z - t)) / (t - a));
double tmp;
if ((t_1 <= -2e-192) || !(t_1 <= 1e-157)) {
tmp = (x + y) + (1.0 / (((a - t) / y) / (t - z)));
} else {
tmp = x + (((y * z) - (y * 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) :: t_1
real(8) :: tmp
t_1 = (x + y) + ((y * (z - t)) / (t - a))
if ((t_1 <= (-2d-192)) .or. (.not. (t_1 <= 1d-157))) then
tmp = (x + y) + (1.0d0 / (((a - t) / y) / (t - z)))
else
tmp = x + (((y * z) - (y * a)) / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (x + y) + ((y * (z - t)) / (t - a));
double tmp;
if ((t_1 <= -2e-192) || !(t_1 <= 1e-157)) {
tmp = (x + y) + (1.0 / (((a - t) / y) / (t - z)));
} else {
tmp = x + (((y * z) - (y * a)) / t);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (x + y) + ((y * (z - t)) / (t - a)) tmp = 0 if (t_1 <= -2e-192) or not (t_1 <= 1e-157): tmp = (x + y) + (1.0 / (((a - t) / y) / (t - z))) else: tmp = x + (((y * z) - (y * a)) / t) return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(x + y) + Float64(Float64(y * Float64(z - t)) / Float64(t - a))) tmp = 0.0 if ((t_1 <= -2e-192) || !(t_1 <= 1e-157)) tmp = Float64(Float64(x + y) + Float64(1.0 / Float64(Float64(Float64(a - t) / y) / Float64(t - z)))); else tmp = Float64(x + Float64(Float64(Float64(y * z) - Float64(y * a)) / t)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (x + y) + ((y * (z - t)) / (t - a)); tmp = 0.0; if ((t_1 <= -2e-192) || ~((t_1 <= 1e-157))) tmp = (x + y) + (1.0 / (((a - t) / y) / (t - z))); else tmp = x + (((y * z) - (y * a)) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x + y), $MachinePrecision] + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -2e-192], N[Not[LessEqual[t$95$1, 1e-157]], $MachinePrecision]], N[(N[(x + y), $MachinePrecision] + N[(1.0 / N[(N[(N[(a - t), $MachinePrecision] / y), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(N[(y * z), $MachinePrecision] - N[(y * a), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x + y\right) + \frac{y \cdot \left(z - t\right)}{t - a}\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{-192} \lor \neg \left(t\_1 \leq 10^{-157}\right):\\
\;\;\;\;\left(x + y\right) + \frac{1}{\frac{\frac{a - t}{y}}{t - z}}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot z - y \cdot a}{t}\\
\end{array}
\end{array}
if (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < -2.0000000000000002e-192 or 9.99999999999999943e-158 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) Initial program 77.9%
clear-num77.9%
inv-pow77.9%
*-commutative77.9%
Applied egg-rr77.9%
unpow-177.9%
Simplified77.9%
Taylor expanded in a around 0 75.1%
+-commutative75.1%
mul-1-neg75.1%
sub-neg75.1%
div-sub77.9%
associate-/r*87.3%
Simplified87.3%
if -2.0000000000000002e-192 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < 9.99999999999999943e-158Initial program 34.5%
Taylor expanded in t around -inf 93.9%
mul-1-neg93.9%
unsub-neg93.9%
*-commutative93.9%
Simplified93.9%
Final simplification88.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -1.8e+59) (not (<= t 1.26e+24))) (+ (- x (* a (/ y t))) (* y (/ z t))) (+ (+ x y) (/ (* y (- z t)) (- t a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -1.8e+59) || !(t <= 1.26e+24)) {
tmp = (x - (a * (y / t))) + (y * (z / t));
} else {
tmp = (x + y) + ((y * (z - t)) / (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 <= (-1.8d+59)) .or. (.not. (t <= 1.26d+24))) then
tmp = (x - (a * (y / t))) + (y * (z / t))
else
tmp = (x + y) + ((y * (z - t)) / (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 <= -1.8e+59) || !(t <= 1.26e+24)) {
tmp = (x - (a * (y / t))) + (y * (z / t));
} else {
tmp = (x + y) + ((y * (z - t)) / (t - a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -1.8e+59) or not (t <= 1.26e+24): tmp = (x - (a * (y / t))) + (y * (z / t)) else: tmp = (x + y) + ((y * (z - t)) / (t - a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -1.8e+59) || !(t <= 1.26e+24)) tmp = Float64(Float64(x - Float64(a * Float64(y / t))) + Float64(y * Float64(z / t))); else tmp = Float64(Float64(x + y) + Float64(Float64(y * Float64(z - t)) / Float64(t - a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -1.8e+59) || ~((t <= 1.26e+24))) tmp = (x - (a * (y / t))) + (y * (z / t)); else tmp = (x + y) + ((y * (z - t)) / (t - a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -1.8e+59], N[Not[LessEqual[t, 1.26e+24]], $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[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.8 \cdot 10^{+59} \lor \neg \left(t \leq 1.26 \cdot 10^{+24}\right):\\
\;\;\;\;\left(x - a \cdot \frac{y}{t}\right) + y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;\left(x + y\right) + \frac{y \cdot \left(z - t\right)}{t - a}\\
\end{array}
\end{array}
if t < -1.7999999999999999e59 or 1.2600000000000001e24 < t Initial program 55.2%
Taylor expanded in t around inf 72.6%
sub-neg72.6%
mul-1-neg72.6%
unsub-neg72.6%
associate-/l*75.7%
mul-1-neg75.7%
remove-double-neg75.7%
associate-/l*85.2%
Simplified85.2%
if -1.7999999999999999e59 < t < 1.2600000000000001e24Initial program 90.4%
Final simplification87.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -1.4e-50) (not (<= t 4.6e-5))) (+ (- x (* a (/ y t))) (* y (/ z t))) (- (+ x y) (/ (* y z) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -1.4e-50) || !(t <= 4.6e-5)) {
tmp = (x - (a * (y / t))) + (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 <= (-1.4d-50)) .or. (.not. (t <= 4.6d-5))) then
tmp = (x - (a * (y / t))) + (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 <= -1.4e-50) || !(t <= 4.6e-5)) {
tmp = (x - (a * (y / t))) + (y * (z / t));
} else {
tmp = (x + y) - ((y * z) / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -1.4e-50) or not (t <= 4.6e-5): tmp = (x - (a * (y / t))) + (y * (z / t)) else: tmp = (x + y) - ((y * z) / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -1.4e-50) || !(t <= 4.6e-5)) tmp = Float64(Float64(x - Float64(a * Float64(y / t))) + Float64(y * Float64(z / 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 <= -1.4e-50) || ~((t <= 4.6e-5))) tmp = (x - (a * (y / t))) + (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, -1.4e-50], N[Not[LessEqual[t, 4.6e-5]], $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[(N[(y * z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.4 \cdot 10^{-50} \lor \neg \left(t \leq 4.6 \cdot 10^{-5}\right):\\
\;\;\;\;\left(x - a \cdot \frac{y}{t}\right) + y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;\left(x + y\right) - \frac{y \cdot z}{a}\\
\end{array}
\end{array}
if t < -1.3999999999999999e-50 or 4.6e-5 < t Initial program 60.6%
Taylor expanded in t around inf 73.0%
sub-neg73.0%
mul-1-neg73.0%
unsub-neg73.0%
associate-/l*75.5%
mul-1-neg75.5%
remove-double-neg75.5%
associate-/l*83.2%
Simplified83.2%
if -1.3999999999999999e-50 < t < 4.6e-5Initial program 92.6%
Taylor expanded in t around 0 81.0%
Final simplification82.4%
(FPCore (x y z t a)
:precision binary64
(if (<= a -4.9e+148)
(+ x y)
(if (<= a 3200000000000.0)
(+ x (/ (- (* y z) (* y a)) t))
(- (+ x y) (/ (* y z) a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -4.9e+148) {
tmp = x + y;
} else if (a <= 3200000000000.0) {
tmp = x + (((y * z) - (y * 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 (a <= (-4.9d+148)) then
tmp = x + y
else if (a <= 3200000000000.0d0) then
tmp = x + (((y * z) - (y * 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 (a <= -4.9e+148) {
tmp = x + y;
} else if (a <= 3200000000000.0) {
tmp = x + (((y * z) - (y * a)) / t);
} else {
tmp = (x + y) - ((y * z) / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -4.9e+148: tmp = x + y elif a <= 3200000000000.0: tmp = x + (((y * z) - (y * a)) / t) else: tmp = (x + y) - ((y * z) / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -4.9e+148) tmp = Float64(x + y); elseif (a <= 3200000000000.0) tmp = Float64(x + Float64(Float64(Float64(y * z) - Float64(y * 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 (a <= -4.9e+148) tmp = x + y; elseif (a <= 3200000000000.0) tmp = x + (((y * z) - (y * a)) / t); else tmp = (x + y) - ((y * z) / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -4.9e+148], N[(x + y), $MachinePrecision], If[LessEqual[a, 3200000000000.0], N[(x + N[(N[(N[(y * z), $MachinePrecision] - N[(y * a), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(N[(x + y), $MachinePrecision] - N[(N[(y * z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -4.9 \cdot 10^{+148}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;a \leq 3200000000000:\\
\;\;\;\;x + \frac{y \cdot z - y \cdot a}{t}\\
\mathbf{else}:\\
\;\;\;\;\left(x + y\right) - \frac{y \cdot z}{a}\\
\end{array}
\end{array}
if a < -4.9e148Initial program 74.9%
sub-neg74.9%
+-commutative74.9%
distribute-frac-neg74.9%
distribute-rgt-neg-out74.9%
associate-/l*92.9%
fma-define92.8%
distribute-frac-neg92.8%
distribute-neg-frac292.8%
sub-neg92.8%
distribute-neg-in92.8%
remove-double-neg92.8%
+-commutative92.8%
sub-neg92.8%
Simplified92.8%
Taylor expanded in a around inf 89.2%
+-commutative89.2%
Simplified89.2%
if -4.9e148 < a < 3.2e12Initial program 72.2%
Taylor expanded in t around -inf 77.5%
mul-1-neg77.5%
unsub-neg77.5%
*-commutative77.5%
Simplified77.5%
if 3.2e12 < a Initial program 71.1%
Taylor expanded in t around 0 76.8%
Final simplification79.6%
(FPCore (x y z t a) :precision binary64 (if (<= a -1.15e+136) (+ x y) (if (<= a 1100000000000.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 (a <= -1.15e+136) {
tmp = x + y;
} else if (a <= 1100000000000.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 (a <= (-1.15d+136)) then
tmp = x + y
else if (a <= 1100000000000.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 (a <= -1.15e+136) {
tmp = x + y;
} else if (a <= 1100000000000.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 a <= -1.15e+136: tmp = x + y elif a <= 1100000000000.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 (a <= -1.15e+136) tmp = Float64(x + y); elseif (a <= 1100000000000.0) tmp = Float64(x + Float64(Float64(y * z) / 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 (a <= -1.15e+136) tmp = x + y; elseif (a <= 1100000000000.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[LessEqual[a, -1.15e+136], N[(x + y), $MachinePrecision], If[LessEqual[a, 1100000000000.0], N[(x + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(N[(x + y), $MachinePrecision] - N[(N[(y * z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.15 \cdot 10^{+136}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;a \leq 1100000000000:\\
\;\;\;\;x + \frac{y \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;\left(x + y\right) - \frac{y \cdot z}{a}\\
\end{array}
\end{array}
if a < -1.15e136Initial program 73.5%
sub-neg73.5%
+-commutative73.5%
distribute-frac-neg73.5%
distribute-rgt-neg-out73.5%
associate-/l*91.1%
fma-define91.2%
distribute-frac-neg91.2%
distribute-neg-frac291.2%
sub-neg91.2%
distribute-neg-in91.2%
remove-double-neg91.2%
+-commutative91.2%
sub-neg91.2%
Simplified91.2%
Taylor expanded in a around inf 87.6%
+-commutative87.6%
Simplified87.6%
if -1.15e136 < a < 1.1e12Initial program 72.6%
Taylor expanded in t around inf 77.4%
associate-*r/77.4%
associate-*r*77.4%
neg-mul-177.4%
associate-*r/77.4%
associate-*r*77.4%
neg-mul-177.4%
Simplified77.4%
Taylor expanded in a around 0 73.1%
cancel-sign-sub-inv73.1%
metadata-eval73.1%
associate-*r/78.0%
*-lft-identity78.0%
associate-*r/73.1%
Simplified73.1%
if 1.1e12 < a Initial program 71.1%
Taylor expanded in t around 0 76.8%
Final simplification76.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -1.15e+136) (not (<= a 1.3e+43))) (+ x y) (+ x (/ (* y z) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1.15e+136) || !(a <= 1.3e+43)) {
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.15d+136)) .or. (.not. (a <= 1.3d+43))) 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.15e+136) || !(a <= 1.3e+43)) {
tmp = x + y;
} else {
tmp = x + ((y * z) / t);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -1.15e+136) or not (a <= 1.3e+43): tmp = x + y else: tmp = x + ((y * z) / t) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -1.15e+136) || !(a <= 1.3e+43)) 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.15e+136) || ~((a <= 1.3e+43))) 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.15e+136], N[Not[LessEqual[a, 1.3e+43]], $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.15 \cdot 10^{+136} \lor \neg \left(a \leq 1.3 \cdot 10^{+43}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot z}{t}\\
\end{array}
\end{array}
if a < -1.15e136 or 1.3000000000000001e43 < a Initial program 73.3%
sub-neg73.3%
+-commutative73.3%
distribute-frac-neg73.3%
distribute-rgt-neg-out73.3%
associate-/l*91.2%
fma-define91.3%
distribute-frac-neg91.3%
distribute-neg-frac291.3%
sub-neg91.3%
distribute-neg-in91.3%
remove-double-neg91.3%
+-commutative91.3%
sub-neg91.3%
Simplified91.3%
Taylor expanded in a around inf 84.7%
+-commutative84.7%
Simplified84.7%
if -1.15e136 < a < 1.3000000000000001e43Initial program 72.0%
Taylor expanded in t around inf 75.3%
associate-*r/75.3%
associate-*r*75.3%
neg-mul-175.3%
associate-*r/75.3%
associate-*r*75.3%
neg-mul-175.3%
Simplified75.3%
Taylor expanded in a around 0 71.3%
cancel-sign-sub-inv71.3%
metadata-eval71.3%
associate-*r/77.1%
*-lft-identity77.1%
associate-*r/71.3%
Simplified71.3%
Final simplification76.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -9e+190) (not (<= z 7e+152))) (* y (/ z (- t a))) (+ x y)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -9e+190) || !(z <= 7e+152)) {
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 <= (-9d+190)) .or. (.not. (z <= 7d+152))) 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 <= -9e+190) || !(z <= 7e+152)) {
tmp = y * (z / (t - a));
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -9e+190) or not (z <= 7e+152): tmp = y * (z / (t - a)) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -9e+190) || !(z <= 7e+152)) 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 <= -9e+190) || ~((z <= 7e+152))) tmp = y * (z / (t - a)); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -9e+190], N[Not[LessEqual[z, 7e+152]], $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 -9 \cdot 10^{+190} \lor \neg \left(z \leq 7 \cdot 10^{+152}\right):\\
\;\;\;\;y \cdot \frac{z}{t - a}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -8.9999999999999999e190 or 6.99999999999999963e152 < z Initial program 75.4%
sub-neg75.4%
+-commutative75.4%
distribute-frac-neg75.4%
distribute-rgt-neg-out75.4%
associate-/l*86.7%
fma-define86.7%
distribute-frac-neg86.7%
distribute-neg-frac286.7%
sub-neg86.7%
distribute-neg-in86.7%
remove-double-neg86.7%
+-commutative86.7%
sub-neg86.7%
Simplified86.7%
Taylor expanded in z around inf 50.9%
associate-/l*68.3%
Simplified68.3%
if -8.9999999999999999e190 < z < 6.99999999999999963e152Initial program 71.8%
sub-neg71.8%
+-commutative71.8%
distribute-frac-neg71.8%
distribute-rgt-neg-out71.8%
associate-/l*78.2%
fma-define78.2%
distribute-frac-neg78.2%
distribute-neg-frac278.2%
sub-neg78.2%
distribute-neg-in78.2%
remove-double-neg78.2%
+-commutative78.2%
sub-neg78.2%
Simplified78.2%
Taylor expanded in a around inf 63.6%
+-commutative63.6%
Simplified63.6%
Final simplification64.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -1.22e+43) (not (<= a 1800000000000.0))) (+ x y) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1.22e+43) || !(a <= 1800000000000.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.22d+43)) .or. (.not. (a <= 1800000000000.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.22e+43) || !(a <= 1800000000000.0)) {
tmp = x + y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -1.22e+43) or not (a <= 1800000000000.0): tmp = x + y else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -1.22e+43) || !(a <= 1800000000000.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.22e+43) || ~((a <= 1800000000000.0))) tmp = x + y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -1.22e+43], N[Not[LessEqual[a, 1800000000000.0]], $MachinePrecision]], N[(x + y), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.22 \cdot 10^{+43} \lor \neg \left(a \leq 1800000000000\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -1.22e43 or 1.8e12 < a Initial program 73.4%
sub-neg73.4%
+-commutative73.4%
distribute-frac-neg73.4%
distribute-rgt-neg-out73.4%
associate-/l*88.3%
fma-define88.3%
distribute-frac-neg88.3%
distribute-neg-frac288.3%
sub-neg88.3%
distribute-neg-in88.3%
remove-double-neg88.3%
+-commutative88.3%
sub-neg88.3%
Simplified88.3%
Taylor expanded in a around inf 78.2%
+-commutative78.2%
Simplified78.2%
if -1.22e43 < a < 1.8e12Initial program 71.7%
sub-neg71.7%
+-commutative71.7%
distribute-frac-neg71.7%
distribute-rgt-neg-out71.7%
associate-/l*72.5%
fma-define72.6%
distribute-frac-neg72.6%
distribute-neg-frac272.6%
sub-neg72.6%
distribute-neg-in72.6%
remove-double-neg72.6%
+-commutative72.6%
sub-neg72.6%
Simplified72.6%
Taylor expanded in t around inf 49.9%
distribute-rgt1-in49.9%
metadata-eval49.9%
mul0-lft49.9%
Simplified49.9%
Taylor expanded in x around 0 49.9%
Final simplification62.9%
(FPCore (x y z t a) :precision binary64 (if (<= y -2.1e+240) y (if (<= y 1.1e+147) x y)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -2.1e+240) {
tmp = y;
} else if (y <= 1.1e+147) {
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 <= (-2.1d+240)) then
tmp = y
else if (y <= 1.1d+147) 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 <= -2.1e+240) {
tmp = y;
} else if (y <= 1.1e+147) {
tmp = x;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= -2.1e+240: tmp = y elif y <= 1.1e+147: tmp = x else: tmp = y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= -2.1e+240) tmp = y; elseif (y <= 1.1e+147) tmp = x; else tmp = y; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (y <= -2.1e+240) tmp = y; elseif (y <= 1.1e+147) tmp = x; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -2.1e+240], y, If[LessEqual[y, 1.1e+147], x, y]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.1 \cdot 10^{+240}:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq 1.1 \cdot 10^{+147}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if y < -2.0999999999999999e240 or 1.1000000000000001e147 < y Initial program 41.6%
sub-neg41.6%
+-commutative41.6%
distribute-frac-neg41.6%
distribute-rgt-neg-out41.6%
associate-/l*64.0%
fma-define64.3%
distribute-frac-neg64.3%
distribute-neg-frac264.3%
sub-neg64.3%
distribute-neg-in64.3%
remove-double-neg64.3%
+-commutative64.3%
sub-neg64.3%
Simplified64.3%
Taylor expanded in y around inf 62.0%
associate--l+62.0%
div-sub62.0%
Simplified62.0%
Taylor expanded in a around inf 35.7%
Taylor expanded in y around 0 35.7%
if -2.0999999999999999e240 < y < 1.1000000000000001e147Initial program 81.7%
sub-neg81.7%
+-commutative81.7%
distribute-frac-neg81.7%
distribute-rgt-neg-out81.7%
associate-/l*84.5%
fma-define84.5%
distribute-frac-neg84.5%
distribute-neg-frac284.5%
sub-neg84.5%
distribute-neg-in84.5%
remove-double-neg84.5%
+-commutative84.5%
sub-neg84.5%
Simplified84.5%
Taylor expanded in t around inf 60.5%
distribute-rgt1-in60.5%
metadata-eval60.5%
mul0-lft60.5%
Simplified60.5%
Taylor expanded in x around 0 60.5%
(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 72.5%
sub-neg72.5%
+-commutative72.5%
distribute-frac-neg72.5%
distribute-rgt-neg-out72.5%
associate-/l*79.8%
fma-define79.8%
distribute-frac-neg79.8%
distribute-neg-frac279.8%
sub-neg79.8%
distribute-neg-in79.8%
remove-double-neg79.8%
+-commutative79.8%
sub-neg79.8%
Simplified79.8%
Taylor expanded in t around inf 49.2%
distribute-rgt1-in49.2%
metadata-eval49.2%
mul0-lft49.2%
Simplified49.2%
Taylor expanded in x around 0 49.2%
(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 2024172
(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))))