
(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 14 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 0.0002)))
(+ (* (cos (/ K 2.0)) (* t_0 J)) U)
(+
U
(*
(+
(* 0.3333333333333333 (pow l 3.0))
(+ (* 0.016666666666666666 (pow l 5.0)) (* l 2.0)))
(* J (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 <= 0.0002)) {
tmp = (cos((K / 2.0)) * (t_0 * J)) + U;
} else {
tmp = U + (((0.3333333333333333 * pow(l, 3.0)) + ((0.016666666666666666 * pow(l, 5.0)) + (l * 2.0))) * (J * 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 <= 0.0002)) {
tmp = (Math.cos((K / 2.0)) * (t_0 * J)) + U;
} else {
tmp = U + (((0.3333333333333333 * Math.pow(l, 3.0)) + ((0.016666666666666666 * Math.pow(l, 5.0)) + (l * 2.0))) * (J * 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 <= 0.0002): tmp = (math.cos((K / 2.0)) * (t_0 * J)) + U else: tmp = U + (((0.3333333333333333 * math.pow(l, 3.0)) + ((0.016666666666666666 * math.pow(l, 5.0)) + (l * 2.0))) * (J * 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 <= 0.0002)) tmp = Float64(Float64(cos(Float64(K / 2.0)) * Float64(t_0 * J)) + U); else tmp = Float64(U + Float64(Float64(Float64(0.3333333333333333 * (l ^ 3.0)) + Float64(Float64(0.016666666666666666 * (l ^ 5.0)) + Float64(l * 2.0))) * Float64(J * 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 <= 0.0002))) tmp = (cos((K / 2.0)) * (t_0 * J)) + U; else tmp = U + (((0.3333333333333333 * (l ^ 3.0)) + ((0.016666666666666666 * (l ^ 5.0)) + (l * 2.0))) * (J * 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, 0.0002]], $MachinePrecision]], N[(N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 * J), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(N[(N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision] + N[(N[(0.016666666666666666 * N[Power[l, 5.0], $MachinePrecision]), $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(J * N[Cos[N[(K * 0.5), $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 0.0002\right):\\
\;\;\;\;\cos \left(\frac{K}{2}\right) \cdot \left(t_0 \cdot J\right) + U\\
\mathbf{else}:\\
\;\;\;\;U + \left(0.3333333333333333 \cdot {\ell}^{3} + \left(0.016666666666666666 \cdot {\ell}^{5} + \ell \cdot 2\right)\right) \cdot \left(J \cdot \cos \left(K \cdot 0.5\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -inf.0 or 2.0000000000000001e-4 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 100.0%
if -inf.0 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 2.0000000000000001e-4Initial program 72.1%
Taylor expanded in l around 0 99.8%
Taylor expanded in J around 0 99.9%
Final simplification99.9%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))) (t_1 (- (exp l) (exp (- l)))))
(if (or (<= t_1 (- INFINITY)) (not (<= t_1 0.0002)))
(+ (* t_0 (* t_1 J)) U)
(+
U
(*
t_0
(*
J
(+
(* 0.3333333333333333 (pow l 3.0))
(+ (* 0.016666666666666666 (pow l 5.0)) (* l 2.0)))))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double t_1 = exp(l) - exp(-l);
double tmp;
if ((t_1 <= -((double) INFINITY)) || !(t_1 <= 0.0002)) {
tmp = (t_0 * (t_1 * J)) + U;
} else {
tmp = U + (t_0 * (J * ((0.3333333333333333 * pow(l, 3.0)) + ((0.016666666666666666 * pow(l, 5.0)) + (l * 2.0)))));
}
return tmp;
}
public static double code(double J, double l, double K, double U) {
double t_0 = Math.cos((K / 2.0));
double t_1 = Math.exp(l) - Math.exp(-l);
double tmp;
if ((t_1 <= -Double.POSITIVE_INFINITY) || !(t_1 <= 0.0002)) {
tmp = (t_0 * (t_1 * J)) + U;
} else {
tmp = U + (t_0 * (J * ((0.3333333333333333 * Math.pow(l, 3.0)) + ((0.016666666666666666 * Math.pow(l, 5.0)) + (l * 2.0)))));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) t_1 = math.exp(l) - math.exp(-l) tmp = 0 if (t_1 <= -math.inf) or not (t_1 <= 0.0002): tmp = (t_0 * (t_1 * J)) + U else: tmp = U + (t_0 * (J * ((0.3333333333333333 * math.pow(l, 3.0)) + ((0.016666666666666666 * math.pow(l, 5.0)) + (l * 2.0))))) return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(exp(l) - exp(Float64(-l))) tmp = 0.0 if ((t_1 <= Float64(-Inf)) || !(t_1 <= 0.0002)) tmp = Float64(Float64(t_0 * Float64(t_1 * J)) + U); else tmp = Float64(U + Float64(t_0 * Float64(J * Float64(Float64(0.3333333333333333 * (l ^ 3.0)) + Float64(Float64(0.016666666666666666 * (l ^ 5.0)) + Float64(l * 2.0)))))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K / 2.0)); t_1 = exp(l) - exp(-l); tmp = 0.0; if ((t_1 <= -Inf) || ~((t_1 <= 0.0002))) tmp = (t_0 * (t_1 * J)) + U; else tmp = U + (t_0 * (J * ((0.3333333333333333 * (l ^ 3.0)) + ((0.016666666666666666 * (l ^ 5.0)) + (l * 2.0))))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 0.0002]], $MachinePrecision]], N[(N[(t$95$0 * N[(t$95$1 * J), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(t$95$0 * N[(J * N[(N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision] + N[(N[(0.016666666666666666 * N[Power[l, 5.0], $MachinePrecision]), $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := e^{\ell} - e^{-\ell}\\
\mathbf{if}\;t_1 \leq -\infty \lor \neg \left(t_1 \leq 0.0002\right):\\
\;\;\;\;t_0 \cdot \left(t_1 \cdot J\right) + U\\
\mathbf{else}:\\
\;\;\;\;U + t_0 \cdot \left(J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \left(0.016666666666666666 \cdot {\ell}^{5} + \ell \cdot 2\right)\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -inf.0 or 2.0000000000000001e-4 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 100.0%
if -inf.0 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 2.0000000000000001e-4Initial program 72.1%
Taylor expanded in l around 0 99.8%
Final simplification99.9%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (- (exp l) (exp (- l)))))
(if (or (<= t_0 -0.005) (not (<= t_0 0.0002)))
(+ (* (cos (/ K 2.0)) (* t_0 J)) U)
(+
U
(*
J
(* (cos (* K 0.5)) (fma 0.3333333333333333 (pow l 3.0) (* l 2.0))))))))
double code(double J, double l, double K, double U) {
double t_0 = exp(l) - exp(-l);
double tmp;
if ((t_0 <= -0.005) || !(t_0 <= 0.0002)) {
tmp = (cos((K / 2.0)) * (t_0 * J)) + U;
} else {
tmp = U + (J * (cos((K * 0.5)) * fma(0.3333333333333333, pow(l, 3.0), (l * 2.0))));
}
return tmp;
}
function code(J, l, K, U) t_0 = Float64(exp(l) - exp(Float64(-l))) tmp = 0.0 if ((t_0 <= -0.005) || !(t_0 <= 0.0002)) tmp = Float64(Float64(cos(Float64(K / 2.0)) * Float64(t_0 * J)) + U); else tmp = Float64(U + Float64(J * Float64(cos(Float64(K * 0.5)) * fma(0.3333333333333333, (l ^ 3.0), Float64(l * 2.0))))); end return 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, -0.005], N[Not[LessEqual[t$95$0, 0.0002]], $MachinePrecision]], N[(N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 * J), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(J * N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{\ell} - e^{-\ell}\\
\mathbf{if}\;t_0 \leq -0.005 \lor \neg \left(t_0 \leq 0.0002\right):\\
\;\;\;\;\cos \left(\frac{K}{2}\right) \cdot \left(t_0 \cdot J\right) + U\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \mathsf{fma}\left(0.3333333333333333, {\ell}^{3}, \ell \cdot 2\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -0.0050000000000000001 or 2.0000000000000001e-4 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 99.9%
if -0.0050000000000000001 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 2.0000000000000001e-4Initial program 72.0%
Taylor expanded in l around 0 99.9%
associate-*r*99.9%
associate-*r*99.9%
associate-*r*99.9%
associate-*r*99.9%
distribute-rgt-out99.9%
*-commutative99.9%
associate-*r*99.9%
*-commutative99.9%
associate-*r*99.9%
distribute-rgt-out99.9%
+-commutative99.9%
fma-def99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))) (t_1 (- (exp l) (exp (- l)))))
(if (or (<= t_1 -0.005) (not (<= t_1 0.0002)))
(+ (* t_0 (* t_1 J)) U)
(+ U (* t_0 (* J (+ (* 0.3333333333333333 (pow l 3.0)) (* l 2.0))))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double t_1 = exp(l) - exp(-l);
double tmp;
if ((t_1 <= -0.005) || !(t_1 <= 0.0002)) {
tmp = (t_0 * (t_1 * J)) + U;
} else {
tmp = U + (t_0 * (J * ((0.3333333333333333 * pow(l, 3.0)) + (l * 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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = cos((k / 2.0d0))
t_1 = exp(l) - exp(-l)
if ((t_1 <= (-0.005d0)) .or. (.not. (t_1 <= 0.0002d0))) then
tmp = (t_0 * (t_1 * j)) + u
else
tmp = u + (t_0 * (j * ((0.3333333333333333d0 * (l ** 3.0d0)) + (l * 2.0d0))))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = Math.cos((K / 2.0));
double t_1 = Math.exp(l) - Math.exp(-l);
double tmp;
if ((t_1 <= -0.005) || !(t_1 <= 0.0002)) {
tmp = (t_0 * (t_1 * J)) + U;
} else {
tmp = U + (t_0 * (J * ((0.3333333333333333 * Math.pow(l, 3.0)) + (l * 2.0))));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) t_1 = math.exp(l) - math.exp(-l) tmp = 0 if (t_1 <= -0.005) or not (t_1 <= 0.0002): tmp = (t_0 * (t_1 * J)) + U else: tmp = U + (t_0 * (J * ((0.3333333333333333 * math.pow(l, 3.0)) + (l * 2.0)))) return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(exp(l) - exp(Float64(-l))) tmp = 0.0 if ((t_1 <= -0.005) || !(t_1 <= 0.0002)) tmp = Float64(Float64(t_0 * Float64(t_1 * J)) + U); else tmp = Float64(U + Float64(t_0 * Float64(J * Float64(Float64(0.3333333333333333 * (l ^ 3.0)) + Float64(l * 2.0))))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K / 2.0)); t_1 = exp(l) - exp(-l); tmp = 0.0; if ((t_1 <= -0.005) || ~((t_1 <= 0.0002))) tmp = (t_0 * (t_1 * J)) + U; else tmp = U + (t_0 * (J * ((0.3333333333333333 * (l ^ 3.0)) + (l * 2.0)))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -0.005], N[Not[LessEqual[t$95$1, 0.0002]], $MachinePrecision]], N[(N[(t$95$0 * N[(t$95$1 * J), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(t$95$0 * N[(J * N[(N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := e^{\ell} - e^{-\ell}\\
\mathbf{if}\;t_1 \leq -0.005 \lor \neg \left(t_1 \leq 0.0002\right):\\
\;\;\;\;t_0 \cdot \left(t_1 \cdot J\right) + U\\
\mathbf{else}:\\
\;\;\;\;U + t_0 \cdot \left(J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -0.0050000000000000001 or 2.0000000000000001e-4 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 99.9%
if -0.0050000000000000001 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 2.0000000000000001e-4Initial program 72.0%
Taylor expanded in l around 0 99.9%
Final simplification99.9%
(FPCore (J l K U)
:precision binary64
(if (or (<= l -8.5e+78)
(not (or (<= l -0.23) (and (not (<= l 31000000.0)) (<= l 6.6e+88)))))
(+
U
(* (cos (/ K 2.0)) (* J (+ (* 0.3333333333333333 (pow l 3.0)) (* l 2.0)))))
(+ U (* (- (exp l) (exp (- l))) J))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -8.5e+78) || !((l <= -0.23) || (!(l <= 31000000.0) && (l <= 6.6e+88)))) {
tmp = U + (cos((K / 2.0)) * (J * ((0.3333333333333333 * pow(l, 3.0)) + (l * 2.0))));
} else {
tmp = U + ((exp(l) - exp(-l)) * J);
}
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 <= (-8.5d+78)) .or. (.not. (l <= (-0.23d0)) .or. (.not. (l <= 31000000.0d0)) .and. (l <= 6.6d+88))) then
tmp = u + (cos((k / 2.0d0)) * (j * ((0.3333333333333333d0 * (l ** 3.0d0)) + (l * 2.0d0))))
else
tmp = u + ((exp(l) - exp(-l)) * j)
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -8.5e+78) || !((l <= -0.23) || (!(l <= 31000000.0) && (l <= 6.6e+88)))) {
tmp = U + (Math.cos((K / 2.0)) * (J * ((0.3333333333333333 * Math.pow(l, 3.0)) + (l * 2.0))));
} else {
tmp = U + ((Math.exp(l) - Math.exp(-l)) * J);
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -8.5e+78) or not ((l <= -0.23) or (not (l <= 31000000.0) and (l <= 6.6e+88))): tmp = U + (math.cos((K / 2.0)) * (J * ((0.3333333333333333 * math.pow(l, 3.0)) + (l * 2.0)))) else: tmp = U + ((math.exp(l) - math.exp(-l)) * J) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -8.5e+78) || !((l <= -0.23) || (!(l <= 31000000.0) && (l <= 6.6e+88)))) tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(Float64(0.3333333333333333 * (l ^ 3.0)) + Float64(l * 2.0))))); else tmp = Float64(U + Float64(Float64(exp(l) - exp(Float64(-l))) * J)); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -8.5e+78) || ~(((l <= -0.23) || (~((l <= 31000000.0)) && (l <= 6.6e+88))))) tmp = U + (cos((K / 2.0)) * (J * ((0.3333333333333333 * (l ^ 3.0)) + (l * 2.0)))); else tmp = U + ((exp(l) - exp(-l)) * J); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -8.5e+78], N[Not[Or[LessEqual[l, -0.23], And[N[Not[LessEqual[l, 31000000.0]], $MachinePrecision], LessEqual[l, 6.6e+88]]]], $MachinePrecision]], N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[(N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -8.5 \cdot 10^{+78} \lor \neg \left(\ell \leq -0.23 \lor \neg \left(\ell \leq 31000000\right) \land \ell \leq 6.6 \cdot 10^{+88}\right):\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + \left(e^{\ell} - e^{-\ell}\right) \cdot J\\
\end{array}
\end{array}
if l < -8.50000000000000079e78 or -0.23000000000000001 < l < 3.1e7 or 6.6000000000000006e88 < l Initial program 84.6%
Taylor expanded in l around 0 98.6%
if -8.50000000000000079e78 < l < -0.23000000000000001 or 3.1e7 < l < 6.6000000000000006e88Initial program 100.0%
Taylor expanded in K around 0 75.9%
Final simplification96.0%
(FPCore (J l K U)
:precision binary64
(if (or (<= l -1.55e+91)
(not (or (<= l -0.15) (and (not (<= l 26.0)) (<= l 1.45e+93)))))
(+
U
(* (cos (/ K 2.0)) (* J (+ (* 0.3333333333333333 (pow l 3.0)) (* l 2.0)))))
(+ U (* (+ (* -0.125 (* K K)) 1.0) (* (- (exp l) (exp (- l))) J)))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -1.55e+91) || !((l <= -0.15) || (!(l <= 26.0) && (l <= 1.45e+93)))) {
tmp = U + (cos((K / 2.0)) * (J * ((0.3333333333333333 * pow(l, 3.0)) + (l * 2.0))));
} else {
tmp = U + (((-0.125 * (K * K)) + 1.0) * ((exp(l) - exp(-l)) * J));
}
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.55d+91)) .or. (.not. (l <= (-0.15d0)) .or. (.not. (l <= 26.0d0)) .and. (l <= 1.45d+93))) then
tmp = u + (cos((k / 2.0d0)) * (j * ((0.3333333333333333d0 * (l ** 3.0d0)) + (l * 2.0d0))))
else
tmp = u + ((((-0.125d0) * (k * k)) + 1.0d0) * ((exp(l) - exp(-l)) * j))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -1.55e+91) || !((l <= -0.15) || (!(l <= 26.0) && (l <= 1.45e+93)))) {
tmp = U + (Math.cos((K / 2.0)) * (J * ((0.3333333333333333 * Math.pow(l, 3.0)) + (l * 2.0))));
} else {
tmp = U + (((-0.125 * (K * K)) + 1.0) * ((Math.exp(l) - Math.exp(-l)) * J));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -1.55e+91) or not ((l <= -0.15) or (not (l <= 26.0) and (l <= 1.45e+93))): tmp = U + (math.cos((K / 2.0)) * (J * ((0.3333333333333333 * math.pow(l, 3.0)) + (l * 2.0)))) else: tmp = U + (((-0.125 * (K * K)) + 1.0) * ((math.exp(l) - math.exp(-l)) * J)) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -1.55e+91) || !((l <= -0.15) || (!(l <= 26.0) && (l <= 1.45e+93)))) tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(Float64(0.3333333333333333 * (l ^ 3.0)) + Float64(l * 2.0))))); else tmp = Float64(U + Float64(Float64(Float64(-0.125 * Float64(K * K)) + 1.0) * Float64(Float64(exp(l) - exp(Float64(-l))) * J))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -1.55e+91) || ~(((l <= -0.15) || (~((l <= 26.0)) && (l <= 1.45e+93))))) tmp = U + (cos((K / 2.0)) * (J * ((0.3333333333333333 * (l ^ 3.0)) + (l * 2.0)))); else tmp = U + (((-0.125 * (K * K)) + 1.0) * ((exp(l) - exp(-l)) * J)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -1.55e+91], N[Not[Or[LessEqual[l, -0.15], And[N[Not[LessEqual[l, 26.0]], $MachinePrecision], LessEqual[l, 1.45e+93]]]], $MachinePrecision]], N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[(N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(N[(N[(-0.125 * N[(K * K), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.55 \cdot 10^{+91} \lor \neg \left(\ell \leq -0.15 \lor \neg \left(\ell \leq 26\right) \land \ell \leq 1.45 \cdot 10^{+93}\right):\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + \left(-0.125 \cdot \left(K \cdot K\right) + 1\right) \cdot \left(\left(e^{\ell} - e^{-\ell}\right) \cdot J\right)\\
\end{array}
\end{array}
if l < -1.54999999999999999e91 or -0.149999999999999994 < l < 26 or 1.4499999999999999e93 < l Initial program 84.2%
Taylor expanded in l around 0 99.8%
if -1.54999999999999999e91 < l < -0.149999999999999994 or 26 < l < 1.4499999999999999e93Initial program 100.0%
Taylor expanded in K around 0 0.0%
associate-*r*0.0%
distribute-rgt1-in85.7%
unpow285.7%
Simplified85.7%
Final simplification97.9%
(FPCore (J l K U) :precision binary64 (if (or (<= l -0.025) (not (<= l 4.5e-5))) (+ U (* (- (exp l) (exp (- l))) J)) (+ U (* (cos (/ K 2.0)) (* J (* l 2.0))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -0.025) || !(l <= 4.5e-5)) {
tmp = U + ((exp(l) - exp(-l)) * J);
} else {
tmp = U + (cos((K / 2.0)) * (J * (l * 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 <= (-0.025d0)) .or. (.not. (l <= 4.5d-5))) then
tmp = u + ((exp(l) - exp(-l)) * j)
else
tmp = u + (cos((k / 2.0d0)) * (j * (l * 2.0d0)))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -0.025) || !(l <= 4.5e-5)) {
tmp = U + ((Math.exp(l) - Math.exp(-l)) * J);
} else {
tmp = U + (Math.cos((K / 2.0)) * (J * (l * 2.0)));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -0.025) or not (l <= 4.5e-5): tmp = U + ((math.exp(l) - math.exp(-l)) * J) else: tmp = U + (math.cos((K / 2.0)) * (J * (l * 2.0))) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -0.025) || !(l <= 4.5e-5)) tmp = Float64(U + Float64(Float64(exp(l) - exp(Float64(-l))) * J)); else tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(l * 2.0)))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -0.025) || ~((l <= 4.5e-5))) tmp = U + ((exp(l) - exp(-l)) * J); else tmp = U + (cos((K / 2.0)) * (J * (l * 2.0))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -0.025], N[Not[LessEqual[l, 4.5e-5]], $MachinePrecision]], N[(U + N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]), $MachinePrecision], N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -0.025 \lor \neg \left(\ell \leq 4.5 \cdot 10^{-5}\right):\\
\;\;\;\;U + \left(e^{\ell} - e^{-\ell}\right) \cdot J\\
\mathbf{else}:\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(\ell \cdot 2\right)\right)\\
\end{array}
\end{array}
if l < -0.025000000000000001 or 4.50000000000000028e-5 < l Initial program 99.8%
Taylor expanded in K around 0 74.9%
if -0.025000000000000001 < l < 4.50000000000000028e-5Initial program 72.1%
Taylor expanded in l around 0 99.4%
Final simplification86.8%
(FPCore (J l K U) :precision binary64 (+ U (* (cos (/ K 2.0)) (* J (* l 2.0)))))
double code(double J, double l, double K, double U) {
return U + (cos((K / 2.0)) * (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 + (cos((k / 2.0d0)) * (j * (l * 2.0d0)))
end function
public static double code(double J, double l, double K, double U) {
return U + (Math.cos((K / 2.0)) * (J * (l * 2.0)));
}
def code(J, l, K, U): return U + (math.cos((K / 2.0)) * (J * (l * 2.0)))
function code(J, l, K, U) return Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(l * 2.0)))) end
function tmp = code(J, l, K, U) tmp = U + (cos((K / 2.0)) * (J * (l * 2.0))); end
code[J_, l_, K_, U_] := N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(\ell \cdot 2\right)\right)
\end{array}
Initial program 86.4%
Taylor expanded in l around 0 61.9%
Final simplification61.9%
(FPCore (J l K U) :precision binary64 (if (<= l -4.8e+32) (pow U -8.0) (if (<= l 5.2e+14) U (pow U -8.0))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -4.8e+32) {
tmp = pow(U, -8.0);
} else if (l <= 5.2e+14) {
tmp = U;
} else {
tmp = pow(U, -8.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 <= (-4.8d+32)) then
tmp = u ** (-8.0d0)
else if (l <= 5.2d+14) then
tmp = u
else
tmp = u ** (-8.0d0)
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= -4.8e+32) {
tmp = Math.pow(U, -8.0);
} else if (l <= 5.2e+14) {
tmp = U;
} else {
tmp = Math.pow(U, -8.0);
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -4.8e+32: tmp = math.pow(U, -8.0) elif l <= 5.2e+14: tmp = U else: tmp = math.pow(U, -8.0) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -4.8e+32) tmp = U ^ -8.0; elseif (l <= 5.2e+14) tmp = U; else tmp = U ^ -8.0; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -4.8e+32) tmp = U ^ -8.0; elseif (l <= 5.2e+14) tmp = U; else tmp = U ^ -8.0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -4.8e+32], N[Power[U, -8.0], $MachinePrecision], If[LessEqual[l, 5.2e+14], U, N[Power[U, -8.0], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -4.8 \cdot 10^{+32}:\\
\;\;\;\;{U}^{-8}\\
\mathbf{elif}\;\ell \leq 5.2 \cdot 10^{+14}:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;{U}^{-8}\\
\end{array}
\end{array}
if l < -4.79999999999999983e32 or 5.2e14 < l Initial program 100.0%
Applied egg-rr28.8%
if -4.79999999999999983e32 < l < 5.2e14Initial program 74.0%
Taylor expanded in J around 0 67.2%
Final simplification48.9%
(FPCore (J l K U) :precision binary64 (if (or (<= l -7.2e+84) (not (<= l 380.0))) (+ U (* J (+ (* (* K K) -64.0) 512.0))) U))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -7.2e+84) || !(l <= 380.0)) {
tmp = U + (J * (((K * K) * -64.0) + 512.0));
} 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 <= (-7.2d+84)) .or. (.not. (l <= 380.0d0))) then
tmp = u + (j * (((k * k) * (-64.0d0)) + 512.0d0))
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 <= -7.2e+84) || !(l <= 380.0)) {
tmp = U + (J * (((K * K) * -64.0) + 512.0));
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -7.2e+84) or not (l <= 380.0): tmp = U + (J * (((K * K) * -64.0) + 512.0)) else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -7.2e+84) || !(l <= 380.0)) tmp = Float64(U + Float64(J * Float64(Float64(Float64(K * K) * -64.0) + 512.0))); else tmp = U; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -7.2e+84) || ~((l <= 380.0))) tmp = U + (J * (((K * K) * -64.0) + 512.0)); else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -7.2e+84], N[Not[LessEqual[l, 380.0]], $MachinePrecision]], N[(U + N[(J * N[(N[(N[(K * K), $MachinePrecision] * -64.0), $MachinePrecision] + 512.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], U]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -7.2 \cdot 10^{+84} \lor \neg \left(\ell \leq 380\right):\\
\;\;\;\;U + J \cdot \left(\left(K \cdot K\right) \cdot -64 + 512\right)\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if l < -7.1999999999999999e84 or 380 < l Initial program 100.0%
Applied egg-rr2.9%
Taylor expanded in K around 0 17.5%
associate-*r*17.5%
distribute-rgt-out17.5%
unpow217.5%
Simplified17.5%
if -7.1999999999999999e84 < l < 380Initial program 75.1%
Taylor expanded in J around 0 64.3%
Final simplification43.1%
(FPCore (J l K U) :precision binary64 (if (<= l -0.00365) (* U U) (if (<= l 210000000000.0) U (* U (- U -8.0)))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -0.00365) {
tmp = U * U;
} else if (l <= 210000000000.0) {
tmp = U;
} else {
tmp = U * (U - -8.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 <= (-0.00365d0)) then
tmp = u * u
else if (l <= 210000000000.0d0) then
tmp = u
else
tmp = u * (u - (-8.0d0))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= -0.00365) {
tmp = U * U;
} else if (l <= 210000000000.0) {
tmp = U;
} else {
tmp = U * (U - -8.0);
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -0.00365: tmp = U * U elif l <= 210000000000.0: tmp = U else: tmp = U * (U - -8.0) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -0.00365) tmp = Float64(U * U); elseif (l <= 210000000000.0) tmp = U; else tmp = Float64(U * Float64(U - -8.0)); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -0.00365) tmp = U * U; elseif (l <= 210000000000.0) tmp = U; else tmp = U * (U - -8.0); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -0.00365], N[(U * U), $MachinePrecision], If[LessEqual[l, 210000000000.0], U, N[(U * N[(U - -8.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -0.00365:\\
\;\;\;\;U \cdot U\\
\mathbf{elif}\;\ell \leq 210000000000:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;U \cdot \left(U - -8\right)\\
\end{array}
\end{array}
if l < -0.00365000000000000003Initial program 99.9%
Applied egg-rr10.0%
if -0.00365000000000000003 < l < 2.1e11Initial program 73.1%
Taylor expanded in J around 0 69.7%
if 2.1e11 < l Initial program 100.0%
Applied egg-rr12.2%
Final simplification40.6%
(FPCore (J l K U) :precision binary64 (if (<= l -0.00365) (* U U) (if (<= l 175000000000.0) U (* U U))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -0.00365) {
tmp = U * U;
} else if (l <= 175000000000.0) {
tmp = U;
} else {
tmp = U * 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 <= (-0.00365d0)) then
tmp = u * u
else if (l <= 175000000000.0d0) then
tmp = u
else
tmp = u * u
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= -0.00365) {
tmp = U * U;
} else if (l <= 175000000000.0) {
tmp = U;
} else {
tmp = U * U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -0.00365: tmp = U * U elif l <= 175000000000.0: tmp = U else: tmp = U * U return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -0.00365) tmp = Float64(U * U); elseif (l <= 175000000000.0) tmp = U; else tmp = Float64(U * U); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -0.00365) tmp = U * U; elseif (l <= 175000000000.0) tmp = U; else tmp = U * U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -0.00365], N[(U * U), $MachinePrecision], If[LessEqual[l, 175000000000.0], U, N[(U * U), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -0.00365:\\
\;\;\;\;U \cdot U\\
\mathbf{elif}\;\ell \leq 175000000000:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;U \cdot U\\
\end{array}
\end{array}
if l < -0.00365000000000000003 or 1.75e11 < l Initial program 99.9%
Applied egg-rr11.1%
if -0.00365000000000000003 < l < 1.75e11Initial program 73.1%
Taylor expanded in J around 0 69.7%
Final simplification40.6%
(FPCore (J l K U) :precision binary64 1.0)
double code(double J, double l, double K, double U) {
return 1.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 = 1.0d0
end function
public static double code(double J, double l, double K, double U) {
return 1.0;
}
def code(J, l, K, U): return 1.0
function code(J, l, K, U) return 1.0 end
function tmp = code(J, l, K, U) tmp = 1.0; end
code[J_, l_, K_, U_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 86.4%
Applied egg-rr2.6%
*-inverses2.6%
Simplified2.6%
Final simplification2.6%
(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}
Initial program 86.4%
Taylor expanded in J around 0 36.3%
Final simplification36.3%
herbie shell --seed 2023192
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))