
(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 -0.02) (not (<= t_0 5e-15)))
(+ (* (* t_0 J) (cos (/ K 2.0))) U)
(fma
l
(* (* J (cos (* K 0.5))) (fma 0.3333333333333333 (pow l 2.0) 2.0))
U))))
double code(double J, double l, double K, double U) {
double t_0 = exp(l) - exp(-l);
double tmp;
if ((t_0 <= -0.02) || !(t_0 <= 5e-15)) {
tmp = ((t_0 * J) * cos((K / 2.0))) + U;
} else {
tmp = fma(l, ((J * cos((K * 0.5))) * fma(0.3333333333333333, pow(l, 2.0), 2.0)), U);
}
return tmp;
}
function code(J, l, K, U) t_0 = Float64(exp(l) - exp(Float64(-l))) tmp = 0.0 if ((t_0 <= -0.02) || !(t_0 <= 5e-15)) tmp = Float64(Float64(Float64(t_0 * J) * cos(Float64(K / 2.0))) + U); else tmp = fma(l, Float64(Float64(J * cos(Float64(K * 0.5))) * fma(0.3333333333333333, (l ^ 2.0), 2.0)), U); 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.02], N[Not[LessEqual[t$95$0, 5e-15]], $MachinePrecision]], N[(N[(N[(t$95$0 * J), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(l * N[(N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(0.3333333333333333 * N[Power[l, 2.0], $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{\ell} - e^{-\ell}\\
\mathbf{if}\;t\_0 \leq -0.02 \lor \neg \left(t\_0 \leq 5 \cdot 10^{-15}\right):\\
\;\;\;\;\left(t\_0 \cdot J\right) \cdot \cos \left(\frac{K}{2}\right) + U\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\ell, \left(J \cdot \cos \left(K \cdot 0.5\right)\right) \cdot \mathsf{fma}\left(0.3333333333333333, {\ell}^{2}, 2\right), U\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -0.0200000000000000004 or 4.99999999999999999e-15 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 100.0%
if -0.0200000000000000004 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 4.99999999999999999e-15Initial program 67.7%
Taylor expanded in l around 0 99.9%
+-commutative99.9%
fma-define99.9%
associate-*r*99.9%
*-commutative99.9%
associate-*r*99.9%
associate-*r*99.9%
*-commutative99.9%
associate-*r*99.9%
*-commutative99.9%
distribute-rgt-out99.9%
fma-define99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (- (exp l) (exp (- l)))))
(if (or (<= t_0 -0.02) (not (<= t_0 5e-15)))
(+ (* (* t_0 J) (cos (/ K 2.0))) U)
(+
U
(*
l
(* (* J (cos (* K 0.5))) (fma 0.3333333333333333 (pow l 2.0) 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.02) || !(t_0 <= 5e-15)) {
tmp = ((t_0 * J) * cos((K / 2.0))) + U;
} else {
tmp = U + (l * ((J * cos((K * 0.5))) * fma(0.3333333333333333, pow(l, 2.0), 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.02) || !(t_0 <= 5e-15)) tmp = Float64(Float64(Float64(t_0 * J) * cos(Float64(K / 2.0))) + U); else tmp = Float64(U + Float64(l * Float64(Float64(J * cos(Float64(K * 0.5))) * fma(0.3333333333333333, (l ^ 2.0), 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.02], N[Not[LessEqual[t$95$0, 5e-15]], $MachinePrecision]], N[(N[(N[(t$95$0 * J), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(l * N[(N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(0.3333333333333333 * N[Power[l, 2.0], $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{\ell} - e^{-\ell}\\
\mathbf{if}\;t\_0 \leq -0.02 \lor \neg \left(t\_0 \leq 5 \cdot 10^{-15}\right):\\
\;\;\;\;\left(t\_0 \cdot J\right) \cdot \cos \left(\frac{K}{2}\right) + U\\
\mathbf{else}:\\
\;\;\;\;U + \ell \cdot \left(\left(J \cdot \cos \left(K \cdot 0.5\right)\right) \cdot \mathsf{fma}\left(0.3333333333333333, {\ell}^{2}, 2\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -0.0200000000000000004 or 4.99999999999999999e-15 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 100.0%
if -0.0200000000000000004 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 4.99999999999999999e-15Initial program 67.7%
Taylor expanded in l around 0 99.9%
associate-*r*99.9%
*-commutative99.9%
associate-*r*99.9%
associate-*r*99.9%
*-commutative99.9%
associate-*r*99.9%
*-commutative99.9%
distribute-rgt-out99.9%
fma-define99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (- (exp l) (exp (- l)))))
(if (or (<= t_0 -0.02) (not (<= t_0 5e-15)))
(+ (* (* t_0 J) (cos (/ K 2.0))) U)
(+
U
(*
J
(*
l
(* (cos (* K 0.5)) (+ 2.0 (* (pow l 2.0) 0.3333333333333333)))))))))
double code(double J, double l, double K, double U) {
double t_0 = exp(l) - exp(-l);
double tmp;
if ((t_0 <= -0.02) || !(t_0 <= 5e-15)) {
tmp = ((t_0 * J) * cos((K / 2.0))) + U;
} else {
tmp = U + (J * (l * (cos((K * 0.5)) * (2.0 + (pow(l, 2.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) :: t_0
real(8) :: tmp
t_0 = exp(l) - exp(-l)
if ((t_0 <= (-0.02d0)) .or. (.not. (t_0 <= 5d-15))) then
tmp = ((t_0 * j) * cos((k / 2.0d0))) + u
else
tmp = u + (j * (l * (cos((k * 0.5d0)) * (2.0d0 + ((l ** 2.0d0) * 0.3333333333333333d0)))))
end if
code = tmp
end function
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 <= -0.02) || !(t_0 <= 5e-15)) {
tmp = ((t_0 * J) * Math.cos((K / 2.0))) + U;
} else {
tmp = U + (J * (l * (Math.cos((K * 0.5)) * (2.0 + (Math.pow(l, 2.0) * 0.3333333333333333)))));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.exp(l) - math.exp(-l) tmp = 0 if (t_0 <= -0.02) or not (t_0 <= 5e-15): tmp = ((t_0 * J) * math.cos((K / 2.0))) + U else: tmp = U + (J * (l * (math.cos((K * 0.5)) * (2.0 + (math.pow(l, 2.0) * 0.3333333333333333))))) return tmp
function code(J, l, K, U) t_0 = Float64(exp(l) - exp(Float64(-l))) tmp = 0.0 if ((t_0 <= -0.02) || !(t_0 <= 5e-15)) tmp = Float64(Float64(Float64(t_0 * J) * cos(Float64(K / 2.0))) + U); else tmp = Float64(U + Float64(J * Float64(l * Float64(cos(Float64(K * 0.5)) * Float64(2.0 + Float64((l ^ 2.0) * 0.3333333333333333)))))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = exp(l) - exp(-l); tmp = 0.0; if ((t_0 <= -0.02) || ~((t_0 <= 5e-15))) tmp = ((t_0 * J) * cos((K / 2.0))) + U; else tmp = U + (J * (l * (cos((K * 0.5)) * (2.0 + ((l ^ 2.0) * 0.3333333333333333))))); 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, -0.02], N[Not[LessEqual[t$95$0, 5e-15]], $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[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(2.0 + N[(N[Power[l, 2.0], $MachinePrecision] * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{\ell} - e^{-\ell}\\
\mathbf{if}\;t\_0 \leq -0.02 \lor \neg \left(t\_0 \leq 5 \cdot 10^{-15}\right):\\
\;\;\;\;\left(t\_0 \cdot J\right) \cdot \cos \left(\frac{K}{2}\right) + U\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\ell \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \left(2 + {\ell}^{2} \cdot 0.3333333333333333\right)\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -0.0200000000000000004 or 4.99999999999999999e-15 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 100.0%
if -0.0200000000000000004 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 4.99999999999999999e-15Initial program 67.7%
Taylor expanded in l around 0 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in l around 0 99.8%
*-commutative99.8%
Simplified99.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 (<= t_1 -0.1)
(+ (* (* t_1 J) t_0) U)
(+
U
(*
t_0
(*
J
(*
l
(+
2.0
(*
(pow l 2.0)
(+
0.3333333333333333
(*
(pow l 2.0)
(+
0.016666666666666666
(* (pow l 2.0) 0.0003968253968253968)))))))))))))
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.1) {
tmp = ((t_1 * J) * t_0) + U;
} else {
tmp = U + (t_0 * (J * (l * (2.0 + (pow(l, 2.0) * (0.3333333333333333 + (pow(l, 2.0) * (0.016666666666666666 + (pow(l, 2.0) * 0.0003968253968253968)))))))));
}
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.1d0)) then
tmp = ((t_1 * j) * t_0) + u
else
tmp = u + (t_0 * (j * (l * (2.0d0 + ((l ** 2.0d0) * (0.3333333333333333d0 + ((l ** 2.0d0) * (0.016666666666666666d0 + ((l ** 2.0d0) * 0.0003968253968253968d0)))))))))
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.1) {
tmp = ((t_1 * J) * t_0) + U;
} else {
tmp = U + (t_0 * (J * (l * (2.0 + (Math.pow(l, 2.0) * (0.3333333333333333 + (Math.pow(l, 2.0) * (0.016666666666666666 + (Math.pow(l, 2.0) * 0.0003968253968253968)))))))));
}
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.1: tmp = ((t_1 * J) * t_0) + U else: tmp = U + (t_0 * (J * (l * (2.0 + (math.pow(l, 2.0) * (0.3333333333333333 + (math.pow(l, 2.0) * (0.016666666666666666 + (math.pow(l, 2.0) * 0.0003968253968253968))))))))) 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.1) tmp = Float64(Float64(Float64(t_1 * J) * t_0) + U); else tmp = Float64(U + Float64(t_0 * Float64(J * Float64(l * Float64(2.0 + Float64((l ^ 2.0) * Float64(0.3333333333333333 + Float64((l ^ 2.0) * Float64(0.016666666666666666 + Float64((l ^ 2.0) * 0.0003968253968253968)))))))))); 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.1) tmp = ((t_1 * J) * t_0) + U; else tmp = U + (t_0 * (J * (l * (2.0 + ((l ^ 2.0) * (0.3333333333333333 + ((l ^ 2.0) * (0.016666666666666666 + ((l ^ 2.0) * 0.0003968253968253968))))))))); 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[LessEqual[t$95$1, -0.1], N[(N[(N[(t$95$1 * J), $MachinePrecision] * t$95$0), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(t$95$0 * N[(J * N[(l * N[(2.0 + N[(N[Power[l, 2.0], $MachinePrecision] * N[(0.3333333333333333 + N[(N[Power[l, 2.0], $MachinePrecision] * N[(0.016666666666666666 + N[(N[Power[l, 2.0], $MachinePrecision] * 0.0003968253968253968), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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 -0.1:\\
\;\;\;\;\left(t\_1 \cdot J\right) \cdot t\_0 + U\\
\mathbf{else}:\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(\ell \cdot \left(2 + {\ell}^{2} \cdot \left(0.3333333333333333 + {\ell}^{2} \cdot \left(0.016666666666666666 + {\ell}^{2} \cdot 0.0003968253968253968\right)\right)\right)\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -0.10000000000000001Initial program 100.0%
if -0.10000000000000001 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 78.8%
Taylor expanded in l around 0 98.1%
*-commutative98.1%
Simplified98.1%
Final simplification98.6%
(FPCore (J l K U)
:precision binary64
(let* ((t_0
(+
U
(* (cos (/ K 2.0)) (* 0.0003968253968253968 (* J (pow l 7.0)))))))
(if (<= l -1.9e+40)
t_0
(if (<= l -0.026)
(+ (* (- (exp l) (exp (- l))) J) U)
(if (<= l 5.6)
(+
U
(*
J
(*
l
(* (cos (* K 0.5)) (+ 2.0 (* (pow l 2.0) 0.3333333333333333))))))
t_0)))))
double code(double J, double l, double K, double U) {
double t_0 = U + (cos((K / 2.0)) * (0.0003968253968253968 * (J * pow(l, 7.0))));
double tmp;
if (l <= -1.9e+40) {
tmp = t_0;
} else if (l <= -0.026) {
tmp = ((exp(l) - exp(-l)) * J) + U;
} else if (l <= 5.6) {
tmp = U + (J * (l * (cos((K * 0.5)) * (2.0 + (pow(l, 2.0) * 0.3333333333333333)))));
} 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 + (cos((k / 2.0d0)) * (0.0003968253968253968d0 * (j * (l ** 7.0d0))))
if (l <= (-1.9d+40)) then
tmp = t_0
else if (l <= (-0.026d0)) then
tmp = ((exp(l) - exp(-l)) * j) + u
else if (l <= 5.6d0) then
tmp = u + (j * (l * (cos((k * 0.5d0)) * (2.0d0 + ((l ** 2.0d0) * 0.3333333333333333d0)))))
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)) * (0.0003968253968253968 * (J * Math.pow(l, 7.0))));
double tmp;
if (l <= -1.9e+40) {
tmp = t_0;
} else if (l <= -0.026) {
tmp = ((Math.exp(l) - Math.exp(-l)) * J) + U;
} else if (l <= 5.6) {
tmp = U + (J * (l * (Math.cos((K * 0.5)) * (2.0 + (Math.pow(l, 2.0) * 0.3333333333333333)))));
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = U + (math.cos((K / 2.0)) * (0.0003968253968253968 * (J * math.pow(l, 7.0)))) tmp = 0 if l <= -1.9e+40: tmp = t_0 elif l <= -0.026: tmp = ((math.exp(l) - math.exp(-l)) * J) + U elif l <= 5.6: tmp = U + (J * (l * (math.cos((K * 0.5)) * (2.0 + (math.pow(l, 2.0) * 0.3333333333333333))))) else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(0.0003968253968253968 * Float64(J * (l ^ 7.0))))) tmp = 0.0 if (l <= -1.9e+40) tmp = t_0; elseif (l <= -0.026) tmp = Float64(Float64(Float64(exp(l) - exp(Float64(-l))) * J) + U); elseif (l <= 5.6) tmp = Float64(U + Float64(J * Float64(l * Float64(cos(Float64(K * 0.5)) * Float64(2.0 + Float64((l ^ 2.0) * 0.3333333333333333)))))); else tmp = t_0; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U + (cos((K / 2.0)) * (0.0003968253968253968 * (J * (l ^ 7.0)))); tmp = 0.0; if (l <= -1.9e+40) tmp = t_0; elseif (l <= -0.026) tmp = ((exp(l) - exp(-l)) * J) + U; elseif (l <= 5.6) tmp = U + (J * (l * (cos((K * 0.5)) * (2.0 + ((l ^ 2.0) * 0.3333333333333333))))); 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[(0.0003968253968253968 * N[(J * N[Power[l, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -1.9e+40], t$95$0, If[LessEqual[l, -0.026], N[(N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision] + U), $MachinePrecision], If[LessEqual[l, 5.6], N[(U + N[(J * N[(l * N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(2.0 + N[(N[Power[l, 2.0], $MachinePrecision] * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + \cos \left(\frac{K}{2}\right) \cdot \left(0.0003968253968253968 \cdot \left(J \cdot {\ell}^{7}\right)\right)\\
\mathbf{if}\;\ell \leq -1.9 \cdot 10^{+40}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq -0.026:\\
\;\;\;\;\left(e^{\ell} - e^{-\ell}\right) \cdot J + U\\
\mathbf{elif}\;\ell \leq 5.6:\\
\;\;\;\;U + J \cdot \left(\ell \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \left(2 + {\ell}^{2} \cdot 0.3333333333333333\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if l < -1.90000000000000002e40 or 5.5999999999999996 < l Initial program 100.0%
Taylor expanded in l around 0 96.8%
*-commutative96.8%
Simplified96.8%
Taylor expanded in l around inf 97.6%
if -1.90000000000000002e40 < l < -0.0259999999999999988Initial program 100.0%
Taylor expanded in K around 0 88.1%
if -0.0259999999999999988 < l < 5.5999999999999996Initial program 68.5%
Taylor expanded in l around 0 99.3%
*-commutative99.3%
Simplified99.3%
Taylor expanded in l around 0 98.9%
*-commutative98.9%
Simplified98.9%
Taylor expanded in J around 0 99.0%
Final simplification97.7%
(FPCore (J l K U)
:precision binary64
(let* ((t_0
(+
U
(* (cos (/ K 2.0)) (* 0.0003968253968253968 (* J (pow l 7.0)))))))
(if (<= l -1.3e+40)
t_0
(if (<= l -0.019)
(+ (* (- (exp l) (exp (- l))) J) U)
(if (<= l 4.0) (+ U (* 2.0 (* J (* l (cos (* K 0.5)))))) t_0)))))
double code(double J, double l, double K, double U) {
double t_0 = U + (cos((K / 2.0)) * (0.0003968253968253968 * (J * pow(l, 7.0))));
double tmp;
if (l <= -1.3e+40) {
tmp = t_0;
} else if (l <= -0.019) {
tmp = ((exp(l) - exp(-l)) * J) + U;
} else if (l <= 4.0) {
tmp = U + (2.0 * (J * (l * cos((K * 0.5)))));
} 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 + (cos((k / 2.0d0)) * (0.0003968253968253968d0 * (j * (l ** 7.0d0))))
if (l <= (-1.3d+40)) then
tmp = t_0
else if (l <= (-0.019d0)) then
tmp = ((exp(l) - exp(-l)) * j) + u
else if (l <= 4.0d0) then
tmp = u + (2.0d0 * (j * (l * cos((k * 0.5d0)))))
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)) * (0.0003968253968253968 * (J * Math.pow(l, 7.0))));
double tmp;
if (l <= -1.3e+40) {
tmp = t_0;
} else if (l <= -0.019) {
tmp = ((Math.exp(l) - Math.exp(-l)) * J) + U;
} else if (l <= 4.0) {
tmp = U + (2.0 * (J * (l * Math.cos((K * 0.5)))));
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = U + (math.cos((K / 2.0)) * (0.0003968253968253968 * (J * math.pow(l, 7.0)))) tmp = 0 if l <= -1.3e+40: tmp = t_0 elif l <= -0.019: tmp = ((math.exp(l) - math.exp(-l)) * J) + U elif l <= 4.0: tmp = U + (2.0 * (J * (l * math.cos((K * 0.5))))) else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(0.0003968253968253968 * Float64(J * (l ^ 7.0))))) tmp = 0.0 if (l <= -1.3e+40) tmp = t_0; elseif (l <= -0.019) tmp = Float64(Float64(Float64(exp(l) - exp(Float64(-l))) * J) + U); elseif (l <= 4.0) tmp = Float64(U + Float64(2.0 * Float64(J * Float64(l * cos(Float64(K * 0.5)))))); else tmp = t_0; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U + (cos((K / 2.0)) * (0.0003968253968253968 * (J * (l ^ 7.0)))); tmp = 0.0; if (l <= -1.3e+40) tmp = t_0; elseif (l <= -0.019) tmp = ((exp(l) - exp(-l)) * J) + U; elseif (l <= 4.0) tmp = U + (2.0 * (J * (l * cos((K * 0.5))))); 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[(0.0003968253968253968 * N[(J * N[Power[l, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -1.3e+40], t$95$0, If[LessEqual[l, -0.019], N[(N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision] + U), $MachinePrecision], If[LessEqual[l, 4.0], N[(U + N[(2.0 * N[(J * N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + \cos \left(\frac{K}{2}\right) \cdot \left(0.0003968253968253968 \cdot \left(J \cdot {\ell}^{7}\right)\right)\\
\mathbf{if}\;\ell \leq -1.3 \cdot 10^{+40}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq -0.019:\\
\;\;\;\;\left(e^{\ell} - e^{-\ell}\right) \cdot J + U\\
\mathbf{elif}\;\ell \leq 4:\\
\;\;\;\;U + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if l < -1.3e40 or 4 < l Initial program 100.0%
Taylor expanded in l around 0 96.8%
*-commutative96.8%
Simplified96.8%
Taylor expanded in l around inf 97.6%
if -1.3e40 < l < -0.0189999999999999995Initial program 100.0%
Taylor expanded in K around 0 88.1%
if -0.0189999999999999995 < l < 4Initial program 68.5%
Taylor expanded in l around 0 98.5%
Final simplification97.5%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.05) (+ U (* 2.0 (* J (* l (cos (* K 0.5)))))) (+ U (* J (* l (+ 2.0 (* (pow l 2.0) 0.3333333333333333)))))))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.05) {
tmp = U + (2.0 * (J * (l * cos((K * 0.5)))));
} else {
tmp = U + (J * (l * (2.0 + (pow(l, 2.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.05d0)) then
tmp = u + (2.0d0 * (j * (l * cos((k * 0.5d0)))))
else
tmp = u + (j * (l * (2.0d0 + ((l ** 2.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.05) {
tmp = U + (2.0 * (J * (l * Math.cos((K * 0.5)))));
} else {
tmp = U + (J * (l * (2.0 + (Math.pow(l, 2.0) * 0.3333333333333333))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if math.cos((K / 2.0)) <= -0.05: tmp = U + (2.0 * (J * (l * math.cos((K * 0.5))))) else: tmp = U + (J * (l * (2.0 + (math.pow(l, 2.0) * 0.3333333333333333)))) return tmp
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.05) tmp = Float64(U + Float64(2.0 * Float64(J * Float64(l * cos(Float64(K * 0.5)))))); else tmp = Float64(U + Float64(J * Float64(l * Float64(2.0 + Float64((l ^ 2.0) * 0.3333333333333333))))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (cos((K / 2.0)) <= -0.05) tmp = U + (2.0 * (J * (l * cos((K * 0.5))))); else tmp = U + (J * (l * (2.0 + ((l ^ 2.0) * 0.3333333333333333)))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.05], 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[(l * N[(2.0 + N[(N[Power[l, 2.0], $MachinePrecision] * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.05:\\
\;\;\;\;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 \left(2 + {\ell}^{2} \cdot 0.3333333333333333\right)\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.050000000000000003Initial program 82.3%
Taylor expanded in l around 0 66.4%
if -0.050000000000000003 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 85.1%
Taylor expanded in l around 0 94.5%
*-commutative94.5%
Simplified94.5%
Taylor expanded in l around 0 86.2%
*-commutative86.2%
Simplified86.2%
Taylor expanded in K around 0 80.9%
Final simplification77.6%
(FPCore (J l K U) :precision binary64 (if (or (<= l -0.027) (not (<= l 0.00132))) (+ (* (- (exp l) (exp (- l))) J) U) (+ U (* 2.0 (* J (* l (cos (* K 0.5))))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -0.027) || !(l <= 0.00132)) {
tmp = ((exp(l) - exp(-l)) * J) + U;
} 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 <= (-0.027d0)) .or. (.not. (l <= 0.00132d0))) then
tmp = ((exp(l) - exp(-l)) * j) + u
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 <= -0.027) || !(l <= 0.00132)) {
tmp = ((Math.exp(l) - Math.exp(-l)) * J) + U;
} else {
tmp = U + (2.0 * (J * (l * Math.cos((K * 0.5)))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -0.027) or not (l <= 0.00132): tmp = ((math.exp(l) - math.exp(-l)) * J) + U 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 <= -0.027) || !(l <= 0.00132)) tmp = Float64(Float64(Float64(exp(l) - exp(Float64(-l))) * J) + U); 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 <= -0.027) || ~((l <= 0.00132))) tmp = ((exp(l) - exp(-l)) * J) + U; 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, -0.027], N[Not[LessEqual[l, 0.00132]], $MachinePrecision]], N[(N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision] + U), $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 -0.027 \lor \neg \left(\ell \leq 0.00132\right):\\
\;\;\;\;\left(e^{\ell} - e^{-\ell}\right) \cdot J + U\\
\mathbf{else}:\\
\;\;\;\;U + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\end{array}
\end{array}
if l < -0.0269999999999999997 or 0.00132 < l Initial program 100.0%
Taylor expanded in K around 0 78.2%
if -0.0269999999999999997 < l < 0.00132Initial program 68.0%
Taylor expanded in l around 0 99.1%
Final simplification88.3%
(FPCore (J l K U)
:precision binary64
(if (<= l -5.5e+140)
(pow U -4.0)
(if (<= l -9.5e+28)
(* U U)
(if (<= l -0.95)
(pow U -3.0)
(if (<= l 2.1) U (if (<= l 3.2e+61) (* U U) (pow U -3.0)))))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -5.5e+140) {
tmp = pow(U, -4.0);
} else if (l <= -9.5e+28) {
tmp = U * U;
} else if (l <= -0.95) {
tmp = pow(U, -3.0);
} else if (l <= 2.1) {
tmp = U;
} else if (l <= 3.2e+61) {
tmp = U * U;
} 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 <= (-5.5d+140)) then
tmp = u ** (-4.0d0)
else if (l <= (-9.5d+28)) then
tmp = u * u
else if (l <= (-0.95d0)) then
tmp = u ** (-3.0d0)
else if (l <= 2.1d0) then
tmp = u
else if (l <= 3.2d+61) then
tmp = u * u
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 <= -5.5e+140) {
tmp = Math.pow(U, -4.0);
} else if (l <= -9.5e+28) {
tmp = U * U;
} else if (l <= -0.95) {
tmp = Math.pow(U, -3.0);
} else if (l <= 2.1) {
tmp = U;
} else if (l <= 3.2e+61) {
tmp = U * U;
} else {
tmp = Math.pow(U, -3.0);
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -5.5e+140: tmp = math.pow(U, -4.0) elif l <= -9.5e+28: tmp = U * U elif l <= -0.95: tmp = math.pow(U, -3.0) elif l <= 2.1: tmp = U elif l <= 3.2e+61: tmp = U * U else: tmp = math.pow(U, -3.0) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -5.5e+140) tmp = U ^ -4.0; elseif (l <= -9.5e+28) tmp = Float64(U * U); elseif (l <= -0.95) tmp = U ^ -3.0; elseif (l <= 2.1) tmp = U; elseif (l <= 3.2e+61) tmp = Float64(U * U); else tmp = U ^ -3.0; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -5.5e+140) tmp = U ^ -4.0; elseif (l <= -9.5e+28) tmp = U * U; elseif (l <= -0.95) tmp = U ^ -3.0; elseif (l <= 2.1) tmp = U; elseif (l <= 3.2e+61) tmp = U * U; else tmp = U ^ -3.0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -5.5e+140], N[Power[U, -4.0], $MachinePrecision], If[LessEqual[l, -9.5e+28], N[(U * U), $MachinePrecision], If[LessEqual[l, -0.95], N[Power[U, -3.0], $MachinePrecision], If[LessEqual[l, 2.1], U, If[LessEqual[l, 3.2e+61], N[(U * U), $MachinePrecision], N[Power[U, -3.0], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5.5 \cdot 10^{+140}:\\
\;\;\;\;{U}^{-4}\\
\mathbf{elif}\;\ell \leq -9.5 \cdot 10^{+28}:\\
\;\;\;\;U \cdot U\\
\mathbf{elif}\;\ell \leq -0.95:\\
\;\;\;\;{U}^{-3}\\
\mathbf{elif}\;\ell \leq 2.1:\\
\;\;\;\;U\\
\mathbf{elif}\;\ell \leq 3.2 \cdot 10^{+61}:\\
\;\;\;\;U \cdot U\\
\mathbf{else}:\\
\;\;\;\;{U}^{-3}\\
\end{array}
\end{array}
if l < -5.5e140Initial program 100.0%
Applied egg-rr30.5%
if -5.5e140 < l < -9.49999999999999927e28 or 2.10000000000000009 < l < 3.1999999999999998e61Initial program 100.0%
Applied egg-rr33.4%
if -9.49999999999999927e28 < l < -0.94999999999999996 or 3.1999999999999998e61 < l Initial program 100.0%
Applied egg-rr28.4%
if -0.94999999999999996 < l < 2.10000000000000009Initial program 68.7%
Taylor expanded in J around 0 66.2%
Final simplification48.3%
(FPCore (J l K U) :precision binary64 (+ U (* 2.0 (* J (* l (cos (* K 0.5)))))))
double code(double J, double l, double K, double U) {
return U + (2.0 * (J * (l * cos((K * 0.5)))));
}
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 + (2.0d0 * (j * (l * cos((k * 0.5d0)))))
end function
public static double code(double J, double l, double K, double U) {
return U + (2.0 * (J * (l * Math.cos((K * 0.5)))));
}
def code(J, l, K, U): return U + (2.0 * (J * (l * math.cos((K * 0.5)))))
function code(J, l, K, U) return Float64(U + Float64(2.0 * Float64(J * Float64(l * cos(Float64(K * 0.5)))))) end
function tmp = code(J, l, K, U) tmp = U + (2.0 * (J * (l * cos((K * 0.5))))); end
code[J_, l_, K_, U_] := N[(U + N[(2.0 * N[(J * N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(K \cdot 0.5\right)\right)\right)
\end{array}
Initial program 84.5%
Taylor expanded in l around 0 61.7%
Final simplification61.7%
(FPCore (J l K U) :precision binary64 (if (<= l -2.1e+141) (pow U -4.0) (if (or (<= l -0.95) (not (<= l 2.1))) (* U U) U)))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -2.1e+141) {
tmp = pow(U, -4.0);
} else if ((l <= -0.95) || !(l <= 2.1)) {
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 <= (-2.1d+141)) then
tmp = u ** (-4.0d0)
else if ((l <= (-0.95d0)) .or. (.not. (l <= 2.1d0))) 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 <= -2.1e+141) {
tmp = Math.pow(U, -4.0);
} else if ((l <= -0.95) || !(l <= 2.1)) {
tmp = U * U;
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -2.1e+141: tmp = math.pow(U, -4.0) elif (l <= -0.95) or not (l <= 2.1): tmp = U * U else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -2.1e+141) tmp = U ^ -4.0; elseif ((l <= -0.95) || !(l <= 2.1)) tmp = Float64(U * U); else tmp = U; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -2.1e+141) tmp = U ^ -4.0; elseif ((l <= -0.95) || ~((l <= 2.1))) tmp = U * U; else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -2.1e+141], N[Power[U, -4.0], $MachinePrecision], If[Or[LessEqual[l, -0.95], N[Not[LessEqual[l, 2.1]], $MachinePrecision]], N[(U * U), $MachinePrecision], U]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.1 \cdot 10^{+141}:\\
\;\;\;\;{U}^{-4}\\
\mathbf{elif}\;\ell \leq -0.95 \lor \neg \left(\ell \leq 2.1\right):\\
\;\;\;\;U \cdot U\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if l < -2.0999999999999998e141Initial program 100.0%
Applied egg-rr30.5%
if -2.0999999999999998e141 < l < -0.94999999999999996 or 2.10000000000000009 < l Initial program 100.0%
Applied egg-rr20.2%
if -0.94999999999999996 < l < 2.10000000000000009Initial program 68.7%
Taylor expanded in J around 0 66.2%
Final simplification44.1%
(FPCore (J l K U) :precision binary64 (if (or (<= l -0.95) (not (<= l 2.1))) (* U U) U))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -0.95) || !(l <= 2.1)) {
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 <= (-0.95d0)) .or. (.not. (l <= 2.1d0))) 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 <= -0.95) || !(l <= 2.1)) {
tmp = U * U;
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -0.95) or not (l <= 2.1): tmp = U * U else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -0.95) || !(l <= 2.1)) tmp = Float64(U * U); else tmp = U; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -0.95) || ~((l <= 2.1))) tmp = U * U; else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -0.95], N[Not[LessEqual[l, 2.1]], $MachinePrecision]], N[(U * U), $MachinePrecision], U]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -0.95 \lor \neg \left(\ell \leq 2.1\right):\\
\;\;\;\;U \cdot U\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if l < -0.94999999999999996 or 2.10000000000000009 < l Initial program 100.0%
Applied egg-rr17.8%
if -0.94999999999999996 < l < 2.10000000000000009Initial program 68.7%
Taylor expanded in J around 0 66.2%
Final simplification41.8%
(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 84.5%
Applied egg-rr2.8%
*-inverses2.8%
Simplified2.8%
Final simplification2.8%
(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 84.5%
Taylor expanded in J around 0 34.0%
Final simplification34.0%
herbie shell --seed 2024130
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))