
(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 10 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 (+ (* y (- (+ (/ t (- a t)) 1.0) (/ z (- a t)))) x))
double code(double x, double y, double z, double t, double a) {
return (y * (((t / (a - t)) + 1.0) - (z / (a - t)))) + 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 = (y * (((t / (a - t)) + 1.0d0) - (z / (a - t)))) + x
end function
public static double code(double x, double y, double z, double t, double a) {
return (y * (((t / (a - t)) + 1.0) - (z / (a - t)))) + x;
}
def code(x, y, z, t, a): return (y * (((t / (a - t)) + 1.0) - (z / (a - t)))) + x
function code(x, y, z, t, a) return Float64(Float64(y * Float64(Float64(Float64(t / Float64(a - t)) + 1.0) - Float64(z / Float64(a - t)))) + x) end
function tmp = code(x, y, z, t, a) tmp = (y * (((t / (a - t)) + 1.0) - (z / (a - t)))) + x; end
code[x_, y_, z_, t_, a_] := N[(N[(y * N[(N[(N[(t / N[(a - t), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] - N[(z / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
y \cdot \left(\left(\frac{t}{a - t} + 1\right) - \frac{z}{a - t}\right) + x
\end{array}
Initial program 75.4%
associate--l+78.5%
sub-neg78.5%
+-commutative78.5%
associate-/l*87.3%
distribute-neg-frac87.3%
associate-/r/90.0%
fma-def90.1%
sub-neg90.1%
+-commutative90.1%
distribute-neg-in90.1%
unsub-neg90.1%
remove-double-neg90.1%
Simplified90.1%
Taylor expanded in y around 0 95.4%
Final simplification95.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ y (- x (/ y (/ a z))))))
(if (<= a -3.1e+150)
t_1
(if (<= a -4.8e+104)
(+ x (/ y (/ t z)))
(if (or (<= a -1.02e-79) (not (<= a 0.049)))
t_1
(+ x (* z (/ y t))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = y + (x - (y / (a / z)));
double tmp;
if (a <= -3.1e+150) {
tmp = t_1;
} else if (a <= -4.8e+104) {
tmp = x + (y / (t / z));
} else if ((a <= -1.02e-79) || !(a <= 0.049)) {
tmp = t_1;
} else {
tmp = x + (z * (y / 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 = y + (x - (y / (a / z)))
if (a <= (-3.1d+150)) then
tmp = t_1
else if (a <= (-4.8d+104)) then
tmp = x + (y / (t / z))
else if ((a <= (-1.02d-79)) .or. (.not. (a <= 0.049d0))) then
tmp = t_1
else
tmp = x + (z * (y / t))
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 - (y / (a / z)));
double tmp;
if (a <= -3.1e+150) {
tmp = t_1;
} else if (a <= -4.8e+104) {
tmp = x + (y / (t / z));
} else if ((a <= -1.02e-79) || !(a <= 0.049)) {
tmp = t_1;
} else {
tmp = x + (z * (y / t));
}
return tmp;
}
def code(x, y, z, t, a): t_1 = y + (x - (y / (a / z))) tmp = 0 if a <= -3.1e+150: tmp = t_1 elif a <= -4.8e+104: tmp = x + (y / (t / z)) elif (a <= -1.02e-79) or not (a <= 0.049): tmp = t_1 else: tmp = x + (z * (y / t)) return tmp
function code(x, y, z, t, a) t_1 = Float64(y + Float64(x - Float64(y / Float64(a / z)))) tmp = 0.0 if (a <= -3.1e+150) tmp = t_1; elseif (a <= -4.8e+104) tmp = Float64(x + Float64(y / Float64(t / z))); elseif ((a <= -1.02e-79) || !(a <= 0.049)) tmp = t_1; else tmp = Float64(x + Float64(z * Float64(y / t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = y + (x - (y / (a / z))); tmp = 0.0; if (a <= -3.1e+150) tmp = t_1; elseif (a <= -4.8e+104) tmp = x + (y / (t / z)); elseif ((a <= -1.02e-79) || ~((a <= 0.049))) tmp = t_1; else tmp = x + (z * (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y + N[(x - N[(y / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -3.1e+150], t$95$1, If[LessEqual[a, -4.8e+104], N[(x + N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[a, -1.02e-79], N[Not[LessEqual[a, 0.049]], $MachinePrecision]], t$95$1, N[(x + N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y + \left(x - \frac{y}{\frac{a}{z}}\right)\\
\mathbf{if}\;a \leq -3.1 \cdot 10^{+150}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;a \leq -4.8 \cdot 10^{+104}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\mathbf{elif}\;a \leq -1.02 \cdot 10^{-79} \lor \neg \left(a \leq 0.049\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \frac{y}{t}\\
\end{array}
\end{array}
if a < -3.10000000000000014e150 or -4.8e104 < a < -1.02000000000000002e-79 or 0.049000000000000002 < a Initial program 79.8%
associate--l+81.7%
sub-neg81.7%
+-commutative81.7%
associate-/l*95.3%
distribute-neg-frac95.3%
associate-/r/96.0%
fma-def96.0%
sub-neg96.0%
+-commutative96.0%
distribute-neg-in96.0%
unsub-neg96.0%
remove-double-neg96.0%
Simplified96.0%
Taylor expanded in t around 0 83.2%
mul-1-neg83.2%
sub-neg83.2%
associate-/l*87.3%
Simplified87.3%
if -3.10000000000000014e150 < a < -4.8e104Initial program 67.8%
associate--l+83.6%
sub-neg83.6%
+-commutative83.6%
associate-/l*68.2%
distribute-neg-frac68.2%
associate-/r/83.7%
fma-def83.7%
sub-neg83.7%
+-commutative83.7%
distribute-neg-in83.7%
unsub-neg83.7%
remove-double-neg83.7%
Simplified83.7%
Taylor expanded in y around 0 91.8%
Taylor expanded in a around 0 83.9%
associate-/l*91.9%
Simplified91.9%
if -1.02000000000000002e-79 < a < 0.049000000000000002Initial program 71.0%
associate--l+74.3%
sub-neg74.3%
+-commutative74.3%
associate-/l*79.9%
distribute-neg-frac79.9%
associate-/r/83.7%
fma-def83.8%
sub-neg83.8%
+-commutative83.8%
distribute-neg-in83.8%
unsub-neg83.8%
remove-double-neg83.8%
Simplified83.8%
Taylor expanded in y around 0 92.6%
Taylor expanded in a around 0 84.3%
associate-/l*85.6%
Simplified85.6%
associate-/r/87.3%
Applied egg-rr87.3%
Final simplification87.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -1e-165) (not (<= a 8e-15))) (+ x (* y (- 1.0 (/ (- z t) (- a t))))) (+ x (* (/ y t) (- z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1e-165) || !(a <= 8e-15)) {
tmp = x + (y * (1.0 - ((z - t) / (a - t))));
} else {
tmp = x + ((y / t) * (z - a));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((a <= (-1d-165)) .or. (.not. (a <= 8d-15))) then
tmp = x + (y * (1.0d0 - ((z - t) / (a - t))))
else
tmp = x + ((y / t) * (z - a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1e-165) || !(a <= 8e-15)) {
tmp = x + (y * (1.0 - ((z - t) / (a - t))));
} else {
tmp = x + ((y / t) * (z - a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -1e-165) or not (a <= 8e-15): tmp = x + (y * (1.0 - ((z - t) / (a - t)))) else: tmp = x + ((y / t) * (z - a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -1e-165) || !(a <= 8e-15)) tmp = Float64(x + Float64(y * Float64(1.0 - Float64(Float64(z - t) / Float64(a - t))))); 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 <= -1e-165) || ~((a <= 8e-15))) tmp = x + (y * (1.0 - ((z - t) / (a - t)))); else tmp = x + ((y / t) * (z - a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -1e-165], N[Not[LessEqual[a, 8e-15]], $MachinePrecision]], N[(x + N[(y * N[(1.0 - N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y / t), $MachinePrecision] * N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1 \cdot 10^{-165} \lor \neg \left(a \leq 8 \cdot 10^{-15}\right):\\
\;\;\;\;x + y \cdot \left(1 - \frac{z - t}{a - t}\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{t} \cdot \left(z - a\right)\\
\end{array}
\end{array}
if a < -1e-165 or 8.0000000000000006e-15 < a Initial program 78.1%
associate--l+80.8%
sub-neg80.8%
+-commutative80.8%
associate-/l*91.4%
distribute-neg-frac91.4%
associate-/r/94.9%
fma-def94.9%
sub-neg94.9%
+-commutative94.9%
distribute-neg-in94.9%
unsub-neg94.9%
remove-double-neg94.9%
Simplified94.9%
Taylor expanded in y around 0 97.9%
associate--l+94.8%
div-sub94.9%
Simplified94.9%
if -1e-165 < a < 8.0000000000000006e-15Initial program 70.9%
associate--l+74.7%
associate-/l*80.2%
Simplified80.2%
Taylor expanded in t around -inf 89.8%
+-commutative89.8%
sub-neg89.8%
mul-1-neg89.8%
+-commutative89.8%
*-commutative89.8%
+-commutative89.8%
*-commutative89.8%
mul-1-neg89.8%
unsub-neg89.8%
mul-1-neg89.8%
sub-neg89.8%
distribute-lft-out--89.8%
Simplified89.8%
Taylor expanded in x around 0 89.8%
+-commutative89.8%
mul-1-neg89.8%
associate-/l*90.3%
sub-neg90.3%
associate-/r/93.2%
Simplified93.2%
Final simplification94.2%
(FPCore (x y z t a)
:precision binary64
(if (<= t -4.5e+150)
(+ x (* z (/ y t)))
(if (<= t 3.25e+112)
(- (+ y x) (* y (/ z (- a t))))
(+ x (* (/ y t) (- z a))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -4.5e+150) {
tmp = x + (z * (y / t));
} else if (t <= 3.25e+112) {
tmp = (y + x) - (y * (z / (a - t)));
} else {
tmp = x + ((y / t) * (z - a));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (t <= (-4.5d+150)) then
tmp = x + (z * (y / t))
else if (t <= 3.25d+112) then
tmp = (y + x) - (y * (z / (a - t)))
else
tmp = x + ((y / t) * (z - a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -4.5e+150) {
tmp = x + (z * (y / t));
} else if (t <= 3.25e+112) {
tmp = (y + x) - (y * (z / (a - t)));
} else {
tmp = x + ((y / t) * (z - a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -4.5e+150: tmp = x + (z * (y / t)) elif t <= 3.25e+112: tmp = (y + x) - (y * (z / (a - t))) else: tmp = x + ((y / t) * (z - a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -4.5e+150) tmp = Float64(x + Float64(z * Float64(y / t))); elseif (t <= 3.25e+112) tmp = Float64(Float64(y + x) - Float64(y * Float64(z / Float64(a - t)))); 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 (t <= -4.5e+150) tmp = x + (z * (y / t)); elseif (t <= 3.25e+112) tmp = (y + x) - (y * (z / (a - t))); else tmp = x + ((y / t) * (z - a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -4.5e+150], N[(x + N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 3.25e+112], N[(N[(y + x), $MachinePrecision] - N[(y * N[(z / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y / t), $MachinePrecision] * N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.5 \cdot 10^{+150}:\\
\;\;\;\;x + z \cdot \frac{y}{t}\\
\mathbf{elif}\;t \leq 3.25 \cdot 10^{+112}:\\
\;\;\;\;\left(y + x\right) - y \cdot \frac{z}{a - t}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{t} \cdot \left(z - a\right)\\
\end{array}
\end{array}
if t < -4.5e150Initial program 55.1%
associate--l+62.2%
sub-neg62.2%
+-commutative62.2%
associate-/l*82.8%
distribute-neg-frac82.8%
associate-/r/88.5%
fma-def88.5%
sub-neg88.5%
+-commutative88.5%
distribute-neg-in88.5%
unsub-neg88.5%
remove-double-neg88.5%
Simplified88.5%
Taylor expanded in y around 0 97.2%
Taylor expanded in a around 0 84.8%
associate-/l*92.9%
Simplified92.9%
associate-/r/95.6%
Applied egg-rr95.6%
if -4.5e150 < t < 3.2499999999999999e112Initial program 86.8%
associate-*l/91.5%
Simplified91.5%
Taylor expanded in z around inf 89.3%
if 3.2499999999999999e112 < t Initial program 49.8%
associate--l+54.4%
associate-/l*66.1%
Simplified66.1%
Taylor expanded in t around -inf 71.2%
+-commutative71.2%
sub-neg71.2%
mul-1-neg71.2%
+-commutative71.2%
*-commutative71.2%
+-commutative71.2%
*-commutative71.2%
mul-1-neg71.2%
unsub-neg71.2%
mul-1-neg71.2%
sub-neg71.2%
distribute-lft-out--71.2%
Simplified71.2%
Taylor expanded in x around 0 71.2%
+-commutative71.2%
mul-1-neg71.2%
associate-/l*96.6%
sub-neg96.6%
associate-/r/94.4%
Simplified94.4%
Final simplification91.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -2.8e-90) (not (<= a 0.29))) (+ y (- x (/ y (/ a z)))) (+ x (* (/ y t) (- z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -2.8e-90) || !(a <= 0.29)) {
tmp = y + (x - (y / (a / z)));
} else {
tmp = x + ((y / t) * (z - a));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((a <= (-2.8d-90)) .or. (.not. (a <= 0.29d0))) then
tmp = y + (x - (y / (a / z)))
else
tmp = x + ((y / t) * (z - a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -2.8e-90) || !(a <= 0.29)) {
tmp = y + (x - (y / (a / z)));
} else {
tmp = x + ((y / t) * (z - a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -2.8e-90) or not (a <= 0.29): tmp = y + (x - (y / (a / z))) else: tmp = x + ((y / t) * (z - a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -2.8e-90) || !(a <= 0.29)) tmp = Float64(y + Float64(x - Float64(y / Float64(a / z)))); 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.8e-90) || ~((a <= 0.29))) tmp = y + (x - (y / (a / z))); else tmp = x + ((y / t) * (z - a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -2.8e-90], N[Not[LessEqual[a, 0.29]], $MachinePrecision]], N[(y + N[(x - N[(y / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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.8 \cdot 10^{-90} \lor \neg \left(a \leq 0.29\right):\\
\;\;\;\;y + \left(x - \frac{y}{\frac{a}{z}}\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{t} \cdot \left(z - a\right)\\
\end{array}
\end{array}
if a < -2.7999999999999999e-90 or 0.28999999999999998 < a Initial program 78.8%
associate--l+81.9%
sub-neg81.9%
+-commutative81.9%
associate-/l*93.0%
distribute-neg-frac93.0%
associate-/r/94.9%
fma-def95.0%
sub-neg95.0%
+-commutative95.0%
distribute-neg-in95.0%
unsub-neg95.0%
remove-double-neg95.0%
Simplified95.0%
Taylor expanded in t around 0 80.7%
mul-1-neg80.7%
sub-neg80.7%
associate-/l*84.5%
Simplified84.5%
if -2.7999999999999999e-90 < a < 0.28999999999999998Initial program 71.0%
associate--l+74.3%
associate-/l*79.9%
Simplified79.9%
Taylor expanded in t around -inf 87.0%
+-commutative87.0%
sub-neg87.0%
mul-1-neg87.0%
+-commutative87.0%
*-commutative87.0%
+-commutative87.0%
*-commutative87.0%
mul-1-neg87.0%
unsub-neg87.0%
mul-1-neg87.0%
sub-neg87.0%
distribute-lft-out--87.0%
Simplified87.0%
Taylor expanded in x around 0 87.0%
+-commutative87.0%
mul-1-neg87.0%
associate-/l*89.2%
sub-neg89.2%
associate-/r/90.8%
Simplified90.8%
Final simplification87.2%
(FPCore (x y z t a) :precision binary64 (if (<= a -1.9e-78) (+ x (+ y (* y (/ t (- a t))))) (if (<= a 0.6) (+ x (* (/ y t) (- z a))) (+ y (- x (/ y (/ a z)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.9e-78) {
tmp = x + (y + (y * (t / (a - t))));
} else if (a <= 0.6) {
tmp = x + ((y / t) * (z - a));
} else {
tmp = y + (x - (y / (a / z)));
}
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.9d-78)) then
tmp = x + (y + (y * (t / (a - t))))
else if (a <= 0.6d0) then
tmp = x + ((y / t) * (z - a))
else
tmp = y + (x - (y / (a / z)))
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.9e-78) {
tmp = x + (y + (y * (t / (a - t))));
} else if (a <= 0.6) {
tmp = x + ((y / t) * (z - a));
} else {
tmp = y + (x - (y / (a / z)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -1.9e-78: tmp = x + (y + (y * (t / (a - t)))) elif a <= 0.6: tmp = x + ((y / t) * (z - a)) else: tmp = y + (x - (y / (a / z))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -1.9e-78) tmp = Float64(x + Float64(y + Float64(y * Float64(t / Float64(a - t))))); elseif (a <= 0.6) tmp = Float64(x + Float64(Float64(y / t) * Float64(z - a))); else tmp = Float64(y + Float64(x - Float64(y / Float64(a / z)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -1.9e-78) tmp = x + (y + (y * (t / (a - t)))); elseif (a <= 0.6) tmp = x + ((y / t) * (z - a)); else tmp = y + (x - (y / (a / z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -1.9e-78], N[(x + N[(y + N[(y * N[(t / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 0.6], N[(x + N[(N[(y / t), $MachinePrecision] * N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y + N[(x - N[(y / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.9 \cdot 10^{-78}:\\
\;\;\;\;x + \left(y + y \cdot \frac{t}{a - t}\right)\\
\mathbf{elif}\;a \leq 0.6:\\
\;\;\;\;x + \frac{y}{t} \cdot \left(z - a\right)\\
\mathbf{else}:\\
\;\;\;\;y + \left(x - \frac{y}{\frac{a}{z}}\right)\\
\end{array}
\end{array}
if a < -1.8999999999999999e-78Initial program 80.0%
associate--l+85.0%
sub-neg85.0%
+-commutative85.0%
associate-/l*93.7%
distribute-neg-frac93.7%
associate-/r/96.1%
fma-def96.1%
sub-neg96.1%
+-commutative96.1%
distribute-neg-in96.1%
unsub-neg96.1%
remove-double-neg96.1%
Simplified96.1%
Taylor expanded in y around 0 98.7%
Taylor expanded in z around 0 87.6%
distribute-rgt-in87.6%
*-lft-identity87.6%
Simplified87.6%
if -1.8999999999999999e-78 < a < 0.599999999999999978Initial program 71.0%
associate--l+74.3%
associate-/l*79.9%
Simplified79.9%
Taylor expanded in t around -inf 87.0%
+-commutative87.0%
sub-neg87.0%
mul-1-neg87.0%
+-commutative87.0%
*-commutative87.0%
+-commutative87.0%
*-commutative87.0%
mul-1-neg87.0%
unsub-neg87.0%
mul-1-neg87.0%
sub-neg87.0%
distribute-lft-out--87.0%
Simplified87.0%
Taylor expanded in x around 0 87.0%
+-commutative87.0%
mul-1-neg87.0%
associate-/l*89.2%
sub-neg89.2%
associate-/r/90.8%
Simplified90.8%
if 0.599999999999999978 < a Initial program 77.6%
associate--l+78.4%
sub-neg78.4%
+-commutative78.4%
associate-/l*92.3%
distribute-neg-frac92.3%
associate-/r/93.7%
fma-def93.7%
sub-neg93.7%
+-commutative93.7%
distribute-neg-in93.7%
unsub-neg93.7%
remove-double-neg93.7%
Simplified93.7%
Taylor expanded in t around 0 76.9%
mul-1-neg76.9%
sub-neg76.9%
associate-/l*82.1%
Simplified82.1%
Final simplification87.5%
(FPCore (x y z t a) :precision binary64 (if (<= a -5.6e-77) (+ y x) (if (<= a 0.135) (+ x (* z (/ y t))) (+ y x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -5.6e-77) {
tmp = y + x;
} else if (a <= 0.135) {
tmp = x + (z * (y / t));
} else {
tmp = y + 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 <= (-5.6d-77)) then
tmp = y + x
else if (a <= 0.135d0) then
tmp = x + (z * (y / t))
else
tmp = y + 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 <= -5.6e-77) {
tmp = y + x;
} else if (a <= 0.135) {
tmp = x + (z * (y / t));
} else {
tmp = y + x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -5.6e-77: tmp = y + x elif a <= 0.135: tmp = x + (z * (y / t)) else: tmp = y + x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -5.6e-77) tmp = Float64(y + x); elseif (a <= 0.135) tmp = Float64(x + Float64(z * Float64(y / t))); else tmp = Float64(y + x); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -5.6e-77) tmp = y + x; elseif (a <= 0.135) tmp = x + (z * (y / t)); else tmp = y + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -5.6e-77], N[(y + x), $MachinePrecision], If[LessEqual[a, 0.135], N[(x + N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -5.6 \cdot 10^{-77}:\\
\;\;\;\;y + x\\
\mathbf{elif}\;a \leq 0.135:\\
\;\;\;\;x + z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if a < -5.5999999999999999e-77 or 0.13500000000000001 < a Initial program 78.8%
associate--l+81.9%
sub-neg81.9%
+-commutative81.9%
associate-/l*93.0%
distribute-neg-frac93.0%
associate-/r/94.9%
fma-def95.0%
sub-neg95.0%
+-commutative95.0%
distribute-neg-in95.0%
unsub-neg95.0%
remove-double-neg95.0%
Simplified95.0%
Taylor expanded in a around inf 77.8%
if -5.5999999999999999e-77 < a < 0.13500000000000001Initial program 71.0%
associate--l+74.3%
sub-neg74.3%
+-commutative74.3%
associate-/l*79.9%
distribute-neg-frac79.9%
associate-/r/83.7%
fma-def83.8%
sub-neg83.8%
+-commutative83.8%
distribute-neg-in83.8%
unsub-neg83.8%
remove-double-neg83.8%
Simplified83.8%
Taylor expanded in y around 0 92.6%
Taylor expanded in a around 0 84.3%
associate-/l*85.6%
Simplified85.6%
associate-/r/87.3%
Applied egg-rr87.3%
Final simplification81.9%
(FPCore (x y z t a) :precision binary64 (if (<= t -2.9e+150) x (if (<= t 2.8e+152) (+ y x) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -2.9e+150) {
tmp = x;
} else if (t <= 2.8e+152) {
tmp = y + x;
} 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 (t <= (-2.9d+150)) then
tmp = x
else if (t <= 2.8d+152) then
tmp = y + x
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 (t <= -2.9e+150) {
tmp = x;
} else if (t <= 2.8e+152) {
tmp = y + x;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -2.9e+150: tmp = x elif t <= 2.8e+152: tmp = y + x else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -2.9e+150) tmp = x; elseif (t <= 2.8e+152) tmp = Float64(y + x); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -2.9e+150) tmp = x; elseif (t <= 2.8e+152) tmp = y + x; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -2.9e+150], x, If[LessEqual[t, 2.8e+152], N[(y + x), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.9 \cdot 10^{+150}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 2.8 \cdot 10^{+152}:\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -2.90000000000000011e150 or 2.8000000000000002e152 < t Initial program 52.5%
associate--l+58.8%
sub-neg58.8%
+-commutative58.8%
associate-/l*75.3%
distribute-neg-frac75.3%
associate-/r/84.5%
fma-def84.5%
sub-neg84.5%
+-commutative84.5%
distribute-neg-in84.5%
unsub-neg84.5%
remove-double-neg84.5%
Simplified84.5%
Taylor expanded in x around inf 74.2%
if -2.90000000000000011e150 < t < 2.8000000000000002e152Initial program 85.7%
associate--l+87.4%
sub-neg87.4%
+-commutative87.4%
associate-/l*92.6%
distribute-neg-frac92.6%
associate-/r/92.5%
fma-def92.6%
sub-neg92.6%
+-commutative92.6%
distribute-neg-in92.6%
unsub-neg92.6%
remove-double-neg92.6%
Simplified92.6%
Taylor expanded in a around inf 64.6%
Final simplification67.6%
(FPCore (x y z t a) :precision binary64 (if (<= x -9.2e-265) x (if (<= x 5.2e-159) y x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -9.2e-265) {
tmp = x;
} else if (x <= 5.2e-159) {
tmp = 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 (x <= (-9.2d-265)) then
tmp = x
else if (x <= 5.2d-159) then
tmp = 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 (x <= -9.2e-265) {
tmp = x;
} else if (x <= 5.2e-159) {
tmp = y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -9.2e-265: tmp = x elif x <= 5.2e-159: tmp = y else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -9.2e-265) tmp = x; elseif (x <= 5.2e-159) tmp = y; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (x <= -9.2e-265) tmp = x; elseif (x <= 5.2e-159) tmp = y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -9.2e-265], x, If[LessEqual[x, 5.2e-159], y, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9.2 \cdot 10^{-265}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 5.2 \cdot 10^{-159}:\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -9.1999999999999996e-265 or 5.1999999999999997e-159 < x Initial program 76.4%
associate--l+79.2%
sub-neg79.2%
+-commutative79.2%
associate-/l*87.7%
distribute-neg-frac87.7%
associate-/r/90.6%
fma-def90.6%
sub-neg90.6%
+-commutative90.6%
distribute-neg-in90.6%
unsub-neg90.6%
remove-double-neg90.6%
Simplified90.6%
Taylor expanded in x around inf 60.1%
if -9.1999999999999996e-265 < x < 5.1999999999999997e-159Initial program 68.2%
associate--l+73.3%
associate-/l*84.0%
Simplified84.0%
Taylor expanded in x around 0 68.2%
associate-*l/81.0%
*-commutative81.0%
Simplified81.0%
Taylor expanded in y around -inf 78.4%
associate-*r/78.4%
neg-mul-178.4%
Simplified78.4%
Taylor expanded in a around inf 56.2%
Final simplification59.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 75.4%
associate--l+78.5%
sub-neg78.5%
+-commutative78.5%
associate-/l*87.3%
distribute-neg-frac87.3%
associate-/r/90.0%
fma-def90.1%
sub-neg90.1%
+-commutative90.1%
distribute-neg-in90.1%
unsub-neg90.1%
remove-double-neg90.1%
Simplified90.1%
Taylor expanded in x around inf 54.1%
Final simplification54.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (+ y x) (* (* (- z t) (/ 1.0 (- a t))) y)))
(t_2 (- (+ x y) (/ (* (- z t) y) (- a t)))))
(if (< t_2 -1.3664970889390727e-7)
t_1
(if (< t_2 1.4754293444577233e-239)
(/ (- (* y (- a z)) (* x t)) (- a t))
t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y + x) - (((z - t) * (1.0 / (a - t))) * y);
double t_2 = (x + y) - (((z - t) * y) / (a - t));
double tmp;
if (t_2 < -1.3664970889390727e-7) {
tmp = t_1;
} else if (t_2 < 1.4754293444577233e-239) {
tmp = ((y * (a - z)) - (x * t)) / (a - t);
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (y + x) - (((z - t) * (1.0d0 / (a - t))) * y)
t_2 = (x + y) - (((z - t) * y) / (a - t))
if (t_2 < (-1.3664970889390727d-7)) then
tmp = t_1
else if (t_2 < 1.4754293444577233d-239) then
tmp = ((y * (a - z)) - (x * t)) / (a - t)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (y + x) - (((z - t) * (1.0 / (a - t))) * y);
double t_2 = (x + y) - (((z - t) * y) / (a - t));
double tmp;
if (t_2 < -1.3664970889390727e-7) {
tmp = t_1;
} else if (t_2 < 1.4754293444577233e-239) {
tmp = ((y * (a - z)) - (x * t)) / (a - t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y + x) - (((z - t) * (1.0 / (a - t))) * y) t_2 = (x + y) - (((z - t) * y) / (a - t)) tmp = 0 if t_2 < -1.3664970889390727e-7: tmp = t_1 elif t_2 < 1.4754293444577233e-239: tmp = ((y * (a - z)) - (x * t)) / (a - t) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y + x) - Float64(Float64(Float64(z - t) * Float64(1.0 / Float64(a - t))) * y)) t_2 = Float64(Float64(x + y) - Float64(Float64(Float64(z - t) * y) / Float64(a - t))) tmp = 0.0 if (t_2 < -1.3664970889390727e-7) tmp = t_1; elseif (t_2 < 1.4754293444577233e-239) tmp = Float64(Float64(Float64(y * Float64(a - z)) - Float64(x * t)) / Float64(a - t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y + x) - (((z - t) * (1.0 / (a - t))) * y); t_2 = (x + y) - (((z - t) * y) / (a - t)); tmp = 0.0; if (t_2 < -1.3664970889390727e-7) tmp = t_1; elseif (t_2 < 1.4754293444577233e-239) tmp = ((y * (a - z)) - (x * t)) / (a - t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y + x), $MachinePrecision] - N[(N[(N[(z - t), $MachinePrecision] * N[(1.0 / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x + y), $MachinePrecision] - N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[t$95$2, -1.3664970889390727e-7], t$95$1, If[Less[t$95$2, 1.4754293444577233e-239], N[(N[(N[(y * N[(a - z), $MachinePrecision]), $MachinePrecision] - N[(x * t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(y + x\right) - \left(\left(z - t\right) \cdot \frac{1}{a - t}\right) \cdot y\\
t_2 := \left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\\
\mathbf{if}\;t_2 < -1.3664970889390727 \cdot 10^{-7}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_2 < 1.4754293444577233 \cdot 10^{-239}:\\
\;\;\;\;\frac{y \cdot \left(a - z\right) - x \cdot t}{a - t}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
herbie shell --seed 2023199
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTick from plot-0.2.3.4, B"
:precision binary64
:herbie-target
(if (< (- (+ x y) (/ (* (- z t) y) (- a t))) -1.3664970889390727e-7) (- (+ y x) (* (* (- z t) (/ 1.0 (- a t))) y)) (if (< (- (+ x y) (/ (* (- z t) y) (- a t))) 1.4754293444577233e-239) (/ (- (* y (- a z)) (* x t)) (- a t)) (- (+ y x) (* (* (- z t) (/ 1.0 (- a t))) y))))
(- (+ x y) (/ (* (- z t) y) (- a t))))