
(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
(let* ((t_1 (* y (- z t))))
(if (<= t_1 (- INFINITY))
(+ x (/ (- t z) (/ a y)))
(if (<= t_1 4e+124) (- x (/ t_1 a)) (- x (/ y (/ a (- z t))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = y * (z - t);
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = x + ((t - z) / (a / y));
} else if (t_1 <= 4e+124) {
tmp = x - (t_1 / a);
} else {
tmp = x - (y / (a / (z - t)));
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a) {
double t_1 = y * (z - t);
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = x + ((t - z) / (a / y));
} else if (t_1 <= 4e+124) {
tmp = x - (t_1 / a);
} else {
tmp = x - (y / (a / (z - t)));
}
return tmp;
}
def code(x, y, z, t, a): t_1 = y * (z - t) tmp = 0 if t_1 <= -math.inf: tmp = x + ((t - z) / (a / y)) elif t_1 <= 4e+124: tmp = x - (t_1 / a) else: tmp = x - (y / (a / (z - t))) return tmp
function code(x, y, z, t, a) t_1 = Float64(y * Float64(z - t)) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(x + Float64(Float64(t - z) / Float64(a / y))); elseif (t_1 <= 4e+124) tmp = Float64(x - Float64(t_1 / a)); else tmp = Float64(x - Float64(y / Float64(a / Float64(z - t)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = y * (z - t); tmp = 0.0; if (t_1 <= -Inf) tmp = x + ((t - z) / (a / y)); elseif (t_1 <= 4e+124) tmp = x - (t_1 / a); else tmp = x - (y / (a / (z - t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(x + N[(N[(t - z), $MachinePrecision] / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 4e+124], N[(x - N[(t$95$1 / a), $MachinePrecision]), $MachinePrecision], N[(x - N[(y / N[(a / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(z - t\right)\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;x + \frac{t - z}{\frac{a}{y}}\\
\mathbf{elif}\;t_1 \leq 4 \cdot 10^{+124}:\\
\;\;\;\;x - \frac{t_1}{a}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y}{\frac{a}{z - t}}\\
\end{array}
\end{array}
if (*.f64 y (-.f64 z t)) < -inf.0Initial program 56.2%
associate-*l/99.9%
Simplified99.9%
*-commutative99.9%
clear-num99.9%
un-div-inv100.0%
Applied egg-rr100.0%
if -inf.0 < (*.f64 y (-.f64 z t)) < 3.99999999999999979e124Initial program 99.8%
if 3.99999999999999979e124 < (*.f64 y (-.f64 z t)) Initial program 90.9%
associate-/l*99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (/ z a) (- y))))
(if (<= x -7e-18)
x
(if (<= x -1.06e-70)
t_1
(if (<= x 4.4e-91) (/ t (/ a y)) (if (<= x 2.3e+37) t_1 x))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z / a) * -y;
double tmp;
if (x <= -7e-18) {
tmp = x;
} else if (x <= -1.06e-70) {
tmp = t_1;
} else if (x <= 4.4e-91) {
tmp = t / (a / y);
} else if (x <= 2.3e+37) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = (z / a) * -y
if (x <= (-7d-18)) then
tmp = x
else if (x <= (-1.06d-70)) then
tmp = t_1
else if (x <= 4.4d-91) then
tmp = t / (a / y)
else if (x <= 2.3d+37) then
tmp = t_1
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (z / a) * -y;
double tmp;
if (x <= -7e-18) {
tmp = x;
} else if (x <= -1.06e-70) {
tmp = t_1;
} else if (x <= 4.4e-91) {
tmp = t / (a / y);
} else if (x <= 2.3e+37) {
tmp = t_1;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (z / a) * -y tmp = 0 if x <= -7e-18: tmp = x elif x <= -1.06e-70: tmp = t_1 elif x <= 4.4e-91: tmp = t / (a / y) elif x <= 2.3e+37: tmp = t_1 else: tmp = x return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(z / a) * Float64(-y)) tmp = 0.0 if (x <= -7e-18) tmp = x; elseif (x <= -1.06e-70) tmp = t_1; elseif (x <= 4.4e-91) tmp = Float64(t / Float64(a / y)); elseif (x <= 2.3e+37) tmp = t_1; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (z / a) * -y; tmp = 0.0; if (x <= -7e-18) tmp = x; elseif (x <= -1.06e-70) tmp = t_1; elseif (x <= 4.4e-91) tmp = t / (a / y); elseif (x <= 2.3e+37) tmp = t_1; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z / a), $MachinePrecision] * (-y)), $MachinePrecision]}, If[LessEqual[x, -7e-18], x, If[LessEqual[x, -1.06e-70], t$95$1, If[LessEqual[x, 4.4e-91], N[(t / N[(a / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.3e+37], t$95$1, x]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z}{a} \cdot \left(-y\right)\\
\mathbf{if}\;x \leq -7 \cdot 10^{-18}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq -1.06 \cdot 10^{-70}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 4.4 \cdot 10^{-91}:\\
\;\;\;\;\frac{t}{\frac{a}{y}}\\
\mathbf{elif}\;x \leq 2.3 \cdot 10^{+37}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -6.9999999999999997e-18 or 2.30000000000000002e37 < x Initial program 94.0%
associate-*l/96.3%
Simplified96.3%
Taylor expanded in z around inf 80.4%
associate-*l/81.4%
*-commutative81.4%
Simplified81.4%
Taylor expanded in x around inf 66.7%
if -6.9999999999999997e-18 < x < -1.06e-70 or 4.4000000000000002e-91 < x < 2.30000000000000002e37Initial program 87.1%
associate-*l/92.6%
Simplified92.6%
Taylor expanded in z around inf 66.3%
associate-*l/76.6%
*-commutative76.6%
Simplified76.6%
Taylor expanded in x around 0 44.7%
mul-1-neg44.7%
associate-*r/57.4%
distribute-rgt-neg-in57.4%
distribute-frac-neg57.4%
Simplified57.4%
if -1.06e-70 < x < 4.4000000000000002e-91Initial program 94.7%
associate-/l*92.2%
Simplified92.2%
Taylor expanded in z around 0 63.5%
associate-*r/63.5%
neg-mul-163.5%
Simplified63.5%
Taylor expanded in x around 0 50.8%
associate-*r/55.5%
Simplified55.5%
Taylor expanded in t around 0 50.8%
associate-/l*55.5%
Simplified55.5%
Final simplification61.4%
(FPCore (x y z t a)
:precision binary64
(if (<= x -2.1e-17)
x
(if (<= x -1.76e-68)
(* (/ z a) (- y))
(if (<= x 3.65e-91)
(/ t (/ a y))
(if (<= x 2.8e+37) (/ y (/ (- a) z)) x)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -2.1e-17) {
tmp = x;
} else if (x <= -1.76e-68) {
tmp = (z / a) * -y;
} else if (x <= 3.65e-91) {
tmp = t / (a / y);
} else if (x <= 2.8e+37) {
tmp = y / (-a / z);
} 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 <= (-2.1d-17)) then
tmp = x
else if (x <= (-1.76d-68)) then
tmp = (z / a) * -y
else if (x <= 3.65d-91) then
tmp = t / (a / y)
else if (x <= 2.8d+37) then
tmp = y / (-a / z)
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 <= -2.1e-17) {
tmp = x;
} else if (x <= -1.76e-68) {
tmp = (z / a) * -y;
} else if (x <= 3.65e-91) {
tmp = t / (a / y);
} else if (x <= 2.8e+37) {
tmp = y / (-a / z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -2.1e-17: tmp = x elif x <= -1.76e-68: tmp = (z / a) * -y elif x <= 3.65e-91: tmp = t / (a / y) elif x <= 2.8e+37: tmp = y / (-a / z) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -2.1e-17) tmp = x; elseif (x <= -1.76e-68) tmp = Float64(Float64(z / a) * Float64(-y)); elseif (x <= 3.65e-91) tmp = Float64(t / Float64(a / y)); elseif (x <= 2.8e+37) tmp = Float64(y / Float64(Float64(-a) / z)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (x <= -2.1e-17) tmp = x; elseif (x <= -1.76e-68) tmp = (z / a) * -y; elseif (x <= 3.65e-91) tmp = t / (a / y); elseif (x <= 2.8e+37) tmp = y / (-a / z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -2.1e-17], x, If[LessEqual[x, -1.76e-68], N[(N[(z / a), $MachinePrecision] * (-y)), $MachinePrecision], If[LessEqual[x, 3.65e-91], N[(t / N[(a / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.8e+37], N[(y / N[((-a) / z), $MachinePrecision]), $MachinePrecision], x]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.1 \cdot 10^{-17}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq -1.76 \cdot 10^{-68}:\\
\;\;\;\;\frac{z}{a} \cdot \left(-y\right)\\
\mathbf{elif}\;x \leq 3.65 \cdot 10^{-91}:\\
\;\;\;\;\frac{t}{\frac{a}{y}}\\
\mathbf{elif}\;x \leq 2.8 \cdot 10^{+37}:\\
\;\;\;\;\frac{y}{\frac{-a}{z}}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -2.09999999999999992e-17 or 2.7999999999999998e37 < x Initial program 94.0%
associate-*l/96.3%
Simplified96.3%
Taylor expanded in z around inf 80.4%
associate-*l/81.4%
*-commutative81.4%
Simplified81.4%
Taylor expanded in x around inf 66.7%
if -2.09999999999999992e-17 < x < -1.76e-68Initial program 99.9%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in z around inf 90.9%
associate-*l/91.0%
*-commutative91.0%
Simplified91.0%
Taylor expanded in x around 0 71.2%
mul-1-neg71.2%
associate-*r/71.3%
distribute-rgt-neg-in71.3%
distribute-frac-neg71.3%
Simplified71.3%
if -1.76e-68 < x < 3.6500000000000001e-91Initial program 94.7%
associate-/l*92.2%
Simplified92.2%
Taylor expanded in z around 0 63.5%
associate-*r/63.5%
neg-mul-163.5%
Simplified63.5%
Taylor expanded in x around 0 50.8%
associate-*r/55.5%
Simplified55.5%
Taylor expanded in t around 0 50.8%
associate-/l*55.5%
Simplified55.5%
if 3.6500000000000001e-91 < x < 2.7999999999999998e37Initial program 81.7%
associate-*l/89.5%
Simplified89.5%
Taylor expanded in z around inf 55.9%
associate-*l/70.5%
*-commutative70.5%
Simplified70.5%
Taylor expanded in x around 0 33.5%
mul-1-neg33.5%
associate-*r/51.5%
distribute-rgt-neg-in51.5%
distribute-frac-neg51.5%
Simplified51.5%
frac-2neg51.5%
remove-double-neg51.5%
associate-*r/33.5%
Applied egg-rr33.5%
associate-/l*51.5%
Simplified51.5%
Final simplification61.4%
(FPCore (x y z t a) :precision binary64 (if (<= y -6.2e+19) (+ x (* y (/ (- t z) a))) (if (<= y 1e-28) (- x (/ (* y (- z t)) a)) (- x (/ y (/ a (- z t)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -6.2e+19) {
tmp = x + (y * ((t - z) / a));
} else if (y <= 1e-28) {
tmp = x - ((y * (z - t)) / a);
} else {
tmp = x - (y / (a / (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 (y <= (-6.2d+19)) then
tmp = x + (y * ((t - z) / a))
else if (y <= 1d-28) then
tmp = x - ((y * (z - t)) / a)
else
tmp = x - (y / (a / (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 (y <= -6.2e+19) {
tmp = x + (y * ((t - z) / a));
} else if (y <= 1e-28) {
tmp = x - ((y * (z - t)) / a);
} else {
tmp = x - (y / (a / (z - t)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= -6.2e+19: tmp = x + (y * ((t - z) / a)) elif y <= 1e-28: tmp = x - ((y * (z - t)) / a) else: tmp = x - (y / (a / (z - t))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= -6.2e+19) tmp = Float64(x + Float64(y * Float64(Float64(t - z) / a))); elseif (y <= 1e-28) tmp = Float64(x - Float64(Float64(y * Float64(z - t)) / a)); else tmp = Float64(x - Float64(y / Float64(a / Float64(z - t)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (y <= -6.2e+19) tmp = x + (y * ((t - z) / a)); elseif (y <= 1e-28) tmp = x - ((y * (z - t)) / a); else tmp = x - (y / (a / (z - t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -6.2e+19], N[(x + N[(y * N[(N[(t - z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1e-28], N[(x - N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(x - N[(y / N[(a / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.2 \cdot 10^{+19}:\\
\;\;\;\;x + y \cdot \frac{t - z}{a}\\
\mathbf{elif}\;y \leq 10^{-28}:\\
\;\;\;\;x - \frac{y \cdot \left(z - t\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y}{\frac{a}{z - t}}\\
\end{array}
\end{array}
if y < -6.2e19Initial program 84.3%
associate-/l*99.8%
Simplified99.8%
clear-num99.9%
associate-/r/99.9%
clear-num99.9%
Applied egg-rr99.9%
if -6.2e19 < y < 9.99999999999999971e-29Initial program 99.9%
if 9.99999999999999971e-29 < y Initial program 89.5%
associate-/l*99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -7.2e+87) (not (<= z 2.6e+249))) (* z (/ y (- a))) (+ x (/ (* y t) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -7.2e+87) || !(z <= 2.6e+249)) {
tmp = z * (y / -a);
} else {
tmp = x + ((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 ((z <= (-7.2d+87)) .or. (.not. (z <= 2.6d+249))) then
tmp = z * (y / -a)
else
tmp = x + ((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 ((z <= -7.2e+87) || !(z <= 2.6e+249)) {
tmp = z * (y / -a);
} else {
tmp = x + ((y * t) / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -7.2e+87) or not (z <= 2.6e+249): tmp = z * (y / -a) else: tmp = x + ((y * t) / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -7.2e+87) || !(z <= 2.6e+249)) tmp = Float64(z * Float64(y / Float64(-a))); else tmp = Float64(x + Float64(Float64(y * t) / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -7.2e+87) || ~((z <= 2.6e+249))) tmp = z * (y / -a); else tmp = x + ((y * t) / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -7.2e+87], N[Not[LessEqual[z, 2.6e+249]], $MachinePrecision]], N[(z * N[(y / (-a)), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.2 \cdot 10^{+87} \lor \neg \left(z \leq 2.6 \cdot 10^{+249}\right):\\
\;\;\;\;z \cdot \frac{y}{-a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot t}{a}\\
\end{array}
\end{array}
if z < -7.19999999999999988e87 or 2.60000000000000019e249 < z Initial program 86.3%
associate-*l/97.9%
Simplified97.9%
Taylor expanded in z around inf 78.1%
associate-*l/83.9%
*-commutative83.9%
Simplified83.9%
Taylor expanded in x around 0 63.8%
mul-1-neg63.8%
associate-*r/67.7%
distribute-rgt-neg-in67.7%
distribute-frac-neg67.7%
Simplified67.7%
frac-2neg67.7%
remove-double-neg67.7%
associate-*r/63.8%
Applied egg-rr63.8%
associate-/l*68.8%
associate-/r/69.6%
Simplified69.6%
if -7.19999999999999988e87 < z < 2.60000000000000019e249Initial program 94.9%
associate-/l*94.4%
Simplified94.4%
Taylor expanded in z around 0 78.4%
associate-*r/78.4%
neg-mul-178.4%
Simplified78.4%
Taylor expanded in x around 0 80.2%
Final simplification78.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -4.7e-32) (not (<= z 21500000000.0))) (- x (* z (/ y a))) (+ x (/ (* y t) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -4.7e-32) || !(z <= 21500000000.0)) {
tmp = x - (z * (y / a));
} else {
tmp = x + ((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 ((z <= (-4.7d-32)) .or. (.not. (z <= 21500000000.0d0))) then
tmp = x - (z * (y / a))
else
tmp = x + ((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 ((z <= -4.7e-32) || !(z <= 21500000000.0)) {
tmp = x - (z * (y / a));
} else {
tmp = x + ((y * t) / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -4.7e-32) or not (z <= 21500000000.0): tmp = x - (z * (y / a)) else: tmp = x + ((y * t) / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -4.7e-32) || !(z <= 21500000000.0)) tmp = Float64(x - Float64(z * Float64(y / a))); else tmp = Float64(x + Float64(Float64(y * t) / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -4.7e-32) || ~((z <= 21500000000.0))) tmp = x - (z * (y / a)); else tmp = x + ((y * t) / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -4.7e-32], N[Not[LessEqual[z, 21500000000.0]], $MachinePrecision]], N[(x - N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.7 \cdot 10^{-32} \lor \neg \left(z \leq 21500000000\right):\\
\;\;\;\;x - z \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot t}{a}\\
\end{array}
\end{array}
if z < -4.70000000000000019e-32 or 2.15e10 < z Initial program 89.6%
associate-*l/98.3%
Simplified98.3%
Taylor expanded in z around inf 78.3%
associate-*l/84.6%
*-commutative84.6%
Simplified84.6%
if -4.70000000000000019e-32 < z < 2.15e10Initial program 96.4%
associate-/l*95.7%
Simplified95.7%
Taylor expanded in z around 0 90.2%
associate-*r/90.2%
neg-mul-190.2%
Simplified90.2%
Taylor expanded in x around 0 91.0%
Final simplification88.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -5.7e-32) (not (<= z 23000000000.0))) (- x (* z (/ y a))) (+ x (* t (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -5.7e-32) || !(z <= 23000000000.0)) {
tmp = x - (z * (y / a));
} else {
tmp = x + (t * (y / 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 ((z <= (-5.7d-32)) .or. (.not. (z <= 23000000000.0d0))) then
tmp = x - (z * (y / a))
else
tmp = x + (t * (y / a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -5.7e-32) || !(z <= 23000000000.0)) {
tmp = x - (z * (y / a));
} else {
tmp = x + (t * (y / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -5.7e-32) or not (z <= 23000000000.0): tmp = x - (z * (y / a)) else: tmp = x + (t * (y / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -5.7e-32) || !(z <= 23000000000.0)) tmp = Float64(x - Float64(z * Float64(y / a))); else tmp = Float64(x + Float64(t * Float64(y / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -5.7e-32) || ~((z <= 23000000000.0))) tmp = x - (z * (y / a)); else tmp = x + (t * (y / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -5.7e-32], N[Not[LessEqual[z, 23000000000.0]], $MachinePrecision]], N[(x - N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.7 \cdot 10^{-32} \lor \neg \left(z \leq 23000000000\right):\\
\;\;\;\;x - z \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x + t \cdot \frac{y}{a}\\
\end{array}
\end{array}
if z < -5.7000000000000004e-32 or 2.3e10 < z Initial program 89.6%
associate-*l/98.3%
Simplified98.3%
Taylor expanded in z around inf 78.3%
associate-*l/84.6%
*-commutative84.6%
Simplified84.6%
if -5.7000000000000004e-32 < z < 2.3e10Initial program 96.4%
associate-*l/94.5%
Simplified94.5%
Taylor expanded in z around 0 91.0%
*-commutative91.0%
associate-*l/91.1%
neg-mul-191.1%
distribute-rgt-neg-out91.1%
Simplified91.1%
Final simplification88.1%
(FPCore (x y z t a) :precision binary64 (if (<= x -1.65e-17) x (if (<= x 3.5e+39) (* t (/ y a)) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -1.65e-17) {
tmp = x;
} else if (x <= 3.5e+39) {
tmp = t * (y / 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 (x <= (-1.65d-17)) then
tmp = x
else if (x <= 3.5d+39) then
tmp = t * (y / 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 (x <= -1.65e-17) {
tmp = x;
} else if (x <= 3.5e+39) {
tmp = t * (y / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -1.65e-17: tmp = x elif x <= 3.5e+39: tmp = t * (y / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -1.65e-17) tmp = x; elseif (x <= 3.5e+39) tmp = Float64(t * Float64(y / a)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (x <= -1.65e-17) tmp = x; elseif (x <= 3.5e+39) tmp = t * (y / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -1.65e-17], x, If[LessEqual[x, 3.5e+39], N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.65 \cdot 10^{-17}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 3.5 \cdot 10^{+39}:\\
\;\;\;\;t \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -1.65e-17 or 3.5000000000000002e39 < x Initial program 94.0%
associate-*l/96.3%
Simplified96.3%
Taylor expanded in z around inf 80.4%
associate-*l/81.4%
*-commutative81.4%
Simplified81.4%
Taylor expanded in x around inf 66.7%
if -1.65e-17 < x < 3.5000000000000002e39Initial program 92.5%
associate-/l*94.4%
Simplified94.4%
Taylor expanded in z around 0 61.0%
associate-*r/61.0%
neg-mul-161.0%
Simplified61.0%
Taylor expanded in x around 0 45.9%
associate-*r/48.0%
Simplified48.0%
Final simplification57.4%
(FPCore (x y z t a) :precision binary64 (if (<= x -3.3e-17) x (if (<= x 8e+37) (/ t (/ a y)) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -3.3e-17) {
tmp = x;
} else if (x <= 8e+37) {
tmp = t / (a / 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 <= (-3.3d-17)) then
tmp = x
else if (x <= 8d+37) then
tmp = t / (a / 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 <= -3.3e-17) {
tmp = x;
} else if (x <= 8e+37) {
tmp = t / (a / y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -3.3e-17: tmp = x elif x <= 8e+37: tmp = t / (a / y) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -3.3e-17) tmp = x; elseif (x <= 8e+37) tmp = Float64(t / Float64(a / y)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (x <= -3.3e-17) tmp = x; elseif (x <= 8e+37) tmp = t / (a / y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -3.3e-17], x, If[LessEqual[x, 8e+37], N[(t / N[(a / y), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.3 \cdot 10^{-17}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 8 \cdot 10^{+37}:\\
\;\;\;\;\frac{t}{\frac{a}{y}}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -3.3e-17 or 7.99999999999999963e37 < x Initial program 94.0%
associate-*l/96.3%
Simplified96.3%
Taylor expanded in z around inf 80.4%
associate-*l/81.4%
*-commutative81.4%
Simplified81.4%
Taylor expanded in x around inf 66.7%
if -3.3e-17 < x < 7.99999999999999963e37Initial program 92.5%
associate-/l*94.4%
Simplified94.4%
Taylor expanded in z around 0 61.0%
associate-*r/61.0%
neg-mul-161.0%
Simplified61.0%
Taylor expanded in x around 0 45.9%
associate-*r/48.0%
Simplified48.0%
Taylor expanded in t around 0 45.9%
associate-/l*48.0%
Simplified48.0%
Final simplification57.4%
(FPCore (x y z t a) :precision binary64 (+ x (* (/ y a) (- t z))))
double code(double x, double y, double z, double t, double a) {
return x + ((y / a) * (t - z));
}
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) * (t - z))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((y / a) * (t - z));
}
def code(x, y, z, t, a): return x + ((y / a) * (t - z))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y / a) * Float64(t - z))) end
function tmp = code(x, y, z, t, a) tmp = x + ((y / a) * (t - z)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y}{a} \cdot \left(t - z\right)
\end{array}
Initial program 93.3%
associate-*l/96.2%
Simplified96.2%
Final simplification96.2%
(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 93.3%
associate-*l/96.2%
Simplified96.2%
Taylor expanded in z around inf 67.4%
associate-*l/70.4%
*-commutative70.4%
Simplified70.4%
Taylor expanded in x around inf 42.4%
Final simplification42.4%
(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 2023293
(FPCore (x y z t a)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, F"
:precision binary64
:herbie-target
(if (< y -1.0761266216389975e-10) (- x (/ 1.0 (/ (/ a (- z t)) y))) (if (< y 2.894426862792089e-49) (- x (/ (* y (- z t)) a)) (- x (/ y (/ a (- z t))))))
(- x (/ (* y (- z t)) a)))