
(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 16 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 (* 2.0 (* l (cos (* K 0.5))))))) U))
double code(double J, double l, double K, double U) {
return (J * log1p(expm1((2.0 * (l * cos((K * 0.5))))))) + U;
}
public static double code(double J, double l, double K, double U) {
return (J * Math.log1p(Math.expm1((2.0 * (l * Math.cos((K * 0.5))))))) + U;
}
def code(J, l, K, U): return (J * math.log1p(math.expm1((2.0 * (l * math.cos((K * 0.5))))))) + U
function code(J, l, K, U) return Float64(Float64(J * log1p(expm1(Float64(2.0 * Float64(l * cos(Float64(K * 0.5))))))) + U) end
code[J_, l_, K_, U_] := N[(N[(J * N[Log[1 + N[(Exp[N[(2.0 * N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
J \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(2 \cdot \left(\ell \cdot \cos \left(K \cdot 0.5\right)\right)\right)\right) + U
\end{array}
Initial program 83.5%
Taylor expanded in l around 0 63.1%
associate-*r*63.1%
Simplified63.1%
Taylor expanded in J around 0 63.1%
*-commutative63.1%
associate-*r*63.1%
*-commutative63.1%
associate-*l*63.1%
*-commutative63.1%
Simplified63.1%
log1p-expm1-u99.5%
*-commutative99.5%
associate-*l*99.5%
*-commutative99.5%
Applied egg-rr99.5%
Final simplification99.5%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (- (exp l) (exp (- l)))))
(if (or (<= t_0 -0.5) (not (<= t_0 2e-13)))
(+ U (* J t_0))
(+ U (* 2.0 (* J (* l (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 <= -0.5) || !(t_0 <= 2e-13)) {
tmp = U + (J * t_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) :: t_0
real(8) :: tmp
t_0 = exp(l) - exp(-l)
if ((t_0 <= (-0.5d0)) .or. (.not. (t_0 <= 2d-13))) then
tmp = u + (j * t_0)
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 t_0 = Math.exp(l) - Math.exp(-l);
double tmp;
if ((t_0 <= -0.5) || !(t_0 <= 2e-13)) {
tmp = U + (J * t_0);
} else {
tmp = U + (2.0 * (J * (l * 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 <= -0.5) or not (t_0 <= 2e-13): tmp = U + (J * t_0) else: tmp = U + (2.0 * (J * (l * 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 <= -0.5) || !(t_0 <= 2e-13)) tmp = Float64(U + Float64(J * t_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) t_0 = exp(l) - exp(-l); tmp = 0.0; if ((t_0 <= -0.5) || ~((t_0 <= 2e-13))) tmp = U + (J * t_0); else tmp = U + (2.0 * (J * (l * 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, -0.5], N[Not[LessEqual[t$95$0, 2e-13]], $MachinePrecision]], N[(U + N[(J * t$95$0), $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}
t_0 := e^{\ell} - e^{-\ell}\\
\mathbf{if}\;t\_0 \leq -0.5 \lor \neg \left(t\_0 \leq 2 \cdot 10^{-13}\right):\\
\;\;\;\;U + J \cdot t\_0\\
\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 (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -0.5 or 2.0000000000000001e-13 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 99.9%
Taylor expanded in K around 0 73.4%
if -0.5 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 2.0000000000000001e-13Initial program 67.1%
Taylor expanded in l around 0 99.9%
Final simplification86.6%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (* (* (pow l 7.0) (* J 0.0003968253968253968)) (cos (* K 0.5)))))
(if (<= l -8e+106)
t_0
(if (<= l -0.086)
(+ U (* J (- (exp l) (exp (- l)))))
(if (<= l 1650.0)
(+
U
(*
(* J (* l (+ 2.0 (* 0.3333333333333333 (pow l 2.0)))))
(cos (/ K 2.0))))
t_0)))))
double code(double J, double l, double K, double U) {
double t_0 = (pow(l, 7.0) * (J * 0.0003968253968253968)) * cos((K * 0.5));
double tmp;
if (l <= -8e+106) {
tmp = t_0;
} else if (l <= -0.086) {
tmp = U + (J * (exp(l) - exp(-l)));
} else if (l <= 1650.0) {
tmp = U + ((J * (l * (2.0 + (0.3333333333333333 * pow(l, 2.0))))) * cos((K / 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 = ((l ** 7.0d0) * (j * 0.0003968253968253968d0)) * cos((k * 0.5d0))
if (l <= (-8d+106)) then
tmp = t_0
else if (l <= (-0.086d0)) then
tmp = u + (j * (exp(l) - exp(-l)))
else if (l <= 1650.0d0) then
tmp = u + ((j * (l * (2.0d0 + (0.3333333333333333d0 * (l ** 2.0d0))))) * cos((k / 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 = (Math.pow(l, 7.0) * (J * 0.0003968253968253968)) * Math.cos((K * 0.5));
double tmp;
if (l <= -8e+106) {
tmp = t_0;
} else if (l <= -0.086) {
tmp = U + (J * (Math.exp(l) - Math.exp(-l)));
} else if (l <= 1650.0) {
tmp = U + ((J * (l * (2.0 + (0.3333333333333333 * Math.pow(l, 2.0))))) * Math.cos((K / 2.0)));
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = (math.pow(l, 7.0) * (J * 0.0003968253968253968)) * math.cos((K * 0.5)) tmp = 0 if l <= -8e+106: tmp = t_0 elif l <= -0.086: tmp = U + (J * (math.exp(l) - math.exp(-l))) elif l <= 1650.0: tmp = U + ((J * (l * (2.0 + (0.3333333333333333 * math.pow(l, 2.0))))) * math.cos((K / 2.0))) else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64(Float64((l ^ 7.0) * Float64(J * 0.0003968253968253968)) * cos(Float64(K * 0.5))) tmp = 0.0 if (l <= -8e+106) tmp = t_0; elseif (l <= -0.086) tmp = Float64(U + Float64(J * Float64(exp(l) - exp(Float64(-l))))); elseif (l <= 1650.0) tmp = Float64(U + Float64(Float64(J * Float64(l * Float64(2.0 + Float64(0.3333333333333333 * (l ^ 2.0))))) * cos(Float64(K / 2.0)))); else tmp = t_0; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = ((l ^ 7.0) * (J * 0.0003968253968253968)) * cos((K * 0.5)); tmp = 0.0; if (l <= -8e+106) tmp = t_0; elseif (l <= -0.086) tmp = U + (J * (exp(l) - exp(-l))); elseif (l <= 1650.0) tmp = U + ((J * (l * (2.0 + (0.3333333333333333 * (l ^ 2.0))))) * cos((K / 2.0))); else tmp = t_0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[(N[Power[l, 7.0], $MachinePrecision] * N[(J * 0.0003968253968253968), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -8e+106], t$95$0, If[LessEqual[l, -0.086], N[(U + N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1650.0], N[(U + N[(N[(J * N[(l * N[(2.0 + N[(0.3333333333333333 * N[Power[l, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left({\ell}^{7} \cdot \left(J \cdot 0.0003968253968253968\right)\right) \cdot \cos \left(K \cdot 0.5\right)\\
\mathbf{if}\;\ell \leq -8 \cdot 10^{+106}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq -0.086:\\
\;\;\;\;U + J \cdot \left(e^{\ell} - e^{-\ell}\right)\\
\mathbf{elif}\;\ell \leq 1650:\\
\;\;\;\;U + \left(J \cdot \left(\ell \cdot \left(2 + 0.3333333333333333 \cdot {\ell}^{2}\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if l < -8.00000000000000073e106 or 1650 < l Initial program 100.0%
associate-*l*100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in l around 0 94.1%
distribute-lft-in94.1%
fma-define94.1%
*-commutative94.1%
*-commutative94.1%
associate-*l*94.1%
Simplified94.1%
Taylor expanded in l around inf 94.1%
*-commutative94.1%
associate-*r*94.1%
associate-*l*94.1%
*-commutative94.1%
associate-*r*94.1%
associate-*r*94.1%
*-commutative94.1%
Simplified94.1%
if -8.00000000000000073e106 < l < -0.085999999999999993Initial program 100.0%
Taylor expanded in K around 0 88.5%
if -0.085999999999999993 < l < 1650Initial program 67.8%
Taylor expanded in l around 0 99.1%
Final simplification96.1%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (+ U (* J (- (exp l) (exp (- l))))))
(t_1 (cos (* K 0.5)))
(t_2 (* (* (pow l 7.0) (* J 0.0003968253968253968)) t_1)))
(if (<= l -8e+106)
t_2
(if (<= l -0.00185)
t_0
(if (<= l 0.00125)
(+ U (* 2.0 (* J (* l t_1))))
(if (<= l 170000000000.0) t_0 t_2))))))
double code(double J, double l, double K, double U) {
double t_0 = U + (J * (exp(l) - exp(-l)));
double t_1 = cos((K * 0.5));
double t_2 = (pow(l, 7.0) * (J * 0.0003968253968253968)) * t_1;
double tmp;
if (l <= -8e+106) {
tmp = t_2;
} else if (l <= -0.00185) {
tmp = t_0;
} else if (l <= 0.00125) {
tmp = U + (2.0 * (J * (l * t_1)));
} else if (l <= 170000000000.0) {
tmp = t_0;
} else {
tmp = t_2;
}
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) :: t_2
real(8) :: tmp
t_0 = u + (j * (exp(l) - exp(-l)))
t_1 = cos((k * 0.5d0))
t_2 = ((l ** 7.0d0) * (j * 0.0003968253968253968d0)) * t_1
if (l <= (-8d+106)) then
tmp = t_2
else if (l <= (-0.00185d0)) then
tmp = t_0
else if (l <= 0.00125d0) then
tmp = u + (2.0d0 * (j * (l * t_1)))
else if (l <= 170000000000.0d0) then
tmp = t_0
else
tmp = t_2
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = U + (J * (Math.exp(l) - Math.exp(-l)));
double t_1 = Math.cos((K * 0.5));
double t_2 = (Math.pow(l, 7.0) * (J * 0.0003968253968253968)) * t_1;
double tmp;
if (l <= -8e+106) {
tmp = t_2;
} else if (l <= -0.00185) {
tmp = t_0;
} else if (l <= 0.00125) {
tmp = U + (2.0 * (J * (l * t_1)));
} else if (l <= 170000000000.0) {
tmp = t_0;
} else {
tmp = t_2;
}
return tmp;
}
def code(J, l, K, U): t_0 = U + (J * (math.exp(l) - math.exp(-l))) t_1 = math.cos((K * 0.5)) t_2 = (math.pow(l, 7.0) * (J * 0.0003968253968253968)) * t_1 tmp = 0 if l <= -8e+106: tmp = t_2 elif l <= -0.00185: tmp = t_0 elif l <= 0.00125: tmp = U + (2.0 * (J * (l * t_1))) elif l <= 170000000000.0: tmp = t_0 else: tmp = t_2 return tmp
function code(J, l, K, U) t_0 = Float64(U + Float64(J * Float64(exp(l) - exp(Float64(-l))))) t_1 = cos(Float64(K * 0.5)) t_2 = Float64(Float64((l ^ 7.0) * Float64(J * 0.0003968253968253968)) * t_1) tmp = 0.0 if (l <= -8e+106) tmp = t_2; elseif (l <= -0.00185) tmp = t_0; elseif (l <= 0.00125) tmp = Float64(U + Float64(2.0 * Float64(J * Float64(l * t_1)))); elseif (l <= 170000000000.0) tmp = t_0; else tmp = t_2; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U + (J * (exp(l) - exp(-l))); t_1 = cos((K * 0.5)); t_2 = ((l ^ 7.0) * (J * 0.0003968253968253968)) * t_1; tmp = 0.0; if (l <= -8e+106) tmp = t_2; elseif (l <= -0.00185) tmp = t_0; elseif (l <= 0.00125) tmp = U + (2.0 * (J * (l * t_1))); elseif (l <= 170000000000.0) tmp = t_0; else tmp = t_2; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Power[l, 7.0], $MachinePrecision] * N[(J * 0.0003968253968253968), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]}, If[LessEqual[l, -8e+106], t$95$2, If[LessEqual[l, -0.00185], t$95$0, If[LessEqual[l, 0.00125], N[(U + N[(2.0 * N[(J * N[(l * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 170000000000.0], t$95$0, t$95$2]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + J \cdot \left(e^{\ell} - e^{-\ell}\right)\\
t_1 := \cos \left(K \cdot 0.5\right)\\
t_2 := \left({\ell}^{7} \cdot \left(J \cdot 0.0003968253968253968\right)\right) \cdot t\_1\\
\mathbf{if}\;\ell \leq -8 \cdot 10^{+106}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;\ell \leq -0.00185:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq 0.00125:\\
\;\;\;\;U + 2 \cdot \left(J \cdot \left(\ell \cdot t\_1\right)\right)\\
\mathbf{elif}\;\ell \leq 170000000000:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if l < -8.00000000000000073e106 or 1.7e11 < l Initial program 100.0%
associate-*l*100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in l around 0 98.0%
distribute-lft-in98.0%
fma-define98.0%
*-commutative98.0%
*-commutative98.0%
associate-*l*98.0%
Simplified98.0%
Taylor expanded in l around inf 98.0%
*-commutative98.0%
associate-*r*98.0%
associate-*l*98.0%
*-commutative98.0%
associate-*r*98.0%
associate-*r*98.0%
*-commutative98.0%
Simplified98.0%
if -8.00000000000000073e106 < l < -0.0018500000000000001 or 0.00125000000000000003 < l < 1.7e11Initial program 99.7%
Taylor expanded in K around 0 87.5%
if -0.0018500000000000001 < l < 0.00125000000000000003Initial program 67.1%
Taylor expanded in l around 0 99.9%
Final simplification97.6%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (* K 0.5)))
(t_1 (* U (+ 1.0 (* 2.0 (* J (* l (/ t_0 U))))))))
(if (<= l -6.2e+143)
t_1
(if (<= l -620.0)
(log1p (expm1 U))
(if (<= l 820000000.0)
(+ U (* 2.0 (* J (* l t_0))))
(if (<= l 3.3e+120)
(+ U (* J (* l (+ 2.0 (* (pow K 2.0) -0.25)))))
t_1))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K * 0.5));
double t_1 = U * (1.0 + (2.0 * (J * (l * (t_0 / U)))));
double tmp;
if (l <= -6.2e+143) {
tmp = t_1;
} else if (l <= -620.0) {
tmp = log1p(expm1(U));
} else if (l <= 820000000.0) {
tmp = U + (2.0 * (J * (l * t_0)));
} else if (l <= 3.3e+120) {
tmp = U + (J * (l * (2.0 + (pow(K, 2.0) * -0.25))));
} else {
tmp = t_1;
}
return tmp;
}
public static double code(double J, double l, double K, double U) {
double t_0 = Math.cos((K * 0.5));
double t_1 = U * (1.0 + (2.0 * (J * (l * (t_0 / U)))));
double tmp;
if (l <= -6.2e+143) {
tmp = t_1;
} else if (l <= -620.0) {
tmp = Math.log1p(Math.expm1(U));
} else if (l <= 820000000.0) {
tmp = U + (2.0 * (J * (l * t_0)));
} else if (l <= 3.3e+120) {
tmp = U + (J * (l * (2.0 + (Math.pow(K, 2.0) * -0.25))));
} else {
tmp = t_1;
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K * 0.5)) t_1 = U * (1.0 + (2.0 * (J * (l * (t_0 / U))))) tmp = 0 if l <= -6.2e+143: tmp = t_1 elif l <= -620.0: tmp = math.log1p(math.expm1(U)) elif l <= 820000000.0: tmp = U + (2.0 * (J * (l * t_0))) elif l <= 3.3e+120: tmp = U + (J * (l * (2.0 + (math.pow(K, 2.0) * -0.25)))) else: tmp = t_1 return tmp
function code(J, l, K, U) t_0 = cos(Float64(K * 0.5)) t_1 = Float64(U * Float64(1.0 + Float64(2.0 * Float64(J * Float64(l * Float64(t_0 / U)))))) tmp = 0.0 if (l <= -6.2e+143) tmp = t_1; elseif (l <= -620.0) tmp = log1p(expm1(U)); elseif (l <= 820000000.0) tmp = Float64(U + Float64(2.0 * Float64(J * Float64(l * t_0)))); elseif (l <= 3.3e+120) tmp = Float64(U + Float64(J * Float64(l * Float64(2.0 + Float64((K ^ 2.0) * -0.25))))); else tmp = t_1; end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(U * N[(1.0 + N[(2.0 * N[(J * N[(l * N[(t$95$0 / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -6.2e+143], t$95$1, If[LessEqual[l, -620.0], N[Log[1 + N[(Exp[U] - 1), $MachinePrecision]], $MachinePrecision], If[LessEqual[l, 820000000.0], N[(U + N[(2.0 * N[(J * N[(l * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 3.3e+120], N[(U + N[(J * N[(l * N[(2.0 + N[(N[Power[K, 2.0], $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(K \cdot 0.5\right)\\
t_1 := U \cdot \left(1 + 2 \cdot \left(J \cdot \left(\ell \cdot \frac{t\_0}{U}\right)\right)\right)\\
\mathbf{if}\;\ell \leq -6.2 \cdot 10^{+143}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\ell \leq -620:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(U\right)\right)\\
\mathbf{elif}\;\ell \leq 820000000:\\
\;\;\;\;U + 2 \cdot \left(J \cdot \left(\ell \cdot t\_0\right)\right)\\
\mathbf{elif}\;\ell \leq 3.3 \cdot 10^{+120}:\\
\;\;\;\;U + J \cdot \left(\ell \cdot \left(2 + {K}^{2} \cdot -0.25\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if l < -6.1999999999999998e143 or 3.29999999999999991e120 < l Initial program 100.0%
associate-*l*100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in l around 0 100.0%
distribute-lft-in100.0%
fma-define100.0%
*-commutative100.0%
*-commutative100.0%
associate-*l*100.0%
Simplified100.0%
Taylor expanded in U around inf 100.0%
+-commutative100.0%
associate-/l*100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in l around 0 49.8%
associate-/l*71.4%
associate-/l*71.4%
Simplified71.4%
if -6.1999999999999998e143 < l < -620Initial program 100.0%
associate-*l*100.0%
fma-define100.0%
Simplified100.0%
Applied egg-rr47.7%
if -620 < l < 8.2e8Initial program 68.8%
Taylor expanded in l around 0 96.1%
if 8.2e8 < l < 3.29999999999999991e120Initial program 100.0%
Taylor expanded in l around 0 8.4%
associate-*r*8.4%
Simplified8.4%
Taylor expanded in J around 0 8.4%
*-commutative8.4%
associate-*r*8.4%
*-commutative8.4%
associate-*l*8.4%
*-commutative8.4%
Simplified8.4%
Taylor expanded in K around 0 46.3%
associate-*r*46.3%
distribute-rgt-out46.3%
*-commutative46.3%
Simplified46.3%
Final simplification79.3%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (+ 2.0 (* (pow K 2.0) -0.25)))
(t_1 (* U (+ 1.0 (* 2.0 (* J (/ l U)))))))
(if (<= l -1e+17)
t_1
(if (<= l 800000000.0)
(+ U (* 2.0 (* J (* l (cos (* K 0.5))))))
(if (<= l 2.15e+125)
(+ U (* J (* l t_0)))
(if (or (<= l 3.2e+195) (not (<= l 1.75e+289)))
t_1
(+ U (* (* J l) t_0))))))))
double code(double J, double l, double K, double U) {
double t_0 = 2.0 + (pow(K, 2.0) * -0.25);
double t_1 = U * (1.0 + (2.0 * (J * (l / U))));
double tmp;
if (l <= -1e+17) {
tmp = t_1;
} else if (l <= 800000000.0) {
tmp = U + (2.0 * (J * (l * cos((K * 0.5)))));
} else if (l <= 2.15e+125) {
tmp = U + (J * (l * t_0));
} else if ((l <= 3.2e+195) || !(l <= 1.75e+289)) {
tmp = t_1;
} else {
tmp = U + ((J * l) * t_0);
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 2.0d0 + ((k ** 2.0d0) * (-0.25d0))
t_1 = u * (1.0d0 + (2.0d0 * (j * (l / u))))
if (l <= (-1d+17)) then
tmp = t_1
else if (l <= 800000000.0d0) then
tmp = u + (2.0d0 * (j * (l * cos((k * 0.5d0)))))
else if (l <= 2.15d+125) then
tmp = u + (j * (l * t_0))
else if ((l <= 3.2d+195) .or. (.not. (l <= 1.75d+289))) then
tmp = t_1
else
tmp = u + ((j * l) * t_0)
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = 2.0 + (Math.pow(K, 2.0) * -0.25);
double t_1 = U * (1.0 + (2.0 * (J * (l / U))));
double tmp;
if (l <= -1e+17) {
tmp = t_1;
} else if (l <= 800000000.0) {
tmp = U + (2.0 * (J * (l * Math.cos((K * 0.5)))));
} else if (l <= 2.15e+125) {
tmp = U + (J * (l * t_0));
} else if ((l <= 3.2e+195) || !(l <= 1.75e+289)) {
tmp = t_1;
} else {
tmp = U + ((J * l) * t_0);
}
return tmp;
}
def code(J, l, K, U): t_0 = 2.0 + (math.pow(K, 2.0) * -0.25) t_1 = U * (1.0 + (2.0 * (J * (l / U)))) tmp = 0 if l <= -1e+17: tmp = t_1 elif l <= 800000000.0: tmp = U + (2.0 * (J * (l * math.cos((K * 0.5))))) elif l <= 2.15e+125: tmp = U + (J * (l * t_0)) elif (l <= 3.2e+195) or not (l <= 1.75e+289): tmp = t_1 else: tmp = U + ((J * l) * t_0) return tmp
function code(J, l, K, U) t_0 = Float64(2.0 + Float64((K ^ 2.0) * -0.25)) t_1 = Float64(U * Float64(1.0 + Float64(2.0 * Float64(J * Float64(l / U))))) tmp = 0.0 if (l <= -1e+17) tmp = t_1; elseif (l <= 800000000.0) tmp = Float64(U + Float64(2.0 * Float64(J * Float64(l * cos(Float64(K * 0.5)))))); elseif (l <= 2.15e+125) tmp = Float64(U + Float64(J * Float64(l * t_0))); elseif ((l <= 3.2e+195) || !(l <= 1.75e+289)) tmp = t_1; else tmp = Float64(U + Float64(Float64(J * l) * t_0)); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = 2.0 + ((K ^ 2.0) * -0.25); t_1 = U * (1.0 + (2.0 * (J * (l / U)))); tmp = 0.0; if (l <= -1e+17) tmp = t_1; elseif (l <= 800000000.0) tmp = U + (2.0 * (J * (l * cos((K * 0.5))))); elseif (l <= 2.15e+125) tmp = U + (J * (l * t_0)); elseif ((l <= 3.2e+195) || ~((l <= 1.75e+289))) tmp = t_1; else tmp = U + ((J * l) * t_0); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(2.0 + N[(N[Power[K, 2.0], $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(U * N[(1.0 + N[(2.0 * N[(J * N[(l / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -1e+17], t$95$1, If[LessEqual[l, 800000000.0], N[(U + N[(2.0 * N[(J * N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.15e+125], N[(U + N[(J * N[(l * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[l, 3.2e+195], N[Not[LessEqual[l, 1.75e+289]], $MachinePrecision]], t$95$1, N[(U + N[(N[(J * l), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 2 + {K}^{2} \cdot -0.25\\
t_1 := U \cdot \left(1 + 2 \cdot \left(J \cdot \frac{\ell}{U}\right)\right)\\
\mathbf{if}\;\ell \leq -1 \cdot 10^{+17}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\ell \leq 800000000:\\
\;\;\;\;U + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{elif}\;\ell \leq 2.15 \cdot 10^{+125}:\\
\;\;\;\;U + J \cdot \left(\ell \cdot t\_0\right)\\
\mathbf{elif}\;\ell \leq 3.2 \cdot 10^{+195} \lor \neg \left(\ell \leq 1.75 \cdot 10^{+289}\right):\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;U + \left(J \cdot \ell\right) \cdot t\_0\\
\end{array}
\end{array}
if l < -1e17 or 2.15000000000000018e125 < l < 3.19999999999999982e195 or 1.75000000000000011e289 < l Initial program 100.0%
Taylor expanded in l around 0 31.7%
associate-*r*31.7%
Simplified31.7%
Taylor expanded in K around 0 26.2%
associate-*r*26.2%
Simplified26.2%
Taylor expanded in U around inf 35.8%
associate-/l*53.4%
Simplified53.4%
if -1e17 < l < 8e8Initial program 69.9%
Taylor expanded in l around 0 92.8%
if 8e8 < l < 2.15000000000000018e125Initial program 100.0%
Taylor expanded in l around 0 12.0%
associate-*r*12.0%
Simplified12.0%
Taylor expanded in J around 0 12.0%
*-commutative12.0%
associate-*r*12.0%
*-commutative12.0%
associate-*l*12.0%
*-commutative12.0%
Simplified12.0%
Taylor expanded in K around 0 48.9%
associate-*r*48.9%
distribute-rgt-out48.9%
*-commutative48.9%
Simplified48.9%
if 3.19999999999999982e195 < l < 1.75000000000000011e289Initial program 100.0%
Taylor expanded in l around 0 27.9%
associate-*r*27.9%
Simplified27.9%
Taylor expanded in K around 0 32.9%
+-commutative32.9%
*-commutative32.9%
*-commutative32.9%
associate-*r*26.7%
associate-*l*26.7%
*-commutative26.7%
associate-*l*26.7%
distribute-lft-out51.7%
Simplified51.7%
Final simplification74.4%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (* U (+ 1.0 (* 2.0 (* J (/ l U)))))))
(if (<= l -5e+16)
t_0
(if (<= l 800000000.0)
(+ U (* 2.0 (* J (* l (cos (* K 0.5))))))
(if (<= l 3.8e+124)
(+ U (* J (* l (+ 2.0 (* (pow K 2.0) -0.25)))))
t_0)))))
double code(double J, double l, double K, double U) {
double t_0 = U * (1.0 + (2.0 * (J * (l / U))));
double tmp;
if (l <= -5e+16) {
tmp = t_0;
} else if (l <= 800000000.0) {
tmp = U + (2.0 * (J * (l * cos((K * 0.5)))));
} else if (l <= 3.8e+124) {
tmp = U + (J * (l * (2.0 + (pow(K, 2.0) * -0.25))));
} 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 * (1.0d0 + (2.0d0 * (j * (l / u))))
if (l <= (-5d+16)) then
tmp = t_0
else if (l <= 800000000.0d0) then
tmp = u + (2.0d0 * (j * (l * cos((k * 0.5d0)))))
else if (l <= 3.8d+124) then
tmp = u + (j * (l * (2.0d0 + ((k ** 2.0d0) * (-0.25d0)))))
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 * (1.0 + (2.0 * (J * (l / U))));
double tmp;
if (l <= -5e+16) {
tmp = t_0;
} else if (l <= 800000000.0) {
tmp = U + (2.0 * (J * (l * Math.cos((K * 0.5)))));
} else if (l <= 3.8e+124) {
tmp = U + (J * (l * (2.0 + (Math.pow(K, 2.0) * -0.25))));
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = U * (1.0 + (2.0 * (J * (l / U)))) tmp = 0 if l <= -5e+16: tmp = t_0 elif l <= 800000000.0: tmp = U + (2.0 * (J * (l * math.cos((K * 0.5))))) elif l <= 3.8e+124: tmp = U + (J * (l * (2.0 + (math.pow(K, 2.0) * -0.25)))) else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64(U * Float64(1.0 + Float64(2.0 * Float64(J * Float64(l / U))))) tmp = 0.0 if (l <= -5e+16) tmp = t_0; elseif (l <= 800000000.0) tmp = Float64(U + Float64(2.0 * Float64(J * Float64(l * cos(Float64(K * 0.5)))))); elseif (l <= 3.8e+124) tmp = Float64(U + Float64(J * Float64(l * Float64(2.0 + Float64((K ^ 2.0) * -0.25))))); else tmp = t_0; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U * (1.0 + (2.0 * (J * (l / U)))); tmp = 0.0; if (l <= -5e+16) tmp = t_0; elseif (l <= 800000000.0) tmp = U + (2.0 * (J * (l * cos((K * 0.5))))); elseif (l <= 3.8e+124) tmp = U + (J * (l * (2.0 + ((K ^ 2.0) * -0.25)))); else tmp = t_0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U * N[(1.0 + N[(2.0 * N[(J * N[(l / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -5e+16], t$95$0, If[LessEqual[l, 800000000.0], N[(U + N[(2.0 * N[(J * N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 3.8e+124], N[(U + N[(J * N[(l * N[(2.0 + N[(N[Power[K, 2.0], $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U \cdot \left(1 + 2 \cdot \left(J \cdot \frac{\ell}{U}\right)\right)\\
\mathbf{if}\;\ell \leq -5 \cdot 10^{+16}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq 800000000:\\
\;\;\;\;U + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{elif}\;\ell \leq 3.8 \cdot 10^{+124}:\\
\;\;\;\;U + J \cdot \left(\ell \cdot \left(2 + {K}^{2} \cdot -0.25\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if l < -5e16 or 3.7999999999999998e124 < l Initial program 100.0%
Taylor expanded in l around 0 31.1%
associate-*r*31.1%
Simplified31.1%
Taylor expanded in K around 0 24.2%
associate-*r*24.2%
Simplified24.2%
Taylor expanded in U around inf 33.2%
associate-/l*47.8%
Simplified47.8%
if -5e16 < l < 8e8Initial program 69.9%
Taylor expanded in l around 0 92.8%
if 8e8 < l < 3.7999999999999998e124Initial program 100.0%
Taylor expanded in l around 0 12.0%
associate-*r*12.0%
Simplified12.0%
Taylor expanded in J around 0 12.0%
*-commutative12.0%
associate-*r*12.0%
*-commutative12.0%
associate-*l*12.0%
*-commutative12.0%
Simplified12.0%
Taylor expanded in K around 0 48.9%
associate-*r*48.9%
distribute-rgt-out48.9%
*-commutative48.9%
Simplified48.9%
Final simplification72.5%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (* U (+ 1.0 (* 2.0 (* J (/ l U)))))))
(if (<= l -5e+16)
t_0
(if (<= l 800000000.0)
(+ U (* 2.0 (* J (* l (cos (* K 0.5))))))
(if (<= l 2.75e+124) (+ U (- (* J 8.0) (* J (pow K 2.0)))) t_0)))))
double code(double J, double l, double K, double U) {
double t_0 = U * (1.0 + (2.0 * (J * (l / U))));
double tmp;
if (l <= -5e+16) {
tmp = t_0;
} else if (l <= 800000000.0) {
tmp = U + (2.0 * (J * (l * cos((K * 0.5)))));
} else if (l <= 2.75e+124) {
tmp = U + ((J * 8.0) - (J * pow(K, 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 * (1.0d0 + (2.0d0 * (j * (l / u))))
if (l <= (-5d+16)) then
tmp = t_0
else if (l <= 800000000.0d0) then
tmp = u + (2.0d0 * (j * (l * cos((k * 0.5d0)))))
else if (l <= 2.75d+124) then
tmp = u + ((j * 8.0d0) - (j * (k ** 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 * (1.0 + (2.0 * (J * (l / U))));
double tmp;
if (l <= -5e+16) {
tmp = t_0;
} else if (l <= 800000000.0) {
tmp = U + (2.0 * (J * (l * Math.cos((K * 0.5)))));
} else if (l <= 2.75e+124) {
tmp = U + ((J * 8.0) - (J * Math.pow(K, 2.0)));
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = U * (1.0 + (2.0 * (J * (l / U)))) tmp = 0 if l <= -5e+16: tmp = t_0 elif l <= 800000000.0: tmp = U + (2.0 * (J * (l * math.cos((K * 0.5))))) elif l <= 2.75e+124: tmp = U + ((J * 8.0) - (J * math.pow(K, 2.0))) else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64(U * Float64(1.0 + Float64(2.0 * Float64(J * Float64(l / U))))) tmp = 0.0 if (l <= -5e+16) tmp = t_0; elseif (l <= 800000000.0) tmp = Float64(U + Float64(2.0 * Float64(J * Float64(l * cos(Float64(K * 0.5)))))); elseif (l <= 2.75e+124) tmp = Float64(U + Float64(Float64(J * 8.0) - Float64(J * (K ^ 2.0)))); else tmp = t_0; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U * (1.0 + (2.0 * (J * (l / U)))); tmp = 0.0; if (l <= -5e+16) tmp = t_0; elseif (l <= 800000000.0) tmp = U + (2.0 * (J * (l * cos((K * 0.5))))); elseif (l <= 2.75e+124) tmp = U + ((J * 8.0) - (J * (K ^ 2.0))); else tmp = t_0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U * N[(1.0 + N[(2.0 * N[(J * N[(l / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -5e+16], t$95$0, If[LessEqual[l, 800000000.0], N[(U + N[(2.0 * N[(J * N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.75e+124], N[(U + N[(N[(J * 8.0), $MachinePrecision] - N[(J * N[Power[K, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U \cdot \left(1 + 2 \cdot \left(J \cdot \frac{\ell}{U}\right)\right)\\
\mathbf{if}\;\ell \leq -5 \cdot 10^{+16}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq 800000000:\\
\;\;\;\;U + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{elif}\;\ell \leq 2.75 \cdot 10^{+124}:\\
\;\;\;\;U + \left(J \cdot 8 - J \cdot {K}^{2}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if l < -5e16 or 2.74999999999999989e124 < l Initial program 100.0%
Taylor expanded in l around 0 31.1%
associate-*r*31.1%
Simplified31.1%
Taylor expanded in K around 0 24.2%
associate-*r*24.2%
Simplified24.2%
Taylor expanded in U around inf 33.2%
associate-/l*47.8%
Simplified47.8%
if -5e16 < l < 8e8Initial program 69.9%
Taylor expanded in l around 0 92.8%
if 8e8 < l < 2.74999999999999989e124Initial program 100.0%
Applied egg-rr3.4%
Taylor expanded in K around 0 36.5%
associate-*r*36.5%
+-commutative36.5%
associate-*r*36.5%
mul-1-neg36.5%
unsub-neg36.5%
*-commutative36.5%
Simplified36.5%
Final simplification71.4%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) 0.36) (* J (+ (* 2.0 l) (/ U J))) (* U (+ 1.0 (* 2.0 (* J (/ l U)))))))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= 0.36) {
tmp = J * ((2.0 * l) + (U / J));
} else {
tmp = U * (1.0 + (2.0 * (J * (l / 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 (cos((k / 2.0d0)) <= 0.36d0) then
tmp = j * ((2.0d0 * l) + (u / j))
else
tmp = u * (1.0d0 + (2.0d0 * (j * (l / u))))
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.36) {
tmp = J * ((2.0 * l) + (U / J));
} else {
tmp = U * (1.0 + (2.0 * (J * (l / U))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if math.cos((K / 2.0)) <= 0.36: tmp = J * ((2.0 * l) + (U / J)) else: tmp = U * (1.0 + (2.0 * (J * (l / U)))) return tmp
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= 0.36) tmp = Float64(J * Float64(Float64(2.0 * l) + Float64(U / J))); else tmp = Float64(U * Float64(1.0 + Float64(2.0 * Float64(J * Float64(l / U))))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (cos((K / 2.0)) <= 0.36) tmp = J * ((2.0 * l) + (U / J)); else tmp = U * (1.0 + (2.0 * (J * (l / U)))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], 0.36], N[(J * N[(N[(2.0 * l), $MachinePrecision] + N[(U / J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U * N[(1.0 + N[(2.0 * N[(J * N[(l / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq 0.36:\\
\;\;\;\;J \cdot \left(2 \cdot \ell + \frac{U}{J}\right)\\
\mathbf{else}:\\
\;\;\;\;U \cdot \left(1 + 2 \cdot \left(J \cdot \frac{\ell}{U}\right)\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.35999999999999999Initial program 84.6%
Taylor expanded in l around 0 61.3%
associate-*r*61.3%
Simplified61.3%
Taylor expanded in K around 0 35.5%
associate-*r*35.5%
Simplified35.5%
Taylor expanded in J around inf 42.6%
if 0.35999999999999999 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 83.0%
Taylor expanded in l around 0 63.9%
associate-*r*63.9%
Simplified63.9%
Taylor expanded in K around 0 58.9%
associate-*r*58.9%
Simplified58.9%
Taylor expanded in U around inf 61.3%
associate-/l*68.9%
Simplified68.9%
Final simplification60.8%
(FPCore (J l K U) :precision binary64 (* U (+ 1.0 (* 2.0 (* J (* l (/ (cos (* K 0.5)) U)))))))
double code(double J, double l, double K, double U) {
return U * (1.0 + (2.0 * (J * (l * (cos((K * 0.5)) / 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 * (1.0d0 + (2.0d0 * (j * (l * (cos((k * 0.5d0)) / u)))))
end function
public static double code(double J, double l, double K, double U) {
return U * (1.0 + (2.0 * (J * (l * (Math.cos((K * 0.5)) / U)))));
}
def code(J, l, K, U): return U * (1.0 + (2.0 * (J * (l * (math.cos((K * 0.5)) / U)))))
function code(J, l, K, U) return Float64(U * Float64(1.0 + Float64(2.0 * Float64(J * Float64(l * Float64(cos(Float64(K * 0.5)) / U)))))) end
function tmp = code(J, l, K, U) tmp = U * (1.0 + (2.0 * (J * (l * (cos((K * 0.5)) / U))))); end
code[J_, l_, K_, U_] := N[(U * N[(1.0 + N[(2.0 * N[(J * N[(l * N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U \cdot \left(1 + 2 \cdot \left(J \cdot \left(\ell \cdot \frac{\cos \left(K \cdot 0.5\right)}{U}\right)\right)\right)
\end{array}
Initial program 83.5%
associate-*l*83.5%
fma-define83.5%
Simplified83.5%
Taylor expanded in l around 0 93.8%
distribute-lft-in93.8%
fma-define93.8%
*-commutative93.8%
*-commutative93.8%
associate-*l*93.8%
Simplified93.8%
Taylor expanded in U around inf 91.9%
+-commutative91.9%
associate-/l*92.6%
fma-define92.6%
Simplified92.6%
Taylor expanded in l around 0 65.6%
associate-/l*71.6%
associate-/l*71.6%
Simplified71.6%
Final simplification71.6%
(FPCore (J l K U) :precision binary64 (if (or (<= J -6.2e+150) (not (<= J 1e+159))) (* J (* 2.0 l)) U))
double code(double J, double l, double K, double U) {
double tmp;
if ((J <= -6.2e+150) || !(J <= 1e+159)) {
tmp = J * (2.0 * l);
} 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 ((j <= (-6.2d+150)) .or. (.not. (j <= 1d+159))) then
tmp = j * (2.0d0 * l)
else
tmp = u
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((J <= -6.2e+150) || !(J <= 1e+159)) {
tmp = J * (2.0 * l);
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (J <= -6.2e+150) or not (J <= 1e+159): tmp = J * (2.0 * l) else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if ((J <= -6.2e+150) || !(J <= 1e+159)) tmp = Float64(J * Float64(2.0 * l)); else tmp = U; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((J <= -6.2e+150) || ~((J <= 1e+159))) tmp = J * (2.0 * l); else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[J, -6.2e+150], N[Not[LessEqual[J, 1e+159]], $MachinePrecision]], N[(J * N[(2.0 * l), $MachinePrecision]), $MachinePrecision], U]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;J \leq -6.2 \cdot 10^{+150} \lor \neg \left(J \leq 10^{+159}\right):\\
\;\;\;\;J \cdot \left(2 \cdot \ell\right)\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if J < -6.20000000000000028e150 or 9.9999999999999993e158 < J Initial program 63.4%
Taylor expanded in l around 0 85.3%
associate-*r*85.3%
Simplified85.3%
Taylor expanded in K around 0 57.8%
associate-*r*57.8%
Simplified57.8%
Taylor expanded in J around inf 50.0%
*-commutative50.0%
associate-*r*50.0%
*-commutative50.0%
Simplified50.0%
if -6.20000000000000028e150 < J < 9.9999999999999993e158Initial program 89.8%
associate-*l*89.8%
fma-define89.8%
Simplified89.8%
Taylor expanded in J around 0 42.2%
Final simplification44.0%
(FPCore (J l K U) :precision binary64 (if (<= l 95000000.0) (+ U (* l (* J 2.0))) (* J (+ (* 2.0 l) (/ U J)))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= 95000000.0) {
tmp = U + (l * (J * 2.0));
} else {
tmp = J * ((2.0 * l) + (U / 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 <= 95000000.0d0) then
tmp = u + (l * (j * 2.0d0))
else
tmp = j * ((2.0d0 * l) + (u / j))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= 95000000.0) {
tmp = U + (l * (J * 2.0));
} else {
tmp = J * ((2.0 * l) + (U / J));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= 95000000.0: tmp = U + (l * (J * 2.0)) else: tmp = J * ((2.0 * l) + (U / J)) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= 95000000.0) tmp = Float64(U + Float64(l * Float64(J * 2.0))); else tmp = Float64(J * Float64(Float64(2.0 * l) + Float64(U / J))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= 95000000.0) tmp = U + (l * (J * 2.0)); else tmp = J * ((2.0 * l) + (U / J)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, 95000000.0], N[(U + N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(J * N[(N[(2.0 * l), $MachinePrecision] + N[(U / J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 95000000:\\
\;\;\;\;U + \ell \cdot \left(J \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;J \cdot \left(2 \cdot \ell + \frac{U}{J}\right)\\
\end{array}
\end{array}
if l < 9.5e7Initial program 78.0%
Taylor expanded in l around 0 75.4%
associate-*r*75.4%
Simplified75.4%
Taylor expanded in K around 0 62.4%
associate-*r*62.4%
Simplified62.4%
if 9.5e7 < l Initial program 100.0%
Taylor expanded in l around 0 26.2%
associate-*r*26.2%
Simplified26.2%
Taylor expanded in K around 0 19.4%
associate-*r*19.4%
Simplified19.4%
Taylor expanded in J around inf 31.1%
Final simplification54.6%
(FPCore (J l K U) :precision binary64 (if (or (<= l -3.4e+34) (not (<= l 95000000.0))) (* U U) U))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -3.4e+34) || !(l <= 95000000.0)) {
tmp = U * U;
} else {
tmp = U;
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if ((l <= (-3.4d+34)) .or. (.not. (l <= 95000000.0d0))) then
tmp = u * u
else
tmp = u
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -3.4e+34) || !(l <= 95000000.0)) {
tmp = U * U;
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -3.4e+34) or not (l <= 95000000.0): tmp = U * U else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -3.4e+34) || !(l <= 95000000.0)) tmp = Float64(U * U); else tmp = U; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -3.4e+34) || ~((l <= 95000000.0))) tmp = U * U; else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -3.4e+34], N[Not[LessEqual[l, 95000000.0]], $MachinePrecision]], N[(U * U), $MachinePrecision], U]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -3.4 \cdot 10^{+34} \lor \neg \left(\ell \leq 95000000\right):\\
\;\;\;\;U \cdot U\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if l < -3.3999999999999999e34 or 9.5e7 < l Initial program 100.0%
associate-*l*100.0%
fma-define100.0%
Simplified100.0%
Applied egg-rr15.7%
if -3.3999999999999999e34 < l < 9.5e7Initial program 70.7%
associate-*l*70.7%
fma-define70.7%
Simplified70.7%
Taylor expanded in J around 0 60.0%
Final simplification40.6%
(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}
Initial program 83.5%
Taylor expanded in l around 0 63.1%
associate-*r*63.1%
Simplified63.1%
Taylor expanded in K around 0 51.7%
associate-*r*51.7%
Simplified51.7%
Final simplification51.7%
(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 83.5%
associate-*l*83.5%
fma-define83.5%
Simplified83.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 83.5%
associate-*l*83.5%
fma-define83.5%
Simplified83.5%
Taylor expanded in J around 0 34.8%
Final simplification34.8%
herbie shell --seed 2024085
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))