
(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 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (- x (/ (* y (- z t)) a)))
double code(double x, double y, double z, double t, double a) {
return x - ((y * (z - t)) / a);
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x - ((y * (z - t)) / a)
end function
public static double code(double x, double y, double z, double t, double a) {
return x - ((y * (z - t)) / a);
}
def code(x, y, z, t, a): return x - ((y * (z - t)) / a)
function code(x, y, z, t, a) return Float64(x - Float64(Float64(y * Float64(z - t)) / a)) end
function tmp = code(x, y, z, t, a) tmp = x - ((y * (z - t)) / a); end
code[x_, y_, z_, t_, a_] := N[(x - N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{y \cdot \left(z - t\right)}{a}
\end{array}
(FPCore (x y z t a) :precision binary64 (if (<= a -2e-19) (+ x (* y (/ (- t z) a))) (+ x (* (/ y a) (- t z)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -2e-19) {
tmp = x + (y * ((t - z) / a));
} else {
tmp = x + ((y / a) * (t - z));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (a <= (-2d-19)) then
tmp = x + (y * ((t - z) / a))
else
tmp = x + ((y / a) * (t - z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -2e-19) {
tmp = x + (y * ((t - z) / a));
} else {
tmp = x + ((y / a) * (t - z));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -2e-19: tmp = x + (y * ((t - z) / a)) else: tmp = x + ((y / a) * (t - z)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -2e-19) tmp = Float64(x + Float64(y * Float64(Float64(t - z) / a))); else tmp = Float64(x + Float64(Float64(y / a) * Float64(t - z))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -2e-19) tmp = x + (y * ((t - z) / a)); else tmp = x + ((y / a) * (t - z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -2e-19], N[(x + N[(y * N[(N[(t - z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2 \cdot 10^{-19}:\\
\;\;\;\;x + y \cdot \frac{t - z}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{a} \cdot \left(t - z\right)\\
\end{array}
\end{array}
if a < -2e-19Initial program 94.0%
associate-*r/99.9%
Simplified99.9%
if -2e-19 < a Initial program 94.9%
associate-*l/98.9%
Simplified98.9%
Final simplification99.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (/ (* y t) a))) (t_2 (- x (/ y (/ a z)))))
(if (<= z -1.02e+176)
(* (/ y a) (- t z))
(if (<= z -2.65e+67)
t_1
(if (<= z -4.6e+44)
t_2
(if (<= z -1.45e+31)
(+ x (* y (/ t a)))
(if (<= z 1.7e+75) t_1 t_2)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + ((y * t) / a);
double t_2 = x - (y / (a / z));
double tmp;
if (z <= -1.02e+176) {
tmp = (y / a) * (t - z);
} else if (z <= -2.65e+67) {
tmp = t_1;
} else if (z <= -4.6e+44) {
tmp = t_2;
} else if (z <= -1.45e+31) {
tmp = x + (y * (t / a));
} else if (z <= 1.7e+75) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = x + ((y * t) / a)
t_2 = x - (y / (a / z))
if (z <= (-1.02d+176)) then
tmp = (y / a) * (t - z)
else if (z <= (-2.65d+67)) then
tmp = t_1
else if (z <= (-4.6d+44)) then
tmp = t_2
else if (z <= (-1.45d+31)) then
tmp = x + (y * (t / a))
else if (z <= 1.7d+75) then
tmp = t_1
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = x + ((y * t) / a);
double t_2 = x - (y / (a / z));
double tmp;
if (z <= -1.02e+176) {
tmp = (y / a) * (t - z);
} else if (z <= -2.65e+67) {
tmp = t_1;
} else if (z <= -4.6e+44) {
tmp = t_2;
} else if (z <= -1.45e+31) {
tmp = x + (y * (t / a));
} else if (z <= 1.7e+75) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + ((y * t) / a) t_2 = x - (y / (a / z)) tmp = 0 if z <= -1.02e+176: tmp = (y / a) * (t - z) elif z <= -2.65e+67: tmp = t_1 elif z <= -4.6e+44: tmp = t_2 elif z <= -1.45e+31: tmp = x + (y * (t / a)) elif z <= 1.7e+75: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(y * t) / a)) t_2 = Float64(x - Float64(y / Float64(a / z))) tmp = 0.0 if (z <= -1.02e+176) tmp = Float64(Float64(y / a) * Float64(t - z)); elseif (z <= -2.65e+67) tmp = t_1; elseif (z <= -4.6e+44) tmp = t_2; elseif (z <= -1.45e+31) tmp = Float64(x + Float64(y * Float64(t / a))); elseif (z <= 1.7e+75) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + ((y * t) / a); t_2 = x - (y / (a / z)); tmp = 0.0; if (z <= -1.02e+176) tmp = (y / a) * (t - z); elseif (z <= -2.65e+67) tmp = t_1; elseif (z <= -4.6e+44) tmp = t_2; elseif (z <= -1.45e+31) tmp = x + (y * (t / a)); elseif (z <= 1.7e+75) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(y * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x - N[(y / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.02e+176], N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -2.65e+67], t$95$1, If[LessEqual[z, -4.6e+44], t$95$2, If[LessEqual[z, -1.45e+31], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.7e+75], t$95$1, t$95$2]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{y \cdot t}{a}\\
t_2 := x - \frac{y}{\frac{a}{z}}\\
\mathbf{if}\;z \leq -1.02 \cdot 10^{+176}:\\
\;\;\;\;\frac{y}{a} \cdot \left(t - z\right)\\
\mathbf{elif}\;z \leq -2.65 \cdot 10^{+67}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -4.6 \cdot 10^{+44}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq -1.45 \cdot 10^{+31}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\mathbf{elif}\;z \leq 1.7 \cdot 10^{+75}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if z < -1.02000000000000001e176Initial program 95.8%
associate-*l/91.9%
Simplified91.9%
Taylor expanded in x around 0 87.7%
associate-*r/72.4%
*-commutative72.4%
associate-*r*72.4%
neg-mul-172.4%
neg-sub072.4%
div-sub71.8%
associate-+l-71.8%
neg-sub071.8%
+-commutative71.8%
sub-neg71.8%
div-sub72.4%
*-rgt-identity72.4%
associate-*r/72.5%
associate-*l*83.5%
associate-*l/83.7%
associate-*r/83.7%
*-lft-identity83.7%
Simplified83.7%
if -1.02000000000000001e176 < z < -2.65e67 or -1.45e31 < z < 1.70000000000000006e75Initial program 96.6%
sub-neg96.6%
+-commutative96.6%
distribute-neg-frac96.6%
distribute-rgt-neg-in96.6%
associate-*r/93.2%
distribute-frac-neg93.2%
fma-def93.2%
distribute-frac-neg93.2%
sub-neg93.2%
+-commutative93.2%
distribute-neg-in93.2%
unsub-neg93.2%
remove-double-neg93.2%
Simplified93.2%
Taylor expanded in z around 0 88.5%
if -2.65e67 < z < -4.60000000000000009e44 or 1.70000000000000006e75 < z Initial program 91.6%
associate-/l*92.8%
Simplified92.8%
Taylor expanded in z around inf 91.3%
if -4.60000000000000009e44 < z < -1.45e31Initial program 62.4%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in z around 0 100.0%
neg-mul-1100.0%
distribute-neg-frac100.0%
Simplified100.0%
*-commutative100.0%
distribute-frac-neg100.0%
cancel-sign-sub100.0%
add-sqr-sqrt40.0%
sqrt-unprod2.4%
sqr-neg2.4%
sqrt-unprod0.0%
add-sqr-sqrt20.1%
*-commutative20.1%
add-sqr-sqrt0.0%
sqrt-unprod2.4%
sqr-neg2.4%
sqrt-unprod40.0%
add-sqr-sqrt100.0%
Applied egg-rr100.0%
Final simplification88.9%
(FPCore (x y z t a)
:precision binary64
(if (<= x -5e+67)
x
(if (or (<= x -5e-40) (and (not (<= x -6.6e-74)) (<= x 4e+83)))
(* y (/ (- t z) a))
x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -5e+67) {
tmp = x;
} else if ((x <= -5e-40) || (!(x <= -6.6e-74) && (x <= 4e+83))) {
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 (x <= (-5d+67)) then
tmp = x
else if ((x <= (-5d-40)) .or. (.not. (x <= (-6.6d-74))) .and. (x <= 4d+83)) 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 (x <= -5e+67) {
tmp = x;
} else if ((x <= -5e-40) || (!(x <= -6.6e-74) && (x <= 4e+83))) {
tmp = y * ((t - z) / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -5e+67: tmp = x elif (x <= -5e-40) or (not (x <= -6.6e-74) and (x <= 4e+83)): tmp = y * ((t - z) / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -5e+67) tmp = x; elseif ((x <= -5e-40) || (!(x <= -6.6e-74) && (x <= 4e+83))) 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 (x <= -5e+67) tmp = x; elseif ((x <= -5e-40) || (~((x <= -6.6e-74)) && (x <= 4e+83))) tmp = y * ((t - z) / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -5e+67], x, If[Or[LessEqual[x, -5e-40], And[N[Not[LessEqual[x, -6.6e-74]], $MachinePrecision], LessEqual[x, 4e+83]]], N[(y * N[(N[(t - z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5 \cdot 10^{+67}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq -5 \cdot 10^{-40} \lor \neg \left(x \leq -6.6 \cdot 10^{-74}\right) \land x \leq 4 \cdot 10^{+83}:\\
\;\;\;\;y \cdot \frac{t - z}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -4.99999999999999976e67 or -4.99999999999999965e-40 < x < -6.59999999999999992e-74 or 4.00000000000000012e83 < x Initial program 95.4%
associate-*l/99.1%
Simplified99.1%
Taylor expanded in x around inf 75.3%
if -4.99999999999999976e67 < x < -4.99999999999999965e-40 or -6.59999999999999992e-74 < x < 4.00000000000000012e83Initial program 94.2%
associate-/l*91.2%
Simplified91.2%
associate-/l*94.2%
clear-num94.1%
associate-/r/94.1%
Applied egg-rr94.1%
Taylor expanded in x around 0 74.5%
associate-*l/71.5%
associate-*r*71.5%
neg-mul-171.5%
neg-sub071.5%
div-sub70.0%
associate--r-70.0%
neg-sub070.0%
+-commutative70.0%
sub-neg70.0%
*-commutative70.0%
div-sub71.5%
Simplified71.5%
Final simplification73.0%
(FPCore (x y z t a)
:precision binary64
(if (<= x -8.8e+68)
x
(if (or (<= x -5.4e-40) (and (not (<= x -6.6e-74)) (<= x 7.5e+129)))
(* (/ y a) (- t z))
x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -8.8e+68) {
tmp = x;
} else if ((x <= -5.4e-40) || (!(x <= -6.6e-74) && (x <= 7.5e+129))) {
tmp = (y / a) * (t - 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 <= (-8.8d+68)) then
tmp = x
else if ((x <= (-5.4d-40)) .or. (.not. (x <= (-6.6d-74))) .and. (x <= 7.5d+129)) then
tmp = (y / a) * (t - 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 <= -8.8e+68) {
tmp = x;
} else if ((x <= -5.4e-40) || (!(x <= -6.6e-74) && (x <= 7.5e+129))) {
tmp = (y / a) * (t - z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -8.8e+68: tmp = x elif (x <= -5.4e-40) or (not (x <= -6.6e-74) and (x <= 7.5e+129)): tmp = (y / a) * (t - z) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -8.8e+68) tmp = x; elseif ((x <= -5.4e-40) || (!(x <= -6.6e-74) && (x <= 7.5e+129))) tmp = Float64(Float64(y / a) * Float64(t - z)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (x <= -8.8e+68) tmp = x; elseif ((x <= -5.4e-40) || (~((x <= -6.6e-74)) && (x <= 7.5e+129))) tmp = (y / a) * (t - z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -8.8e+68], x, If[Or[LessEqual[x, -5.4e-40], And[N[Not[LessEqual[x, -6.6e-74]], $MachinePrecision], LessEqual[x, 7.5e+129]]], N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -8.8 \cdot 10^{+68}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq -5.4 \cdot 10^{-40} \lor \neg \left(x \leq -6.6 \cdot 10^{-74}\right) \land x \leq 7.5 \cdot 10^{+129}:\\
\;\;\;\;\frac{y}{a} \cdot \left(t - z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -8.79999999999999949e68 or -5.4e-40 < x < -6.59999999999999992e-74 or 7.4999999999999998e129 < x Initial program 95.1%
associate-*l/99.1%
Simplified99.1%
Taylor expanded in x around inf 77.4%
if -8.79999999999999949e68 < x < -5.4e-40 or -6.59999999999999992e-74 < x < 7.4999999999999998e129Initial program 94.5%
associate-*l/96.2%
Simplified96.2%
Taylor expanded in x around 0 73.3%
associate-*r/69.8%
*-commutative69.8%
associate-*r*69.8%
neg-mul-169.8%
neg-sub069.8%
div-sub68.4%
associate-+l-68.4%
neg-sub068.4%
+-commutative68.4%
sub-neg68.4%
div-sub69.8%
*-rgt-identity69.8%
associate-*r/69.7%
associate-*l*75.0%
associate-*l/75.1%
associate-*r/75.1%
*-lft-identity75.1%
Simplified75.1%
Final simplification76.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -3.55e-37) (not (<= a 11000.0))) (+ x (* y (/ t a))) (* (/ y a) (- t z))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -3.55e-37) || !(a <= 11000.0)) {
tmp = x + (y * (t / a));
} else {
tmp = (y / a) * (t - z);
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((a <= (-3.55d-37)) .or. (.not. (a <= 11000.0d0))) then
tmp = x + (y * (t / a))
else
tmp = (y / a) * (t - z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -3.55e-37) || !(a <= 11000.0)) {
tmp = x + (y * (t / a));
} else {
tmp = (y / a) * (t - z);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -3.55e-37) or not (a <= 11000.0): tmp = x + (y * (t / a)) else: tmp = (y / a) * (t - z) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -3.55e-37) || !(a <= 11000.0)) tmp = Float64(x + Float64(y * Float64(t / a))); else tmp = Float64(Float64(y / a) * Float64(t - z)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -3.55e-37) || ~((a <= 11000.0))) tmp = x + (y * (t / a)); else tmp = (y / a) * (t - z); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -3.55e-37], N[Not[LessEqual[a, 11000.0]], $MachinePrecision]], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.55 \cdot 10^{-37} \lor \neg \left(a \leq 11000\right):\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a} \cdot \left(t - z\right)\\
\end{array}
\end{array}
if a < -3.54999999999999989e-37 or 11000 < a Initial program 90.9%
associate-*r/99.9%
Simplified99.9%
Taylor expanded in z around 0 83.6%
neg-mul-183.6%
distribute-neg-frac83.6%
Simplified83.6%
*-commutative83.6%
distribute-frac-neg83.6%
cancel-sign-sub83.6%
add-sqr-sqrt46.7%
sqrt-unprod66.8%
sqr-neg66.8%
sqrt-unprod27.5%
add-sqr-sqrt63.0%
*-commutative63.0%
add-sqr-sqrt27.5%
sqrt-unprod66.8%
sqr-neg66.8%
sqrt-unprod46.7%
add-sqr-sqrt83.6%
Applied egg-rr83.6%
if -3.54999999999999989e-37 < a < 11000Initial program 99.8%
associate-*l/99.0%
Simplified99.0%
Taylor expanded in x around 0 82.7%
associate-*r/68.3%
*-commutative68.3%
associate-*r*68.3%
neg-mul-168.3%
neg-sub068.3%
div-sub65.5%
associate-+l-65.5%
neg-sub065.5%
+-commutative65.5%
sub-neg65.5%
div-sub68.3%
*-rgt-identity68.3%
associate-*r/68.3%
associate-*l*82.8%
associate-*l/82.8%
associate-*r/82.8%
*-lft-identity82.8%
Simplified82.8%
Final simplification83.3%
(FPCore (x y z t a) :precision binary64 (if (<= z -9.5e+174) (* (/ y a) (- t z)) (if (<= z 2.05e+129) (+ x (/ (* y t) a)) (* z (/ (- y) a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -9.5e+174) {
tmp = (y / a) * (t - z);
} else if (z <= 2.05e+129) {
tmp = x + ((y * t) / 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 <= (-9.5d+174)) then
tmp = (y / a) * (t - z)
else if (z <= 2.05d+129) then
tmp = x + ((y * t) / 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 <= -9.5e+174) {
tmp = (y / a) * (t - z);
} else if (z <= 2.05e+129) {
tmp = x + ((y * t) / a);
} else {
tmp = z * (-y / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -9.5e+174: tmp = (y / a) * (t - z) elif z <= 2.05e+129: tmp = x + ((y * t) / a) else: tmp = z * (-y / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -9.5e+174) tmp = Float64(Float64(y / a) * Float64(t - z)); elseif (z <= 2.05e+129) tmp = Float64(x + Float64(Float64(y * t) / 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 <= -9.5e+174) tmp = (y / a) * (t - z); elseif (z <= 2.05e+129) tmp = x + ((y * t) / a); else tmp = z * (-y / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -9.5e+174], N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.05e+129], N[(x + N[(N[(y * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(z * N[((-y) / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.5 \cdot 10^{+174}:\\
\;\;\;\;\frac{y}{a} \cdot \left(t - z\right)\\
\mathbf{elif}\;z \leq 2.05 \cdot 10^{+129}:\\
\;\;\;\;x + \frac{y \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{-y}{a}\\
\end{array}
\end{array}
if z < -9.4999999999999992e174Initial program 95.8%
associate-*l/91.9%
Simplified91.9%
Taylor expanded in x around 0 87.7%
associate-*r/72.4%
*-commutative72.4%
associate-*r*72.4%
neg-mul-172.4%
neg-sub072.4%
div-sub71.8%
associate-+l-71.8%
neg-sub071.8%
+-commutative71.8%
sub-neg71.8%
div-sub72.4%
*-rgt-identity72.4%
associate-*r/72.5%
associate-*l*83.5%
associate-*l/83.7%
associate-*r/83.7%
*-lft-identity83.7%
Simplified83.7%
if -9.4999999999999992e174 < z < 2.0500000000000001e129Initial program 95.4%
sub-neg95.4%
+-commutative95.4%
distribute-neg-frac95.4%
distribute-rgt-neg-in95.4%
associate-*r/93.9%
distribute-frac-neg93.9%
fma-def93.9%
distribute-frac-neg93.9%
sub-neg93.9%
+-commutative93.9%
distribute-neg-in93.9%
unsub-neg93.9%
remove-double-neg93.9%
Simplified93.9%
Taylor expanded in z around 0 85.9%
if 2.0500000000000001e129 < z Initial program 91.0%
associate-*l/99.8%
Simplified99.8%
Taylor expanded in z around inf 65.5%
mul-1-neg65.5%
associate-*l/74.4%
distribute-rgt-neg-in74.4%
Simplified74.4%
Final simplification83.8%
(FPCore (x y z t a) :precision binary64 (if (<= z -5.5e+174) (/ (* y (- t z)) a) (if (<= z 1.35e+75) (+ x (/ (* y t) a)) (- x (/ y (/ a z))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -5.5e+174) {
tmp = (y * (t - z)) / a;
} else if (z <= 1.35e+75) {
tmp = x + ((y * t) / a);
} else {
tmp = x - (y / (a / z));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (z <= (-5.5d+174)) then
tmp = (y * (t - z)) / a
else if (z <= 1.35d+75) then
tmp = x + ((y * t) / a)
else
tmp = x - (y / (a / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -5.5e+174) {
tmp = (y * (t - z)) / a;
} else if (z <= 1.35e+75) {
tmp = x + ((y * t) / a);
} else {
tmp = x - (y / (a / z));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -5.5e+174: tmp = (y * (t - z)) / a elif z <= 1.35e+75: tmp = x + ((y * t) / a) else: tmp = x - (y / (a / z)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -5.5e+174) tmp = Float64(Float64(y * Float64(t - z)) / a); elseif (z <= 1.35e+75) tmp = Float64(x + Float64(Float64(y * t) / a)); else tmp = Float64(x - Float64(y / Float64(a / z))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -5.5e+174) tmp = (y * (t - z)) / a; elseif (z <= 1.35e+75) tmp = x + ((y * t) / a); else tmp = x - (y / (a / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -5.5e+174], N[(N[(y * N[(t - z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[z, 1.35e+75], N[(x + N[(N[(y * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(x - N[(y / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.5 \cdot 10^{+174}:\\
\;\;\;\;\frac{y \cdot \left(t - z\right)}{a}\\
\mathbf{elif}\;z \leq 1.35 \cdot 10^{+75}:\\
\;\;\;\;x + \frac{y \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y}{\frac{a}{z}}\\
\end{array}
\end{array}
if z < -5.4999999999999998e174Initial program 95.8%
sub-neg95.8%
+-commutative95.8%
distribute-neg-frac95.8%
distribute-rgt-neg-in95.8%
associate-*r/80.6%
distribute-frac-neg80.6%
fma-def80.6%
distribute-frac-neg80.6%
sub-neg80.6%
+-commutative80.6%
distribute-neg-in80.6%
unsub-neg80.6%
remove-double-neg80.6%
Simplified80.6%
Taylor expanded in y around -inf 87.7%
if -5.4999999999999998e174 < z < 1.34999999999999999e75Initial program 95.7%
sub-neg95.7%
+-commutative95.7%
distribute-neg-frac95.7%
distribute-rgt-neg-in95.7%
associate-*r/93.6%
distribute-frac-neg93.6%
fma-def93.6%
distribute-frac-neg93.6%
sub-neg93.6%
+-commutative93.6%
distribute-neg-in93.6%
unsub-neg93.6%
remove-double-neg93.6%
Simplified93.6%
Taylor expanded in z around 0 86.2%
if 1.34999999999999999e75 < z Initial program 90.8%
associate-/l*92.1%
Simplified92.1%
Taylor expanded in z around inf 90.5%
Final simplification87.2%
(FPCore (x y z t a) :precision binary64 (if (<= a -6.4e-38) x (if (<= a 1650000.0) (* t (/ y a)) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -6.4e-38) {
tmp = x;
} else if (a <= 1650000.0) {
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 (a <= (-6.4d-38)) then
tmp = x
else if (a <= 1650000.0d0) 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 (a <= -6.4e-38) {
tmp = x;
} else if (a <= 1650000.0) {
tmp = t * (y / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -6.4e-38: tmp = x elif a <= 1650000.0: tmp = t * (y / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -6.4e-38) tmp = x; elseif (a <= 1650000.0) 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 (a <= -6.4e-38) tmp = x; elseif (a <= 1650000.0) tmp = t * (y / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -6.4e-38], x, If[LessEqual[a, 1650000.0], N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -6.4 \cdot 10^{-38}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 1650000:\\
\;\;\;\;t \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -6.39999999999999955e-38 or 1.65e6 < a Initial program 90.8%
associate-*l/96.0%
Simplified96.0%
Taylor expanded in x around inf 62.5%
if -6.39999999999999955e-38 < a < 1.65e6Initial program 99.8%
associate-*l/99.0%
Simplified99.0%
Taylor expanded in t around inf 48.0%
*-commutative48.0%
associate-*r/49.7%
Simplified49.7%
Final simplification57.0%
(FPCore (x y z t a) :precision binary64 (+ x (* y (/ (- t z) a))))
double code(double x, double y, double z, double t, double a) {
return x + (y * ((t - z) / 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 * ((t - z) / a))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y * ((t - z) / a));
}
def code(x, y, z, t, a): return x + (y * ((t - z) / a))
function code(x, y, z, t, a) return Float64(x + Float64(y * Float64(Float64(t - z) / a))) end
function tmp = code(x, y, z, t, a) tmp = x + (y * ((t - z) / a)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y * N[(N[(t - z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{t - z}{a}
\end{array}
Initial program 94.7%
associate-*r/91.8%
Simplified91.8%
Final simplification91.8%
(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 94.7%
associate-*l/97.3%
Simplified97.3%
Taylor expanded in x around inf 43.3%
Final simplification43.3%
(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 2023200
(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)))