
(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 (+ (* J (log1p (expm1 (* (* l 2.0) (cos (* K 0.5)))))) U))
double code(double J, double l, double K, double U) {
return (J * log1p(expm1(((l * 2.0) * cos((K * 0.5)))))) + U;
}
public static double code(double J, double l, double K, double U) {
return (J * Math.log1p(Math.expm1(((l * 2.0) * Math.cos((K * 0.5)))))) + U;
}
def code(J, l, K, U): return (J * math.log1p(math.expm1(((l * 2.0) * math.cos((K * 0.5)))))) + U
function code(J, l, K, U) return Float64(Float64(J * log1p(expm1(Float64(Float64(l * 2.0) * cos(Float64(K * 0.5)))))) + U) end
code[J_, l_, K_, U_] := N[(N[(J * N[Log[1 + N[(Exp[N[(N[(l * 2.0), $MachinePrecision] * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
J \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\left(\ell \cdot 2\right) \cdot \cos \left(K \cdot 0.5\right)\right)\right) + U
\end{array}
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) 0.0668) (+ U (* 2.0 (* J (* l (cos (* K 0.5)))))) (+ U (* J (log1p (expm1 (* l 2.0)))))))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= 0.0668) {
tmp = U + (2.0 * (J * (l * cos((K * 0.5)))));
} else {
tmp = U + (J * log1p(expm1((l * 2.0))));
}
return tmp;
}
public static double code(double J, double l, double K, double U) {
double tmp;
if (Math.cos((K / 2.0)) <= 0.0668) {
tmp = U + (2.0 * (J * (l * Math.cos((K * 0.5)))));
} else {
tmp = U + (J * Math.log1p(Math.expm1((l * 2.0))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if math.cos((K / 2.0)) <= 0.0668: tmp = U + (2.0 * (J * (l * math.cos((K * 0.5))))) else: tmp = U + (J * math.log1p(math.expm1((l * 2.0)))) return tmp
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= 0.0668) tmp = Float64(U + Float64(2.0 * Float64(J * Float64(l * cos(Float64(K * 0.5)))))); else tmp = Float64(U + Float64(J * log1p(expm1(Float64(l * 2.0))))); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], 0.0668], N[(U + N[(2.0 * N[(J * N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[Log[1 + N[(Exp[N[(l * 2.0), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq 0.0668:\\
\;\;\;\;U + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\ell \cdot 2\right)\right)\\
\end{array}
\end{array}
(FPCore (J l K U)
:precision binary64
(let* ((t_0
(+ U (* (cos (/ K 2.0)) (* 0.3333333333333333 (* J (pow l 3.0))))))
(t_1 (+ U (* J (log1p (expm1 (* l 2.0)))))))
(if (<= l -1.02e+83)
t_0
(if (<= l -780.0)
t_1
(if (<= l 85000000000.0)
(+ U (* l (* (cos (* K 0.5)) (* J 2.0))))
(if (<= l 2.45e+97) t_1 t_0))))))
double code(double J, double l, double K, double U) {
double t_0 = U + (cos((K / 2.0)) * (0.3333333333333333 * (J * pow(l, 3.0))));
double t_1 = U + (J * log1p(expm1((l * 2.0))));
double tmp;
if (l <= -1.02e+83) {
tmp = t_0;
} else if (l <= -780.0) {
tmp = t_1;
} else if (l <= 85000000000.0) {
tmp = U + (l * (cos((K * 0.5)) * (J * 2.0)));
} else if (l <= 2.45e+97) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double J, double l, double K, double U) {
double t_0 = U + (Math.cos((K / 2.0)) * (0.3333333333333333 * (J * Math.pow(l, 3.0))));
double t_1 = U + (J * Math.log1p(Math.expm1((l * 2.0))));
double tmp;
if (l <= -1.02e+83) {
tmp = t_0;
} else if (l <= -780.0) {
tmp = t_1;
} else if (l <= 85000000000.0) {
tmp = U + (l * (Math.cos((K * 0.5)) * (J * 2.0)));
} else if (l <= 2.45e+97) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = U + (math.cos((K / 2.0)) * (0.3333333333333333 * (J * math.pow(l, 3.0)))) t_1 = U + (J * math.log1p(math.expm1((l * 2.0)))) tmp = 0 if l <= -1.02e+83: tmp = t_0 elif l <= -780.0: tmp = t_1 elif l <= 85000000000.0: tmp = U + (l * (math.cos((K * 0.5)) * (J * 2.0))) elif l <= 2.45e+97: 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(0.3333333333333333 * Float64(J * (l ^ 3.0))))) t_1 = Float64(U + Float64(J * log1p(expm1(Float64(l * 2.0))))) tmp = 0.0 if (l <= -1.02e+83) tmp = t_0; elseif (l <= -780.0) tmp = t_1; elseif (l <= 85000000000.0) tmp = Float64(U + Float64(l * Float64(cos(Float64(K * 0.5)) * Float64(J * 2.0)))); elseif (l <= 2.45e+97) tmp = t_1; else tmp = t_0; end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(0.3333333333333333 * N[(J * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(U + N[(J * N[Log[1 + N[(Exp[N[(l * 2.0), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -1.02e+83], t$95$0, If[LessEqual[l, -780.0], t$95$1, If[LessEqual[l, 85000000000.0], N[(U + N[(l * N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.45e+97], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + \cos \left(\frac{K}{2}\right) \cdot \left(0.3333333333333333 \cdot \left(J \cdot {\ell}^{3}\right)\right)\\
t_1 := U + J \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\ell \cdot 2\right)\right)\\
\mathbf{if}\;\ell \leq -1.02 \cdot 10^{+83}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq -780:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\ell \leq 85000000000:\\
\;\;\;\;U + \ell \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \left(J \cdot 2\right)\right)\\
\mathbf{elif}\;\ell \leq 2.45 \cdot 10^{+97}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
(FPCore (J l K U)
:precision binary64
(if (<= (/ K 2.0) 1.0)
(+ U (* J (log1p (expm1 (* l 2.0)))))
(+
U
(*
(* J (+ (* l 2.0) (* 0.3333333333333333 (pow l 3.0))))
(cos (/ K 2.0))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((K / 2.0) <= 1.0) {
tmp = U + (J * log1p(expm1((l * 2.0))));
} else {
tmp = U + ((J * ((l * 2.0) + (0.3333333333333333 * pow(l, 3.0)))) * cos((K / 2.0)));
}
return tmp;
}
public static double code(double J, double l, double K, double U) {
double tmp;
if ((K / 2.0) <= 1.0) {
tmp = U + (J * Math.log1p(Math.expm1((l * 2.0))));
} else {
tmp = U + ((J * ((l * 2.0) + (0.3333333333333333 * Math.pow(l, 3.0)))) * Math.cos((K / 2.0)));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (K / 2.0) <= 1.0: tmp = U + (J * math.log1p(math.expm1((l * 2.0)))) else: tmp = U + ((J * ((l * 2.0) + (0.3333333333333333 * math.pow(l, 3.0)))) * math.cos((K / 2.0))) return tmp
function code(J, l, K, U) tmp = 0.0 if (Float64(K / 2.0) <= 1.0) tmp = Float64(U + Float64(J * log1p(expm1(Float64(l * 2.0))))); else tmp = Float64(U + Float64(Float64(J * Float64(Float64(l * 2.0) + Float64(0.3333333333333333 * (l ^ 3.0)))) * cos(Float64(K / 2.0)))); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[(K / 2.0), $MachinePrecision], 1.0], N[(U + N[(J * N[Log[1 + N[(Exp[N[(l * 2.0), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(N[(J * N[(N[(l * 2.0), $MachinePrecision] + N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{K}{2} \leq 1:\\
\;\;\;\;U + J \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\ell \cdot 2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + \left(J \cdot \left(\ell \cdot 2 + 0.3333333333333333 \cdot {\ell}^{3}\right)\right) \cdot \cos \left(\frac{K}{2}\right)\\
\end{array}
\end{array}
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) 0.0668) (+ U (* 2.0 (* J (* l (cos (* K 0.5)))))) (+ U (* J (+ (* l 2.0) (* 0.3333333333333333 (pow l 3.0)))))))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= 0.0668) {
tmp = U + (2.0 * (J * (l * cos((K * 0.5)))));
} else {
tmp = U + (J * ((l * 2.0) + (0.3333333333333333 * pow(l, 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 (cos((k / 2.0d0)) <= 0.0668d0) then
tmp = u + (2.0d0 * (j * (l * cos((k * 0.5d0)))))
else
tmp = u + (j * ((l * 2.0d0) + (0.3333333333333333d0 * (l ** 3.0d0))))
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.0668) {
tmp = U + (2.0 * (J * (l * Math.cos((K * 0.5)))));
} else {
tmp = U + (J * ((l * 2.0) + (0.3333333333333333 * Math.pow(l, 3.0))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if math.cos((K / 2.0)) <= 0.0668: tmp = U + (2.0 * (J * (l * math.cos((K * 0.5))))) else: tmp = U + (J * ((l * 2.0) + (0.3333333333333333 * math.pow(l, 3.0)))) return tmp
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= 0.0668) tmp = Float64(U + Float64(2.0 * Float64(J * Float64(l * cos(Float64(K * 0.5)))))); else tmp = Float64(U + Float64(J * Float64(Float64(l * 2.0) + Float64(0.3333333333333333 * (l ^ 3.0))))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (cos((K / 2.0)) <= 0.0668) tmp = U + (2.0 * (J * (l * cos((K * 0.5))))); else tmp = U + (J * ((l * 2.0) + (0.3333333333333333 * (l ^ 3.0)))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], 0.0668], N[(U + N[(2.0 * N[(J * N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(N[(l * 2.0), $MachinePrecision] + N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq 0.0668:\\
\;\;\;\;U + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\ell \cdot 2 + 0.3333333333333333 \cdot {\ell}^{3}\right)\\
\end{array}
\end{array}
(FPCore (J l K U) :precision binary64 (if (or (<= l -1.08e+42) (not (<= l 7.3e-7))) (+ U (* 0.3333333333333333 (* J (pow l 3.0)))) (+ U (* 2.0 (* J (* l (cos (* K 0.5))))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -1.08e+42) || !(l <= 7.3e-7)) {
tmp = U + (0.3333333333333333 * (J * pow(l, 3.0)));
} else {
tmp = U + (2.0 * (J * (l * 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 <= (-1.08d+42)) .or. (.not. (l <= 7.3d-7))) then
tmp = u + (0.3333333333333333d0 * (j * (l ** 3.0d0)))
else
tmp = u + (2.0d0 * (j * (l * 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 <= -1.08e+42) || !(l <= 7.3e-7)) {
tmp = U + (0.3333333333333333 * (J * Math.pow(l, 3.0)));
} else {
tmp = U + (2.0 * (J * (l * Math.cos((K * 0.5)))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -1.08e+42) or not (l <= 7.3e-7): tmp = U + (0.3333333333333333 * (J * math.pow(l, 3.0))) else: tmp = U + (2.0 * (J * (l * math.cos((K * 0.5))))) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -1.08e+42) || !(l <= 7.3e-7)) tmp = Float64(U + Float64(0.3333333333333333 * Float64(J * (l ^ 3.0)))); else tmp = Float64(U + Float64(2.0 * Float64(J * Float64(l * cos(Float64(K * 0.5)))))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -1.08e+42) || ~((l <= 7.3e-7))) tmp = U + (0.3333333333333333 * (J * (l ^ 3.0))); else tmp = U + (2.0 * (J * (l * cos((K * 0.5))))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -1.08e+42], N[Not[LessEqual[l, 7.3e-7]], $MachinePrecision]], N[(U + N[(0.3333333333333333 * N[(J * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(2.0 * N[(J * N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.08 \cdot 10^{+42} \lor \neg \left(\ell \leq 7.3 \cdot 10^{-7}\right):\\
\;\;\;\;U + 0.3333333333333333 \cdot \left(J \cdot {\ell}^{3}\right)\\
\mathbf{else}:\\
\;\;\;\;U + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\end{array}
\end{array}
(FPCore (J l K U) :precision binary64 (if (or (<= l -8e+42) (not (<= l 7.3e-7))) (+ U (* 0.3333333333333333 (* J (pow l 3.0)))) (+ U (* l (* (cos (* K 0.5)) (* J 2.0))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -8e+42) || !(l <= 7.3e-7)) {
tmp = U + (0.3333333333333333 * (J * pow(l, 3.0)));
} else {
tmp = U + (l * (cos((K * 0.5)) * (J * 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 <= (-8d+42)) .or. (.not. (l <= 7.3d-7))) then
tmp = u + (0.3333333333333333d0 * (j * (l ** 3.0d0)))
else
tmp = u + (l * (cos((k * 0.5d0)) * (j * 2.0d0)))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -8e+42) || !(l <= 7.3e-7)) {
tmp = U + (0.3333333333333333 * (J * Math.pow(l, 3.0)));
} else {
tmp = U + (l * (Math.cos((K * 0.5)) * (J * 2.0)));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -8e+42) or not (l <= 7.3e-7): tmp = U + (0.3333333333333333 * (J * math.pow(l, 3.0))) else: tmp = U + (l * (math.cos((K * 0.5)) * (J * 2.0))) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -8e+42) || !(l <= 7.3e-7)) tmp = Float64(U + Float64(0.3333333333333333 * Float64(J * (l ^ 3.0)))); else tmp = Float64(U + Float64(l * Float64(cos(Float64(K * 0.5)) * Float64(J * 2.0)))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -8e+42) || ~((l <= 7.3e-7))) tmp = U + (0.3333333333333333 * (J * (l ^ 3.0))); else tmp = U + (l * (cos((K * 0.5)) * (J * 2.0))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -8e+42], N[Not[LessEqual[l, 7.3e-7]], $MachinePrecision]], N[(U + N[(0.3333333333333333 * N[(J * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(l * N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -8 \cdot 10^{+42} \lor \neg \left(\ell \leq 7.3 \cdot 10^{-7}\right):\\
\;\;\;\;U + 0.3333333333333333 \cdot \left(J \cdot {\ell}^{3}\right)\\
\mathbf{else}:\\
\;\;\;\;U + \ell \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \left(J \cdot 2\right)\right)\\
\end{array}
\end{array}
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (+ U (* 0.3333333333333333 (* J (pow l 3.0))))))
(if (<= l -4e+43)
t_0
(if (<= l -660.0)
(+ U (* 0.020833333333333332 (* J (pow K 4.0))))
(if (<= l 7.3e-7) (+ U (* l (* J 2.0))) t_0)))))
double code(double J, double l, double K, double U) {
double t_0 = U + (0.3333333333333333 * (J * pow(l, 3.0)));
double tmp;
if (l <= -4e+43) {
tmp = t_0;
} else if (l <= -660.0) {
tmp = U + (0.020833333333333332 * (J * pow(K, 4.0)));
} else if (l <= 7.3e-7) {
tmp = U + (l * (J * 2.0));
} 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) :: tmp
t_0 = u + (0.3333333333333333d0 * (j * (l ** 3.0d0)))
if (l <= (-4d+43)) then
tmp = t_0
else if (l <= (-660.0d0)) then
tmp = u + (0.020833333333333332d0 * (j * (k ** 4.0d0)))
else if (l <= 7.3d-7) then
tmp = u + (l * (j * 2.0d0))
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 + (0.3333333333333333 * (J * Math.pow(l, 3.0)));
double tmp;
if (l <= -4e+43) {
tmp = t_0;
} else if (l <= -660.0) {
tmp = U + (0.020833333333333332 * (J * Math.pow(K, 4.0)));
} else if (l <= 7.3e-7) {
tmp = U + (l * (J * 2.0));
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = U + (0.3333333333333333 * (J * math.pow(l, 3.0))) tmp = 0 if l <= -4e+43: tmp = t_0 elif l <= -660.0: tmp = U + (0.020833333333333332 * (J * math.pow(K, 4.0))) elif l <= 7.3e-7: tmp = U + (l * (J * 2.0)) else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64(U + Float64(0.3333333333333333 * Float64(J * (l ^ 3.0)))) tmp = 0.0 if (l <= -4e+43) tmp = t_0; elseif (l <= -660.0) tmp = Float64(U + Float64(0.020833333333333332 * Float64(J * (K ^ 4.0)))); elseif (l <= 7.3e-7) tmp = Float64(U + Float64(l * Float64(J * 2.0))); else tmp = t_0; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U + (0.3333333333333333 * (J * (l ^ 3.0))); tmp = 0.0; if (l <= -4e+43) tmp = t_0; elseif (l <= -660.0) tmp = U + (0.020833333333333332 * (J * (K ^ 4.0))); elseif (l <= 7.3e-7) tmp = U + (l * (J * 2.0)); else tmp = t_0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(0.3333333333333333 * N[(J * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -4e+43], t$95$0, If[LessEqual[l, -660.0], N[(U + N[(0.020833333333333332 * N[(J * N[Power[K, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 7.3e-7], N[(U + N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + 0.3333333333333333 \cdot \left(J \cdot {\ell}^{3}\right)\\
\mathbf{if}\;\ell \leq -4 \cdot 10^{+43}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq -660:\\
\;\;\;\;U + 0.020833333333333332 \cdot \left(J \cdot {K}^{4}\right)\\
\mathbf{elif}\;\ell \leq 7.3 \cdot 10^{-7}:\\
\;\;\;\;U + \ell \cdot \left(J \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
(FPCore (J l K U) :precision binary64 (+ U (* l (* J 2.0))))
double code(double J, double l, double K, double U) {
return U + (l * (J * 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 + (l * (j * 2.0d0))
end function
public static double code(double J, double l, double K, double U) {
return U + (l * (J * 2.0));
}
def code(J, l, K, U): return U + (l * (J * 2.0))
function code(J, l, K, U) return Float64(U + Float64(l * Float64(J * 2.0))) end
function tmp = code(J, l, K, U) tmp = U + (l * (J * 2.0)); end
code[J_, l_, K_, U_] := N[(U + N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + \ell \cdot \left(J \cdot 2\right)
\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 2023348
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))