
(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
(let* ((t_0 (- (exp l) (exp (- l)))))
(if (or (<= t_0 (- INFINITY)) (not (<= t_0 0.0)))
(+ (* (* 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 <= -((double) INFINITY)) || !(t_0 <= 0.0)) {
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 <= Float64(-Inf)) || !(t_0 <= 0.0)) 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, (-Infinity)], N[Not[LessEqual[t$95$0, 0.0]], $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 -\infty \lor \neg \left(t\_0 \leq 0\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))) < -inf.0 or 0.0 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 100.0%
if -inf.0 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 0.0Initial program 71.2%
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 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 (- INFINITY)) (not (<= t_1 0.0)))
(+ (* (* t_1 J) t_0) U)
(+ U (* t_0 (* J (* l (+ 2.0 (* 0.3333333333333333 (pow l 2.0))))))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double t_1 = exp(l) - exp(-l);
double tmp;
if ((t_1 <= -((double) INFINITY)) || !(t_1 <= 0.0)) {
tmp = ((t_1 * J) * t_0) + U;
} else {
tmp = U + (t_0 * (J * (l * (2.0 + (0.3333333333333333 * pow(l, 2.0))))));
}
return tmp;
}
public static double code(double J, double l, double K, double U) {
double t_0 = Math.cos((K / 2.0));
double t_1 = Math.exp(l) - Math.exp(-l);
double tmp;
if ((t_1 <= -Double.POSITIVE_INFINITY) || !(t_1 <= 0.0)) {
tmp = ((t_1 * J) * t_0) + U;
} else {
tmp = U + (t_0 * (J * (l * (2.0 + (0.3333333333333333 * Math.pow(l, 2.0))))));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) t_1 = math.exp(l) - math.exp(-l) tmp = 0 if (t_1 <= -math.inf) or not (t_1 <= 0.0): tmp = ((t_1 * J) * t_0) + U else: tmp = U + (t_0 * (J * (l * (2.0 + (0.3333333333333333 * math.pow(l, 2.0)))))) return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(exp(l) - exp(Float64(-l))) tmp = 0.0 if ((t_1 <= Float64(-Inf)) || !(t_1 <= 0.0)) 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(0.3333333333333333 * (l ^ 2.0))))))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K / 2.0)); t_1 = exp(l) - exp(-l); tmp = 0.0; if ((t_1 <= -Inf) || ~((t_1 <= 0.0))) tmp = ((t_1 * J) * t_0) + U; else tmp = U + (t_0 * (J * (l * (2.0 + (0.3333333333333333 * (l ^ 2.0)))))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 0.0]], $MachinePrecision]], 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[(0.3333333333333333 * N[Power[l, 2.0], $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 -\infty \lor \neg \left(t\_1 \leq 0\right):\\
\;\;\;\;\left(t\_1 \cdot J\right) \cdot t\_0 + U\\
\mathbf{else}:\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(\ell \cdot \left(2 + 0.3333333333333333 \cdot {\ell}^{2}\right)\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -inf.0 or 0.0 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 100.0%
if -inf.0 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 0.0Initial program 71.2%
Taylor expanded in l around 0 99.9%
Final simplification99.9%
(FPCore (J l K U)
:precision binary64
(let* ((t_0
(+ U (* (cos (/ K 2.0)) (* 0.3333333333333333 (* J (pow l 3.0)))))))
(if (<= l -1.55e+85)
t_0
(if (<= l -2.45e-5)
(* (- (exp l) (exp (- l))) J)
(if (<= l 5.6e-15) (+ U (* l (* (cos (* K 0.5)) (* J 2.0)))) t_0)))))
double code(double J, double l, double K, double U) {
double t_0 = U + (cos((K / 2.0)) * (0.3333333333333333 * (J * pow(l, 3.0))));
double tmp;
if (l <= -1.55e+85) {
tmp = t_0;
} else if (l <= -2.45e-5) {
tmp = (exp(l) - exp(-l)) * J;
} else if (l <= 5.6e-15) {
tmp = U + (l * (cos((K * 0.5)) * (J * 2.0)));
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
real(8) :: tmp
t_0 = u + (cos((k / 2.0d0)) * (0.3333333333333333d0 * (j * (l ** 3.0d0))))
if (l <= (-1.55d+85)) then
tmp = t_0
else if (l <= (-2.45d-5)) then
tmp = (exp(l) - exp(-l)) * j
else if (l <= 5.6d-15) then
tmp = u + (l * (cos((k * 0.5d0)) * (j * 2.0d0)))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = U + (Math.cos((K / 2.0)) * (0.3333333333333333 * (J * Math.pow(l, 3.0))));
double tmp;
if (l <= -1.55e+85) {
tmp = t_0;
} else if (l <= -2.45e-5) {
tmp = (Math.exp(l) - Math.exp(-l)) * J;
} else if (l <= 5.6e-15) {
tmp = U + (l * (Math.cos((K * 0.5)) * (J * 2.0)));
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = U + (math.cos((K / 2.0)) * (0.3333333333333333 * (J * math.pow(l, 3.0)))) tmp = 0 if l <= -1.55e+85: tmp = t_0 elif l <= -2.45e-5: tmp = (math.exp(l) - math.exp(-l)) * J elif l <= 5.6e-15: tmp = U + (l * (math.cos((K * 0.5)) * (J * 2.0))) else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(0.3333333333333333 * Float64(J * (l ^ 3.0))))) tmp = 0.0 if (l <= -1.55e+85) tmp = t_0; elseif (l <= -2.45e-5) tmp = Float64(Float64(exp(l) - exp(Float64(-l))) * J); elseif (l <= 5.6e-15) tmp = Float64(U + Float64(l * Float64(cos(Float64(K * 0.5)) * Float64(J * 2.0)))); else tmp = t_0; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U + (cos((K / 2.0)) * (0.3333333333333333 * (J * (l ^ 3.0)))); tmp = 0.0; if (l <= -1.55e+85) tmp = t_0; elseif (l <= -2.45e-5) tmp = (exp(l) - exp(-l)) * J; elseif (l <= 5.6e-15) tmp = U + (l * (cos((K * 0.5)) * (J * 2.0))); 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.3333333333333333 * N[(J * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -1.55e+85], t$95$0, If[LessEqual[l, -2.45e-5], N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision], If[LessEqual[l, 5.6e-15], N[(U + N[(l * N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(J * 2.0), $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.3333333333333333 \cdot \left(J \cdot {\ell}^{3}\right)\right)\\
\mathbf{if}\;\ell \leq -1.55 \cdot 10^{+85}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq -2.45 \cdot 10^{-5}:\\
\;\;\;\;\left(e^{\ell} - e^{-\ell}\right) \cdot J\\
\mathbf{elif}\;\ell \leq 5.6 \cdot 10^{-15}:\\
\;\;\;\;U + \ell \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \left(J \cdot 2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if l < -1.55000000000000006e85 or 5.60000000000000028e-15 < l Initial program 100.0%
Taylor expanded in l around 0 91.8%
Taylor expanded in l around inf 91.8%
if -1.55000000000000006e85 < l < -2.45e-5Initial program 98.8%
Taylor expanded in K around 0 75.2%
Taylor expanded in J around inf 75.2%
if -2.45e-5 < l < 5.60000000000000028e-15Initial program 71.1%
Taylor expanded in l around 0 99.9%
distribute-lft-in99.9%
*-commutative99.9%
associate-*l*99.9%
unpow299.9%
pow399.9%
Applied egg-rr99.9%
Taylor expanded in l around 0 99.7%
*-commutative99.7%
associate-*r*99.8%
associate-*l*99.8%
*-commutative99.8%
associate-*r*99.8%
*-commutative99.8%
Simplified99.8%
Final simplification94.6%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.005) (+ U (* l (* (cos (* K 0.5)) (* J 2.0)))) (+ 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.005) {
tmp = U + (l * (cos((K * 0.5)) * (J * 2.0)));
} 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.005d0)) then
tmp = u + (l * (cos((k * 0.5d0)) * (j * 2.0d0)))
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.005) {
tmp = U + (l * (Math.cos((K * 0.5)) * (J * 2.0)));
} 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.005: tmp = U + (l * (math.cos((K * 0.5)) * (J * 2.0))) 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.005) tmp = Float64(U + Float64(l * Float64(cos(Float64(K * 0.5)) * Float64(J * 2.0)))); 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.005) tmp = U + (l * (cos((K * 0.5)) * (J * 2.0))); 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.005], N[(U + N[(l * N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(J * 2.0), $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.005:\\
\;\;\;\;U + \ell \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \left(J \cdot 2\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 #s(literal 2 binary64))) < -0.0050000000000000001Initial program 85.4%
Taylor expanded in l around 0 88.6%
distribute-lft-in88.5%
*-commutative88.5%
associate-*l*88.5%
unpow288.5%
pow388.5%
Applied egg-rr88.5%
Taylor expanded in l around 0 65.3%
*-commutative65.3%
associate-*r*65.4%
associate-*l*65.4%
*-commutative65.4%
associate-*r*65.4%
*-commutative65.4%
Simplified65.4%
if -0.0050000000000000001 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 86.1%
Taylor expanded in l around 0 93.9%
distribute-lft-in93.9%
*-commutative93.9%
associate-*l*93.9%
unpow293.9%
pow393.9%
Applied egg-rr93.9%
Taylor expanded in K around 0 91.0%
Final simplification84.3%
(FPCore (J l K U) :precision binary64 (if (or (<= l -2.45e-5) (not (<= l 8.5))) (* (- (exp l) (exp (- l))) J) (+ U (* l (* (cos (* K 0.5)) (* J 2.0))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -2.45e-5) || !(l <= 8.5)) {
tmp = (exp(l) - exp(-l)) * J;
} else {
tmp = U + (l * (cos((K * 0.5)) * (J * 2.0)));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if ((l <= (-2.45d-5)) .or. (.not. (l <= 8.5d0))) then
tmp = (exp(l) - exp(-l)) * j
else
tmp = u + (l * (cos((k * 0.5d0)) * (j * 2.0d0)))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -2.45e-5) || !(l <= 8.5)) {
tmp = (Math.exp(l) - Math.exp(-l)) * J;
} else {
tmp = U + (l * (Math.cos((K * 0.5)) * (J * 2.0)));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -2.45e-5) or not (l <= 8.5): tmp = (math.exp(l) - math.exp(-l)) * J else: tmp = U + (l * (math.cos((K * 0.5)) * (J * 2.0))) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -2.45e-5) || !(l <= 8.5)) tmp = Float64(Float64(exp(l) - exp(Float64(-l))) * J); else tmp = Float64(U + Float64(l * Float64(cos(Float64(K * 0.5)) * Float64(J * 2.0)))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -2.45e-5) || ~((l <= 8.5))) tmp = (exp(l) - exp(-l)) * J; else tmp = U + (l * (cos((K * 0.5)) * (J * 2.0))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -2.45e-5], N[Not[LessEqual[l, 8.5]], $MachinePrecision]], N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision], N[(U + N[(l * N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.45 \cdot 10^{-5} \lor \neg \left(\ell \leq 8.5\right):\\
\;\;\;\;\left(e^{\ell} - e^{-\ell}\right) \cdot J\\
\mathbf{else}:\\
\;\;\;\;U + \ell \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \left(J \cdot 2\right)\right)\\
\end{array}
\end{array}
if l < -2.45e-5 or 8.5 < l Initial program 99.8%
Taylor expanded in K around 0 76.4%
Taylor expanded in J around inf 76.4%
if -2.45e-5 < l < 8.5Initial program 72.0%
Taylor expanded in l around 0 99.9%
distribute-lft-in99.9%
*-commutative99.9%
associate-*l*99.9%
unpow299.9%
pow399.9%
Applied egg-rr99.9%
Taylor expanded in l around 0 99.8%
*-commutative99.8%
associate-*r*99.8%
associate-*l*99.8%
*-commutative99.8%
associate-*r*99.8%
*-commutative99.8%
Simplified99.8%
Final simplification88.1%
(FPCore (J l K U) :precision binary64 (+ U (* (cos (/ K 2.0)) (* J (* l (+ 2.0 (* 0.3333333333333333 (pow l 2.0))))))))
double code(double J, double l, double K, double U) {
return U + (cos((K / 2.0)) * (J * (l * (2.0 + (0.3333333333333333 * pow(l, 2.0))))));
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = u + (cos((k / 2.0d0)) * (j * (l * (2.0d0 + (0.3333333333333333d0 * (l ** 2.0d0))))))
end function
public static double code(double J, double l, double K, double U) {
return U + (Math.cos((K / 2.0)) * (J * (l * (2.0 + (0.3333333333333333 * Math.pow(l, 2.0))))));
}
def code(J, l, K, U): return U + (math.cos((K / 2.0)) * (J * (l * (2.0 + (0.3333333333333333 * math.pow(l, 2.0))))))
function code(J, l, K, U) return Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(l * Float64(2.0 + Float64(0.3333333333333333 * (l ^ 2.0))))))) end
function tmp = code(J, l, K, U) tmp = U + (cos((K / 2.0)) * (J * (l * (2.0 + (0.3333333333333333 * (l ^ 2.0)))))); end
code[J_, l_, K_, U_] := N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[(l * N[(2.0 + N[(0.3333333333333333 * N[Power[l, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(\ell \cdot \left(2 + 0.3333333333333333 \cdot {\ell}^{2}\right)\right)\right)
\end{array}
Initial program 85.9%
Taylor expanded in l around 0 92.5%
Final simplification92.5%
(FPCore (J l K U)
:precision binary64
(if (<= l -2.45e-5)
(* J (+ (* 0.3333333333333333 (pow l 3.0)) (* l 2.0)))
(if (<= l 2.6e+74)
(+ U (* l (* (cos (* K 0.5)) (* J 2.0))))
(+ U (* (pow l 3.0) (* J 0.3333333333333333))))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -2.45e-5) {
tmp = J * ((0.3333333333333333 * pow(l, 3.0)) + (l * 2.0));
} else if (l <= 2.6e+74) {
tmp = U + (l * (cos((K * 0.5)) * (J * 2.0)));
} else {
tmp = U + (pow(l, 3.0) * (J * 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 (l <= (-2.45d-5)) then
tmp = j * ((0.3333333333333333d0 * (l ** 3.0d0)) + (l * 2.0d0))
else if (l <= 2.6d+74) then
tmp = u + (l * (cos((k * 0.5d0)) * (j * 2.0d0)))
else
tmp = u + ((l ** 3.0d0) * (j * 0.3333333333333333d0))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= -2.45e-5) {
tmp = J * ((0.3333333333333333 * Math.pow(l, 3.0)) + (l * 2.0));
} else if (l <= 2.6e+74) {
tmp = U + (l * (Math.cos((K * 0.5)) * (J * 2.0)));
} else {
tmp = U + (Math.pow(l, 3.0) * (J * 0.3333333333333333));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -2.45e-5: tmp = J * ((0.3333333333333333 * math.pow(l, 3.0)) + (l * 2.0)) elif l <= 2.6e+74: tmp = U + (l * (math.cos((K * 0.5)) * (J * 2.0))) else: tmp = U + (math.pow(l, 3.0) * (J * 0.3333333333333333)) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -2.45e-5) tmp = Float64(J * Float64(Float64(0.3333333333333333 * (l ^ 3.0)) + Float64(l * 2.0))); elseif (l <= 2.6e+74) tmp = Float64(U + Float64(l * Float64(cos(Float64(K * 0.5)) * Float64(J * 2.0)))); else tmp = Float64(U + Float64((l ^ 3.0) * Float64(J * 0.3333333333333333))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -2.45e-5) tmp = J * ((0.3333333333333333 * (l ^ 3.0)) + (l * 2.0)); elseif (l <= 2.6e+74) tmp = U + (l * (cos((K * 0.5)) * (J * 2.0))); else tmp = U + ((l ^ 3.0) * (J * 0.3333333333333333)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -2.45e-5], N[(J * N[(N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.6e+74], N[(U + N[(l * N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(N[Power[l, 3.0], $MachinePrecision] * N[(J * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.45 \cdot 10^{-5}:\\
\;\;\;\;J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\\
\mathbf{elif}\;\ell \leq 2.6 \cdot 10^{+74}:\\
\;\;\;\;U + \ell \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \left(J \cdot 2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + {\ell}^{3} \cdot \left(J \cdot 0.3333333333333333\right)\\
\end{array}
\end{array}
if l < -2.45e-5Initial program 99.7%
Taylor expanded in l around 0 84.4%
distribute-lft-in84.4%
*-commutative84.4%
associate-*l*84.4%
unpow284.4%
pow384.4%
Applied egg-rr84.4%
Taylor expanded in K around 0 64.8%
Taylor expanded in U around 0 64.6%
if -2.45e-5 < l < 2.6000000000000001e74Initial program 74.0%
Taylor expanded in l around 0 93.7%
distribute-lft-in93.7%
*-commutative93.7%
associate-*l*93.7%
unpow293.7%
pow393.7%
Applied egg-rr93.7%
Taylor expanded in l around 0 92.8%
*-commutative92.8%
associate-*r*92.9%
associate-*l*92.9%
*-commutative92.9%
associate-*r*92.9%
*-commutative92.9%
Simplified92.9%
if 2.6000000000000001e74 < l Initial program 100.0%
Taylor expanded in l around 0 100.0%
Taylor expanded in l around inf 100.0%
Taylor expanded in K around 0 84.3%
associate-*r*84.3%
*-commutative84.3%
Simplified84.3%
Final simplification83.8%
(FPCore (J l K U)
:precision binary64
(if (<= l -2.45e-5)
(* J (+ (* 0.3333333333333333 (pow l 3.0)) (* l 2.0)))
(if (<= l 2.6e+73)
(+ U (* 2.0 (* J (* l (cos (* K 0.5))))))
(+ U (* (pow l 3.0) (* J 0.3333333333333333))))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -2.45e-5) {
tmp = J * ((0.3333333333333333 * pow(l, 3.0)) + (l * 2.0));
} else if (l <= 2.6e+73) {
tmp = U + (2.0 * (J * (l * cos((K * 0.5)))));
} else {
tmp = U + (pow(l, 3.0) * (J * 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 (l <= (-2.45d-5)) then
tmp = j * ((0.3333333333333333d0 * (l ** 3.0d0)) + (l * 2.0d0))
else if (l <= 2.6d+73) then
tmp = u + (2.0d0 * (j * (l * cos((k * 0.5d0)))))
else
tmp = u + ((l ** 3.0d0) * (j * 0.3333333333333333d0))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= -2.45e-5) {
tmp = J * ((0.3333333333333333 * Math.pow(l, 3.0)) + (l * 2.0));
} else if (l <= 2.6e+73) {
tmp = U + (2.0 * (J * (l * Math.cos((K * 0.5)))));
} else {
tmp = U + (Math.pow(l, 3.0) * (J * 0.3333333333333333));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -2.45e-5: tmp = J * ((0.3333333333333333 * math.pow(l, 3.0)) + (l * 2.0)) elif l <= 2.6e+73: tmp = U + (2.0 * (J * (l * math.cos((K * 0.5))))) else: tmp = U + (math.pow(l, 3.0) * (J * 0.3333333333333333)) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -2.45e-5) tmp = Float64(J * Float64(Float64(0.3333333333333333 * (l ^ 3.0)) + Float64(l * 2.0))); elseif (l <= 2.6e+73) tmp = Float64(U + Float64(2.0 * Float64(J * Float64(l * cos(Float64(K * 0.5)))))); else tmp = Float64(U + Float64((l ^ 3.0) * Float64(J * 0.3333333333333333))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -2.45e-5) tmp = J * ((0.3333333333333333 * (l ^ 3.0)) + (l * 2.0)); elseif (l <= 2.6e+73) tmp = U + (2.0 * (J * (l * cos((K * 0.5))))); else tmp = U + ((l ^ 3.0) * (J * 0.3333333333333333)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -2.45e-5], N[(J * N[(N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.6e+73], N[(U + N[(2.0 * N[(J * N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(N[Power[l, 3.0], $MachinePrecision] * N[(J * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.45 \cdot 10^{-5}:\\
\;\;\;\;J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\\
\mathbf{elif}\;\ell \leq 2.6 \cdot 10^{+73}:\\
\;\;\;\;U + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + {\ell}^{3} \cdot \left(J \cdot 0.3333333333333333\right)\\
\end{array}
\end{array}
if l < -2.45e-5Initial program 99.7%
Taylor expanded in l around 0 84.4%
distribute-lft-in84.4%
*-commutative84.4%
associate-*l*84.4%
unpow284.4%
pow384.4%
Applied egg-rr84.4%
Taylor expanded in K around 0 64.8%
Taylor expanded in U around 0 64.6%
if -2.45e-5 < l < 2.6000000000000001e73Initial program 74.0%
Taylor expanded in l around 0 92.8%
if 2.6000000000000001e73 < l Initial program 100.0%
Taylor expanded in l around 0 100.0%
Taylor expanded in l around inf 100.0%
Taylor expanded in K around 0 84.3%
associate-*r*84.3%
*-commutative84.3%
Simplified84.3%
Final simplification83.7%
(FPCore (J l K U) :precision binary64 (if (or (<= l -1.02e+19) (not (<= l 1.35e-28))) (+ U (* (pow l 3.0) (* J 0.3333333333333333))) (fma (* J 2.0) l U)))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -1.02e+19) || !(l <= 1.35e-28)) {
tmp = U + (pow(l, 3.0) * (J * 0.3333333333333333));
} else {
tmp = fma((J * 2.0), l, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if ((l <= -1.02e+19) || !(l <= 1.35e-28)) tmp = Float64(U + Float64((l ^ 3.0) * Float64(J * 0.3333333333333333))); else tmp = fma(Float64(J * 2.0), l, U); end return tmp end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -1.02e+19], N[Not[LessEqual[l, 1.35e-28]], $MachinePrecision]], N[(U + N[(N[Power[l, 3.0], $MachinePrecision] * N[(J * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(J * 2.0), $MachinePrecision] * l + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.02 \cdot 10^{+19} \lor \neg \left(\ell \leq 1.35 \cdot 10^{-28}\right):\\
\;\;\;\;U + {\ell}^{3} \cdot \left(J \cdot 0.3333333333333333\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(J \cdot 2, \ell, U\right)\\
\end{array}
\end{array}
if l < -1.02e19 or 1.3499999999999999e-28 < l Initial program 99.3%
Taylor expanded in l around 0 87.5%
Taylor expanded in l around inf 86.8%
Taylor expanded in K around 0 69.5%
associate-*r*69.5%
*-commutative69.5%
Simplified69.5%
if -1.02e19 < l < 1.3499999999999999e-28Initial program 72.4%
Taylor expanded in l around 0 97.6%
distribute-lft-in97.6%
*-commutative97.6%
associate-*l*97.6%
unpow297.6%
pow397.6%
Applied egg-rr97.6%
Taylor expanded in K around 0 85.6%
Taylor expanded in l around 0 85.3%
+-commutative85.3%
associate-*r*85.3%
fma-define85.3%
*-commutative85.3%
Simplified85.3%
Final simplification77.3%
(FPCore (J l K U)
:precision binary64
(if (<= l -2.45e-5)
(* J (+ (* 0.3333333333333333 (pow l 3.0)) (* l 2.0)))
(if (<= l 1.35e-28)
(fma (* J 2.0) l U)
(+ U (* (pow l 3.0) (* J 0.3333333333333333))))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -2.45e-5) {
tmp = J * ((0.3333333333333333 * pow(l, 3.0)) + (l * 2.0));
} else if (l <= 1.35e-28) {
tmp = fma((J * 2.0), l, U);
} else {
tmp = U + (pow(l, 3.0) * (J * 0.3333333333333333));
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (l <= -2.45e-5) tmp = Float64(J * Float64(Float64(0.3333333333333333 * (l ^ 3.0)) + Float64(l * 2.0))); elseif (l <= 1.35e-28) tmp = fma(Float64(J * 2.0), l, U); else tmp = Float64(U + Float64((l ^ 3.0) * Float64(J * 0.3333333333333333))); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[l, -2.45e-5], N[(J * N[(N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.35e-28], N[(N[(J * 2.0), $MachinePrecision] * l + U), $MachinePrecision], N[(U + N[(N[Power[l, 3.0], $MachinePrecision] * N[(J * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.45 \cdot 10^{-5}:\\
\;\;\;\;J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\\
\mathbf{elif}\;\ell \leq 1.35 \cdot 10^{-28}:\\
\;\;\;\;\mathsf{fma}\left(J \cdot 2, \ell, U\right)\\
\mathbf{else}:\\
\;\;\;\;U + {\ell}^{3} \cdot \left(J \cdot 0.3333333333333333\right)\\
\end{array}
\end{array}
if l < -2.45e-5Initial program 99.7%
Taylor expanded in l around 0 84.4%
distribute-lft-in84.4%
*-commutative84.4%
associate-*l*84.4%
unpow284.4%
pow384.4%
Applied egg-rr84.4%
Taylor expanded in K around 0 64.8%
Taylor expanded in U around 0 64.6%
if -2.45e-5 < l < 1.3499999999999999e-28Initial program 71.6%
Taylor expanded in l around 0 99.9%
distribute-lft-in99.9%
*-commutative99.9%
associate-*l*99.9%
unpow299.9%
pow399.9%
Applied egg-rr99.9%
Taylor expanded in K around 0 87.4%
Taylor expanded in l around 0 87.4%
+-commutative87.4%
associate-*r*87.4%
fma-define87.5%
*-commutative87.5%
Simplified87.5%
if 1.3499999999999999e-28 < l Initial program 98.6%
Taylor expanded in l around 0 87.1%
Taylor expanded in l around inf 85.7%
Taylor expanded in K around 0 71.7%
associate-*r*71.7%
*-commutative71.7%
Simplified71.7%
Final simplification77.4%
(FPCore (J l K U) :precision binary64 (fma (* J 2.0) l U))
double code(double J, double l, double K, double U) {
return fma((J * 2.0), l, U);
}
function code(J, l, K, U) return fma(Float64(J * 2.0), l, U) end
code[J_, l_, K_, U_] := N[(N[(J * 2.0), $MachinePrecision] * l + U), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(J \cdot 2, \ell, U\right)
\end{array}
Initial program 85.9%
Taylor expanded in l around 0 92.5%
distribute-lft-in92.5%
*-commutative92.5%
associate-*l*92.5%
unpow292.5%
pow392.5%
Applied egg-rr92.5%
Taylor expanded in K around 0 77.5%
Taylor expanded in l around 0 57.3%
+-commutative57.3%
associate-*r*57.3%
fma-define57.3%
*-commutative57.3%
Simplified57.3%
(FPCore (J l K U) :precision binary64 (if (<= l -2.45e-5) (* U U) (if (<= l 270000000000.0) U (* U (+ U -1.0)))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -2.45e-5) {
tmp = U * U;
} else if (l <= 270000000000.0) {
tmp = U;
} else {
tmp = U * (U + -1.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 <= (-2.45d-5)) then
tmp = u * u
else if (l <= 270000000000.0d0) then
tmp = u
else
tmp = u * (u + (-1.0d0))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= -2.45e-5) {
tmp = U * U;
} else if (l <= 270000000000.0) {
tmp = U;
} else {
tmp = U * (U + -1.0);
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -2.45e-5: tmp = U * U elif l <= 270000000000.0: tmp = U else: tmp = U * (U + -1.0) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -2.45e-5) tmp = Float64(U * U); elseif (l <= 270000000000.0) tmp = U; else tmp = Float64(U * Float64(U + -1.0)); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -2.45e-5) tmp = U * U; elseif (l <= 270000000000.0) tmp = U; else tmp = U * (U + -1.0); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -2.45e-5], N[(U * U), $MachinePrecision], If[LessEqual[l, 270000000000.0], U, N[(U * N[(U + -1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.45 \cdot 10^{-5}:\\
\;\;\;\;U \cdot U\\
\mathbf{elif}\;\ell \leq 270000000000:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;U \cdot \left(U + -1\right)\\
\end{array}
\end{array}
if l < -2.45e-5Initial program 99.7%
Applied egg-rr11.8%
if -2.45e-5 < l < 2.7e11Initial program 72.2%
Taylor expanded in J around 0 70.5%
if 2.7e11 < l Initial program 100.0%
Taylor expanded in l around 0 87.4%
distribute-lft-in87.4%
*-commutative87.4%
associate-*l*87.4%
unpow287.4%
pow387.4%
Applied egg-rr87.4%
Applied egg-rr13.4%
fma-undefine13.4%
neg-mul-113.4%
distribute-rgt-out13.4%
Simplified13.4%
(FPCore (J l K U) :precision binary64 (if (or (<= l -2.45e-5) (not (<= l 4.3e+68))) (* U U) U))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -2.45e-5) || !(l <= 4.3e+68)) {
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.45d-5)) .or. (.not. (l <= 4.3d+68))) 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.45e-5) || !(l <= 4.3e+68)) {
tmp = U * U;
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -2.45e-5) or not (l <= 4.3e+68): tmp = U * U else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -2.45e-5) || !(l <= 4.3e+68)) 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.45e-5) || ~((l <= 4.3e+68))) tmp = U * U; else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -2.45e-5], N[Not[LessEqual[l, 4.3e+68]], $MachinePrecision]], N[(U * U), $MachinePrecision], U]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.45 \cdot 10^{-5} \lor \neg \left(\ell \leq 4.3 \cdot 10^{+68}\right):\\
\;\;\;\;U \cdot U\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if l < -2.45e-5 or 4.3000000000000001e68 < l Initial program 99.8%
Applied egg-rr13.3%
if -2.45e-5 < l < 4.3000000000000001e68Initial program 73.8%
Taylor expanded in J around 0 66.5%
Final simplification41.8%
(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 85.9%
Taylor expanded in K around 0 73.9%
Taylor expanded in l around 0 57.3%
associate-*r*57.3%
Simplified57.3%
Final simplification57.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 85.9%
Taylor expanded in J around 0 36.6%
(FPCore (J l K U) :precision binary64 1.0)
double code(double J, double l, double K, double U) {
return 1.0;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = 1.0d0
end function
public static double code(double J, double l, double K, double U) {
return 1.0;
}
def code(J, l, K, U): return 1.0
function code(J, l, K, U) return 1.0 end
function tmp = code(J, l, K, U) tmp = 1.0; end
code[J_, l_, K_, U_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 85.9%
Applied egg-rr2.8%
*-inverses2.8%
Simplified2.8%
herbie shell --seed 2024103
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))