
(FPCore (x y z t a) :precision binary64 (+ x (/ (* y (- z t)) a)))
double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / a);
}
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)
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / a);
}
def code(x, y, z, t, a): return x + ((y * (z - t)) / a)
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y * Float64(z - t)) / a)) end
function tmp = code(x, y, z, t, a) tmp = x + ((y * (z - t)) / a); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - t\right)}{a}
\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)) a)))
double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / a);
}
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)
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / a);
}
def code(x, y, z, t, a): return x + ((y * (z - t)) / a)
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y * Float64(z - t)) / a)) end
function tmp = code(x, y, z, t, a) tmp = x + ((y * (z - t)) / a); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - t\right)}{a}
\end{array}
(FPCore (x y z t a) :precision binary64 (if (<= a 8.6e-40) (+ x (/ (* y (- z t)) a)) (+ x (* y (/ (- z t) a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= 8.6e-40) {
tmp = x + ((y * (z - t)) / a);
} else {
tmp = x + (y * ((z - 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 (a <= 8.6d-40) then
tmp = x + ((y * (z - t)) / a)
else
tmp = x + (y * ((z - 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 (a <= 8.6e-40) {
tmp = x + ((y * (z - t)) / a);
} else {
tmp = x + (y * ((z - t) / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= 8.6e-40: tmp = x + ((y * (z - t)) / a) else: tmp = x + (y * ((z - t) / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= 8.6e-40) tmp = Float64(x + Float64(Float64(y * Float64(z - t)) / a)); else tmp = Float64(x + Float64(y * Float64(Float64(z - t) / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= 8.6e-40) tmp = x + ((y * (z - t)) / a); else tmp = x + (y * ((z - t) / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, 8.6e-40], N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 8.6 \cdot 10^{-40}:\\
\;\;\;\;x + \frac{y \cdot \left(z - t\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z - t}{a}\\
\end{array}
\end{array}
if a < 8.6000000000000005e-40Initial program 98.4%
if 8.6000000000000005e-40 < a Initial program 89.7%
associate-/l*99.9%
Simplified99.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (/ (* y z) a)))
(t_2 (/ (* y (- z t)) a))
(t_3 (/ y (/ a (- z t)))))
(if (<= t_2 -1e+271)
t_3
(if (<= t_2 -1e+47)
t_1
(if (<= t_2 5e-16) (- x (* y (/ t a))) (if (<= t_2 5e+161) t_1 t_3))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + ((y * z) / a);
double t_2 = (y * (z - t)) / a;
double t_3 = y / (a / (z - t));
double tmp;
if (t_2 <= -1e+271) {
tmp = t_3;
} else if (t_2 <= -1e+47) {
tmp = t_1;
} else if (t_2 <= 5e-16) {
tmp = x - (y * (t / a));
} else if (t_2 <= 5e+161) {
tmp = t_1;
} else {
tmp = t_3;
}
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) :: t_3
real(8) :: tmp
t_1 = x + ((y * z) / a)
t_2 = (y * (z - t)) / a
t_3 = y / (a / (z - t))
if (t_2 <= (-1d+271)) then
tmp = t_3
else if (t_2 <= (-1d+47)) then
tmp = t_1
else if (t_2 <= 5d-16) then
tmp = x - (y * (t / a))
else if (t_2 <= 5d+161) then
tmp = t_1
else
tmp = t_3
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);
double t_2 = (y * (z - t)) / a;
double t_3 = y / (a / (z - t));
double tmp;
if (t_2 <= -1e+271) {
tmp = t_3;
} else if (t_2 <= -1e+47) {
tmp = t_1;
} else if (t_2 <= 5e-16) {
tmp = x - (y * (t / a));
} else if (t_2 <= 5e+161) {
tmp = t_1;
} else {
tmp = t_3;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + ((y * z) / a) t_2 = (y * (z - t)) / a t_3 = y / (a / (z - t)) tmp = 0 if t_2 <= -1e+271: tmp = t_3 elif t_2 <= -1e+47: tmp = t_1 elif t_2 <= 5e-16: tmp = x - (y * (t / a)) elif t_2 <= 5e+161: tmp = t_1 else: tmp = t_3 return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(y * z) / a)) t_2 = Float64(Float64(y * Float64(z - t)) / a) t_3 = Float64(y / Float64(a / Float64(z - t))) tmp = 0.0 if (t_2 <= -1e+271) tmp = t_3; elseif (t_2 <= -1e+47) tmp = t_1; elseif (t_2 <= 5e-16) tmp = Float64(x - Float64(y * Float64(t / a))); elseif (t_2 <= 5e+161) tmp = t_1; else tmp = t_3; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + ((y * z) / a); t_2 = (y * (z - t)) / a; t_3 = y / (a / (z - t)); tmp = 0.0; if (t_2 <= -1e+271) tmp = t_3; elseif (t_2 <= -1e+47) tmp = t_1; elseif (t_2 <= 5e-16) tmp = x - (y * (t / a)); elseif (t_2 <= 5e+161) tmp = t_1; else tmp = t_3; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(y * z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]}, Block[{t$95$3 = N[(y / N[(a / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1e+271], t$95$3, If[LessEqual[t$95$2, -1e+47], t$95$1, If[LessEqual[t$95$2, 5e-16], N[(x - N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 5e+161], t$95$1, t$95$3]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{y \cdot z}{a}\\
t_2 := \frac{y \cdot \left(z - t\right)}{a}\\
t_3 := \frac{y}{\frac{a}{z - t}}\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{+271}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq -1 \cdot 10^{+47}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{-16}:\\
\;\;\;\;x - y \cdot \frac{t}{a}\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+161}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if (/.f64 (*.f64 y (-.f64 z t)) a) < -9.99999999999999953e270 or 4.9999999999999997e161 < (/.f64 (*.f64 y (-.f64 z t)) a) Initial program 88.8%
associate-/l*94.9%
Simplified94.9%
Taylor expanded in a around 0 88.8%
Taylor expanded in a around 0 87.6%
associate-*r/93.8%
*-commutative93.8%
Applied egg-rr93.8%
*-commutative93.8%
clear-num93.8%
un-div-inv94.5%
Applied egg-rr94.5%
if -9.99999999999999953e270 < (/.f64 (*.f64 y (-.f64 z t)) a) < -1e47 or 5.0000000000000004e-16 < (/.f64 (*.f64 y (-.f64 z t)) a) < 4.9999999999999997e161Initial program 99.8%
associate-/l*79.8%
Simplified79.8%
Taylor expanded in z around inf 85.5%
if -1e47 < (/.f64 (*.f64 y (-.f64 z t)) a) < 5.0000000000000004e-16Initial program 99.9%
associate-/l*99.1%
Simplified99.1%
Taylor expanded in z around 0 93.4%
mul-1-neg93.4%
unsub-neg93.4%
*-commutative93.4%
associate-/l*93.5%
Simplified93.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= y -9.5e+34) (not (<= y 155000000000.0))) (* y (/ (- z t) a)) (+ x (/ (* y z) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -9.5e+34) || !(y <= 155000000000.0)) {
tmp = y * ((z - t) / a);
} else {
tmp = x + ((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 ((y <= (-9.5d+34)) .or. (.not. (y <= 155000000000.0d0))) then
tmp = y * ((z - t) / a)
else
tmp = x + ((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 ((y <= -9.5e+34) || !(y <= 155000000000.0)) {
tmp = y * ((z - t) / a);
} else {
tmp = x + ((y * z) / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (y <= -9.5e+34) or not (y <= 155000000000.0): tmp = y * ((z - t) / a) else: tmp = x + ((y * z) / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -9.5e+34) || !(y <= 155000000000.0)) tmp = Float64(y * Float64(Float64(z - t) / a)); else tmp = Float64(x + Float64(Float64(y * z) / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((y <= -9.5e+34) || ~((y <= 155000000000.0))) tmp = y * ((z - t) / a); else tmp = x + ((y * z) / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -9.5e+34], N[Not[LessEqual[y, 155000000000.0]], $MachinePrecision]], N[(y * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y * z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.5 \cdot 10^{+34} \lor \neg \left(y \leq 155000000000\right):\\
\;\;\;\;y \cdot \frac{z - t}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot z}{a}\\
\end{array}
\end{array}
if y < -9.4999999999999999e34 or 1.55e11 < y Initial program 90.3%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in a around 0 84.3%
Taylor expanded in a around 0 76.4%
associate-*r/85.1%
*-commutative85.1%
Applied egg-rr85.1%
if -9.4999999999999999e34 < y < 1.55e11Initial program 99.9%
associate-/l*89.1%
Simplified89.1%
Taylor expanded in z around inf 83.2%
Final simplification84.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= y -1.32e-98) (not (<= y 3.7e-110))) (* y (/ (- z t) a)) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -1.32e-98) || !(y <= 3.7e-110)) {
tmp = y * ((z - t) / a);
} 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 ((y <= (-1.32d-98)) .or. (.not. (y <= 3.7d-110))) then
tmp = y * ((z - t) / a)
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 ((y <= -1.32e-98) || !(y <= 3.7e-110)) {
tmp = y * ((z - t) / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (y <= -1.32e-98) or not (y <= 3.7e-110): tmp = y * ((z - t) / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -1.32e-98) || !(y <= 3.7e-110)) tmp = Float64(y * Float64(Float64(z - t) / a)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((y <= -1.32e-98) || ~((y <= 3.7e-110))) tmp = y * ((z - t) / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -1.32e-98], N[Not[LessEqual[y, 3.7e-110]], $MachinePrecision]], N[(y * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.32 \cdot 10^{-98} \lor \neg \left(y \leq 3.7 \cdot 10^{-110}\right):\\
\;\;\;\;y \cdot \frac{z - t}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1.31999999999999995e-98 or 3.70000000000000016e-110 < y Initial program 93.1%
associate-/l*98.7%
Simplified98.7%
Taylor expanded in a around 0 85.8%
Taylor expanded in a around 0 71.5%
associate-*r/76.5%
*-commutative76.5%
Applied egg-rr76.5%
if -1.31999999999999995e-98 < y < 3.70000000000000016e-110Initial program 99.9%
associate-/l*86.2%
Simplified86.2%
Taylor expanded in x around inf 69.5%
Final simplification73.7%
(FPCore (x y z t a) :precision binary64 (if (<= z -0.68) (+ x (* z (/ y a))) (if (<= z 1.2e-10) (- x (/ (* y t) a)) (+ x (/ z (/ a y))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -0.68) {
tmp = x + (z * (y / a));
} else if (z <= 1.2e-10) {
tmp = x - ((y * t) / a);
} else {
tmp = x + (z / (a / y));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (z <= (-0.68d0)) then
tmp = x + (z * (y / a))
else if (z <= 1.2d-10) then
tmp = x - ((y * t) / a)
else
tmp = x + (z / (a / y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -0.68) {
tmp = x + (z * (y / a));
} else if (z <= 1.2e-10) {
tmp = x - ((y * t) / a);
} else {
tmp = x + (z / (a / y));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -0.68: tmp = x + (z * (y / a)) elif z <= 1.2e-10: tmp = x - ((y * t) / a) else: tmp = x + (z / (a / y)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -0.68) tmp = Float64(x + Float64(z * Float64(y / a))); elseif (z <= 1.2e-10) tmp = Float64(x - Float64(Float64(y * t) / a)); else tmp = Float64(x + Float64(z / Float64(a / y))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -0.68) tmp = x + (z * (y / a)); elseif (z <= 1.2e-10) tmp = x - ((y * t) / a); else tmp = x + (z / (a / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -0.68], N[(x + N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.2e-10], N[(x - N[(N[(y * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(x + N[(z / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.68:\\
\;\;\;\;x + z \cdot \frac{y}{a}\\
\mathbf{elif}\;z \leq 1.2 \cdot 10^{-10}:\\
\;\;\;\;x - \frac{y \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z}{\frac{a}{y}}\\
\end{array}
\end{array}
if z < -0.680000000000000049Initial program 92.6%
+-commutative92.6%
associate-/l*92.5%
fma-define92.5%
Simplified92.5%
fma-undefine92.5%
associate-*r/92.6%
*-commutative92.6%
associate-/l*99.9%
Applied egg-rr99.9%
Taylor expanded in z around inf 93.0%
if -0.680000000000000049 < z < 1.2e-10Initial program 97.7%
associate-/l*96.3%
Simplified96.3%
Taylor expanded in z around 0 89.7%
+-commutative89.7%
associate-*r/89.7%
mul-1-neg89.7%
distribute-lft-neg-out89.7%
*-commutative89.7%
Simplified89.7%
if 1.2e-10 < z Initial program 94.8%
+-commutative94.8%
associate-/l*89.8%
fma-define89.9%
Simplified89.9%
fma-undefine89.8%
associate-*r/94.8%
*-commutative94.8%
associate-/l*98.4%
Applied egg-rr98.4%
Taylor expanded in z around inf 86.3%
clear-num86.3%
un-div-inv86.4%
Applied egg-rr86.4%
Final simplification89.4%
(FPCore (x y z t a) :precision binary64 (if (<= z -21.0) (+ x (* z (/ y a))) (if (<= z 4.8e-13) (- x (* y (/ t a))) (+ x (/ z (/ a y))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -21.0) {
tmp = x + (z * (y / a));
} else if (z <= 4.8e-13) {
tmp = x - (y * (t / a));
} else {
tmp = x + (z / (a / y));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (z <= (-21.0d0)) then
tmp = x + (z * (y / a))
else if (z <= 4.8d-13) then
tmp = x - (y * (t / a))
else
tmp = x + (z / (a / y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -21.0) {
tmp = x + (z * (y / a));
} else if (z <= 4.8e-13) {
tmp = x - (y * (t / a));
} else {
tmp = x + (z / (a / y));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -21.0: tmp = x + (z * (y / a)) elif z <= 4.8e-13: tmp = x - (y * (t / a)) else: tmp = x + (z / (a / y)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -21.0) tmp = Float64(x + Float64(z * Float64(y / a))); elseif (z <= 4.8e-13) tmp = Float64(x - Float64(y * Float64(t / a))); else tmp = Float64(x + Float64(z / Float64(a / y))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -21.0) tmp = x + (z * (y / a)); elseif (z <= 4.8e-13) tmp = x - (y * (t / a)); else tmp = x + (z / (a / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -21.0], N[(x + N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.8e-13], N[(x - N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -21:\\
\;\;\;\;x + z \cdot \frac{y}{a}\\
\mathbf{elif}\;z \leq 4.8 \cdot 10^{-13}:\\
\;\;\;\;x - y \cdot \frac{t}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z}{\frac{a}{y}}\\
\end{array}
\end{array}
if z < -21Initial program 92.6%
+-commutative92.6%
associate-/l*92.5%
fma-define92.5%
Simplified92.5%
fma-undefine92.5%
associate-*r/92.6%
*-commutative92.6%
associate-/l*99.9%
Applied egg-rr99.9%
Taylor expanded in z around inf 93.0%
if -21 < z < 4.7999999999999997e-13Initial program 97.7%
associate-/l*96.3%
Simplified96.3%
Taylor expanded in z around 0 89.7%
mul-1-neg89.7%
unsub-neg89.7%
*-commutative89.7%
associate-/l*88.2%
Simplified88.2%
if 4.7999999999999997e-13 < z Initial program 94.8%
+-commutative94.8%
associate-/l*89.8%
fma-define89.9%
Simplified89.9%
fma-undefine89.8%
associate-*r/94.8%
*-commutative94.8%
associate-/l*98.4%
Applied egg-rr98.4%
Taylor expanded in z around inf 86.3%
clear-num86.3%
un-div-inv86.4%
Applied egg-rr86.4%
Final simplification88.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -2100.0) (not (<= z 1.62e+16))) (/ (* y z) a) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2100.0) || !(z <= 1.62e+16)) {
tmp = (y * z) / a;
} 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 ((z <= (-2100.0d0)) .or. (.not. (z <= 1.62d+16))) then
tmp = (y * z) / a
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 ((z <= -2100.0) || !(z <= 1.62e+16)) {
tmp = (y * z) / a;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -2100.0) or not (z <= 1.62e+16): tmp = (y * z) / a else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -2100.0) || !(z <= 1.62e+16)) tmp = Float64(Float64(y * z) / a); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -2100.0) || ~((z <= 1.62e+16))) tmp = (y * z) / a; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -2100.0], N[Not[LessEqual[z, 1.62e+16]], $MachinePrecision]], N[(N[(y * z), $MachinePrecision] / a), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2100 \lor \neg \left(z \leq 1.62 \cdot 10^{+16}\right):\\
\;\;\;\;\frac{y \cdot z}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -2100 or 1.62e16 < z Initial program 93.5%
associate-/l*90.4%
Simplified90.4%
Taylor expanded in a around 0 88.7%
Taylor expanded in z around inf 62.5%
if -2100 < z < 1.62e16Initial program 97.8%
associate-/l*96.5%
Simplified96.5%
Taylor expanded in x around inf 57.7%
Final simplification60.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= y -1.4e+41) (not (<= y 8.6e-69))) (* y (/ z a)) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -1.4e+41) || !(y <= 8.6e-69)) {
tmp = y * (z / a);
} 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 ((y <= (-1.4d+41)) .or. (.not. (y <= 8.6d-69))) then
tmp = y * (z / a)
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 ((y <= -1.4e+41) || !(y <= 8.6e-69)) {
tmp = y * (z / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (y <= -1.4e+41) or not (y <= 8.6e-69): tmp = y * (z / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -1.4e+41) || !(y <= 8.6e-69)) tmp = Float64(y * Float64(z / a)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((y <= -1.4e+41) || ~((y <= 8.6e-69))) tmp = y * (z / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -1.4e+41], N[Not[LessEqual[y, 8.6e-69]], $MachinePrecision]], N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.4 \cdot 10^{+41} \lor \neg \left(y \leq 8.6 \cdot 10^{-69}\right):\\
\;\;\;\;y \cdot \frac{z}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1.4e41 or 8.59999999999999999e-69 < y Initial program 91.0%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in a around 0 84.5%
Taylor expanded in a around 0 74.7%
associate-*r/82.8%
*-commutative82.8%
Applied egg-rr82.8%
Taylor expanded in z around inf 57.6%
if -1.4e41 < y < 8.59999999999999999e-69Initial program 99.9%
associate-/l*88.5%
Simplified88.5%
Taylor expanded in x around inf 61.7%
Final simplification59.9%
(FPCore (x y z t a) :precision binary64 (+ x (/ y (/ a (- z t)))))
double code(double x, double y, double z, double t, double a) {
return x + (y / (a / (z - 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 / (a / (z - t)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y / (a / (z - t)));
}
def code(x, y, z, t, a): return x + (y / (a / (z - t)))
function code(x, y, z, t, a) return Float64(x + Float64(y / Float64(a / Float64(z - t)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y / (a / (z - t))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y / N[(a / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y}{\frac{a}{z - t}}
\end{array}
Initial program 95.8%
associate-/l*93.6%
Simplified93.6%
Taylor expanded in y around 0 95.8%
associate-*l/97.1%
associate-/r/94.6%
Simplified94.6%
(FPCore (x y z t a) :precision binary64 (+ x (* y (/ (- z t) a))))
double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / a));
}
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))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / a));
}
def code(x, y, z, t, a): return x + (y * ((z - t) / a))
function code(x, y, z, t, a) return Float64(x + Float64(y * Float64(Float64(z - t) / a))) end
function tmp = code(x, y, z, t, a) tmp = x + (y * ((z - t) / a)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{z - t}{a}
\end{array}
Initial program 95.8%
associate-/l*93.6%
Simplified93.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 95.8%
associate-/l*93.6%
Simplified93.6%
Taylor expanded in x around inf 42.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ a (- z t))))
(if (< y -1.0761266216389975e-10)
(+ x (/ 1.0 (/ t_1 y)))
(if (< y 2.894426862792089e-49)
(+ x (/ (* y (- z t)) a))
(+ x (/ y t_1))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = a / (z - t);
double tmp;
if (y < -1.0761266216389975e-10) {
tmp = x + (1.0 / (t_1 / y));
} else if (y < 2.894426862792089e-49) {
tmp = x + ((y * (z - t)) / a);
} else {
tmp = x + (y / 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 = a / (z - t)
if (y < (-1.0761266216389975d-10)) then
tmp = x + (1.0d0 / (t_1 / y))
else if (y < 2.894426862792089d-49) then
tmp = x + ((y * (z - t)) / a)
else
tmp = x + (y / 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 = a / (z - t);
double tmp;
if (y < -1.0761266216389975e-10) {
tmp = x + (1.0 / (t_1 / y));
} else if (y < 2.894426862792089e-49) {
tmp = x + ((y * (z - t)) / a);
} else {
tmp = x + (y / t_1);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = a / (z - t) tmp = 0 if y < -1.0761266216389975e-10: tmp = x + (1.0 / (t_1 / y)) elif y < 2.894426862792089e-49: tmp = x + ((y * (z - t)) / a) else: tmp = x + (y / t_1) return tmp
function code(x, y, z, t, a) t_1 = Float64(a / Float64(z - t)) tmp = 0.0 if (y < -1.0761266216389975e-10) tmp = Float64(x + Float64(1.0 / Float64(t_1 / y))); elseif (y < 2.894426862792089e-49) tmp = Float64(x + Float64(Float64(y * Float64(z - t)) / a)); else tmp = Float64(x + Float64(y / t_1)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = a / (z - t); tmp = 0.0; if (y < -1.0761266216389975e-10) tmp = x + (1.0 / (t_1 / y)); elseif (y < 2.894426862792089e-49) tmp = x + ((y * (z - t)) / a); else tmp = x + (y / t_1); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(a / N[(z - t), $MachinePrecision]), $MachinePrecision]}, If[Less[y, -1.0761266216389975e-10], N[(x + N[(1.0 / N[(t$95$1 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Less[y, 2.894426862792089e-49], N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / t$95$1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{a}{z - t}\\
\mathbf{if}\;y < -1.0761266216389975 \cdot 10^{-10}:\\
\;\;\;\;x + \frac{1}{\frac{t\_1}{y}}\\
\mathbf{elif}\;y < 2.894426862792089 \cdot 10^{-49}:\\
\;\;\;\;x + \frac{y \cdot \left(z - t\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{t\_1}\\
\end{array}
\end{array}
herbie shell --seed 2024145
(FPCore (x y z t a)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, E"
:precision binary64
:alt
(! :herbie-platform default (if (< y -430450648655599/4000000000000000000000000) (+ x (/ 1 (/ (/ a (- z t)) y))) (if (< y 2894426862792089/10000000000000000000000000000000000000000000000000000000000000000) (+ x (/ (* y (- z t)) a)) (+ x (/ y (/ a (- z t)))))))
(+ x (/ (* y (- z t)) a)))