
(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 12 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 (+ x (* (- z t) (* (/ 1.0 a) y))))
double code(double x, double y, double z, double t, double a) {
return x + ((z - t) * ((1.0 / a) * y));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + ((z - t) * ((1.0d0 / a) * y))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((z - t) * ((1.0 / a) * y));
}
def code(x, y, z, t, a): return x + ((z - t) * ((1.0 / a) * y))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(z - t) * Float64(Float64(1.0 / a) * y))) end
function tmp = code(x, y, z, t, a) tmp = x + ((z - t) * ((1.0 / a) * y)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(z - t), $MachinePrecision] * N[(N[(1.0 / a), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(z - t\right) \cdot \left(\frac{1}{a} \cdot y\right)
\end{array}
Initial program 93.6%
associate-*r/92.7%
*-commutative92.7%
div-inv92.6%
associate-*l*97.7%
Applied egg-rr97.7%
(FPCore (x y z t a) :precision binary64 (if (<= y -2.55e+16) (/ y (/ a (- t))) (if (<= y 6.2e-38) x (if (<= y 3.8e+135) (* y (/ z a)) (* (- y) (/ t a))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -2.55e+16) {
tmp = y / (a / -t);
} else if (y <= 6.2e-38) {
tmp = x;
} else if (y <= 3.8e+135) {
tmp = y * (z / a);
} else {
tmp = -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 (y <= (-2.55d+16)) then
tmp = y / (a / -t)
else if (y <= 6.2d-38) then
tmp = x
else if (y <= 3.8d+135) then
tmp = y * (z / a)
else
tmp = -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 (y <= -2.55e+16) {
tmp = y / (a / -t);
} else if (y <= 6.2e-38) {
tmp = x;
} else if (y <= 3.8e+135) {
tmp = y * (z / a);
} else {
tmp = -y * (t / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= -2.55e+16: tmp = y / (a / -t) elif y <= 6.2e-38: tmp = x elif y <= 3.8e+135: tmp = y * (z / a) else: tmp = -y * (t / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= -2.55e+16) tmp = Float64(y / Float64(a / Float64(-t))); elseif (y <= 6.2e-38) tmp = x; elseif (y <= 3.8e+135) tmp = Float64(y * Float64(z / a)); else tmp = Float64(Float64(-y) * Float64(t / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (y <= -2.55e+16) tmp = y / (a / -t); elseif (y <= 6.2e-38) tmp = x; elseif (y <= 3.8e+135) tmp = y * (z / a); else tmp = -y * (t / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -2.55e+16], N[(y / N[(a / (-t)), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6.2e-38], x, If[LessEqual[y, 3.8e+135], N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision], N[((-y) * N[(t / a), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.55 \cdot 10^{+16}:\\
\;\;\;\;\frac{y}{\frac{a}{-t}}\\
\mathbf{elif}\;y \leq 6.2 \cdot 10^{-38}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 3.8 \cdot 10^{+135}:\\
\;\;\;\;y \cdot \frac{z}{a}\\
\mathbf{else}:\\
\;\;\;\;\left(-y\right) \cdot \frac{t}{a}\\
\end{array}
\end{array}
if y < -2.55e16Initial program 81.0%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in y around 0 81.0%
associate-*l/99.7%
associate-/r/99.8%
Simplified99.8%
Taylor expanded in x around 0 81.0%
+-commutative81.0%
Simplified81.0%
Taylor expanded in t around inf 49.3%
mul-1-neg49.3%
associate-*r/62.6%
*-commutative62.6%
associate-/r/59.2%
distribute-frac-neg59.2%
Simplified59.2%
if -2.55e16 < y < 6.19999999999999966e-38Initial program 99.2%
associate-/l*86.9%
Simplified86.9%
Taylor expanded in x around inf 58.8%
if 6.19999999999999966e-38 < y < 3.8000000000000001e135Initial program 94.4%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in y around 0 94.4%
associate-*l/99.8%
associate-/r/99.7%
Simplified99.7%
Taylor expanded in x around 0 94.4%
+-commutative94.4%
Simplified94.4%
Taylor expanded in z around inf 42.5%
associate-*r/48.0%
Simplified48.0%
if 3.8000000000000001e135 < y Initial program 88.7%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in y around 0 88.7%
associate-*l/96.2%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in x around 0 88.7%
+-commutative88.7%
Simplified88.7%
Taylor expanded in t around inf 61.8%
mul-1-neg61.8%
associate-*r/72.8%
*-commutative72.8%
associate-/r/72.9%
distribute-frac-neg72.9%
Simplified72.9%
distribute-frac-neg72.9%
div-inv72.9%
clear-num73.0%
Applied egg-rr73.0%
Final simplification58.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (- y) (/ t a))))
(if (<= y -2.05e+16)
t_1
(if (<= y 5.2e-40) x (if (<= y 3.9e+135) (* y (/ z a)) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = -y * (t / a);
double tmp;
if (y <= -2.05e+16) {
tmp = t_1;
} else if (y <= 5.2e-40) {
tmp = x;
} else if (y <= 3.9e+135) {
tmp = y * (z / a);
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = -y * (t / a)
if (y <= (-2.05d+16)) then
tmp = t_1
else if (y <= 5.2d-40) then
tmp = x
else if (y <= 3.9d+135) then
tmp = y * (z / a)
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 * (t / a);
double tmp;
if (y <= -2.05e+16) {
tmp = t_1;
} else if (y <= 5.2e-40) {
tmp = x;
} else if (y <= 3.9e+135) {
tmp = y * (z / a);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = -y * (t / a) tmp = 0 if y <= -2.05e+16: tmp = t_1 elif y <= 5.2e-40: tmp = x elif y <= 3.9e+135: tmp = y * (z / a) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(-y) * Float64(t / a)) tmp = 0.0 if (y <= -2.05e+16) tmp = t_1; elseif (y <= 5.2e-40) tmp = x; elseif (y <= 3.9e+135) tmp = Float64(y * Float64(z / a)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = -y * (t / a); tmp = 0.0; if (y <= -2.05e+16) tmp = t_1; elseif (y <= 5.2e-40) tmp = x; elseif (y <= 3.9e+135) tmp = y * (z / a); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[((-y) * N[(t / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.05e+16], t$95$1, If[LessEqual[y, 5.2e-40], x, If[LessEqual[y, 3.9e+135], N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(-y\right) \cdot \frac{t}{a}\\
\mathbf{if}\;y \leq -2.05 \cdot 10^{+16}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 5.2 \cdot 10^{-40}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 3.9 \cdot 10^{+135}:\\
\;\;\;\;y \cdot \frac{z}{a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -2.05e16 or 3.90000000000000032e135 < y Initial program 83.4%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in y around 0 83.4%
associate-*l/98.6%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in x around 0 83.4%
+-commutative83.4%
Simplified83.4%
Taylor expanded in t around inf 53.2%
mul-1-neg53.2%
associate-*r/65.8%
*-commutative65.8%
associate-/r/63.5%
distribute-frac-neg63.5%
Simplified63.5%
distribute-frac-neg63.5%
div-inv63.5%
clear-num63.5%
Applied egg-rr63.5%
if -2.05e16 < y < 5.2000000000000003e-40Initial program 99.2%
associate-/l*86.9%
Simplified86.9%
Taylor expanded in x around inf 58.8%
if 5.2000000000000003e-40 < y < 3.90000000000000032e135Initial program 94.4%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in y around 0 94.4%
associate-*l/99.8%
associate-/r/99.7%
Simplified99.7%
Taylor expanded in x around 0 94.4%
+-commutative94.4%
Simplified94.4%
Taylor expanded in z around inf 42.5%
associate-*r/48.0%
Simplified48.0%
Final simplification58.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -1.8e-121) (not (<= a 7.8e-283))) (+ x (* y (/ (- z t) a))) (/ (* (- z t) y) a)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1.8e-121) || !(a <= 7.8e-283)) {
tmp = x + (y * ((z - t) / a));
} else {
tmp = ((z - 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 ((a <= (-1.8d-121)) .or. (.not. (a <= 7.8d-283))) then
tmp = x + (y * ((z - t) / a))
else
tmp = ((z - 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 ((a <= -1.8e-121) || !(a <= 7.8e-283)) {
tmp = x + (y * ((z - t) / a));
} else {
tmp = ((z - t) * y) / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -1.8e-121) or not (a <= 7.8e-283): tmp = x + (y * ((z - t) / a)) else: tmp = ((z - t) * y) / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -1.8e-121) || !(a <= 7.8e-283)) tmp = Float64(x + Float64(y * Float64(Float64(z - t) / a))); else tmp = Float64(Float64(Float64(z - t) * y) / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -1.8e-121) || ~((a <= 7.8e-283))) tmp = x + (y * ((z - t) / a)); else tmp = ((z - t) * y) / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -1.8e-121], N[Not[LessEqual[a, 7.8e-283]], $MachinePrecision]], N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.8 \cdot 10^{-121} \lor \neg \left(a \leq 7.8 \cdot 10^{-283}\right):\\
\;\;\;\;x + y \cdot \frac{z - t}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(z - t\right) \cdot y}{a}\\
\end{array}
\end{array}
if a < -1.79999999999999992e-121 or 7.8000000000000004e-283 < a Initial program 92.1%
associate-/l*97.6%
Simplified97.6%
if -1.79999999999999992e-121 < a < 7.8000000000000004e-283Initial program 99.9%
associate-/l*71.8%
Simplified71.8%
Taylor expanded in y around 0 99.9%
associate-*l/99.9%
associate-/r/72.7%
Simplified72.7%
Taylor expanded in x around 0 99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in y around -inf 93.7%
Final simplification96.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -2.8e+63) (not (<= z 1.5e+109))) (+ x (/ (* z y) a)) (- x (* t (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2.8e+63) || !(z <= 1.5e+109)) {
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 <= (-2.8d+63)) .or. (.not. (z <= 1.5d+109))) 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 <= -2.8e+63) || !(z <= 1.5e+109)) {
tmp = x + ((z * y) / a);
} else {
tmp = x - (t * (y / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -2.8e+63) or not (z <= 1.5e+109): 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 <= -2.8e+63) || !(z <= 1.5e+109)) tmp = Float64(x + Float64(Float64(z * 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 <= -2.8e+63) || ~((z <= 1.5e+109))) 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, -2.8e+63], N[Not[LessEqual[z, 1.5e+109]], $MachinePrecision]], N[(x + N[(N[(z * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(x - N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.8 \cdot 10^{+63} \lor \neg \left(z \leq 1.5 \cdot 10^{+109}\right):\\
\;\;\;\;x + \frac{z \cdot y}{a}\\
\mathbf{else}:\\
\;\;\;\;x - t \cdot \frac{y}{a}\\
\end{array}
\end{array}
if z < -2.79999999999999987e63 or 1.50000000000000008e109 < z Initial program 94.7%
associate-/l*85.7%
Simplified85.7%
Taylor expanded in z around inf 86.4%
if -2.79999999999999987e63 < z < 1.50000000000000008e109Initial program 93.0%
associate-/l*96.4%
Simplified96.4%
Taylor expanded in z around 0 86.0%
+-commutative86.0%
associate-*r/86.0%
mul-1-neg86.0%
distribute-lft-neg-out86.0%
*-commutative86.0%
Simplified86.0%
Taylor expanded in y around 0 86.0%
associate-*l/88.2%
*-commutative88.2%
neg-mul-188.2%
sub-neg88.2%
associate-*r/86.0%
associate-*l/91.6%
*-commutative91.6%
Simplified91.6%
Final simplification89.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= y -3e+16) (not (<= y 2.6e-32))) (* y (/ (- z t) a)) (+ x (/ (* z y) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -3e+16) || !(y <= 2.6e-32)) {
tmp = y * ((z - t) / a);
} else {
tmp = x + ((z * 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 ((y <= (-3d+16)) .or. (.not. (y <= 2.6d-32))) then
tmp = y * ((z - t) / a)
else
tmp = x + ((z * 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 ((y <= -3e+16) || !(y <= 2.6e-32)) {
tmp = y * ((z - t) / a);
} else {
tmp = x + ((z * y) / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (y <= -3e+16) or not (y <= 2.6e-32): tmp = y * ((z - t) / a) else: tmp = x + ((z * y) / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -3e+16) || !(y <= 2.6e-32)) tmp = Float64(y * Float64(Float64(z - t) / a)); else tmp = Float64(x + Float64(Float64(z * y) / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((y <= -3e+16) || ~((y <= 2.6e-32))) tmp = y * ((z - t) / a); else tmp = x + ((z * y) / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -3e+16], N[Not[LessEqual[y, 2.6e-32]], $MachinePrecision]], N[(y * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(z * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3 \cdot 10^{+16} \lor \neg \left(y \leq 2.6 \cdot 10^{-32}\right):\\
\;\;\;\;y \cdot \frac{z - t}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z \cdot y}{a}\\
\end{array}
\end{array}
if y < -3e16 or 2.5999999999999997e-32 < y Initial program 86.7%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in y around 0 86.7%
associate-*l/99.0%
associate-/r/99.8%
Simplified99.8%
Taylor expanded in x around 0 86.7%
+-commutative86.7%
Simplified86.7%
Taylor expanded in y around inf 81.0%
div-sub83.7%
Simplified83.7%
if -3e16 < y < 2.5999999999999997e-32Initial program 99.2%
associate-/l*86.9%
Simplified86.9%
Taylor expanded in z around inf 78.1%
Final simplification80.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= y -2.9e-16) (not (<= y 1.52e-80))) (* y (/ (- z t) a)) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -2.9e-16) || !(y <= 1.52e-80)) {
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 <= (-2.9d-16)) .or. (.not. (y <= 1.52d-80))) 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 <= -2.9e-16) || !(y <= 1.52e-80)) {
tmp = y * ((z - t) / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (y <= -2.9e-16) or not (y <= 1.52e-80): tmp = y * ((z - t) / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -2.9e-16) || !(y <= 1.52e-80)) 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 <= -2.9e-16) || ~((y <= 1.52e-80))) tmp = y * ((z - t) / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -2.9e-16], N[Not[LessEqual[y, 1.52e-80]], $MachinePrecision]], N[(y * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.9 \cdot 10^{-16} \lor \neg \left(y \leq 1.52 \cdot 10^{-80}\right):\\
\;\;\;\;y \cdot \frac{z - t}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -2.8999999999999998e-16 or 1.5199999999999999e-80 < y Initial program 88.4%
associate-/l*99.1%
Simplified99.1%
Taylor expanded in y around 0 88.4%
associate-*l/99.1%
associate-/r/99.4%
Simplified99.4%
Taylor expanded in x around 0 88.4%
+-commutative88.4%
Simplified88.4%
Taylor expanded in y around inf 77.7%
div-sub79.9%
Simplified79.9%
if -2.8999999999999998e-16 < y < 1.5199999999999999e-80Initial program 99.2%
associate-/l*85.8%
Simplified85.8%
Taylor expanded in x around inf 61.5%
Final simplification71.0%
(FPCore (x y z t a) :precision binary64 (if (<= a -5.2e-7) x (if (<= a 1.25e-151) (/ (* z y) a) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -5.2e-7) {
tmp = x;
} else if (a <= 1.25e-151) {
tmp = (z * 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 (a <= (-5.2d-7)) then
tmp = x
else if (a <= 1.25d-151) then
tmp = (z * 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 (a <= -5.2e-7) {
tmp = x;
} else if (a <= 1.25e-151) {
tmp = (z * y) / a;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -5.2e-7: tmp = x elif a <= 1.25e-151: tmp = (z * y) / a else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -5.2e-7) tmp = x; elseif (a <= 1.25e-151) tmp = Float64(Float64(z * y) / a); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -5.2e-7) tmp = x; elseif (a <= 1.25e-151) tmp = (z * y) / a; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -5.2e-7], x, If[LessEqual[a, 1.25e-151], N[(N[(z * y), $MachinePrecision] / a), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -5.2 \cdot 10^{-7}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 1.25 \cdot 10^{-151}:\\
\;\;\;\;\frac{z \cdot y}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -5.19999999999999998e-7 or 1.25000000000000001e-151 < a Initial program 89.9%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in x around inf 56.5%
if -5.19999999999999998e-7 < a < 1.25000000000000001e-151Initial program 99.8%
associate-/l*80.7%
Simplified80.7%
Taylor expanded in y around 0 99.8%
associate-*l/99.9%
associate-/r/82.9%
Simplified82.9%
Taylor expanded in x around 0 99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in z around inf 49.3%
Final simplification53.8%
(FPCore (x y z t a) :precision binary64 (if (<= x -4.5e-23) x (if (<= x 2.9e-87) (/ y (/ a z)) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -4.5e-23) {
tmp = x;
} else if (x <= 2.9e-87) {
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 <= (-4.5d-23)) then
tmp = x
else if (x <= 2.9d-87) 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 <= -4.5e-23) {
tmp = x;
} else if (x <= 2.9e-87) {
tmp = y / (a / z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -4.5e-23: tmp = x elif x <= 2.9e-87: tmp = y / (a / z) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -4.5e-23) tmp = x; elseif (x <= 2.9e-87) tmp = Float64(y / Float64(a / z)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (x <= -4.5e-23) tmp = x; elseif (x <= 2.9e-87) tmp = y / (a / z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -4.5e-23], x, If[LessEqual[x, 2.9e-87], N[(y / N[(a / z), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.5 \cdot 10^{-23}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 2.9 \cdot 10^{-87}:\\
\;\;\;\;\frac{y}{\frac{a}{z}}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -4.49999999999999975e-23 or 2.8999999999999999e-87 < x Initial program 95.1%
associate-/l*93.6%
Simplified93.6%
Taylor expanded in x around inf 57.9%
if -4.49999999999999975e-23 < x < 2.8999999999999999e-87Initial program 91.3%
associate-/l*91.2%
Simplified91.2%
Taylor expanded in y around 0 91.3%
associate-*l/94.2%
associate-/r/92.6%
Simplified92.6%
Taylor expanded in x around 0 91.3%
+-commutative91.3%
Simplified91.3%
Taylor expanded in z around inf 43.1%
associate-*r/41.9%
Simplified41.9%
clear-num41.8%
un-div-inv42.7%
Applied egg-rr42.7%
(FPCore (x y z t a) :precision binary64 (if (<= a -8e-7) x (if (<= a 1.25e-151) (* y (/ z a)) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -8e-7) {
tmp = x;
} else if (a <= 1.25e-151) {
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 (a <= (-8d-7)) then
tmp = x
else if (a <= 1.25d-151) 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 (a <= -8e-7) {
tmp = x;
} else if (a <= 1.25e-151) {
tmp = y * (z / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -8e-7: tmp = x elif a <= 1.25e-151: tmp = y * (z / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -8e-7) tmp = x; elseif (a <= 1.25e-151) 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 (a <= -8e-7) tmp = x; elseif (a <= 1.25e-151) tmp = y * (z / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -8e-7], x, If[LessEqual[a, 1.25e-151], N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -8 \cdot 10^{-7}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 1.25 \cdot 10^{-151}:\\
\;\;\;\;y \cdot \frac{z}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -7.9999999999999996e-7 or 1.25000000000000001e-151 < a Initial program 89.9%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in x around inf 56.5%
if -7.9999999999999996e-7 < a < 1.25000000000000001e-151Initial program 99.8%
associate-/l*80.7%
Simplified80.7%
Taylor expanded in y around 0 99.8%
associate-*l/99.9%
associate-/r/82.9%
Simplified82.9%
Taylor expanded in x around 0 99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in z around inf 49.3%
associate-*r/44.0%
Simplified44.0%
(FPCore (x y z t a) :precision binary64 (+ x (* (- z t) (/ y a))))
double code(double x, double y, double z, double t, double a) {
return x + ((z - t) * (y / 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 + ((z - t) * (y / a))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((z - t) * (y / a));
}
def code(x, y, z, t, a): return x + ((z - t) * (y / a))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(z - t) * Float64(y / a))) end
function tmp = code(x, y, z, t, a) tmp = x + ((z - t) * (y / a)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(z - t), $MachinePrecision] * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(z - t\right) \cdot \frac{y}{a}
\end{array}
Initial program 93.6%
*-commutative93.6%
associate-/l*97.7%
Applied egg-rr97.7%
(FPCore (x y z t a) :precision binary64 x)
double code(double x, double y, double z, double t, double a) {
return x;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x
end function
public static double code(double x, double y, double z, double t, double a) {
return x;
}
def code(x, y, z, t, a): return x
function code(x, y, z, t, a) return x end
function tmp = code(x, y, z, t, a) tmp = x; end
code[x_, y_, z_, t_, a_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 93.6%
associate-/l*92.7%
Simplified92.7%
Taylor expanded in x around inf 40.5%
(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 2024156
(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)))