
(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 (/ (- t z) (/ a y))))
double code(double x, double y, double z, double t, double a) {
return x + ((t - z) / (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 + ((t - z) / (a / y))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((t - z) / (a / y));
}
def code(x, y, z, t, a): return x + ((t - z) / (a / y))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(t - z) / Float64(a / y))) end
function tmp = code(x, y, z, t, a) tmp = x + ((t - z) / (a / y)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(t - z), $MachinePrecision] / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{t - z}{\frac{a}{y}}
\end{array}
Initial program 93.5%
associate-*l/96.4%
Simplified96.4%
*-commutative96.4%
clear-num95.8%
un-div-inv96.6%
Applied egg-rr96.6%
Final simplification96.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* z (/ (- y) a))))
(if (<= t -3.05e+177)
(/ y (/ a t))
(if (<= t -1.4e-6)
x
(if (<= t -5.8e-72)
t_1
(if (<= t 2.1e-36)
x
(if (<= t 9e-9) t_1 (if (<= t 3.7e+136) x (* t (/ y a))))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = z * (-y / a);
double tmp;
if (t <= -3.05e+177) {
tmp = y / (a / t);
} else if (t <= -1.4e-6) {
tmp = x;
} else if (t <= -5.8e-72) {
tmp = t_1;
} else if (t <= 2.1e-36) {
tmp = x;
} else if (t <= 9e-9) {
tmp = t_1;
} else if (t <= 3.7e+136) {
tmp = x;
} else {
tmp = 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) :: t_1
real(8) :: tmp
t_1 = z * (-y / a)
if (t <= (-3.05d+177)) then
tmp = y / (a / t)
else if (t <= (-1.4d-6)) then
tmp = x
else if (t <= (-5.8d-72)) then
tmp = t_1
else if (t <= 2.1d-36) then
tmp = x
else if (t <= 9d-9) then
tmp = t_1
else if (t <= 3.7d+136) then
tmp = x
else
tmp = t * (y / a)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = z * (-y / a);
double tmp;
if (t <= -3.05e+177) {
tmp = y / (a / t);
} else if (t <= -1.4e-6) {
tmp = x;
} else if (t <= -5.8e-72) {
tmp = t_1;
} else if (t <= 2.1e-36) {
tmp = x;
} else if (t <= 9e-9) {
tmp = t_1;
} else if (t <= 3.7e+136) {
tmp = x;
} else {
tmp = t * (y / a);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = z * (-y / a) tmp = 0 if t <= -3.05e+177: tmp = y / (a / t) elif t <= -1.4e-6: tmp = x elif t <= -5.8e-72: tmp = t_1 elif t <= 2.1e-36: tmp = x elif t <= 9e-9: tmp = t_1 elif t <= 3.7e+136: tmp = x else: tmp = t * (y / a) return tmp
function code(x, y, z, t, a) t_1 = Float64(z * Float64(Float64(-y) / a)) tmp = 0.0 if (t <= -3.05e+177) tmp = Float64(y / Float64(a / t)); elseif (t <= -1.4e-6) tmp = x; elseif (t <= -5.8e-72) tmp = t_1; elseif (t <= 2.1e-36) tmp = x; elseif (t <= 9e-9) tmp = t_1; elseif (t <= 3.7e+136) tmp = x; else tmp = Float64(t * Float64(y / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = z * (-y / a); tmp = 0.0; if (t <= -3.05e+177) tmp = y / (a / t); elseif (t <= -1.4e-6) tmp = x; elseif (t <= -5.8e-72) tmp = t_1; elseif (t <= 2.1e-36) tmp = x; elseif (t <= 9e-9) tmp = t_1; elseif (t <= 3.7e+136) tmp = x; else tmp = t * (y / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(z * N[((-y) / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -3.05e+177], N[(y / N[(a / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -1.4e-6], x, If[LessEqual[t, -5.8e-72], t$95$1, If[LessEqual[t, 2.1e-36], x, If[LessEqual[t, 9e-9], t$95$1, If[LessEqual[t, 3.7e+136], x, N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \frac{-y}{a}\\
\mathbf{if}\;t \leq -3.05 \cdot 10^{+177}:\\
\;\;\;\;\frac{y}{\frac{a}{t}}\\
\mathbf{elif}\;t \leq -1.4 \cdot 10^{-6}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq -5.8 \cdot 10^{-72}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 2.1 \cdot 10^{-36}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 9 \cdot 10^{-9}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 3.7 \cdot 10^{+136}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{y}{a}\\
\end{array}
\end{array}
if t < -3.0499999999999999e177Initial program 87.7%
associate-*l/97.2%
Simplified97.2%
Taylor expanded in z around 0 78.1%
sub-neg78.1%
mul-1-neg78.1%
remove-double-neg78.1%
+-commutative78.1%
associate-*r/85.3%
Simplified85.3%
Taylor expanded in t around inf 65.7%
*-commutative65.7%
associate-/l*70.3%
Simplified70.3%
if -3.0499999999999999e177 < t < -1.39999999999999994e-6 or -5.79999999999999995e-72 < t < 2.09999999999999991e-36 or 8.99999999999999953e-9 < t < 3.7000000000000001e136Initial program 96.2%
associate-*l/96.3%
Simplified96.3%
Taylor expanded in x around inf 60.8%
if -1.39999999999999994e-6 < t < -5.79999999999999995e-72 or 2.09999999999999991e-36 < t < 8.99999999999999953e-9Initial program 89.6%
associate-*l/96.5%
Simplified96.5%
Taylor expanded in z around inf 61.5%
mul-1-neg61.5%
associate-*l/66.2%
distribute-rgt-neg-in66.2%
Simplified66.2%
if 3.7000000000000001e136 < t Initial program 90.7%
associate-*l/96.1%
Simplified96.1%
Taylor expanded in t around inf 66.0%
associate-*r/68.4%
Simplified68.4%
Final simplification63.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* y (/ (- t z) a))))
(if (<= y -5.1e-14)
t_1
(if (<= y -1.05e-166)
x
(if (<= y -4.5e-233) (* (/ y a) (- t z)) (if (<= y 5e-99) x t_1))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = y * ((t - z) / a);
double tmp;
if (y <= -5.1e-14) {
tmp = t_1;
} else if (y <= -1.05e-166) {
tmp = x;
} else if (y <= -4.5e-233) {
tmp = (y / a) * (t - z);
} else if (y <= 5e-99) {
tmp = x;
} 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 - z) / a)
if (y <= (-5.1d-14)) then
tmp = t_1
else if (y <= (-1.05d-166)) then
tmp = x
else if (y <= (-4.5d-233)) then
tmp = (y / a) * (t - z)
else if (y <= 5d-99) then
tmp = x
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 - z) / a);
double tmp;
if (y <= -5.1e-14) {
tmp = t_1;
} else if (y <= -1.05e-166) {
tmp = x;
} else if (y <= -4.5e-233) {
tmp = (y / a) * (t - z);
} else if (y <= 5e-99) {
tmp = x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = y * ((t - z) / a) tmp = 0 if y <= -5.1e-14: tmp = t_1 elif y <= -1.05e-166: tmp = x elif y <= -4.5e-233: tmp = (y / a) * (t - z) elif y <= 5e-99: tmp = x else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(y * Float64(Float64(t - z) / a)) tmp = 0.0 if (y <= -5.1e-14) tmp = t_1; elseif (y <= -1.05e-166) tmp = x; elseif (y <= -4.5e-233) tmp = Float64(Float64(y / a) * Float64(t - z)); elseif (y <= 5e-99) tmp = x; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = y * ((t - z) / a); tmp = 0.0; if (y <= -5.1e-14) tmp = t_1; elseif (y <= -1.05e-166) tmp = x; elseif (y <= -4.5e-233) tmp = (y / a) * (t - z); elseif (y <= 5e-99) tmp = x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(N[(t - z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -5.1e-14], t$95$1, If[LessEqual[y, -1.05e-166], x, If[LessEqual[y, -4.5e-233], N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5e-99], x, t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{t - z}{a}\\
\mathbf{if}\;y \leq -5.1 \cdot 10^{-14}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -1.05 \cdot 10^{-166}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq -4.5 \cdot 10^{-233}:\\
\;\;\;\;\frac{y}{a} \cdot \left(t - z\right)\\
\mathbf{elif}\;y \leq 5 \cdot 10^{-99}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if y < -5.0999999999999997e-14 or 4.99999999999999969e-99 < y Initial program 88.8%
associate-*l/96.5%
Simplified96.5%
*-commutative96.5%
clear-num96.4%
un-div-inv97.9%
Applied egg-rr97.9%
Taylor expanded in y around inf 72.7%
div-sub74.9%
Simplified74.9%
if -5.0999999999999997e-14 < y < -1.05e-166 or -4.5000000000000002e-233 < y < 4.99999999999999969e-99Initial program 99.9%
associate-*l/96.9%
Simplified96.9%
Taylor expanded in x around inf 70.2%
if -1.05e-166 < y < -4.5000000000000002e-233Initial program 93.7%
associate-*l/92.9%
Simplified92.9%
*-commutative92.9%
clear-num88.2%
un-div-inv88.3%
Applied egg-rr88.3%
Taylor expanded in y around inf 29.8%
div-sub36.3%
associate-*r/59.6%
associate-/l*36.2%
associate-/r/62.3%
Simplified62.3%
Final simplification72.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= y -5.4e-14) (not (<= y 5.2e-104))) (* y (/ (- t z) a)) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -5.4e-14) || !(y <= 5.2e-104)) {
tmp = y * ((t - 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 <= (-5.4d-14)) .or. (.not. (y <= 5.2d-104))) then
tmp = y * ((t - 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 <= -5.4e-14) || !(y <= 5.2e-104)) {
tmp = y * ((t - z) / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (y <= -5.4e-14) or not (y <= 5.2e-104): tmp = y * ((t - z) / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -5.4e-14) || !(y <= 5.2e-104)) tmp = Float64(y * Float64(Float64(t - z) / a)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((y <= -5.4e-14) || ~((y <= 5.2e-104))) tmp = y * ((t - z) / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -5.4e-14], N[Not[LessEqual[y, 5.2e-104]], $MachinePrecision]], N[(y * N[(N[(t - z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.4 \cdot 10^{-14} \lor \neg \left(y \leq 5.2 \cdot 10^{-104}\right):\\
\;\;\;\;y \cdot \frac{t - z}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -5.3999999999999997e-14 or 5.20000000000000005e-104 < y Initial program 88.8%
associate-*l/96.5%
Simplified96.5%
*-commutative96.5%
clear-num96.4%
un-div-inv97.9%
Applied egg-rr97.9%
Taylor expanded in y around inf 72.7%
div-sub74.9%
Simplified74.9%
if -5.3999999999999997e-14 < y < 5.20000000000000005e-104Initial program 99.0%
associate-*l/96.3%
Simplified96.3%
Taylor expanded in x around inf 64.8%
Final simplification70.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -4.4e+142) (not (<= z 4.4e+145))) (* (/ y a) (- t z)) (+ x (* t (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -4.4e+142) || !(z <= 4.4e+145)) {
tmp = (y / a) * (t - z);
} 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 <= (-4.4d+142)) .or. (.not. (z <= 4.4d+145))) then
tmp = (y / a) * (t - z)
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 <= -4.4e+142) || !(z <= 4.4e+145)) {
tmp = (y / a) * (t - z);
} else {
tmp = x + (t * (y / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -4.4e+142) or not (z <= 4.4e+145): tmp = (y / a) * (t - z) else: tmp = x + (t * (y / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -4.4e+142) || !(z <= 4.4e+145)) tmp = Float64(Float64(y / a) * Float64(t - z)); 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 <= -4.4e+142) || ~((z <= 4.4e+145))) tmp = (y / a) * (t - z); else tmp = x + (t * (y / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -4.4e+142], N[Not[LessEqual[z, 4.4e+145]], $MachinePrecision]], N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision], N[(x + N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.4 \cdot 10^{+142} \lor \neg \left(z \leq 4.4 \cdot 10^{+145}\right):\\
\;\;\;\;\frac{y}{a} \cdot \left(t - z\right)\\
\mathbf{else}:\\
\;\;\;\;x + t \cdot \frac{y}{a}\\
\end{array}
\end{array}
if z < -4.39999999999999974e142 or 4.40000000000000017e145 < z Initial program 87.0%
associate-*l/95.8%
Simplified95.8%
*-commutative95.8%
clear-num94.8%
un-div-inv94.8%
Applied egg-rr94.8%
Taylor expanded in y around inf 59.2%
div-sub63.2%
associate-*r/67.2%
associate-/l*64.2%
associate-/r/71.3%
Simplified71.3%
if -4.39999999999999974e142 < z < 4.40000000000000017e145Initial program 96.2%
associate-*l/96.7%
Simplified96.7%
Taylor expanded in z around 0 86.5%
sub-neg86.5%
mul-1-neg86.5%
remove-double-neg86.5%
+-commutative86.5%
associate-*r/87.5%
Simplified87.5%
Final simplification82.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -34000000000000.0) (not (<= z 9.2e+134))) (- x (* z (/ y a))) (+ x (/ (* t y) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -34000000000000.0) || !(z <= 9.2e+134)) {
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 <= (-34000000000000.0d0)) .or. (.not. (z <= 9.2d+134))) 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 <= -34000000000000.0) || !(z <= 9.2e+134)) {
tmp = x - (z * (y / a));
} else {
tmp = x + ((t * y) / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -34000000000000.0) or not (z <= 9.2e+134): 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 <= -34000000000000.0) || !(z <= 9.2e+134)) tmp = Float64(x - Float64(z * Float64(y / a))); else tmp = Float64(x + Float64(Float64(t * y) / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -34000000000000.0) || ~((z <= 9.2e+134))) 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, -34000000000000.0], N[Not[LessEqual[z, 9.2e+134]], $MachinePrecision]], N[(x - N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(t * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -34000000000000 \lor \neg \left(z \leq 9.2 \cdot 10^{+134}\right):\\
\;\;\;\;x - z \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{t \cdot y}{a}\\
\end{array}
\end{array}
if z < -3.4e13 or 9.1999999999999992e134 < z Initial program 88.1%
associate-*l/97.1%
Simplified97.1%
Taylor expanded in z around inf 77.4%
associate-*l/85.5%
*-commutative85.5%
Simplified85.5%
if -3.4e13 < z < 9.1999999999999992e134Initial program 97.4%
associate-*l/96.0%
Simplified96.0%
Taylor expanded in z around 0 89.5%
sub-neg89.5%
mul-1-neg89.5%
remove-double-neg89.5%
+-commutative89.5%
associate-*r/88.8%
Simplified88.8%
Taylor expanded in t around 0 89.5%
Final simplification87.9%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.25e+142) (* (/ y a) (- t z)) (if (<= z 2.45e+191) (+ x (/ (* t y) a)) (* z (/ (- y) a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.25e+142) {
tmp = (y / a) * (t - z);
} else if (z <= 2.45e+191) {
tmp = x + ((t * y) / a);
} else {
tmp = 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 (z <= (-1.25d+142)) then
tmp = (y / a) * (t - z)
else if (z <= 2.45d+191) then
tmp = x + ((t * y) / a)
else
tmp = 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 (z <= -1.25e+142) {
tmp = (y / a) * (t - z);
} else if (z <= 2.45e+191) {
tmp = x + ((t * y) / a);
} else {
tmp = z * (-y / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.25e+142: tmp = (y / a) * (t - z) elif z <= 2.45e+191: tmp = x + ((t * y) / a) else: tmp = z * (-y / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.25e+142) tmp = Float64(Float64(y / a) * Float64(t - z)); elseif (z <= 2.45e+191) tmp = Float64(x + Float64(Float64(t * y) / a)); else tmp = Float64(z * Float64(Float64(-y) / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -1.25e+142) tmp = (y / a) * (t - z); elseif (z <= 2.45e+191) tmp = x + ((t * y) / a); else tmp = z * (-y / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.25e+142], N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.45e+191], N[(x + N[(N[(t * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(z * N[((-y) / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.25 \cdot 10^{+142}:\\
\;\;\;\;\frac{y}{a} \cdot \left(t - z\right)\\
\mathbf{elif}\;z \leq 2.45 \cdot 10^{+191}:\\
\;\;\;\;x + \frac{t \cdot y}{a}\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{-y}{a}\\
\end{array}
\end{array}
if z < -1.25e142Initial program 88.1%
associate-*l/97.5%
Simplified97.5%
*-commutative97.5%
clear-num97.4%
un-div-inv97.4%
Applied egg-rr97.4%
Taylor expanded in y around inf 56.4%
div-sub63.8%
associate-*r/68.8%
associate-/l*65.5%
associate-/r/74.0%
Simplified74.0%
if -1.25e142 < z < 2.45e191Initial program 95.4%
associate-*l/96.3%
Simplified96.3%
Taylor expanded in z around 0 85.5%
sub-neg85.5%
mul-1-neg85.5%
remove-double-neg85.5%
+-commutative85.5%
associate-*r/86.0%
Simplified86.0%
Taylor expanded in t around 0 85.5%
if 2.45e191 < z Initial program 88.0%
associate-*l/96.1%
Simplified96.1%
Taylor expanded in z around inf 68.5%
mul-1-neg68.5%
associate-*l/68.7%
distribute-rgt-neg-in68.7%
Simplified68.7%
Final simplification82.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -8.5e+177) (not (<= t 4.4e+136))) (* t (/ y a)) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -8.5e+177) || !(t <= 4.4e+136)) {
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 ((t <= (-8.5d+177)) .or. (.not. (t <= 4.4d+136))) 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 ((t <= -8.5e+177) || !(t <= 4.4e+136)) {
tmp = t * (y / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -8.5e+177) or not (t <= 4.4e+136): tmp = t * (y / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -8.5e+177) || !(t <= 4.4e+136)) 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 ((t <= -8.5e+177) || ~((t <= 4.4e+136))) tmp = t * (y / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -8.5e+177], N[Not[LessEqual[t, 4.4e+136]], $MachinePrecision]], N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -8.5 \cdot 10^{+177} \lor \neg \left(t \leq 4.4 \cdot 10^{+136}\right):\\
\;\;\;\;t \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -8.5000000000000006e177 or 4.3999999999999999e136 < t Initial program 89.0%
associate-*l/96.7%
Simplified96.7%
Taylor expanded in t around inf 65.8%
associate-*r/68.3%
Simplified68.3%
if -8.5000000000000006e177 < t < 4.3999999999999999e136Initial program 95.2%
associate-*l/96.3%
Simplified96.3%
Taylor expanded in x around inf 54.7%
Final simplification58.4%
(FPCore (x y z t a) :precision binary64 (if (<= t -2.6e+177) (* y (/ t a)) (if (<= t 4.9e+136) x (* t (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -2.6e+177) {
tmp = y * (t / a);
} else if (t <= 4.9e+136) {
tmp = x;
} else {
tmp = 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 (t <= (-2.6d+177)) then
tmp = y * (t / a)
else if (t <= 4.9d+136) then
tmp = x
else
tmp = 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 (t <= -2.6e+177) {
tmp = y * (t / a);
} else if (t <= 4.9e+136) {
tmp = x;
} else {
tmp = t * (y / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -2.6e+177: tmp = y * (t / a) elif t <= 4.9e+136: tmp = x else: tmp = t * (y / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -2.6e+177) tmp = Float64(y * Float64(t / a)); elseif (t <= 4.9e+136) tmp = x; else tmp = Float64(t * Float64(y / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -2.6e+177) tmp = y * (t / a); elseif (t <= 4.9e+136) tmp = x; else tmp = t * (y / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -2.6e+177], N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 4.9e+136], x, N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.6 \cdot 10^{+177}:\\
\;\;\;\;y \cdot \frac{t}{a}\\
\mathbf{elif}\;t \leq 4.9 \cdot 10^{+136}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{y}{a}\\
\end{array}
\end{array}
if t < -2.59999999999999979e177Initial program 87.7%
associate-*l/97.2%
Simplified97.2%
*-commutative97.2%
clear-num95.2%
un-div-inv95.2%
Applied egg-rr95.2%
Taylor expanded in t around inf 65.7%
associate-*l/70.3%
*-commutative70.3%
Simplified70.3%
if -2.59999999999999979e177 < t < 4.90000000000000012e136Initial program 95.2%
associate-*l/96.3%
Simplified96.3%
Taylor expanded in x around inf 54.7%
if 4.90000000000000012e136 < t Initial program 90.7%
associate-*l/96.1%
Simplified96.1%
Taylor expanded in t around inf 66.0%
associate-*r/68.4%
Simplified68.4%
Final simplification58.8%
(FPCore (x y z t a) :precision binary64 (if (<= t -4e+178) (/ y (/ a t)) (if (<= t 3.6e+136) x (* t (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -4e+178) {
tmp = y / (a / t);
} else if (t <= 3.6e+136) {
tmp = x;
} else {
tmp = 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 (t <= (-4d+178)) then
tmp = y / (a / t)
else if (t <= 3.6d+136) then
tmp = x
else
tmp = 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 (t <= -4e+178) {
tmp = y / (a / t);
} else if (t <= 3.6e+136) {
tmp = x;
} else {
tmp = t * (y / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -4e+178: tmp = y / (a / t) elif t <= 3.6e+136: tmp = x else: tmp = t * (y / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -4e+178) tmp = Float64(y / Float64(a / t)); elseif (t <= 3.6e+136) tmp = x; else tmp = Float64(t * Float64(y / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -4e+178) tmp = y / (a / t); elseif (t <= 3.6e+136) tmp = x; else tmp = t * (y / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -4e+178], N[(y / N[(a / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 3.6e+136], x, N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4 \cdot 10^{+178}:\\
\;\;\;\;\frac{y}{\frac{a}{t}}\\
\mathbf{elif}\;t \leq 3.6 \cdot 10^{+136}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{y}{a}\\
\end{array}
\end{array}
if t < -4.0000000000000002e178Initial program 87.7%
associate-*l/97.2%
Simplified97.2%
Taylor expanded in z around 0 78.1%
sub-neg78.1%
mul-1-neg78.1%
remove-double-neg78.1%
+-commutative78.1%
associate-*r/85.3%
Simplified85.3%
Taylor expanded in t around inf 65.7%
*-commutative65.7%
associate-/l*70.3%
Simplified70.3%
if -4.0000000000000002e178 < t < 3.60000000000000006e136Initial program 95.2%
associate-*l/96.3%
Simplified96.3%
Taylor expanded in x around inf 54.7%
if 3.60000000000000006e136 < t Initial program 90.7%
associate-*l/96.1%
Simplified96.1%
Taylor expanded in t around inf 66.0%
associate-*r/68.4%
Simplified68.4%
Final simplification58.8%
(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.5%
associate-*l/96.4%
Simplified96.4%
Final simplification96.4%
(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.5%
associate-*l/96.4%
Simplified96.4%
Taylor expanded in x around inf 44.2%
Final simplification44.2%
(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 2024010
(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)))