
(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 -2e+24) (not (<= t_0 2e-6)))
(+ (* (cos (/ K 2.0)) (* t_0 J)) U)
(+
U
(*
J
(* (fma 0.3333333333333333 (pow l 3.0) (* l 2.0)) (cos (* K 0.5))))))))
double code(double J, double l, double K, double U) {
double t_0 = exp(l) - exp(-l);
double tmp;
if ((t_0 <= -2e+24) || !(t_0 <= 2e-6)) {
tmp = (cos((K / 2.0)) * (t_0 * J)) + U;
} else {
tmp = U + (J * (fma(0.3333333333333333, pow(l, 3.0), (l * 2.0)) * 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 <= -2e+24) || !(t_0 <= 2e-6)) tmp = Float64(Float64(cos(Float64(K / 2.0)) * Float64(t_0 * J)) + U); else tmp = Float64(U + Float64(J * Float64(fma(0.3333333333333333, (l ^ 3.0), Float64(l * 2.0)) * cos(Float64(K * 0.5))))); 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, -2e+24], N[Not[LessEqual[t$95$0, 2e-6]], $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[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $MachinePrecision] * 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 -2 \cdot 10^{+24} \lor \neg \left(t_0 \leq 2 \cdot 10^{-6}\right):\\
\;\;\;\;\cos \left(\frac{K}{2}\right) \cdot \left(t_0 \cdot J\right) + U\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\mathsf{fma}\left(0.3333333333333333, {\ell}^{3}, \ell \cdot 2\right) \cdot \cos \left(K \cdot 0.5\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -2e24 or 1.99999999999999991e-6 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 100.0%
if -2e24 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 1.99999999999999991e-6Initial program 69.9%
Taylor expanded in l around 0 99.9%
Taylor expanded in J around 0 99.9%
associate-*r*99.9%
*-commutative99.9%
*-commutative99.9%
fma-def99.9%
*-commutative99.9%
Simplified99.9%
Final simplification100.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))) (t_1 (- (exp l) (exp (- l)))))
(if (or (<= t_1 -2e+24) (not (<= t_1 2e-6)))
(+ (* 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 <= -2e+24) || !(t_1 <= 2e-6)) {
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 <= (-2d+24)) .or. (.not. (t_1 <= 2d-6))) 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 <= -2e+24) || !(t_1 <= 2e-6)) {
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 <= -2e+24) or not (t_1 <= 2e-6): 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 <= -2e+24) || !(t_1 <= 2e-6)) 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 <= -2e+24) || ~((t_1 <= 2e-6))) 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, -2e+24], N[Not[LessEqual[t$95$1, 2e-6]], $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 -2 \cdot 10^{+24} \lor \neg \left(t_1 \leq 2 \cdot 10^{-6}\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))) < -2e24 or 1.99999999999999991e-6 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 100.0%
if -2e24 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 1.99999999999999991e-6Initial program 69.9%
Taylor expanded in l around 0 99.9%
Final simplification100.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (* 0.3333333333333333 (pow l 3.0)))
(t_1 (+ U (* (cos (* K 0.5)) (* J t_0))))
(t_2 (+ U (* (- (exp l) (exp (- l))) J))))
(if (<= l -5e+125)
t_1
(if (<= l -57.0)
t_2
(if (<= l 16500000000.0)
(+ U (* (cos (/ K 2.0)) (* J (+ t_0 (* l 2.0)))))
(if (<= l 6.3e+100) t_2 t_1))))))
double code(double J, double l, double K, double U) {
double t_0 = 0.3333333333333333 * pow(l, 3.0);
double t_1 = U + (cos((K * 0.5)) * (J * t_0));
double t_2 = U + ((exp(l) - exp(-l)) * J);
double tmp;
if (l <= -5e+125) {
tmp = t_1;
} else if (l <= -57.0) {
tmp = t_2;
} else if (l <= 16500000000.0) {
tmp = U + (cos((K / 2.0)) * (J * (t_0 + (l * 2.0))));
} else if (l <= 6.3e+100) {
tmp = t_2;
} else {
tmp = t_1;
}
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 = 0.3333333333333333d0 * (l ** 3.0d0)
t_1 = u + (cos((k * 0.5d0)) * (j * t_0))
t_2 = u + ((exp(l) - exp(-l)) * j)
if (l <= (-5d+125)) then
tmp = t_1
else if (l <= (-57.0d0)) then
tmp = t_2
else if (l <= 16500000000.0d0) then
tmp = u + (cos((k / 2.0d0)) * (j * (t_0 + (l * 2.0d0))))
else if (l <= 6.3d+100) then
tmp = t_2
else
tmp = t_1
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = 0.3333333333333333 * Math.pow(l, 3.0);
double t_1 = U + (Math.cos((K * 0.5)) * (J * t_0));
double t_2 = U + ((Math.exp(l) - Math.exp(-l)) * J);
double tmp;
if (l <= -5e+125) {
tmp = t_1;
} else if (l <= -57.0) {
tmp = t_2;
} else if (l <= 16500000000.0) {
tmp = U + (Math.cos((K / 2.0)) * (J * (t_0 + (l * 2.0))));
} else if (l <= 6.3e+100) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(J, l, K, U): t_0 = 0.3333333333333333 * math.pow(l, 3.0) t_1 = U + (math.cos((K * 0.5)) * (J * t_0)) t_2 = U + ((math.exp(l) - math.exp(-l)) * J) tmp = 0 if l <= -5e+125: tmp = t_1 elif l <= -57.0: tmp = t_2 elif l <= 16500000000.0: tmp = U + (math.cos((K / 2.0)) * (J * (t_0 + (l * 2.0)))) elif l <= 6.3e+100: tmp = t_2 else: tmp = t_1 return tmp
function code(J, l, K, U) t_0 = Float64(0.3333333333333333 * (l ^ 3.0)) t_1 = Float64(U + Float64(cos(Float64(K * 0.5)) * Float64(J * t_0))) t_2 = Float64(U + Float64(Float64(exp(l) - exp(Float64(-l))) * J)) tmp = 0.0 if (l <= -5e+125) tmp = t_1; elseif (l <= -57.0) tmp = t_2; elseif (l <= 16500000000.0) tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(t_0 + Float64(l * 2.0))))); elseif (l <= 6.3e+100) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = 0.3333333333333333 * (l ^ 3.0); t_1 = U + (cos((K * 0.5)) * (J * t_0)); t_2 = U + ((exp(l) - exp(-l)) * J); tmp = 0.0; if (l <= -5e+125) tmp = t_1; elseif (l <= -57.0) tmp = t_2; elseif (l <= 16500000000.0) tmp = U + (cos((K / 2.0)) * (J * (t_0 + (l * 2.0)))); elseif (l <= 6.3e+100) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(U + N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(J * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(U + N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -5e+125], t$95$1, If[LessEqual[l, -57.0], t$95$2, If[LessEqual[l, 16500000000.0], N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[(t$95$0 + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 6.3e+100], t$95$2, t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.3333333333333333 \cdot {\ell}^{3}\\
t_1 := U + \cos \left(K \cdot 0.5\right) \cdot \left(J \cdot t_0\right)\\
t_2 := U + \left(e^{\ell} - e^{-\ell}\right) \cdot J\\
\mathbf{if}\;\ell \leq -5 \cdot 10^{+125}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\ell \leq -57:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\ell \leq 16500000000:\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(t_0 + \ell \cdot 2\right)\right)\\
\mathbf{elif}\;\ell \leq 6.3 \cdot 10^{+100}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if l < -4.99999999999999962e125 or 6.3000000000000004e100 < l Initial program 100.0%
Taylor expanded in l around 0 100.0%
Taylor expanded in J around 0 100.0%
*-commutative100.0%
associate-*l*100.0%
fma-def100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in l around inf 100.0%
*-commutative100.0%
associate-*r*100.0%
associate-*l*100.0%
*-commutative100.0%
*-commutative100.0%
Simplified100.0%
if -4.99999999999999962e125 < l < -57 or 1.65e10 < l < 6.3000000000000004e100Initial program 100.0%
Taylor expanded in K around 0 79.6%
if -57 < l < 1.65e10Initial program 70.5%
Taylor expanded in l around 0 98.3%
Final simplification95.3%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (* K 0.5)))
(t_1 (+ U (* t_0 (* J (* 0.3333333333333333 (pow l 3.0))))))
(t_2 (+ U (* (- (exp l) (exp (- l))) J))))
(if (<= l -1.96e+105)
t_1
(if (<= l -57.0)
t_2
(if (<= l 16500000000.0)
(+ U (* (* l t_0) (* J 2.0)))
(if (<= l 6.5e+100) t_2 t_1))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K * 0.5));
double t_1 = U + (t_0 * (J * (0.3333333333333333 * pow(l, 3.0))));
double t_2 = U + ((exp(l) - exp(-l)) * J);
double tmp;
if (l <= -1.96e+105) {
tmp = t_1;
} else if (l <= -57.0) {
tmp = t_2;
} else if (l <= 16500000000.0) {
tmp = U + ((l * t_0) * (J * 2.0));
} else if (l <= 6.5e+100) {
tmp = t_2;
} else {
tmp = t_1;
}
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 = cos((k * 0.5d0))
t_1 = u + (t_0 * (j * (0.3333333333333333d0 * (l ** 3.0d0))))
t_2 = u + ((exp(l) - exp(-l)) * j)
if (l <= (-1.96d+105)) then
tmp = t_1
else if (l <= (-57.0d0)) then
tmp = t_2
else if (l <= 16500000000.0d0) then
tmp = u + ((l * t_0) * (j * 2.0d0))
else if (l <= 6.5d+100) then
tmp = t_2
else
tmp = t_1
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = Math.cos((K * 0.5));
double t_1 = U + (t_0 * (J * (0.3333333333333333 * Math.pow(l, 3.0))));
double t_2 = U + ((Math.exp(l) - Math.exp(-l)) * J);
double tmp;
if (l <= -1.96e+105) {
tmp = t_1;
} else if (l <= -57.0) {
tmp = t_2;
} else if (l <= 16500000000.0) {
tmp = U + ((l * t_0) * (J * 2.0));
} else if (l <= 6.5e+100) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K * 0.5)) t_1 = U + (t_0 * (J * (0.3333333333333333 * math.pow(l, 3.0)))) t_2 = U + ((math.exp(l) - math.exp(-l)) * J) tmp = 0 if l <= -1.96e+105: tmp = t_1 elif l <= -57.0: tmp = t_2 elif l <= 16500000000.0: tmp = U + ((l * t_0) * (J * 2.0)) elif l <= 6.5e+100: tmp = t_2 else: tmp = t_1 return tmp
function code(J, l, K, U) t_0 = cos(Float64(K * 0.5)) t_1 = Float64(U + Float64(t_0 * Float64(J * Float64(0.3333333333333333 * (l ^ 3.0))))) t_2 = Float64(U + Float64(Float64(exp(l) - exp(Float64(-l))) * J)) tmp = 0.0 if (l <= -1.96e+105) tmp = t_1; elseif (l <= -57.0) tmp = t_2; elseif (l <= 16500000000.0) tmp = Float64(U + Float64(Float64(l * t_0) * Float64(J * 2.0))); elseif (l <= 6.5e+100) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K * 0.5)); t_1 = U + (t_0 * (J * (0.3333333333333333 * (l ^ 3.0)))); t_2 = U + ((exp(l) - exp(-l)) * J); tmp = 0.0; if (l <= -1.96e+105) tmp = t_1; elseif (l <= -57.0) tmp = t_2; elseif (l <= 16500000000.0) tmp = U + ((l * t_0) * (J * 2.0)); elseif (l <= 6.5e+100) tmp = t_2; else tmp = t_1; end tmp_2 = 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[(t$95$0 * N[(J * N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(U + N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -1.96e+105], t$95$1, If[LessEqual[l, -57.0], t$95$2, If[LessEqual[l, 16500000000.0], N[(U + N[(N[(l * t$95$0), $MachinePrecision] * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 6.5e+100], t$95$2, t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(K \cdot 0.5\right)\\
t_1 := U + t_0 \cdot \left(J \cdot \left(0.3333333333333333 \cdot {\ell}^{3}\right)\right)\\
t_2 := U + \left(e^{\ell} - e^{-\ell}\right) \cdot J\\
\mathbf{if}\;\ell \leq -1.96 \cdot 10^{+105}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\ell \leq -57:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\ell \leq 16500000000:\\
\;\;\;\;U + \left(\ell \cdot t_0\right) \cdot \left(J \cdot 2\right)\\
\mathbf{elif}\;\ell \leq 6.5 \cdot 10^{+100}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if l < -1.95999999999999994e105 or 6.50000000000000001e100 < l Initial program 100.0%
Taylor expanded in l around 0 100.0%
Taylor expanded in J around 0 100.0%
*-commutative100.0%
associate-*l*100.0%
fma-def100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in l around inf 100.0%
*-commutative100.0%
associate-*r*100.0%
associate-*l*100.0%
*-commutative100.0%
*-commutative100.0%
Simplified100.0%
if -1.95999999999999994e105 < l < -57 or 1.65e10 < l < 6.50000000000000001e100Initial program 100.0%
Taylor expanded in K around 0 79.6%
if -57 < l < 1.65e10Initial program 70.5%
Taylor expanded in l around 0 98.3%
Taylor expanded in J around 0 98.3%
associate-*r*98.3%
*-commutative98.3%
*-commutative98.3%
fma-def98.3%
*-commutative98.3%
Simplified98.3%
Taylor expanded in l around 0 98.2%
*-commutative98.2%
associate-*r*98.2%
associate-*l*98.2%
Simplified98.2%
Final simplification95.3%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) 0.55) (+ U (* l (* J (* 2.0 (cos (* K 0.5)))))) (+ U (* J (+ (* 0.3333333333333333 (pow l 3.0)) (* l 2.0))))))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= 0.55) {
tmp = U + (l * (J * (2.0 * cos((K * 0.5)))));
} else {
tmp = U + (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) :: tmp
if (cos((k / 2.0d0)) <= 0.55d0) then
tmp = u + (l * (j * (2.0d0 * cos((k * 0.5d0)))))
else
tmp = u + (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 tmp;
if (Math.cos((K / 2.0)) <= 0.55) {
tmp = U + (l * (J * (2.0 * Math.cos((K * 0.5)))));
} else {
tmp = U + (J * ((0.3333333333333333 * Math.pow(l, 3.0)) + (l * 2.0)));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if math.cos((K / 2.0)) <= 0.55: tmp = U + (l * (J * (2.0 * math.cos((K * 0.5))))) else: tmp = U + (J * ((0.3333333333333333 * math.pow(l, 3.0)) + (l * 2.0))) return tmp
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= 0.55) tmp = Float64(U + Float64(l * Float64(J * Float64(2.0 * cos(Float64(K * 0.5)))))); else tmp = Float64(U + 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) tmp = 0.0; if (cos((K / 2.0)) <= 0.55) tmp = U + (l * (J * (2.0 * cos((K * 0.5))))); else tmp = U + (J * ((0.3333333333333333 * (l ^ 3.0)) + (l * 2.0))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], 0.55], N[(U + N[(l * N[(J * N[(2.0 * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq 0.55:\\
\;\;\;\;U + \ell \cdot \left(J \cdot \left(2 \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K 2)) < 0.55000000000000004Initial program 80.4%
Taylor expanded in l around 0 88.1%
Taylor expanded in l around 0 75.1%
associate-*r*75.1%
*-commutative75.1%
associate-*l*75.1%
Simplified75.1%
if 0.55000000000000004 < (cos.f64 (/.f64 K 2)) Initial program 90.8%
Taylor expanded in K around 0 90.8%
Taylor expanded in l around 0 81.7%
Final simplification79.2%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (* K 0.5))))
(if (<= J -1.6e+143)
(+ U (* (* l t_0) (* J 2.0)))
(if (<= J 1.45e+73)
(+ U (* (- (exp l) (exp (- l))) J))
(+ U (* l (* J (* 2.0 t_0))))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K * 0.5));
double tmp;
if (J <= -1.6e+143) {
tmp = U + ((l * t_0) * (J * 2.0));
} else if (J <= 1.45e+73) {
tmp = U + ((exp(l) - exp(-l)) * J);
} else {
tmp = U + (l * (J * (2.0 * 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 = cos((k * 0.5d0))
if (j <= (-1.6d+143)) then
tmp = u + ((l * t_0) * (j * 2.0d0))
else if (j <= 1.45d+73) then
tmp = u + ((exp(l) - exp(-l)) * j)
else
tmp = u + (l * (j * (2.0d0 * t_0)))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = Math.cos((K * 0.5));
double tmp;
if (J <= -1.6e+143) {
tmp = U + ((l * t_0) * (J * 2.0));
} else if (J <= 1.45e+73) {
tmp = U + ((Math.exp(l) - Math.exp(-l)) * J);
} else {
tmp = U + (l * (J * (2.0 * t_0)));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K * 0.5)) tmp = 0 if J <= -1.6e+143: tmp = U + ((l * t_0) * (J * 2.0)) elif J <= 1.45e+73: tmp = U + ((math.exp(l) - math.exp(-l)) * J) else: tmp = U + (l * (J * (2.0 * t_0))) return tmp
function code(J, l, K, U) t_0 = cos(Float64(K * 0.5)) tmp = 0.0 if (J <= -1.6e+143) tmp = Float64(U + Float64(Float64(l * t_0) * Float64(J * 2.0))); elseif (J <= 1.45e+73) tmp = Float64(U + Float64(Float64(exp(l) - exp(Float64(-l))) * J)); else tmp = Float64(U + Float64(l * Float64(J * Float64(2.0 * t_0)))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K * 0.5)); tmp = 0.0; if (J <= -1.6e+143) tmp = U + ((l * t_0) * (J * 2.0)); elseif (J <= 1.45e+73) tmp = U + ((exp(l) - exp(-l)) * J); else tmp = U + (l * (J * (2.0 * t_0))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[J, -1.6e+143], N[(U + N[(N[(l * t$95$0), $MachinePrecision] * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[J, 1.45e+73], N[(U + N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]), $MachinePrecision], N[(U + N[(l * N[(J * N[(2.0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(K \cdot 0.5\right)\\
\mathbf{if}\;J \leq -1.6 \cdot 10^{+143}:\\
\;\;\;\;U + \left(\ell \cdot t_0\right) \cdot \left(J \cdot 2\right)\\
\mathbf{elif}\;J \leq 1.45 \cdot 10^{+73}:\\
\;\;\;\;U + \left(e^{\ell} - e^{-\ell}\right) \cdot J\\
\mathbf{else}:\\
\;\;\;\;U + \ell \cdot \left(J \cdot \left(2 \cdot t_0\right)\right)\\
\end{array}
\end{array}
if J < -1.60000000000000008e143Initial program 64.3%
Taylor expanded in l around 0 97.8%
Taylor expanded in J around 0 97.8%
associate-*r*97.8%
*-commutative97.8%
*-commutative97.8%
fma-def97.8%
*-commutative97.8%
Simplified97.8%
Taylor expanded in l around 0 95.6%
*-commutative95.6%
associate-*r*95.7%
associate-*l*95.7%
Simplified95.7%
if -1.60000000000000008e143 < J < 1.4500000000000001e73Initial program 97.5%
Taylor expanded in K around 0 86.8%
if 1.4500000000000001e73 < J Initial program 75.0%
Taylor expanded in l around 0 93.6%
Taylor expanded in l around 0 82.4%
associate-*r*82.4%
*-commutative82.4%
associate-*l*82.4%
Simplified82.4%
Final simplification87.3%
(FPCore (J l K U) :precision binary64 (+ U (* l (* J (* 2.0 (cos (* K 0.5)))))))
double code(double J, double l, double K, double U) {
return U + (l * (J * (2.0 * 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 + (l * (j * (2.0d0 * cos((k * 0.5d0)))))
end function
public static double code(double J, double l, double K, double U) {
return U + (l * (J * (2.0 * Math.cos((K * 0.5)))));
}
def code(J, l, K, U): return U + (l * (J * (2.0 * math.cos((K * 0.5)))))
function code(J, l, K, U) return Float64(U + Float64(l * Float64(J * Float64(2.0 * cos(Float64(K * 0.5)))))) end
function tmp = code(J, l, K, U) tmp = U + (l * (J * (2.0 * cos((K * 0.5))))); end
code[J_, l_, K_, U_] := N[(U + N[(l * N[(J * N[(2.0 * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + \ell \cdot \left(J \cdot \left(2 \cdot \cos \left(K \cdot 0.5\right)\right)\right)
\end{array}
Initial program 86.8%
Taylor expanded in l around 0 85.1%
Taylor expanded in l around 0 62.9%
associate-*r*62.9%
*-commutative62.9%
associate-*l*62.8%
Simplified62.8%
Final simplification62.8%
(FPCore (J l K U) :precision binary64 (+ U (* (cos (/ K 2.0)) (* l (* J 2.0)))))
double code(double J, double l, double K, double U) {
return U + (cos((K / 2.0)) * (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 + (cos((k / 2.0d0)) * (l * (j * 2.0d0)))
end function
public static double code(double J, double l, double K, double U) {
return U + (Math.cos((K / 2.0)) * (l * (J * 2.0)));
}
def code(J, l, K, U): return U + (math.cos((K / 2.0)) * (l * (J * 2.0)))
function code(J, l, K, U) return Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(l * Float64(J * 2.0)))) end
function tmp = code(J, l, K, U) tmp = U + (cos((K / 2.0)) * (l * (J * 2.0))); end
code[J_, l_, K_, U_] := N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + \cos \left(\frac{K}{2}\right) \cdot \left(\ell \cdot \left(J \cdot 2\right)\right)
\end{array}
Initial program 86.8%
Taylor expanded in l around 0 62.9%
associate-*r*62.9%
*-commutative62.9%
associate-*l*62.9%
Simplified62.9%
Final simplification62.9%
(FPCore (J l K U) :precision binary64 (+ U (* (* l (cos (* K 0.5))) (* J 2.0))))
double code(double J, double l, double K, double U) {
return U + ((l * cos((K * 0.5))) * (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 * cos((k * 0.5d0))) * (j * 2.0d0))
end function
public static double code(double J, double l, double K, double U) {
return U + ((l * Math.cos((K * 0.5))) * (J * 2.0));
}
def code(J, l, K, U): return U + ((l * math.cos((K * 0.5))) * (J * 2.0))
function code(J, l, K, U) return Float64(U + Float64(Float64(l * cos(Float64(K * 0.5))) * Float64(J * 2.0))) end
function tmp = code(J, l, K, U) tmp = U + ((l * cos((K * 0.5))) * (J * 2.0)); end
code[J_, l_, K_, U_] := N[(U + N[(N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + \left(\ell \cdot \cos \left(K \cdot 0.5\right)\right) \cdot \left(J \cdot 2\right)
\end{array}
Initial program 86.8%
Taylor expanded in l around 0 85.1%
Taylor expanded in J around 0 85.1%
associate-*r*85.1%
*-commutative85.1%
*-commutative85.1%
fma-def85.1%
*-commutative85.1%
Simplified85.1%
Taylor expanded in l around 0 62.9%
*-commutative62.9%
associate-*r*62.9%
associate-*l*62.9%
Simplified62.9%
Final simplification62.9%
(FPCore (J l K U) :precision binary64 (if (or (<= l -56.0) (not (<= l 260.0))) (+ U (* (* l J) (+ 2.0 (* (* K K) -0.25)))) (+ U (* J (* l 2.0)))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -56.0) || !(l <= 260.0)) {
tmp = U + ((l * J) * (2.0 + ((K * K) * -0.25)));
} else {
tmp = U + (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 <= (-56.0d0)) .or. (.not. (l <= 260.0d0))) then
tmp = u + ((l * j) * (2.0d0 + ((k * k) * (-0.25d0))))
else
tmp = u + (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 <= -56.0) || !(l <= 260.0)) {
tmp = U + ((l * J) * (2.0 + ((K * K) * -0.25)));
} else {
tmp = U + (J * (l * 2.0));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -56.0) or not (l <= 260.0): tmp = U + ((l * J) * (2.0 + ((K * K) * -0.25))) else: tmp = U + (J * (l * 2.0)) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -56.0) || !(l <= 260.0)) tmp = Float64(U + Float64(Float64(l * J) * Float64(2.0 + Float64(Float64(K * K) * -0.25)))); else tmp = Float64(U + Float64(J * Float64(l * 2.0))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -56.0) || ~((l <= 260.0))) tmp = U + ((l * J) * (2.0 + ((K * K) * -0.25))); else tmp = U + (J * (l * 2.0)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -56.0], N[Not[LessEqual[l, 260.0]], $MachinePrecision]], N[(U + N[(N[(l * J), $MachinePrecision] * N[(2.0 + N[(N[(K * K), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -56 \lor \neg \left(\ell \leq 260\right):\\
\;\;\;\;U + \left(\ell \cdot J\right) \cdot \left(2 + \left(K \cdot K\right) \cdot -0.25\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\ell \cdot 2\right)\\
\end{array}
\end{array}
if l < -56 or 260 < l Initial program 100.0%
Taylor expanded in l around 0 34.1%
associate-*r*34.1%
*-commutative34.1%
associate-*l*34.1%
Simplified34.1%
Taylor expanded in K around 0 13.1%
+-commutative13.1%
associate-*r*13.1%
distribute-rgt-out36.0%
*-commutative36.0%
unpow236.0%
Simplified36.0%
if -56 < l < 260Initial program 69.9%
Taylor expanded in K around 0 69.4%
Taylor expanded in l around 0 80.6%
Final simplification55.5%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (* U (* U -134217728.0))))
(if (<= l -3.2e+133)
t_0
(if (<= l -2.75e+60)
(* U U)
(if (or (<= l -56.0) (not (<= l 1.35e+74))) t_0 U)))))
double code(double J, double l, double K, double U) {
double t_0 = U * (U * -134217728.0);
double tmp;
if (l <= -3.2e+133) {
tmp = t_0;
} else if (l <= -2.75e+60) {
tmp = U * U;
} else if ((l <= -56.0) || !(l <= 1.35e+74)) {
tmp = t_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) :: t_0
real(8) :: tmp
t_0 = u * (u * (-134217728.0d0))
if (l <= (-3.2d+133)) then
tmp = t_0
else if (l <= (-2.75d+60)) then
tmp = u * u
else if ((l <= (-56.0d0)) .or. (.not. (l <= 1.35d+74))) then
tmp = t_0
else
tmp = u
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = U * (U * -134217728.0);
double tmp;
if (l <= -3.2e+133) {
tmp = t_0;
} else if (l <= -2.75e+60) {
tmp = U * U;
} else if ((l <= -56.0) || !(l <= 1.35e+74)) {
tmp = t_0;
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): t_0 = U * (U * -134217728.0) tmp = 0 if l <= -3.2e+133: tmp = t_0 elif l <= -2.75e+60: tmp = U * U elif (l <= -56.0) or not (l <= 1.35e+74): tmp = t_0 else: tmp = U return tmp
function code(J, l, K, U) t_0 = Float64(U * Float64(U * -134217728.0)) tmp = 0.0 if (l <= -3.2e+133) tmp = t_0; elseif (l <= -2.75e+60) tmp = Float64(U * U); elseif ((l <= -56.0) || !(l <= 1.35e+74)) tmp = t_0; else tmp = U; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U * (U * -134217728.0); tmp = 0.0; if (l <= -3.2e+133) tmp = t_0; elseif (l <= -2.75e+60) tmp = U * U; elseif ((l <= -56.0) || ~((l <= 1.35e+74))) tmp = t_0; else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U * N[(U * -134217728.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -3.2e+133], t$95$0, If[LessEqual[l, -2.75e+60], N[(U * U), $MachinePrecision], If[Or[LessEqual[l, -56.0], N[Not[LessEqual[l, 1.35e+74]], $MachinePrecision]], t$95$0, U]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U \cdot \left(U \cdot -134217728\right)\\
\mathbf{if}\;\ell \leq -3.2 \cdot 10^{+133}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq -2.75 \cdot 10^{+60}:\\
\;\;\;\;U \cdot U\\
\mathbf{elif}\;\ell \leq -56 \lor \neg \left(\ell \leq 1.35 \cdot 10^{+74}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if l < -3.19999999999999997e133 or -2.75e60 < l < -56 or 1.3499999999999999e74 < l Initial program 100.0%
Applied egg-rr2.8%
Applied egg-rr21.7%
if -3.19999999999999997e133 < l < -2.75e60Initial program 100.0%
Applied egg-rr0.7%
Applied egg-rr37.3%
if -56 < l < 1.3499999999999999e74Initial program 73.5%
Applied egg-rr43.9%
Taylor expanded in J around 0 61.4%
Final simplification42.3%
(FPCore (J l K U) :precision binary64 (if (<= l -1.55e+15) (* U U) (if (<= l 6.2e-7) U (* U U))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -1.55e+15) {
tmp = U * U;
} else if (l <= 6.2e-7) {
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 <= (-1.55d+15)) then
tmp = u * u
else if (l <= 6.2d-7) 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 <= -1.55e+15) {
tmp = U * U;
} else if (l <= 6.2e-7) {
tmp = U;
} else {
tmp = U * U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -1.55e+15: tmp = U * U elif l <= 6.2e-7: tmp = U else: tmp = U * U return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -1.55e+15) tmp = Float64(U * U); elseif (l <= 6.2e-7) tmp = U; else tmp = Float64(U * U); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -1.55e+15) tmp = U * U; elseif (l <= 6.2e-7) tmp = U; else tmp = U * U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -1.55e+15], N[(U * U), $MachinePrecision], If[LessEqual[l, 6.2e-7], U, N[(U * U), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.55 \cdot 10^{+15}:\\
\;\;\;\;U \cdot U\\
\mathbf{elif}\;\ell \leq 6.2 \cdot 10^{-7}:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;U \cdot U\\
\end{array}
\end{array}
if l < -1.55e15 or 6.1999999999999999e-7 < l Initial program 99.8%
Applied egg-rr3.5%
Applied egg-rr12.6%
if -1.55e15 < l < 6.1999999999999999e-7Initial program 70.7%
Applied egg-rr47.4%
Taylor expanded in J around 0 68.1%
Final simplification37.3%
(FPCore (J l K U) :precision binary64 (+ U (* J (* l 2.0))))
double code(double J, double l, double K, double U) {
return U + (J * (l * 2.0));
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = u + (j * (l * 2.0d0))
end function
public static double code(double J, double l, double K, double U) {
return U + (J * (l * 2.0));
}
def code(J, l, K, U): return U + (J * (l * 2.0))
function code(J, l, K, U) return Float64(U + Float64(J * Float64(l * 2.0))) end
function tmp = code(J, l, K, U) tmp = U + (J * (l * 2.0)); end
code[J_, l_, K_, U_] := N[(U + N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + J \cdot \left(\ell \cdot 2\right)
\end{array}
Initial program 86.8%
Taylor expanded in K around 0 72.6%
Taylor expanded in l around 0 48.3%
Final simplification48.3%
(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.8%
Applied egg-rr23.1%
Taylor expanded in J around 0 31.6%
Final simplification31.6%
herbie shell --seed 2023275
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))