
(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 (/ y (- t a))) (t_2 (+ (+ x y) (/ (* y (- z t)) (- t a)))))
(if (<= t_2 (- INFINITY))
(* z t_1)
(if (<= t_2 -5e-253)
t_2
(if (<= t_2 0.0)
(+ (- x (* a (/ y t))) (* y (/ z t)))
(fma (- z t) t_1 (+ x y)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = y / (t - a);
double t_2 = (x + y) + ((y * (z - t)) / (t - a));
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = z * t_1;
} else if (t_2 <= -5e-253) {
tmp = t_2;
} else if (t_2 <= 0.0) {
tmp = (x - (a * (y / t))) + (y * (z / t));
} else {
tmp = fma((z - t), t_1, (x + y));
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(y / Float64(t - a)) t_2 = Float64(Float64(x + y) + Float64(Float64(y * Float64(z - t)) / Float64(t - a))) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = Float64(z * t_1); elseif (t_2 <= -5e-253) tmp = t_2; elseif (t_2 <= 0.0) tmp = Float64(Float64(x - Float64(a * Float64(y / t))) + Float64(y * Float64(z / t))); else tmp = fma(Float64(z - t), t_1, Float64(x + y)); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y / N[(t - a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x + y), $MachinePrecision] + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], N[(z * t$95$1), $MachinePrecision], If[LessEqual[t$95$2, -5e-253], t$95$2, If[LessEqual[t$95$2, 0.0], N[(N[(x - N[(a * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z - t), $MachinePrecision] * t$95$1 + N[(x + y), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{t - a}\\
t_2 := \left(x + y\right) + \frac{y \cdot \left(z - t\right)}{t - a}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;z \cdot t\_1\\
\mathbf{elif}\;t\_2 \leq -5 \cdot 10^{-253}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;\left(x - a \cdot \frac{y}{t}\right) + y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z - t, t\_1, x + y\right)\\
\end{array}
\end{array}
if (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < -inf.0Initial program 60.7%
sub-neg60.7%
+-commutative60.7%
distribute-frac-neg60.7%
distribute-rgt-neg-out60.7%
associate-/l*73.2%
fma-define74.0%
distribute-frac-neg74.0%
distribute-neg-frac274.0%
sub-neg74.0%
distribute-neg-in74.0%
remove-double-neg74.0%
+-commutative74.0%
sub-neg74.0%
Simplified74.0%
Taylor expanded in z around inf 72.0%
*-commutative72.0%
*-un-lft-identity72.0%
times-frac94.2%
Applied egg-rr94.2%
if -inf.0 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < -4.99999999999999971e-253Initial program 96.6%
if -4.99999999999999971e-253 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < 0.0Initial program 11.7%
associate-/l*4.8%
*-commutative4.8%
Applied egg-rr4.8%
Taylor expanded in t around inf 99.9%
sub-neg99.9%
mul-1-neg99.9%
unsub-neg99.9%
associate-/l*100.0%
mul-1-neg100.0%
remove-double-neg100.0%
associate-/l*100.0%
Simplified100.0%
if 0.0 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) Initial program 82.0%
sub-neg82.0%
+-commutative82.0%
distribute-frac-neg82.0%
distribute-rgt-neg-out82.0%
associate-/l*90.9%
fma-define91.0%
distribute-frac-neg91.0%
distribute-neg-frac291.0%
sub-neg91.0%
distribute-neg-in91.0%
remove-double-neg91.0%
+-commutative91.0%
sub-neg91.0%
Simplified91.0%
Final simplification93.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ y (- t a))) (t_2 (+ (+ x y) (/ (* y (- z t)) (- t a)))))
(if (<= t_2 (- INFINITY))
(* z t_1)
(if (<= t_2 -5e-253)
t_2
(if (<= t_2 0.0)
(+ (- x (* a (/ y t))) (* y (/ z t)))
(+ (+ x y) (* (- z t) t_1)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = y / (t - a);
double t_2 = (x + y) + ((y * (z - t)) / (t - a));
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = z * t_1;
} else if (t_2 <= -5e-253) {
tmp = t_2;
} else if (t_2 <= 0.0) {
tmp = (x - (a * (y / t))) + (y * (z / t));
} else {
tmp = (x + y) + ((z - t) * t_1);
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a) {
double t_1 = y / (t - a);
double t_2 = (x + y) + ((y * (z - t)) / (t - a));
double tmp;
if (t_2 <= -Double.POSITIVE_INFINITY) {
tmp = z * t_1;
} else if (t_2 <= -5e-253) {
tmp = t_2;
} else if (t_2 <= 0.0) {
tmp = (x - (a * (y / t))) + (y * (z / t));
} else {
tmp = (x + y) + ((z - t) * t_1);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = y / (t - a) t_2 = (x + y) + ((y * (z - t)) / (t - a)) tmp = 0 if t_2 <= -math.inf: tmp = z * t_1 elif t_2 <= -5e-253: tmp = t_2 elif t_2 <= 0.0: tmp = (x - (a * (y / t))) + (y * (z / t)) else: tmp = (x + y) + ((z - t) * t_1) return tmp
function code(x, y, z, t, a) t_1 = Float64(y / Float64(t - a)) t_2 = Float64(Float64(x + y) + Float64(Float64(y * Float64(z - t)) / Float64(t - a))) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = Float64(z * t_1); elseif (t_2 <= -5e-253) tmp = t_2; elseif (t_2 <= 0.0) tmp = Float64(Float64(x - Float64(a * Float64(y / t))) + Float64(y * Float64(z / t))); else tmp = Float64(Float64(x + y) + Float64(Float64(z - t) * t_1)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = y / (t - a); t_2 = (x + y) + ((y * (z - t)) / (t - a)); tmp = 0.0; if (t_2 <= -Inf) tmp = z * t_1; elseif (t_2 <= -5e-253) tmp = t_2; elseif (t_2 <= 0.0) tmp = (x - (a * (y / t))) + (y * (z / t)); else tmp = (x + y) + ((z - t) * t_1); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y / N[(t - a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x + y), $MachinePrecision] + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], N[(z * t$95$1), $MachinePrecision], If[LessEqual[t$95$2, -5e-253], t$95$2, If[LessEqual[t$95$2, 0.0], 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[(z - t), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{t - a}\\
t_2 := \left(x + y\right) + \frac{y \cdot \left(z - t\right)}{t - a}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;z \cdot t\_1\\
\mathbf{elif}\;t\_2 \leq -5 \cdot 10^{-253}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;\left(x - a \cdot \frac{y}{t}\right) + y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;\left(x + y\right) + \left(z - t\right) \cdot t\_1\\
\end{array}
\end{array}
if (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < -inf.0Initial program 60.7%
sub-neg60.7%
+-commutative60.7%
distribute-frac-neg60.7%
distribute-rgt-neg-out60.7%
associate-/l*73.2%
fma-define74.0%
distribute-frac-neg74.0%
distribute-neg-frac274.0%
sub-neg74.0%
distribute-neg-in74.0%
remove-double-neg74.0%
+-commutative74.0%
sub-neg74.0%
Simplified74.0%
Taylor expanded in z around inf 72.0%
*-commutative72.0%
*-un-lft-identity72.0%
times-frac94.2%
Applied egg-rr94.2%
if -inf.0 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < -4.99999999999999971e-253Initial program 96.6%
if -4.99999999999999971e-253 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < 0.0Initial program 11.7%
associate-/l*4.8%
*-commutative4.8%
Applied egg-rr4.8%
Taylor expanded in t around inf 99.9%
sub-neg99.9%
mul-1-neg99.9%
unsub-neg99.9%
associate-/l*100.0%
mul-1-neg100.0%
remove-double-neg100.0%
associate-/l*100.0%
Simplified100.0%
if 0.0 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) Initial program 82.0%
associate-/l*90.9%
*-commutative90.9%
Applied egg-rr90.9%
Final simplification93.8%
(FPCore (x y z t a)
:precision binary64
(if (or (<= a -2.2e+77)
(not (or (<= a -6.4e+45) (and (not (<= a -3.4e-7)) (<= a 1.55e+53)))))
(+ x y)
(+ x (* (/ y t) (- z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -2.2e+77) || !((a <= -6.4e+45) || (!(a <= -3.4e-7) && (a <= 1.55e+53)))) {
tmp = x + y;
} 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 <= (-2.2d+77)) .or. (.not. (a <= (-6.4d+45)) .or. (.not. (a <= (-3.4d-7))) .and. (a <= 1.55d+53))) then
tmp = x + y
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 <= -2.2e+77) || !((a <= -6.4e+45) || (!(a <= -3.4e-7) && (a <= 1.55e+53)))) {
tmp = x + y;
} else {
tmp = x + ((y / t) * (z - a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -2.2e+77) or not ((a <= -6.4e+45) or (not (a <= -3.4e-7) and (a <= 1.55e+53))): tmp = x + y else: tmp = x + ((y / t) * (z - a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -2.2e+77) || !((a <= -6.4e+45) || (!(a <= -3.4e-7) && (a <= 1.55e+53)))) tmp = Float64(x + y); else tmp = Float64(x + Float64(Float64(y / t) * Float64(z - a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -2.2e+77) || ~(((a <= -6.4e+45) || (~((a <= -3.4e-7)) && (a <= 1.55e+53))))) tmp = x + y; else tmp = x + ((y / t) * (z - a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -2.2e+77], N[Not[Or[LessEqual[a, -6.4e+45], And[N[Not[LessEqual[a, -3.4e-7]], $MachinePrecision], LessEqual[a, 1.55e+53]]]], $MachinePrecision]], N[(x + y), $MachinePrecision], N[(x + N[(N[(y / t), $MachinePrecision] * N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.2 \cdot 10^{+77} \lor \neg \left(a \leq -6.4 \cdot 10^{+45} \lor \neg \left(a \leq -3.4 \cdot 10^{-7}\right) \land a \leq 1.55 \cdot 10^{+53}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{t} \cdot \left(z - a\right)\\
\end{array}
\end{array}
if a < -2.2e77 or -6.4000000000000006e45 < a < -3.39999999999999974e-7 or 1.5500000000000001e53 < a Initial program 86.7%
Taylor expanded in a around inf 82.7%
+-commutative82.7%
Simplified82.7%
if -2.2e77 < a < -6.4000000000000006e45 or -3.39999999999999974e-7 < a < 1.5500000000000001e53Initial program 80.1%
associate-/l*77.7%
*-commutative77.7%
Applied egg-rr77.7%
Taylor expanded in t around inf 76.0%
sub-neg76.0%
mul-1-neg76.0%
unsub-neg76.0%
associate-/l*75.3%
mul-1-neg75.3%
remove-double-neg75.3%
associate-/l*76.6%
Simplified76.6%
Taylor expanded in x around 0 76.0%
associate--l+76.0%
associate-*r/77.3%
associate-*r/76.6%
*-commutative76.6%
associate-*l/75.3%
associate-*r/79.8%
distribute-rgt-out--81.3%
Simplified81.3%
Final simplification81.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -2.7e+125) (not (<= t 4.3e+160))) (+ x (* (/ y t) (- z a))) (+ (+ x y) (* (- z t) (/ y (- t a))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -2.7e+125) || !(t <= 4.3e+160)) {
tmp = x + ((y / t) * (z - a));
} 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 <= (-2.7d+125)) .or. (.not. (t <= 4.3d+160))) then
tmp = x + ((y / t) * (z - a))
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 <= -2.7e+125) || !(t <= 4.3e+160)) {
tmp = x + ((y / t) * (z - a));
} else {
tmp = (x + y) + ((z - t) * (y / (t - a)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -2.7e+125) or not (t <= 4.3e+160): tmp = x + ((y / t) * (z - a)) else: tmp = (x + y) + ((z - t) * (y / (t - a))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -2.7e+125) || !(t <= 4.3e+160)) tmp = Float64(x + Float64(Float64(y / t) * Float64(z - a))); 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 <= -2.7e+125) || ~((t <= 4.3e+160))) tmp = x + ((y / t) * (z - a)); else tmp = (x + y) + ((z - t) * (y / (t - a))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -2.7e+125], N[Not[LessEqual[t, 4.3e+160]], $MachinePrecision]], N[(x + N[(N[(y / t), $MachinePrecision] * N[(z - a), $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 -2.7 \cdot 10^{+125} \lor \neg \left(t \leq 4.3 \cdot 10^{+160}\right):\\
\;\;\;\;x + \frac{y}{t} \cdot \left(z - a\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x + y\right) + \left(z - t\right) \cdot \frac{y}{t - a}\\
\end{array}
\end{array}
if t < -2.6999999999999999e125 or 4.29999999999999989e160 < t Initial program 62.2%
associate-/l*73.3%
*-commutative73.3%
Applied egg-rr73.3%
Taylor expanded in t around inf 72.2%
sub-neg72.2%
mul-1-neg72.2%
unsub-neg72.2%
associate-/l*77.1%
mul-1-neg77.1%
remove-double-neg77.1%
associate-/l*93.7%
Simplified93.7%
Taylor expanded in x around 0 72.2%
associate--l+72.2%
associate-*r/84.4%
associate-*r/93.7%
*-commutative93.7%
associate-*l/77.1%
associate-*r/93.8%
distribute-rgt-out--93.8%
Simplified93.8%
if -2.6999999999999999e125 < t < 4.29999999999999989e160Initial program 89.6%
associate-/l*89.4%
*-commutative89.4%
Applied egg-rr89.4%
Final simplification90.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -3.1e-6) (not (<= t 0.215))) (+ x (* (/ y t) (- z a))) (- (+ x y) (* y (/ z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -3.1e-6) || !(t <= 0.215)) {
tmp = x + ((y / t) * (z - a));
} 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 <= (-3.1d-6)) .or. (.not. (t <= 0.215d0))) then
tmp = x + ((y / t) * (z - a))
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 <= -3.1e-6) || !(t <= 0.215)) {
tmp = x + ((y / t) * (z - a));
} else {
tmp = (x + y) - (y * (z / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -3.1e-6) or not (t <= 0.215): tmp = x + ((y / t) * (z - a)) else: tmp = (x + y) - (y * (z / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -3.1e-6) || !(t <= 0.215)) tmp = Float64(x + Float64(Float64(y / t) * Float64(z - a))); 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 <= -3.1e-6) || ~((t <= 0.215))) tmp = x + ((y / t) * (z - a)); else tmp = (x + y) - (y * (z / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -3.1e-6], N[Not[LessEqual[t, 0.215]], $MachinePrecision]], N[(x + N[(N[(y / t), $MachinePrecision] * N[(z - a), $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 -3.1 \cdot 10^{-6} \lor \neg \left(t \leq 0.215\right):\\
\;\;\;\;x + \frac{y}{t} \cdot \left(z - a\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x + y\right) - y \cdot \frac{z}{a}\\
\end{array}
\end{array}
if t < -3.1e-6 or 0.214999999999999997 < t Initial program 69.3%
associate-/l*79.5%
*-commutative79.5%
Applied egg-rr79.5%
Taylor expanded in t around inf 72.4%
sub-neg72.4%
mul-1-neg72.4%
unsub-neg72.4%
associate-/l*75.1%
mul-1-neg75.1%
remove-double-neg75.1%
associate-/l*84.1%
Simplified84.1%
Taylor expanded in x around 0 72.4%
associate--l+72.4%
associate-*r/79.1%
associate-*r/84.1%
*-commutative84.1%
associate-*l/75.1%
associate-*r/84.2%
distribute-rgt-out--84.2%
Simplified84.2%
if -3.1e-6 < t < 0.214999999999999997Initial program 94.1%
Taylor expanded in t around 0 84.4%
associate-/l*83.6%
Simplified83.6%
Final simplification83.9%
(FPCore (x y z t a) :precision binary64 (if (<= y -2.2e+186) (* y (- 1.0 (/ z a))) (if (<= y -1e+142) (* y (/ z t)) (if (<= y -1.75e+50) x (+ x y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -2.2e+186) {
tmp = y * (1.0 - (z / a));
} else if (y <= -1e+142) {
tmp = y * (z / t);
} else if (y <= -1.75e+50) {
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 (y <= (-2.2d+186)) then
tmp = y * (1.0d0 - (z / a))
else if (y <= (-1d+142)) then
tmp = y * (z / t)
else if (y <= (-1.75d+50)) 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 (y <= -2.2e+186) {
tmp = y * (1.0 - (z / a));
} else if (y <= -1e+142) {
tmp = y * (z / t);
} else if (y <= -1.75e+50) {
tmp = x;
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= -2.2e+186: tmp = y * (1.0 - (z / a)) elif y <= -1e+142: tmp = y * (z / t) elif y <= -1.75e+50: tmp = x else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= -2.2e+186) tmp = Float64(y * Float64(1.0 - Float64(z / a))); elseif (y <= -1e+142) tmp = Float64(y * Float64(z / t)); elseif (y <= -1.75e+50) tmp = x; else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (y <= -2.2e+186) tmp = y * (1.0 - (z / a)); elseif (y <= -1e+142) tmp = y * (z / t); elseif (y <= -1.75e+50) tmp = x; else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -2.2e+186], N[(y * N[(1.0 - N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -1e+142], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -1.75e+50], x, N[(x + y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.2 \cdot 10^{+186}:\\
\;\;\;\;y \cdot \left(1 - \frac{z}{a}\right)\\
\mathbf{elif}\;y \leq -1 \cdot 10^{+142}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{elif}\;y \leq -1.75 \cdot 10^{+50}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if y < -2.1999999999999998e186Initial program 60.8%
associate-/l*58.2%
*-commutative58.2%
Applied egg-rr58.2%
Taylor expanded in t around 0 64.1%
+-commutative64.1%
associate-/l*70.8%
Simplified70.8%
Taylor expanded in y around inf 64.2%
if -2.1999999999999998e186 < y < -1.00000000000000005e142Initial program 52.2%
sub-neg52.2%
+-commutative52.2%
distribute-frac-neg52.2%
distribute-rgt-neg-out52.2%
associate-/l*75.5%
fma-define76.1%
distribute-frac-neg76.1%
distribute-neg-frac276.1%
sub-neg76.1%
distribute-neg-in76.1%
remove-double-neg76.1%
+-commutative76.1%
sub-neg76.1%
Simplified76.1%
Taylor expanded in z around inf 44.0%
Taylor expanded in t around inf 34.8%
associate-/l*58.3%
Simplified58.3%
if -1.00000000000000005e142 < y < -1.75000000000000003e50Initial program 63.1%
Taylor expanded in x around inf 44.3%
if -1.75000000000000003e50 < y Initial program 90.5%
Taylor expanded in a around inf 73.5%
+-commutative73.5%
Simplified73.5%
Final simplification69.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -2.2e+77) (not (<= a 2.1e-150))) (+ x y) (+ x (/ (* y z) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -2.2e+77) || !(a <= 2.1e-150)) {
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.2d+77)) .or. (.not. (a <= 2.1d-150))) 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.2e+77) || !(a <= 2.1e-150)) {
tmp = x + y;
} else {
tmp = x + ((y * z) / t);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -2.2e+77) or not (a <= 2.1e-150): tmp = x + y else: tmp = x + ((y * z) / t) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -2.2e+77) || !(a <= 2.1e-150)) 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.2e+77) || ~((a <= 2.1e-150))) 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.2e+77], N[Not[LessEqual[a, 2.1e-150]], $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.2 \cdot 10^{+77} \lor \neg \left(a \leq 2.1 \cdot 10^{-150}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot z}{t}\\
\end{array}
\end{array}
if a < -2.2e77 or 2.1000000000000001e-150 < a Initial program 84.6%
Taylor expanded in a around inf 79.0%
+-commutative79.0%
Simplified79.0%
if -2.2e77 < a < 2.1000000000000001e-150Initial program 81.1%
associate-/l*78.8%
*-commutative78.8%
Applied egg-rr78.8%
Taylor expanded in t around inf 74.9%
sub-neg74.9%
mul-1-neg74.9%
unsub-neg74.9%
associate-/l*74.1%
mul-1-neg74.1%
remove-double-neg74.1%
associate-/l*73.3%
Simplified73.3%
Taylor expanded in a around 0 75.3%
Final simplification77.2%
(FPCore (x y z t a) :precision binary64 (if (<= y -2.9e+186) (* y (- 1.0 (/ z a))) (if (<= y -4.9e+61) (* y (/ z (- t a))) (+ x y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -2.9e+186) {
tmp = y * (1.0 - (z / a));
} else if (y <= -4.9e+61) {
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 (y <= (-2.9d+186)) then
tmp = y * (1.0d0 - (z / a))
else if (y <= (-4.9d+61)) 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 (y <= -2.9e+186) {
tmp = y * (1.0 - (z / a));
} else if (y <= -4.9e+61) {
tmp = y * (z / (t - a));
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= -2.9e+186: tmp = y * (1.0 - (z / a)) elif y <= -4.9e+61: tmp = y * (z / (t - a)) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= -2.9e+186) tmp = Float64(y * Float64(1.0 - Float64(z / a))); elseif (y <= -4.9e+61) 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 (y <= -2.9e+186) tmp = y * (1.0 - (z / a)); elseif (y <= -4.9e+61) tmp = y * (z / (t - a)); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -2.9e+186], N[(y * N[(1.0 - N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -4.9e+61], N[(y * N[(z / N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.9 \cdot 10^{+186}:\\
\;\;\;\;y \cdot \left(1 - \frac{z}{a}\right)\\
\mathbf{elif}\;y \leq -4.9 \cdot 10^{+61}:\\
\;\;\;\;y \cdot \frac{z}{t - a}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if y < -2.9e186Initial program 60.8%
associate-/l*58.2%
*-commutative58.2%
Applied egg-rr58.2%
Taylor expanded in t around 0 64.1%
+-commutative64.1%
associate-/l*70.8%
Simplified70.8%
Taylor expanded in y around inf 64.2%
if -2.9e186 < y < -4.90000000000000025e61Initial program 59.7%
sub-neg59.7%
+-commutative59.7%
distribute-frac-neg59.7%
distribute-rgt-neg-out59.7%
associate-/l*78.0%
fma-define77.8%
distribute-frac-neg77.8%
distribute-neg-frac277.8%
sub-neg77.8%
distribute-neg-in77.8%
remove-double-neg77.8%
+-commutative77.8%
sub-neg77.8%
Simplified77.8%
Taylor expanded in z around inf 41.1%
associate-/l*59.3%
Simplified59.3%
if -4.90000000000000025e61 < y Initial program 90.1%
Taylor expanded in a around inf 73.3%
+-commutative73.3%
Simplified73.3%
Final simplification70.5%
(FPCore (x y z t a) :precision binary64 (if (<= y -1.75e+147) y (if (<= y 4.2e+182) x y)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -1.75e+147) {
tmp = y;
} else if (y <= 4.2e+182) {
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 <= (-1.75d+147)) then
tmp = y
else if (y <= 4.2d+182) 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 <= -1.75e+147) {
tmp = y;
} else if (y <= 4.2e+182) {
tmp = x;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= -1.75e+147: tmp = y elif y <= 4.2e+182: tmp = x else: tmp = y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= -1.75e+147) tmp = y; elseif (y <= 4.2e+182) tmp = x; else tmp = y; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (y <= -1.75e+147) tmp = y; elseif (y <= 4.2e+182) tmp = x; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -1.75e+147], y, If[LessEqual[y, 4.2e+182], x, y]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.75 \cdot 10^{+147}:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq 4.2 \cdot 10^{+182}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if y < -1.74999999999999987e147 or 4.1999999999999998e182 < y Initial program 64.3%
Taylor expanded in a around inf 54.2%
associate-+r+54.2%
+-commutative54.2%
mul-1-neg54.2%
unsub-neg54.2%
associate-/l*62.9%
Simplified62.9%
Taylor expanded in y around -inf 61.2%
neg-mul-161.2%
unsub-neg61.2%
Simplified61.2%
Taylor expanded in a around inf 38.2%
if -1.74999999999999987e147 < y < 4.1999999999999998e182Initial program 88.6%
Taylor expanded in x around inf 63.8%
Final simplification57.9%
(FPCore (x y z t a) :precision binary64 (+ x y))
double code(double x, double y, double z, double t, double a) {
return x + y;
}
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
end function
public static double code(double x, double y, double z, double t, double a) {
return x + y;
}
def code(x, y, z, t, a): return x + y
function code(x, y, z, t, a) return Float64(x + y) end
function tmp = code(x, y, z, t, a) tmp = x + y; end
code[x_, y_, z_, t_, a_] := N[(x + y), $MachinePrecision]
\begin{array}{l}
\\
x + y
\end{array}
Initial program 83.0%
Taylor expanded in a around inf 64.6%
+-commutative64.6%
Simplified64.6%
Final simplification64.6%
(FPCore (x y z t a) :precision binary64 x)
double code(double x, double y, double z, double t, double a) {
return x;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x
end function
public static double code(double x, double y, double z, double t, double a) {
return x;
}
def code(x, y, z, t, a): return x
function code(x, y, z, t, a) return x end
function tmp = code(x, y, z, t, a) tmp = x; end
code[x_, y_, z_, t_, a_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 83.0%
Taylor expanded in x around inf 52.4%
Final simplification52.4%
(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 2024053
(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))))