
(FPCore (x y z t a) :precision binary64 (+ x (/ (* y (- z t)) a)))
double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / a);
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + ((y * (z - t)) / a)
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / a);
}
def code(x, y, z, t, a): return x + ((y * (z - t)) / a)
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y * Float64(z - t)) / a)) end
function tmp = code(x, y, z, t, a) tmp = x + ((y * (z - t)) / a); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - t\right)}{a}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ x (/ (* y (- z t)) a)))
double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / a);
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + ((y * (z - t)) / a)
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / a);
}
def code(x, y, z, t, a): return x + ((y * (z - t)) / a)
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y * Float64(z - t)) / a)) end
function tmp = code(x, y, z, t, a) tmp = x + ((y * (z - t)) / a); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - t\right)}{a}
\end{array}
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* y (- z t))))
(if (or (<= t_1 -4e+275) (not (<= t_1 2e+285)))
(* (- z t) (/ y a))
(+ x (/ t_1 a)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = y * (z - t);
double tmp;
if ((t_1 <= -4e+275) || !(t_1 <= 2e+285)) {
tmp = (z - t) * (y / a);
} else {
tmp = x + (t_1 / 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 = y * (z - t)
if ((t_1 <= (-4d+275)) .or. (.not. (t_1 <= 2d+285))) then
tmp = (z - t) * (y / a)
else
tmp = x + (t_1 / a)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = y * (z - t);
double tmp;
if ((t_1 <= -4e+275) || !(t_1 <= 2e+285)) {
tmp = (z - t) * (y / a);
} else {
tmp = x + (t_1 / a);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = y * (z - t) tmp = 0 if (t_1 <= -4e+275) or not (t_1 <= 2e+285): tmp = (z - t) * (y / a) else: tmp = x + (t_1 / a) return tmp
function code(x, y, z, t, a) t_1 = Float64(y * Float64(z - t)) tmp = 0.0 if ((t_1 <= -4e+275) || !(t_1 <= 2e+285)) tmp = Float64(Float64(z - t) * Float64(y / a)); else tmp = Float64(x + Float64(t_1 / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = y * (z - t); tmp = 0.0; if ((t_1 <= -4e+275) || ~((t_1 <= 2e+285))) tmp = (z - t) * (y / a); else tmp = x + (t_1 / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -4e+275], N[Not[LessEqual[t$95$1, 2e+285]], $MachinePrecision]], N[(N[(z - t), $MachinePrecision] * N[(y / a), $MachinePrecision]), $MachinePrecision], N[(x + N[(t$95$1 / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(z - t\right)\\
\mathbf{if}\;t_1 \leq -4 \cdot 10^{+275} \lor \neg \left(t_1 \leq 2 \cdot 10^{+285}\right):\\
\;\;\;\;\left(z - t\right) \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{t_1}{a}\\
\end{array}
\end{array}
if (*.f64 y (-.f64 z t)) < -3.99999999999999984e275 or 2e285 < (*.f64 y (-.f64 z t)) Initial program 70.2%
Taylor expanded in x around 0 70.2%
associate-*l/96.2%
Applied egg-rr96.2%
if -3.99999999999999984e275 < (*.f64 y (-.f64 z t)) < 2e285Initial program 98.4%
Final simplification97.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* y (- z t)) a)))
(if (or (<= t_1 -2e-26) (not (<= t_1 2e+162)))
(* (- z t) (/ y a))
(+ x (/ y (/ a z))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y * (z - t)) / a;
double tmp;
if ((t_1 <= -2e-26) || !(t_1 <= 2e+162)) {
tmp = (z - t) * (y / 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) :: t_1
real(8) :: tmp
t_1 = (y * (z - t)) / a
if ((t_1 <= (-2d-26)) .or. (.not. (t_1 <= 2d+162))) then
tmp = (z - t) * (y / 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 t_1 = (y * (z - t)) / a;
double tmp;
if ((t_1 <= -2e-26) || !(t_1 <= 2e+162)) {
tmp = (z - t) * (y / a);
} else {
tmp = x + (y / (a / z));
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y * (z - t)) / a tmp = 0 if (t_1 <= -2e-26) or not (t_1 <= 2e+162): tmp = (z - t) * (y / a) else: tmp = x + (y / (a / z)) return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y * Float64(z - t)) / a) tmp = 0.0 if ((t_1 <= -2e-26) || !(t_1 <= 2e+162)) tmp = Float64(Float64(z - t) * Float64(y / a)); else tmp = Float64(x + Float64(y / Float64(a / z))); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y * (z - t)) / a; tmp = 0.0; if ((t_1 <= -2e-26) || ~((t_1 <= 2e+162))) tmp = (z - t) * (y / a); else tmp = x + (y / (a / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -2e-26], N[Not[LessEqual[t$95$1, 2e+162]], $MachinePrecision]], N[(N[(z - t), $MachinePrecision] * N[(y / a), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y \cdot \left(z - t\right)}{a}\\
\mathbf{if}\;t_1 \leq -2 \cdot 10^{-26} \lor \neg \left(t_1 \leq 2 \cdot 10^{+162}\right):\\
\;\;\;\;\left(z - t\right) \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{a}{z}}\\
\end{array}
\end{array}
if (/.f64 (*.f64 y (-.f64 z t)) a) < -2.0000000000000001e-26 or 1.9999999999999999e162 < (/.f64 (*.f64 y (-.f64 z t)) a) Initial program 87.6%
Taylor expanded in x around 0 84.2%
associate-*l/94.3%
Applied egg-rr94.3%
if -2.0000000000000001e-26 < (/.f64 (*.f64 y (-.f64 z t)) a) < 1.9999999999999999e162Initial program 97.5%
associate-*l/92.8%
div-inv92.8%
associate-*l*97.5%
Applied egg-rr97.5%
Taylor expanded in z around inf 84.3%
associate-/l*84.6%
Simplified84.6%
Final simplification89.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* y (/ (- t) a))))
(if (<= a -1.3)
x
(if (<= a -8.5e-209)
(/ (* y z) a)
(if (<= a -5e-256)
t_1
(if (<= a 0.00385) (* z (/ y a)) (if (<= a 1.12e+33) t_1 x)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = y * (-t / a);
double tmp;
if (a <= -1.3) {
tmp = x;
} else if (a <= -8.5e-209) {
tmp = (y * z) / a;
} else if (a <= -5e-256) {
tmp = t_1;
} else if (a <= 0.00385) {
tmp = z * (y / a);
} else if (a <= 1.12e+33) {
tmp = t_1;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = y * (-t / a)
if (a <= (-1.3d0)) then
tmp = x
else if (a <= (-8.5d-209)) then
tmp = (y * z) / a
else if (a <= (-5d-256)) then
tmp = t_1
else if (a <= 0.00385d0) then
tmp = z * (y / a)
else if (a <= 1.12d+33) then
tmp = t_1
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = y * (-t / a);
double tmp;
if (a <= -1.3) {
tmp = x;
} else if (a <= -8.5e-209) {
tmp = (y * z) / a;
} else if (a <= -5e-256) {
tmp = t_1;
} else if (a <= 0.00385) {
tmp = z * (y / a);
} else if (a <= 1.12e+33) {
tmp = t_1;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = y * (-t / a) tmp = 0 if a <= -1.3: tmp = x elif a <= -8.5e-209: tmp = (y * z) / a elif a <= -5e-256: tmp = t_1 elif a <= 0.00385: tmp = z * (y / a) elif a <= 1.12e+33: tmp = t_1 else: tmp = x return tmp
function code(x, y, z, t, a) t_1 = Float64(y * Float64(Float64(-t) / a)) tmp = 0.0 if (a <= -1.3) tmp = x; elseif (a <= -8.5e-209) tmp = Float64(Float64(y * z) / a); elseif (a <= -5e-256) tmp = t_1; elseif (a <= 0.00385) tmp = Float64(z * Float64(y / a)); elseif (a <= 1.12e+33) tmp = t_1; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = y * (-t / a); tmp = 0.0; if (a <= -1.3) tmp = x; elseif (a <= -8.5e-209) tmp = (y * z) / a; elseif (a <= -5e-256) tmp = t_1; elseif (a <= 0.00385) tmp = z * (y / a); elseif (a <= 1.12e+33) tmp = t_1; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[((-t) / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -1.3], x, If[LessEqual[a, -8.5e-209], N[(N[(y * z), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[a, -5e-256], t$95$1, If[LessEqual[a, 0.00385], N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 1.12e+33], t$95$1, x]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{-t}{a}\\
\mathbf{if}\;a \leq -1.3:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq -8.5 \cdot 10^{-209}:\\
\;\;\;\;\frac{y \cdot z}{a}\\
\mathbf{elif}\;a \leq -5 \cdot 10^{-256}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;a \leq 0.00385:\\
\;\;\;\;z \cdot \frac{y}{a}\\
\mathbf{elif}\;a \leq 1.12 \cdot 10^{+33}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -1.30000000000000004 or 1.12e33 < a Initial program 85.3%
Taylor expanded in x around inf 63.6%
if -1.30000000000000004 < a < -8.5e-209Initial program 99.8%
Taylor expanded in x around 0 80.7%
Taylor expanded in z around inf 53.6%
if -8.5e-209 < a < -5e-256 or 0.0038500000000000001 < a < 1.12e33Initial program 99.9%
Taylor expanded in x around 0 91.7%
Taylor expanded in z around 0 78.5%
mul-1-neg78.5%
associate-*l/74.4%
distribute-rgt-neg-in74.4%
Simplified74.4%
if -5e-256 < a < 0.0038500000000000001Initial program 96.0%
Taylor expanded in x around 0 78.9%
Taylor expanded in z around inf 55.1%
associate-*l/56.9%
*-commutative56.9%
Simplified56.9%
Final simplification60.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* t (/ (- y) a))))
(if (<= a -15.0)
x
(if (<= a -8e-208)
(/ (* y z) a)
(if (<= a -2.1e-260)
t_1
(if (<= a 0.0045) (* z (/ y a)) (if (<= a 1.25e+33) t_1 x)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = t * (-y / a);
double tmp;
if (a <= -15.0) {
tmp = x;
} else if (a <= -8e-208) {
tmp = (y * z) / a;
} else if (a <= -2.1e-260) {
tmp = t_1;
} else if (a <= 0.0045) {
tmp = z * (y / a);
} else if (a <= 1.25e+33) {
tmp = t_1;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = t * (-y / a)
if (a <= (-15.0d0)) then
tmp = x
else if (a <= (-8d-208)) then
tmp = (y * z) / a
else if (a <= (-2.1d-260)) then
tmp = t_1
else if (a <= 0.0045d0) then
tmp = z * (y / a)
else if (a <= 1.25d+33) then
tmp = t_1
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = t * (-y / a);
double tmp;
if (a <= -15.0) {
tmp = x;
} else if (a <= -8e-208) {
tmp = (y * z) / a;
} else if (a <= -2.1e-260) {
tmp = t_1;
} else if (a <= 0.0045) {
tmp = z * (y / a);
} else if (a <= 1.25e+33) {
tmp = t_1;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = t * (-y / a) tmp = 0 if a <= -15.0: tmp = x elif a <= -8e-208: tmp = (y * z) / a elif a <= -2.1e-260: tmp = t_1 elif a <= 0.0045: tmp = z * (y / a) elif a <= 1.25e+33: tmp = t_1 else: tmp = x return tmp
function code(x, y, z, t, a) t_1 = Float64(t * Float64(Float64(-y) / a)) tmp = 0.0 if (a <= -15.0) tmp = x; elseif (a <= -8e-208) tmp = Float64(Float64(y * z) / a); elseif (a <= -2.1e-260) tmp = t_1; elseif (a <= 0.0045) tmp = Float64(z * Float64(y / a)); elseif (a <= 1.25e+33) tmp = t_1; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = t * (-y / a); tmp = 0.0; if (a <= -15.0) tmp = x; elseif (a <= -8e-208) tmp = (y * z) / a; elseif (a <= -2.1e-260) tmp = t_1; elseif (a <= 0.0045) tmp = z * (y / a); elseif (a <= 1.25e+33) tmp = t_1; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t * N[((-y) / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -15.0], x, If[LessEqual[a, -8e-208], N[(N[(y * z), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[a, -2.1e-260], t$95$1, If[LessEqual[a, 0.0045], N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 1.25e+33], t$95$1, x]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \frac{-y}{a}\\
\mathbf{if}\;a \leq -15:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq -8 \cdot 10^{-208}:\\
\;\;\;\;\frac{y \cdot z}{a}\\
\mathbf{elif}\;a \leq -2.1 \cdot 10^{-260}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;a \leq 0.0045:\\
\;\;\;\;z \cdot \frac{y}{a}\\
\mathbf{elif}\;a \leq 1.25 \cdot 10^{+33}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -15 or 1.24999999999999993e33 < a Initial program 85.3%
Taylor expanded in x around inf 63.6%
if -15 < a < -8.0000000000000008e-208Initial program 99.8%
Taylor expanded in x around 0 80.7%
Taylor expanded in z around inf 53.6%
if -8.0000000000000008e-208 < a < -2.10000000000000005e-260 or 0.00449999999999999966 < a < 1.24999999999999993e33Initial program 99.9%
Taylor expanded in z around 0 86.9%
mul-1-neg86.9%
associate-*l/82.6%
unsub-neg82.6%
associate-*l/86.9%
*-commutative86.9%
associate-/l*82.6%
Simplified82.6%
associate-/r/87.0%
Applied egg-rr87.0%
Taylor expanded in x around 0 78.5%
associate-*r/78.6%
associate-*l*78.6%
neg-mul-178.6%
*-commutative78.6%
Simplified78.6%
if -2.10000000000000005e-260 < a < 0.00449999999999999966Initial program 96.0%
Taylor expanded in x around 0 78.9%
Taylor expanded in z around inf 55.1%
associate-*l/56.9%
*-commutative56.9%
Simplified56.9%
Final simplification61.1%
(FPCore (x y z t a)
:precision binary64
(if (or (<= a -7e-38)
(not (or (<= a 1.95e-75) (and (not (<= a 1.6e-20)) (<= a 5.5e+31)))))
(+ x (* z (/ y a)))
(* (- z t) (/ y a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -7e-38) || !((a <= 1.95e-75) || (!(a <= 1.6e-20) && (a <= 5.5e+31)))) {
tmp = x + (z * (y / 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 <= (-7d-38)) .or. (.not. (a <= 1.95d-75) .or. (.not. (a <= 1.6d-20)) .and. (a <= 5.5d+31))) then
tmp = x + (z * (y / 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 <= -7e-38) || !((a <= 1.95e-75) || (!(a <= 1.6e-20) && (a <= 5.5e+31)))) {
tmp = x + (z * (y / a));
} else {
tmp = (z - t) * (y / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -7e-38) or not ((a <= 1.95e-75) or (not (a <= 1.6e-20) and (a <= 5.5e+31))): tmp = x + (z * (y / a)) else: tmp = (z - t) * (y / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -7e-38) || !((a <= 1.95e-75) || (!(a <= 1.6e-20) && (a <= 5.5e+31)))) tmp = Float64(x + Float64(z * Float64(y / a))); else tmp = Float64(Float64(z - t) * Float64(y / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -7e-38) || ~(((a <= 1.95e-75) || (~((a <= 1.6e-20)) && (a <= 5.5e+31))))) tmp = x + (z * (y / a)); else tmp = (z - t) * (y / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -7e-38], N[Not[Or[LessEqual[a, 1.95e-75], And[N[Not[LessEqual[a, 1.6e-20]], $MachinePrecision], LessEqual[a, 5.5e+31]]]], $MachinePrecision]], N[(x + N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z - t), $MachinePrecision] * N[(y / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -7 \cdot 10^{-38} \lor \neg \left(a \leq 1.95 \cdot 10^{-75} \lor \neg \left(a \leq 1.6 \cdot 10^{-20}\right) \land a \leq 5.5 \cdot 10^{+31}\right):\\
\;\;\;\;x + z \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\left(z - t\right) \cdot \frac{y}{a}\\
\end{array}
\end{array}
if a < -7.0000000000000003e-38 or 1.9500000000000001e-75 < a < 1.59999999999999985e-20 or 5.50000000000000002e31 < a Initial program 87.9%
Taylor expanded in z around inf 76.4%
associate-*l/21.0%
*-commutative21.0%
Simplified79.6%
if -7.0000000000000003e-38 < a < 1.9500000000000001e-75 or 1.59999999999999985e-20 < a < 5.50000000000000002e31Initial program 97.4%
Taylor expanded in x around 0 87.2%
associate-*l/88.2%
Applied egg-rr88.2%
Final simplification83.7%
(FPCore (x y z t a)
:precision binary64
(if (<= a -1.35e+184)
x
(if (or (<= a -4.8e+151) (and (not (<= a -25.0)) (<= a 1.15e+43)))
(* (- z t) (/ y a))
x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.35e+184) {
tmp = x;
} else if ((a <= -4.8e+151) || (!(a <= -25.0) && (a <= 1.15e+43))) {
tmp = (z - 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 <= (-1.35d+184)) then
tmp = x
else if ((a <= (-4.8d+151)) .or. (.not. (a <= (-25.0d0))) .and. (a <= 1.15d+43)) then
tmp = (z - 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 <= -1.35e+184) {
tmp = x;
} else if ((a <= -4.8e+151) || (!(a <= -25.0) && (a <= 1.15e+43))) {
tmp = (z - t) * (y / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -1.35e+184: tmp = x elif (a <= -4.8e+151) or (not (a <= -25.0) and (a <= 1.15e+43)): tmp = (z - t) * (y / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -1.35e+184) tmp = x; elseif ((a <= -4.8e+151) || (!(a <= -25.0) && (a <= 1.15e+43))) tmp = Float64(Float64(z - 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 <= -1.35e+184) tmp = x; elseif ((a <= -4.8e+151) || (~((a <= -25.0)) && (a <= 1.15e+43))) tmp = (z - t) * (y / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -1.35e+184], x, If[Or[LessEqual[a, -4.8e+151], And[N[Not[LessEqual[a, -25.0]], $MachinePrecision], LessEqual[a, 1.15e+43]]], N[(N[(z - t), $MachinePrecision] * N[(y / a), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.35 \cdot 10^{+184}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq -4.8 \cdot 10^{+151} \lor \neg \left(a \leq -25\right) \land a \leq 1.15 \cdot 10^{+43}:\\
\;\;\;\;\left(z - t\right) \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -1.35e184 or -4.8000000000000002e151 < a < -25 or 1.1500000000000001e43 < a Initial program 87.3%
Taylor expanded in x around inf 67.7%
if -1.35e184 < a < -4.8000000000000002e151 or -25 < a < 1.1500000000000001e43Initial program 95.6%
Taylor expanded in x around 0 78.2%
associate-*l/81.3%
Applied egg-rr81.3%
Final simplification76.1%
(FPCore (x y z t a) :precision binary64 (if (<= a -3e-11) (+ x (* y (* (/ 1.0 a) (- z t)))) (+ x (/ (- z t) (/ a y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -3e-11) {
tmp = x + (y * ((1.0 / a) * (z - t)));
} else {
tmp = x + ((z - t) / (a / y));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (a <= (-3d-11)) then
tmp = x + (y * ((1.0d0 / a) * (z - t)))
else
tmp = x + ((z - t) / (a / y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -3e-11) {
tmp = x + (y * ((1.0 / a) * (z - t)));
} else {
tmp = x + ((z - t) / (a / y));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -3e-11: tmp = x + (y * ((1.0 / a) * (z - t))) else: tmp = x + ((z - t) / (a / y)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -3e-11) tmp = Float64(x + Float64(y * Float64(Float64(1.0 / a) * Float64(z - t)))); else tmp = Float64(x + Float64(Float64(z - t) / Float64(a / y))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -3e-11) tmp = x + (y * ((1.0 / a) * (z - t))); else tmp = x + ((z - t) / (a / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -3e-11], N[(x + N[(y * N[(N[(1.0 / a), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(z - t), $MachinePrecision] / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3 \cdot 10^{-11}:\\
\;\;\;\;x + y \cdot \left(\frac{1}{a} \cdot \left(z - t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z - t}{\frac{a}{y}}\\
\end{array}
\end{array}
if a < -3e-11Initial program 86.9%
associate-*l/93.6%
div-inv93.6%
associate-*l*99.9%
Applied egg-rr99.9%
if -3e-11 < a Initial program 94.3%
*-commutative94.3%
associate-/l*96.6%
Simplified96.6%
Final simplification97.4%
(FPCore (x y z t a) :precision binary64 (if (<= a -0.0275) x (if (<= a 0.065) (* z (/ y a)) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -0.0275) {
tmp = x;
} else if (a <= 0.065) {
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 <= (-0.0275d0)) then
tmp = x
else if (a <= 0.065d0) 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 <= -0.0275) {
tmp = x;
} else if (a <= 0.065) {
tmp = z * (y / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -0.0275: tmp = x elif a <= 0.065: tmp = z * (y / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -0.0275) tmp = x; elseif (a <= 0.065) tmp = Float64(z * Float64(y / a)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -0.0275) tmp = x; elseif (a <= 0.065) tmp = z * (y / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -0.0275], x, If[LessEqual[a, 0.065], N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -0.0275:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 0.065:\\
\;\;\;\;z \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -0.0275000000000000001 or 0.065000000000000002 < a Initial program 86.5%
Taylor expanded in x around inf 60.2%
if -0.0275000000000000001 < a < 0.065000000000000002Initial program 97.6%
Taylor expanded in x around 0 81.5%
Taylor expanded in z around inf 51.0%
associate-*l/51.3%
*-commutative51.3%
Simplified51.3%
Final simplification55.5%
(FPCore (x y z t a) :precision binary64 (if (<= a -1.9) x (if (<= a 0.052) (/ z (/ a y)) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.9) {
tmp = x;
} else if (a <= 0.052) {
tmp = z / (a / y);
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (a <= (-1.9d0)) then
tmp = x
else if (a <= 0.052d0) then
tmp = z / (a / y)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.9) {
tmp = x;
} else if (a <= 0.052) {
tmp = z / (a / y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -1.9: tmp = x elif a <= 0.052: tmp = z / (a / y) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -1.9) tmp = x; elseif (a <= 0.052) tmp = Float64(z / Float64(a / y)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -1.9) tmp = x; elseif (a <= 0.052) tmp = z / (a / y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -1.9], x, If[LessEqual[a, 0.052], N[(z / N[(a / y), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.9:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 0.052:\\
\;\;\;\;\frac{z}{\frac{a}{y}}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -1.8999999999999999 or 0.0519999999999999976 < a Initial program 86.5%
Taylor expanded in x around inf 60.2%
if -1.8999999999999999 < a < 0.0519999999999999976Initial program 97.6%
Taylor expanded in x around 0 81.5%
Taylor expanded in z around inf 51.0%
associate-*l/51.3%
*-commutative51.3%
Simplified51.3%
clear-num51.3%
un-div-inv51.6%
Applied egg-rr51.6%
Final simplification55.6%
(FPCore (x y z t a) :precision binary64 (+ x (/ (- z t) (/ a y))))
double code(double x, double y, double z, double t, double a) {
return x + ((z - t) / (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) / (a / y))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((z - t) / (a / y));
}
def code(x, y, z, t, a): return x + ((z - t) / (a / y))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(z - t) / Float64(a / y))) end
function tmp = code(x, y, z, t, a) tmp = x + ((z - t) / (a / y)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(z - t), $MachinePrecision] / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{z - t}{\frac{a}{y}}
\end{array}
Initial program 92.4%
*-commutative92.4%
associate-/l*95.8%
Simplified95.8%
Final simplification95.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 92.4%
Taylor expanded in x around inf 37.5%
Final simplification37.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 2023318
(FPCore (x y z t a)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, E"
: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)))