
(FPCore (x y z t a) :precision binary64 (+ x (* y (/ (- z t) (- a t)))))
double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (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) / (a - t)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (a - t)));
}
def code(x, y, z, t, a): return x + (y * ((z - t) / (a - t)))
function code(x, y, z, t, a) return Float64(x + Float64(y * Float64(Float64(z - t) / Float64(a - t)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y * ((z - t) / (a - t))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{z - t}{a - t}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ x (* y (/ (- z t) (- a t)))))
double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (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) / (a - t)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (a - t)));
}
def code(x, y, z, t, a): return x + (y * ((z - t) / (a - t)))
function code(x, y, z, t, a) return Float64(x + Float64(y * Float64(Float64(z - t) / Float64(a - t)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y * ((z - t) / (a - t))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{z - t}{a - t}
\end{array}
(FPCore (x y z t a) :precision binary64 (+ x (* y (/ (- z t) (- a t)))))
double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (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) / (a - t)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (a - t)));
}
def code(x, y, z, t, a): return x + (y * ((z - t) / (a - t)))
function code(x, y, z, t, a) return Float64(x + Float64(y * Float64(Float64(z - t) / Float64(a - t)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y * ((z - t) / (a - t))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{z - t}{a - t}
\end{array}
Initial program 98.8%
Final simplification98.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* y (/ z (- a t))))))
(if (<= t -1.85e+120)
(+ x y)
(if (<= t 2.8e+53)
t_1
(if (<= t 1.2e+95)
(/ (* y t) (- t a))
(if (<= t 9.2e+174) t_1 (+ x y)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (y * (z / (a - t)));
double tmp;
if (t <= -1.85e+120) {
tmp = x + y;
} else if (t <= 2.8e+53) {
tmp = t_1;
} else if (t <= 1.2e+95) {
tmp = (y * t) / (t - a);
} else if (t <= 9.2e+174) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = x + (y * (z / (a - t)))
if (t <= (-1.85d+120)) then
tmp = x + y
else if (t <= 2.8d+53) then
tmp = t_1
else if (t <= 1.2d+95) then
tmp = (y * t) / (t - a)
else if (t <= 9.2d+174) then
tmp = t_1
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 t_1 = x + (y * (z / (a - t)));
double tmp;
if (t <= -1.85e+120) {
tmp = x + y;
} else if (t <= 2.8e+53) {
tmp = t_1;
} else if (t <= 1.2e+95) {
tmp = (y * t) / (t - a);
} else if (t <= 9.2e+174) {
tmp = t_1;
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + (y * (z / (a - t))) tmp = 0 if t <= -1.85e+120: tmp = x + y elif t <= 2.8e+53: tmp = t_1 elif t <= 1.2e+95: tmp = (y * t) / (t - a) elif t <= 9.2e+174: tmp = t_1 else: tmp = x + y return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(y * Float64(z / Float64(a - t)))) tmp = 0.0 if (t <= -1.85e+120) tmp = Float64(x + y); elseif (t <= 2.8e+53) tmp = t_1; elseif (t <= 1.2e+95) tmp = Float64(Float64(y * t) / Float64(t - a)); elseif (t <= 9.2e+174) tmp = t_1; else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + (y * (z / (a - t))); tmp = 0.0; if (t <= -1.85e+120) tmp = x + y; elseif (t <= 2.8e+53) tmp = t_1; elseif (t <= 1.2e+95) tmp = (y * t) / (t - a); elseif (t <= 9.2e+174) tmp = t_1; else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(y * N[(z / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -1.85e+120], N[(x + y), $MachinePrecision], If[LessEqual[t, 2.8e+53], t$95$1, If[LessEqual[t, 1.2e+95], N[(N[(y * t), $MachinePrecision] / N[(t - a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 9.2e+174], t$95$1, N[(x + y), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + y \cdot \frac{z}{a - t}\\
\mathbf{if}\;t \leq -1.85 \cdot 10^{+120}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;t \leq 2.8 \cdot 10^{+53}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 1.2 \cdot 10^{+95}:\\
\;\;\;\;\frac{y \cdot t}{t - a}\\
\mathbf{elif}\;t \leq 9.2 \cdot 10^{+174}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if t < -1.85000000000000012e120 or 9.1999999999999991e174 < t Initial program 100.0%
Taylor expanded in t around inf 89.8%
if -1.85000000000000012e120 < t < 2.8e53 or 1.2e95 < t < 9.1999999999999991e174Initial program 98.3%
Taylor expanded in z around inf 85.0%
if 2.8e53 < t < 1.2e95Initial program 100.0%
+-commutative100.0%
*-commutative100.0%
associate-*l/100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
times-frac99.5%
fma-def99.5%
sub-neg99.5%
+-commutative99.5%
neg-sub099.5%
associate-+l-99.5%
sub0-neg99.5%
neg-mul-199.5%
*-commutative99.5%
associate-/l*99.5%
metadata-eval99.5%
/-rgt-identity99.5%
Simplified99.5%
Taylor expanded in y around -inf 93.3%
associate-/l*93.3%
Simplified93.3%
Taylor expanded in z around 0 93.3%
Final simplification86.6%
(FPCore (x y z t a)
:precision binary64
(if (<= t -6.6e-22)
(+ x y)
(if (<= t 2.8e+53)
(+ x (* z (/ y a)))
(if (<= t 1.2e+95)
(/ (* y t) (- t a))
(if (<= t 1.55e+150) (- x (* z (/ y t))) (+ x y))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -6.6e-22) {
tmp = x + y;
} else if (t <= 2.8e+53) {
tmp = x + (z * (y / a));
} else if (t <= 1.2e+95) {
tmp = (y * t) / (t - a);
} else if (t <= 1.55e+150) {
tmp = x - (z * (y / t));
} 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 (t <= (-6.6d-22)) then
tmp = x + y
else if (t <= 2.8d+53) then
tmp = x + (z * (y / a))
else if (t <= 1.2d+95) then
tmp = (y * t) / (t - a)
else if (t <= 1.55d+150) then
tmp = x - (z * (y / t))
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 (t <= -6.6e-22) {
tmp = x + y;
} else if (t <= 2.8e+53) {
tmp = x + (z * (y / a));
} else if (t <= 1.2e+95) {
tmp = (y * t) / (t - a);
} else if (t <= 1.55e+150) {
tmp = x - (z * (y / t));
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -6.6e-22: tmp = x + y elif t <= 2.8e+53: tmp = x + (z * (y / a)) elif t <= 1.2e+95: tmp = (y * t) / (t - a) elif t <= 1.55e+150: tmp = x - (z * (y / t)) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -6.6e-22) tmp = Float64(x + y); elseif (t <= 2.8e+53) tmp = Float64(x + Float64(z * Float64(y / a))); elseif (t <= 1.2e+95) tmp = Float64(Float64(y * t) / Float64(t - a)); elseif (t <= 1.55e+150) tmp = Float64(x - Float64(z * Float64(y / t))); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -6.6e-22) tmp = x + y; elseif (t <= 2.8e+53) tmp = x + (z * (y / a)); elseif (t <= 1.2e+95) tmp = (y * t) / (t - a); elseif (t <= 1.55e+150) tmp = x - (z * (y / t)); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -6.6e-22], N[(x + y), $MachinePrecision], If[LessEqual[t, 2.8e+53], N[(x + N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.2e+95], N[(N[(y * t), $MachinePrecision] / N[(t - a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.55e+150], N[(x - N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -6.6 \cdot 10^{-22}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;t \leq 2.8 \cdot 10^{+53}:\\
\;\;\;\;x + z \cdot \frac{y}{a}\\
\mathbf{elif}\;t \leq 1.2 \cdot 10^{+95}:\\
\;\;\;\;\frac{y \cdot t}{t - a}\\
\mathbf{elif}\;t \leq 1.55 \cdot 10^{+150}:\\
\;\;\;\;x - z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if t < -6.6000000000000002e-22 or 1.55000000000000007e150 < t Initial program 100.0%
Taylor expanded in t around inf 83.1%
if -6.6000000000000002e-22 < t < 2.8e53Initial program 97.7%
Taylor expanded in t around 0 69.6%
associate-/l*72.4%
Simplified72.4%
associate-/r/25.1%
Applied egg-rr73.1%
if 2.8e53 < t < 1.2e95Initial program 100.0%
+-commutative100.0%
*-commutative100.0%
associate-*l/100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
times-frac99.5%
fma-def99.5%
sub-neg99.5%
+-commutative99.5%
neg-sub099.5%
associate-+l-99.5%
sub0-neg99.5%
neg-mul-199.5%
*-commutative99.5%
associate-/l*99.5%
metadata-eval99.5%
/-rgt-identity99.5%
Simplified99.5%
Taylor expanded in y around -inf 93.3%
associate-/l*93.3%
Simplified93.3%
Taylor expanded in z around 0 93.3%
if 1.2e95 < t < 1.55000000000000007e150Initial program 100.0%
Taylor expanded in z around inf 88.5%
Taylor expanded in a around 0 77.2%
+-commutative77.2%
associate-*r/77.2%
mul-1-neg77.2%
distribute-rgt-neg-out77.2%
associate-*l/88.5%
*-commutative88.5%
distribute-lft-neg-out88.5%
unsub-neg88.5%
Simplified88.5%
Final simplification78.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -4.8e-22) (not (<= t 6.8e+52))) (+ x (/ y (/ t (- t z)))) (+ x (* y (/ z (- a t))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -4.8e-22) || !(t <= 6.8e+52)) {
tmp = x + (y / (t / (t - z)));
} else {
tmp = x + (y * (z / (a - t)));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((t <= (-4.8d-22)) .or. (.not. (t <= 6.8d+52))) then
tmp = x + (y / (t / (t - z)))
else
tmp = x + (y * (z / (a - t)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -4.8e-22) || !(t <= 6.8e+52)) {
tmp = x + (y / (t / (t - z)));
} else {
tmp = x + (y * (z / (a - t)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -4.8e-22) or not (t <= 6.8e+52): tmp = x + (y / (t / (t - z))) else: tmp = x + (y * (z / (a - t))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -4.8e-22) || !(t <= 6.8e+52)) tmp = Float64(x + Float64(y / Float64(t / Float64(t - z)))); else tmp = Float64(x + Float64(y * Float64(z / Float64(a - t)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -4.8e-22) || ~((t <= 6.8e+52))) tmp = x + (y / (t / (t - z))); else tmp = x + (y * (z / (a - t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -4.8e-22], N[Not[LessEqual[t, 6.8e+52]], $MachinePrecision]], N[(x + N[(y / N[(t / N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(z / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.8 \cdot 10^{-22} \lor \neg \left(t \leq 6.8 \cdot 10^{+52}\right):\\
\;\;\;\;x + \frac{y}{\frac{t}{t - z}}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{a - t}\\
\end{array}
\end{array}
if t < -4.80000000000000005e-22 or 6.8e52 < t Initial program 100.0%
+-commutative100.0%
*-commutative100.0%
associate-*l/73.2%
sub-neg73.2%
+-commutative73.2%
neg-sub073.2%
associate-+l-73.2%
sub0-neg73.2%
neg-mul-173.2%
times-frac94.5%
fma-def94.5%
sub-neg94.5%
+-commutative94.5%
neg-sub094.5%
associate-+l-94.5%
sub0-neg94.5%
neg-mul-194.5%
*-commutative94.5%
associate-/l*94.5%
metadata-eval94.5%
/-rgt-identity94.5%
Simplified94.5%
Taylor expanded in a around 0 65.8%
+-commutative65.8%
associate-/l*89.6%
Simplified89.6%
if -4.80000000000000005e-22 < t < 6.8e52Initial program 97.7%
Taylor expanded in z around inf 88.6%
Final simplification89.1%
(FPCore (x y z t a) :precision binary64 (if (<= t -7.8e-22) (+ x (/ y (/ t (- t z)))) (if (<= t 7.6e+52) (+ x (* y (/ z (- a t)))) (+ x (* y (/ (- t z) t))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -7.8e-22) {
tmp = x + (y / (t / (t - z)));
} else if (t <= 7.6e+52) {
tmp = x + (y * (z / (a - t)));
} else {
tmp = x + (y * ((t - z) / t));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (t <= (-7.8d-22)) then
tmp = x + (y / (t / (t - z)))
else if (t <= 7.6d+52) then
tmp = x + (y * (z / (a - t)))
else
tmp = x + (y * ((t - z) / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -7.8e-22) {
tmp = x + (y / (t / (t - z)));
} else if (t <= 7.6e+52) {
tmp = x + (y * (z / (a - t)));
} else {
tmp = x + (y * ((t - z) / t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -7.8e-22: tmp = x + (y / (t / (t - z))) elif t <= 7.6e+52: tmp = x + (y * (z / (a - t))) else: tmp = x + (y * ((t - z) / t)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -7.8e-22) tmp = Float64(x + Float64(y / Float64(t / Float64(t - z)))); elseif (t <= 7.6e+52) tmp = Float64(x + Float64(y * Float64(z / Float64(a - t)))); else tmp = Float64(x + Float64(y * Float64(Float64(t - z) / t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -7.8e-22) tmp = x + (y / (t / (t - z))); elseif (t <= 7.6e+52) tmp = x + (y * (z / (a - t))); else tmp = x + (y * ((t - z) / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -7.8e-22], N[(x + N[(y / N[(t / N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 7.6e+52], N[(x + N[(y * N[(z / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(N[(t - z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -7.8 \cdot 10^{-22}:\\
\;\;\;\;x + \frac{y}{\frac{t}{t - z}}\\
\mathbf{elif}\;t \leq 7.6 \cdot 10^{+52}:\\
\;\;\;\;x + y \cdot \frac{z}{a - t}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{t - z}{t}\\
\end{array}
\end{array}
if t < -7.79999999999999996e-22Initial program 100.0%
+-commutative100.0%
*-commutative100.0%
associate-*l/74.2%
sub-neg74.2%
+-commutative74.2%
neg-sub074.2%
associate-+l-74.2%
sub0-neg74.2%
neg-mul-174.2%
times-frac96.2%
fma-def96.2%
sub-neg96.2%
+-commutative96.2%
neg-sub096.2%
associate-+l-96.2%
sub0-neg96.2%
neg-mul-196.2%
*-commutative96.2%
associate-/l*96.2%
metadata-eval96.2%
/-rgt-identity96.2%
Simplified96.2%
Taylor expanded in a around 0 66.3%
+-commutative66.3%
associate-/l*87.0%
Simplified87.0%
if -7.79999999999999996e-22 < t < 7.5999999999999999e52Initial program 97.7%
Taylor expanded in z around inf 88.6%
if 7.5999999999999999e52 < t Initial program 100.0%
Taylor expanded in a around 0 93.4%
associate-*r/93.4%
neg-mul-193.4%
neg-sub093.4%
associate--r-93.4%
neg-sub093.4%
Simplified93.4%
Final simplification89.1%
(FPCore (x y z t a)
:precision binary64
(if (<= t -1.45e-22)
(+ x y)
(if (<= t 2.2e-270)
x
(if (<= t 9e-240) (* z (/ y a)) (if (<= t 1.35e-84) x (+ x y))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.45e-22) {
tmp = x + y;
} else if (t <= 2.2e-270) {
tmp = x;
} else if (t <= 9e-240) {
tmp = z * (y / a);
} else if (t <= 1.35e-84) {
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 (t <= (-1.45d-22)) then
tmp = x + y
else if (t <= 2.2d-270) then
tmp = x
else if (t <= 9d-240) then
tmp = z * (y / a)
else if (t <= 1.35d-84) 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 (t <= -1.45e-22) {
tmp = x + y;
} else if (t <= 2.2e-270) {
tmp = x;
} else if (t <= 9e-240) {
tmp = z * (y / a);
} else if (t <= 1.35e-84) {
tmp = x;
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -1.45e-22: tmp = x + y elif t <= 2.2e-270: tmp = x elif t <= 9e-240: tmp = z * (y / a) elif t <= 1.35e-84: tmp = x else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -1.45e-22) tmp = Float64(x + y); elseif (t <= 2.2e-270) tmp = x; elseif (t <= 9e-240) tmp = Float64(z * Float64(y / a)); elseif (t <= 1.35e-84) tmp = x; else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -1.45e-22) tmp = x + y; elseif (t <= 2.2e-270) tmp = x; elseif (t <= 9e-240) tmp = z * (y / a); elseif (t <= 1.35e-84) tmp = x; else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1.45e-22], N[(x + y), $MachinePrecision], If[LessEqual[t, 2.2e-270], x, If[LessEqual[t, 9e-240], N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.35e-84], x, N[(x + y), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.45 \cdot 10^{-22}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;t \leq 2.2 \cdot 10^{-270}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 9 \cdot 10^{-240}:\\
\;\;\;\;z \cdot \frac{y}{a}\\
\mathbf{elif}\;t \leq 1.35 \cdot 10^{-84}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if t < -1.4500000000000001e-22 or 1.35e-84 < t Initial program 99.9%
Taylor expanded in t around inf 75.9%
if -1.4500000000000001e-22 < t < 2.1999999999999998e-270 or 9.0000000000000003e-240 < t < 1.35e-84Initial program 96.4%
Taylor expanded in x around inf 58.4%
if 2.1999999999999998e-270 < t < 9.0000000000000003e-240Initial program 99.5%
+-commutative99.5%
*-commutative99.5%
associate-*l/89.5%
sub-neg89.5%
+-commutative89.5%
neg-sub089.5%
associate-+l-89.5%
sub0-neg89.5%
neg-mul-189.5%
times-frac99.7%
fma-def99.7%
sub-neg99.7%
+-commutative99.7%
neg-sub099.7%
associate-+l-99.7%
sub0-neg99.7%
neg-mul-199.7%
*-commutative99.7%
associate-/l*99.7%
metadata-eval99.7%
/-rgt-identity99.7%
Simplified99.7%
Taylor expanded in y around -inf 87.0%
associate-/l*97.2%
Simplified97.2%
Taylor expanded in t around 0 75.2%
associate-/r/75.2%
Applied egg-rr75.2%
Final simplification70.3%
(FPCore (x y z t a) :precision binary64 (if (<= t -8e-23) (+ x y) (if (<= t 1850000000.0) (+ x (* z (/ y a))) (+ x y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -8e-23) {
tmp = x + y;
} else if (t <= 1850000000.0) {
tmp = x + (z * (y / 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 (t <= (-8d-23)) then
tmp = x + y
else if (t <= 1850000000.0d0) then
tmp = x + (z * (y / 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 (t <= -8e-23) {
tmp = x + y;
} else if (t <= 1850000000.0) {
tmp = x + (z * (y / a));
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -8e-23: tmp = x + y elif t <= 1850000000.0: tmp = x + (z * (y / a)) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -8e-23) tmp = Float64(x + y); elseif (t <= 1850000000.0) tmp = Float64(x + Float64(z * Float64(y / a))); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -8e-23) tmp = x + y; elseif (t <= 1850000000.0) tmp = x + (z * (y / a)); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -8e-23], N[(x + y), $MachinePrecision], If[LessEqual[t, 1850000000.0], N[(x + N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -8 \cdot 10^{-23}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;t \leq 1850000000:\\
\;\;\;\;x + z \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if t < -7.99999999999999968e-23 or 1.85e9 < t Initial program 100.0%
Taylor expanded in t around inf 78.4%
if -7.99999999999999968e-23 < t < 1.85e9Initial program 97.4%
Taylor expanded in t around 0 70.7%
associate-/l*73.9%
Simplified73.9%
associate-/r/27.1%
Applied egg-rr74.7%
Final simplification76.7%
(FPCore (x y z t a) :precision binary64 (if (<= t -2.05e-23) (+ x y) (if (<= t 1.8e-97) x (+ x y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -2.05e-23) {
tmp = x + y;
} else if (t <= 1.8e-97) {
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 (t <= (-2.05d-23)) then
tmp = x + y
else if (t <= 1.8d-97) 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 (t <= -2.05e-23) {
tmp = x + y;
} else if (t <= 1.8e-97) {
tmp = x;
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -2.05e-23: tmp = x + y elif t <= 1.8e-97: tmp = x else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -2.05e-23) tmp = Float64(x + y); elseif (t <= 1.8e-97) tmp = x; else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -2.05e-23) tmp = x + y; elseif (t <= 1.8e-97) tmp = x; else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -2.05e-23], N[(x + y), $MachinePrecision], If[LessEqual[t, 1.8e-97], x, N[(x + y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.05 \cdot 10^{-23}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;t \leq 1.8 \cdot 10^{-97}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if t < -2.05000000000000015e-23 or 1.79999999999999999e-97 < t Initial program 99.9%
Taylor expanded in t around inf 75.9%
if -2.05000000000000015e-23 < t < 1.79999999999999999e-97Initial program 96.7%
Taylor expanded in x around inf 53.0%
Final simplification67.8%
(FPCore (x y z t a) :precision binary64 (if (<= y 4.6e+132) x y))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= 4.6e+132) {
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 <= 4.6d+132) 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 <= 4.6e+132) {
tmp = x;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= 4.6e+132: tmp = x else: tmp = y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= 4.6e+132) tmp = x; else tmp = y; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (y <= 4.6e+132) tmp = x; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, 4.6e+132], x, y]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 4.6 \cdot 10^{+132}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if y < 4.6000000000000003e132Initial program 98.6%
Taylor expanded in x around inf 60.5%
if 4.6000000000000003e132 < y Initial program 99.9%
+-commutative99.9%
*-commutative99.9%
associate-*l/62.1%
sub-neg62.1%
+-commutative62.1%
neg-sub062.1%
associate-+l-62.1%
sub0-neg62.1%
neg-mul-162.1%
times-frac99.9%
fma-def99.9%
sub-neg99.9%
+-commutative99.9%
neg-sub099.9%
associate-+l-99.9%
sub0-neg99.9%
neg-mul-199.9%
*-commutative99.9%
associate-/l*99.9%
metadata-eval99.9%
/-rgt-identity99.9%
Simplified99.9%
Taylor expanded in a around 0 36.1%
+-commutative36.1%
associate-/l*64.9%
Simplified64.9%
Taylor expanded in y around inf 61.0%
Taylor expanded in z around 0 43.2%
Final simplification57.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 98.8%
Taylor expanded in x around inf 52.9%
Final simplification52.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* y (/ (- z t) (- a t))))))
(if (< y -8.508084860551241e-17)
t_1
(if (< y 2.894426862792089e-49)
(+ x (* (* y (- z t)) (/ 1.0 (- a t))))
t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (y * ((z - t) / (a - t)));
double tmp;
if (y < -8.508084860551241e-17) {
tmp = t_1;
} else if (y < 2.894426862792089e-49) {
tmp = x + ((y * (z - t)) * (1.0 / (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) :: tmp
t_1 = x + (y * ((z - t) / (a - t)))
if (y < (-8.508084860551241d-17)) then
tmp = t_1
else if (y < 2.894426862792089d-49) then
tmp = x + ((y * (z - t)) * (1.0d0 / (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 = x + (y * ((z - t) / (a - t)));
double tmp;
if (y < -8.508084860551241e-17) {
tmp = t_1;
} else if (y < 2.894426862792089e-49) {
tmp = x + ((y * (z - t)) * (1.0 / (a - t)));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + (y * ((z - t) / (a - t))) tmp = 0 if y < -8.508084860551241e-17: tmp = t_1 elif y < 2.894426862792089e-49: tmp = x + ((y * (z - t)) * (1.0 / (a - t))) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(y * Float64(Float64(z - t) / Float64(a - t)))) tmp = 0.0 if (y < -8.508084860551241e-17) tmp = t_1; elseif (y < 2.894426862792089e-49) tmp = Float64(x + Float64(Float64(y * Float64(z - t)) * Float64(1.0 / Float64(a - t)))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + (y * ((z - t) / (a - t))); tmp = 0.0; if (y < -8.508084860551241e-17) tmp = t_1; elseif (y < 2.894426862792089e-49) tmp = x + ((y * (z - t)) * (1.0 / (a - t))); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[y, -8.508084860551241e-17], t$95$1, If[Less[y, 2.894426862792089e-49], N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + y \cdot \frac{z - t}{a - t}\\
\mathbf{if}\;y < -8.508084860551241 \cdot 10^{-17}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y < 2.894426862792089 \cdot 10^{-49}:\\
\;\;\;\;x + \left(y \cdot \left(z - t\right)\right) \cdot \frac{1}{a - t}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
herbie shell --seed 2023199
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisLine from plot-0.2.3.4, B"
:precision binary64
:herbie-target
(if (< y -8.508084860551241e-17) (+ x (* y (/ (- z t) (- a t)))) (if (< y 2.894426862792089e-49) (+ x (* (* y (- z t)) (/ 1.0 (- a t)))) (+ x (* y (/ (- z t) (- a t))))))
(+ x (* y (/ (- z t) (- a t)))))