
(FPCore (J l K U) :precision binary64 (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))
double code(double J, double l, double K, double U) {
return ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = ((j * (exp(l) - exp(-l))) * cos((k / 2.0d0))) + u
end function
public static double code(double J, double l, double K, double U) {
return ((J * (Math.exp(l) - Math.exp(-l))) * Math.cos((K / 2.0))) + U;
}
def code(J, l, K, U): return ((J * (math.exp(l) - math.exp(-l))) * math.cos((K / 2.0))) + U
function code(J, l, K, U) return Float64(Float64(Float64(J * Float64(exp(l) - exp(Float64(-l)))) * cos(Float64(K / 2.0))) + U) end
function tmp = code(J, l, K, U) tmp = ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U; end
code[J_, l_, K_, U_] := N[(N[(N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (J l K U) :precision binary64 (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))
double code(double J, double l, double K, double U) {
return ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = ((j * (exp(l) - exp(-l))) * cos((k / 2.0d0))) + u
end function
public static double code(double J, double l, double K, double U) {
return ((J * (Math.exp(l) - Math.exp(-l))) * Math.cos((K / 2.0))) + U;
}
def code(J, l, K, U): return ((J * (math.exp(l) - math.exp(-l))) * math.cos((K / 2.0))) + U
function code(J, l, K, U) return Float64(Float64(Float64(J * Float64(exp(l) - exp(Float64(-l)))) * cos(Float64(K / 2.0))) + U) end
function tmp = code(J, l, K, U) tmp = ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U; end
code[J_, l_, K_, U_] := N[(N[(N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U
\end{array}
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (- (exp l) (exp (- l)))))
(if (or (<= t_0 (- INFINITY)) (not (<= t_0 2e-8)))
(+ (* (* t_0 J) (cos (/ K 2.0))) U)
(+ U (* J (* l (* 2.0 (cos (* K 0.5)))))))))
double code(double J, double l, double K, double U) {
double t_0 = exp(l) - exp(-l);
double tmp;
if ((t_0 <= -((double) INFINITY)) || !(t_0 <= 2e-8)) {
tmp = ((t_0 * J) * cos((K / 2.0))) + U;
} else {
tmp = U + (J * (l * (2.0 * cos((K * 0.5)))));
}
return tmp;
}
public static double code(double J, double l, double K, double U) {
double t_0 = Math.exp(l) - Math.exp(-l);
double tmp;
if ((t_0 <= -Double.POSITIVE_INFINITY) || !(t_0 <= 2e-8)) {
tmp = ((t_0 * J) * Math.cos((K / 2.0))) + U;
} else {
tmp = U + (J * (l * (2.0 * Math.cos((K * 0.5)))));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.exp(l) - math.exp(-l) tmp = 0 if (t_0 <= -math.inf) or not (t_0 <= 2e-8): tmp = ((t_0 * J) * math.cos((K / 2.0))) + U else: tmp = U + (J * (l * (2.0 * math.cos((K * 0.5))))) return tmp
function code(J, l, K, U) t_0 = Float64(exp(l) - exp(Float64(-l))) tmp = 0.0 if ((t_0 <= Float64(-Inf)) || !(t_0 <= 2e-8)) tmp = Float64(Float64(Float64(t_0 * J) * cos(Float64(K / 2.0))) + U); else tmp = Float64(U + Float64(J * Float64(l * Float64(2.0 * cos(Float64(K * 0.5)))))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = exp(l) - exp(-l); tmp = 0.0; if ((t_0 <= -Inf) || ~((t_0 <= 2e-8))) tmp = ((t_0 * J) * cos((K / 2.0))) + U; else tmp = U + (J * (l * (2.0 * cos((K * 0.5))))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, (-Infinity)], N[Not[LessEqual[t$95$0, 2e-8]], $MachinePrecision]], N[(N[(N[(t$95$0 * J), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(J * N[(l * N[(2.0 * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{\ell} - e^{-\ell}\\
\mathbf{if}\;t_0 \leq -\infty \lor \neg \left(t_0 \leq 2 \cdot 10^{-8}\right):\\
\;\;\;\;\left(t_0 \cdot J\right) \cdot \cos \left(\frac{K}{2}\right) + U\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\ell \cdot \left(2 \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\end{array}
\end{array}
(FPCore (J l K U)
:precision binary64
(let* ((t_0
(+ U (* (cos (/ K 2.0)) (* (pow l 3.0) (* J 0.3333333333333333)))))
(t_1 (+ (* (- (exp l) (exp (- l))) J) U)))
(if (<= l -1.1e+121)
t_0
(if (<= l -0.165)
t_1
(if (<= l 0.0038)
(+ U (* J (* l (* 2.0 (cos (* K 0.5))))))
(if (<= l 3.25e+102) t_1 t_0))))))
double code(double J, double l, double K, double U) {
double t_0 = U + (cos((K / 2.0)) * (pow(l, 3.0) * (J * 0.3333333333333333)));
double t_1 = ((exp(l) - exp(-l)) * J) + U;
double tmp;
if (l <= -1.1e+121) {
tmp = t_0;
} else if (l <= -0.165) {
tmp = t_1;
} else if (l <= 0.0038) {
tmp = U + (J * (l * (2.0 * cos((K * 0.5)))));
} else if (l <= 3.25e+102) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = u + (cos((k / 2.0d0)) * ((l ** 3.0d0) * (j * 0.3333333333333333d0)))
t_1 = ((exp(l) - exp(-l)) * j) + u
if (l <= (-1.1d+121)) then
tmp = t_0
else if (l <= (-0.165d0)) then
tmp = t_1
else if (l <= 0.0038d0) then
tmp = u + (j * (l * (2.0d0 * cos((k * 0.5d0)))))
else if (l <= 3.25d+102) then
tmp = t_1
else
tmp = t_0
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = U + (Math.cos((K / 2.0)) * (Math.pow(l, 3.0) * (J * 0.3333333333333333)));
double t_1 = ((Math.exp(l) - Math.exp(-l)) * J) + U;
double tmp;
if (l <= -1.1e+121) {
tmp = t_0;
} else if (l <= -0.165) {
tmp = t_1;
} else if (l <= 0.0038) {
tmp = U + (J * (l * (2.0 * Math.cos((K * 0.5)))));
} else if (l <= 3.25e+102) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = U + (math.cos((K / 2.0)) * (math.pow(l, 3.0) * (J * 0.3333333333333333))) t_1 = ((math.exp(l) - math.exp(-l)) * J) + U tmp = 0 if l <= -1.1e+121: tmp = t_0 elif l <= -0.165: tmp = t_1 elif l <= 0.0038: tmp = U + (J * (l * (2.0 * math.cos((K * 0.5))))) elif l <= 3.25e+102: tmp = t_1 else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64((l ^ 3.0) * Float64(J * 0.3333333333333333)))) t_1 = Float64(Float64(Float64(exp(l) - exp(Float64(-l))) * J) + U) tmp = 0.0 if (l <= -1.1e+121) tmp = t_0; elseif (l <= -0.165) tmp = t_1; elseif (l <= 0.0038) tmp = Float64(U + Float64(J * Float64(l * Float64(2.0 * cos(Float64(K * 0.5)))))); elseif (l <= 3.25e+102) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U + (cos((K / 2.0)) * ((l ^ 3.0) * (J * 0.3333333333333333))); t_1 = ((exp(l) - exp(-l)) * J) + U; tmp = 0.0; if (l <= -1.1e+121) tmp = t_0; elseif (l <= -0.165) tmp = t_1; elseif (l <= 0.0038) tmp = U + (J * (l * (2.0 * cos((K * 0.5))))); elseif (l <= 3.25e+102) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(N[Power[l, 3.0], $MachinePrecision] * N[(J * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision] + U), $MachinePrecision]}, If[LessEqual[l, -1.1e+121], t$95$0, If[LessEqual[l, -0.165], t$95$1, If[LessEqual[l, 0.0038], N[(U + N[(J * N[(l * N[(2.0 * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 3.25e+102], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + \cos \left(\frac{K}{2}\right) \cdot \left({\ell}^{3} \cdot \left(J \cdot 0.3333333333333333\right)\right)\\
t_1 := \left(e^{\ell} - e^{-\ell}\right) \cdot J + U\\
\mathbf{if}\;\ell \leq -1.1 \cdot 10^{+121}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq -0.165:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\ell \leq 0.0038:\\
\;\;\;\;U + J \cdot \left(\ell \cdot \left(2 \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{elif}\;\ell \leq 3.25 \cdot 10^{+102}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) 0.1) (+ U (* J (* l (* 2.0 (cos (* K 0.5)))))) (+ U (* J (+ (* l 2.0) (* (pow l 3.0) 0.3333333333333333))))))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= 0.1) {
tmp = U + (J * (l * (2.0 * cos((K * 0.5)))));
} else {
tmp = U + (J * ((l * 2.0) + (pow(l, 3.0) * 0.3333333333333333)));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if (cos((k / 2.0d0)) <= 0.1d0) then
tmp = u + (j * (l * (2.0d0 * cos((k * 0.5d0)))))
else
tmp = u + (j * ((l * 2.0d0) + ((l ** 3.0d0) * 0.3333333333333333d0)))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (Math.cos((K / 2.0)) <= 0.1) {
tmp = U + (J * (l * (2.0 * Math.cos((K * 0.5)))));
} else {
tmp = U + (J * ((l * 2.0) + (Math.pow(l, 3.0) * 0.3333333333333333)));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if math.cos((K / 2.0)) <= 0.1: tmp = U + (J * (l * (2.0 * math.cos((K * 0.5))))) else: tmp = U + (J * ((l * 2.0) + (math.pow(l, 3.0) * 0.3333333333333333))) return tmp
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= 0.1) tmp = Float64(U + Float64(J * Float64(l * Float64(2.0 * cos(Float64(K * 0.5)))))); else tmp = Float64(U + Float64(J * Float64(Float64(l * 2.0) + Float64((l ^ 3.0) * 0.3333333333333333)))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (cos((K / 2.0)) <= 0.1) tmp = U + (J * (l * (2.0 * cos((K * 0.5))))); else tmp = U + (J * ((l * 2.0) + ((l ^ 3.0) * 0.3333333333333333))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], 0.1], N[(U + N[(J * N[(l * N[(2.0 * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(N[(l * 2.0), $MachinePrecision] + N[(N[Power[l, 3.0], $MachinePrecision] * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq 0.1:\\
\;\;\;\;U + J \cdot \left(\ell \cdot \left(2 \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\ell \cdot 2 + {\ell}^{3} \cdot 0.3333333333333333\right)\\
\end{array}
\end{array}
(FPCore (J l K U)
:precision binary64
(if (<= l -2.36e+204)
(+ U (* J (+ (* l 2.0) (* (* l (pow K 2.0)) -0.25))))
(if (or (<= l -0.105) (not (<= l 0.00086)))
(+ (* (- (exp l) (exp (- l))) J) U)
(+ U (* J (* l (* 2.0 (cos (* K 0.5)))))))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -2.36e+204) {
tmp = U + (J * ((l * 2.0) + ((l * pow(K, 2.0)) * -0.25)));
} else if ((l <= -0.105) || !(l <= 0.00086)) {
tmp = ((exp(l) - exp(-l)) * J) + U;
} else {
tmp = U + (J * (l * (2.0 * cos((K * 0.5)))));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if (l <= (-2.36d+204)) then
tmp = u + (j * ((l * 2.0d0) + ((l * (k ** 2.0d0)) * (-0.25d0))))
else if ((l <= (-0.105d0)) .or. (.not. (l <= 0.00086d0))) then
tmp = ((exp(l) - exp(-l)) * j) + u
else
tmp = u + (j * (l * (2.0d0 * cos((k * 0.5d0)))))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= -2.36e+204) {
tmp = U + (J * ((l * 2.0) + ((l * Math.pow(K, 2.0)) * -0.25)));
} else if ((l <= -0.105) || !(l <= 0.00086)) {
tmp = ((Math.exp(l) - Math.exp(-l)) * J) + U;
} else {
tmp = U + (J * (l * (2.0 * Math.cos((K * 0.5)))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -2.36e+204: tmp = U + (J * ((l * 2.0) + ((l * math.pow(K, 2.0)) * -0.25))) elif (l <= -0.105) or not (l <= 0.00086): tmp = ((math.exp(l) - math.exp(-l)) * J) + U else: tmp = U + (J * (l * (2.0 * math.cos((K * 0.5))))) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -2.36e+204) tmp = Float64(U + Float64(J * Float64(Float64(l * 2.0) + Float64(Float64(l * (K ^ 2.0)) * -0.25)))); elseif ((l <= -0.105) || !(l <= 0.00086)) tmp = Float64(Float64(Float64(exp(l) - exp(Float64(-l))) * J) + U); else tmp = Float64(U + Float64(J * Float64(l * Float64(2.0 * cos(Float64(K * 0.5)))))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -2.36e+204) tmp = U + (J * ((l * 2.0) + ((l * (K ^ 2.0)) * -0.25))); elseif ((l <= -0.105) || ~((l <= 0.00086))) tmp = ((exp(l) - exp(-l)) * J) + U; else tmp = U + (J * (l * (2.0 * cos((K * 0.5))))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -2.36e+204], N[(U + N[(J * N[(N[(l * 2.0), $MachinePrecision] + N[(N[(l * N[Power[K, 2.0], $MachinePrecision]), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[l, -0.105], N[Not[LessEqual[l, 0.00086]], $MachinePrecision]], N[(N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(J * N[(l * N[(2.0 * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.36 \cdot 10^{+204}:\\
\;\;\;\;U + J \cdot \left(\ell \cdot 2 + \left(\ell \cdot {K}^{2}\right) \cdot -0.25\right)\\
\mathbf{elif}\;\ell \leq -0.105 \lor \neg \left(\ell \leq 0.00086\right):\\
\;\;\;\;\left(e^{\ell} - e^{-\ell}\right) \cdot J + U\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\ell \cdot \left(2 \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\end{array}
\end{array}
(FPCore (J l K U) :precision binary64 (if (or (<= l -2.8e+157) (not (<= l -600.0))) (+ U (* J (* l (* 2.0 (cos (* K 0.5)))))) (pow U -3.0)))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -2.8e+157) || !(l <= -600.0)) {
tmp = U + (J * (l * (2.0 * cos((K * 0.5)))));
} else {
tmp = pow(U, -3.0);
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if ((l <= (-2.8d+157)) .or. (.not. (l <= (-600.0d0)))) then
tmp = u + (j * (l * (2.0d0 * cos((k * 0.5d0)))))
else
tmp = u ** (-3.0d0)
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -2.8e+157) || !(l <= -600.0)) {
tmp = U + (J * (l * (2.0 * Math.cos((K * 0.5)))));
} else {
tmp = Math.pow(U, -3.0);
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -2.8e+157) or not (l <= -600.0): tmp = U + (J * (l * (2.0 * math.cos((K * 0.5))))) else: tmp = math.pow(U, -3.0) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -2.8e+157) || !(l <= -600.0)) tmp = Float64(U + Float64(J * Float64(l * Float64(2.0 * cos(Float64(K * 0.5)))))); else tmp = U ^ -3.0; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -2.8e+157) || ~((l <= -600.0))) tmp = U + (J * (l * (2.0 * cos((K * 0.5))))); else tmp = U ^ -3.0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -2.8e+157], N[Not[LessEqual[l, -600.0]], $MachinePrecision]], N[(U + N[(J * N[(l * N[(2.0 * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Power[U, -3.0], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.8 \cdot 10^{+157} \lor \neg \left(\ell \leq -600\right):\\
\;\;\;\;U + J \cdot \left(\ell \cdot \left(2 \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;{U}^{-3}\\
\end{array}
\end{array}
(FPCore (J l K U)
:precision binary64
(if (<= l -780.0)
(pow U -3.0)
(if (or (<= l 9.2e-9) (not (<= l 3.75e+143)))
(+ U (* J (* l 2.0)))
(+ U (* J (- 8.0 (pow K 2.0)))))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -780.0) {
tmp = pow(U, -3.0);
} else if ((l <= 9.2e-9) || !(l <= 3.75e+143)) {
tmp = U + (J * (l * 2.0));
} else {
tmp = U + (J * (8.0 - pow(K, 2.0)));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if (l <= (-780.0d0)) then
tmp = u ** (-3.0d0)
else if ((l <= 9.2d-9) .or. (.not. (l <= 3.75d+143))) then
tmp = u + (j * (l * 2.0d0))
else
tmp = u + (j * (8.0d0 - (k ** 2.0d0)))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= -780.0) {
tmp = Math.pow(U, -3.0);
} else if ((l <= 9.2e-9) || !(l <= 3.75e+143)) {
tmp = U + (J * (l * 2.0));
} else {
tmp = U + (J * (8.0 - Math.pow(K, 2.0)));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -780.0: tmp = math.pow(U, -3.0) elif (l <= 9.2e-9) or not (l <= 3.75e+143): tmp = U + (J * (l * 2.0)) else: tmp = U + (J * (8.0 - math.pow(K, 2.0))) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -780.0) tmp = U ^ -3.0; elseif ((l <= 9.2e-9) || !(l <= 3.75e+143)) tmp = Float64(U + Float64(J * Float64(l * 2.0))); else tmp = Float64(U + Float64(J * Float64(8.0 - (K ^ 2.0)))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -780.0) tmp = U ^ -3.0; elseif ((l <= 9.2e-9) || ~((l <= 3.75e+143))) tmp = U + (J * (l * 2.0)); else tmp = U + (J * (8.0 - (K ^ 2.0))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -780.0], N[Power[U, -3.0], $MachinePrecision], If[Or[LessEqual[l, 9.2e-9], N[Not[LessEqual[l, 3.75e+143]], $MachinePrecision]], N[(U + N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(8.0 - N[Power[K, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -780:\\
\;\;\;\;{U}^{-3}\\
\mathbf{elif}\;\ell \leq 9.2 \cdot 10^{-9} \lor \neg \left(\ell \leq 3.75 \cdot 10^{+143}\right):\\
\;\;\;\;U + J \cdot \left(\ell \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(8 - {K}^{2}\right)\\
\end{array}
\end{array}
(FPCore (J l K U)
:precision binary64
(if (<= l -750.0)
(pow U -3.0)
(if (or (<= l 7.8e+98) (not (<= l 9e+202)))
(+ U (* J (* l 2.0)))
(pow U -4.0))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -750.0) {
tmp = pow(U, -3.0);
} else if ((l <= 7.8e+98) || !(l <= 9e+202)) {
tmp = U + (J * (l * 2.0));
} else {
tmp = pow(U, -4.0);
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if (l <= (-750.0d0)) then
tmp = u ** (-3.0d0)
else if ((l <= 7.8d+98) .or. (.not. (l <= 9d+202))) then
tmp = u + (j * (l * 2.0d0))
else
tmp = u ** (-4.0d0)
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= -750.0) {
tmp = Math.pow(U, -3.0);
} else if ((l <= 7.8e+98) || !(l <= 9e+202)) {
tmp = U + (J * (l * 2.0));
} else {
tmp = Math.pow(U, -4.0);
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -750.0: tmp = math.pow(U, -3.0) elif (l <= 7.8e+98) or not (l <= 9e+202): tmp = U + (J * (l * 2.0)) else: tmp = math.pow(U, -4.0) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -750.0) tmp = U ^ -3.0; elseif ((l <= 7.8e+98) || !(l <= 9e+202)) tmp = Float64(U + Float64(J * Float64(l * 2.0))); else tmp = U ^ -4.0; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -750.0) tmp = U ^ -3.0; elseif ((l <= 7.8e+98) || ~((l <= 9e+202))) tmp = U + (J * (l * 2.0)); else tmp = U ^ -4.0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -750.0], N[Power[U, -3.0], $MachinePrecision], If[Or[LessEqual[l, 7.8e+98], N[Not[LessEqual[l, 9e+202]], $MachinePrecision]], N[(U + N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Power[U, -4.0], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -750:\\
\;\;\;\;{U}^{-3}\\
\mathbf{elif}\;\ell \leq 7.8 \cdot 10^{+98} \lor \neg \left(\ell \leq 9 \cdot 10^{+202}\right):\\
\;\;\;\;U + J \cdot \left(\ell \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;{U}^{-4}\\
\end{array}
\end{array}
(FPCore (J l K U) :precision binary64 (+ U (* J (* l 2.0))))
double code(double J, double l, double K, double U) {
return U + (J * (l * 2.0));
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = u + (j * (l * 2.0d0))
end function
public static double code(double J, double l, double K, double U) {
return U + (J * (l * 2.0));
}
def code(J, l, K, U): return U + (J * (l * 2.0))
function code(J, l, K, U) return Float64(U + Float64(J * Float64(l * 2.0))) end
function tmp = code(J, l, K, U) tmp = U + (J * (l * 2.0)); end
code[J_, l_, K_, U_] := N[(U + N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + J \cdot \left(\ell \cdot 2\right)
\end{array}
(FPCore (J l K U) :precision binary64 (if (<= l -122000000000.0) (* U U) U))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -122000000000.0) {
tmp = U * U;
} else {
tmp = U;
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if (l <= (-122000000000.0d0)) then
tmp = u * u
else
tmp = u
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= -122000000000.0) {
tmp = U * U;
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -122000000000.0: tmp = U * U else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -122000000000.0) tmp = Float64(U * U); else tmp = U; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -122000000000.0) tmp = U * U; else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -122000000000.0], N[(U * U), $MachinePrecision], U]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -122000000000:\\
\;\;\;\;U \cdot U\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
(FPCore (J l K U) :precision binary64 U)
double code(double J, double l, double K, double U) {
return U;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = u
end function
public static double code(double J, double l, double K, double U) {
return U;
}
def code(J, l, K, U): return U
function code(J, l, K, U) return U end
function tmp = code(J, l, K, U) tmp = U; end
code[J_, l_, K_, U_] := U
\begin{array}{l}
\\
U
\end{array}
herbie shell --seed 2023350
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))