
(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 17 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 (+ (* 2.0 (* J (log1p (expm1 (* l (cos (* K 0.5))))))) U))
double code(double J, double l, double K, double U) {
return (2.0 * (J * log1p(expm1((l * cos((K * 0.5))))))) + U;
}
public static double code(double J, double l, double K, double U) {
return (2.0 * (J * Math.log1p(Math.expm1((l * Math.cos((K * 0.5))))))) + U;
}
def code(J, l, K, U): return (2.0 * (J * math.log1p(math.expm1((l * math.cos((K * 0.5))))))) + U
function code(J, l, K, U) return Float64(Float64(2.0 * Float64(J * log1p(expm1(Float64(l * cos(Float64(K * 0.5))))))) + U) end
code[J_, l_, K_, U_] := N[(N[(2.0 * N[(J * N[Log[1 + N[(Exp[N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
2 \cdot \left(J \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\ell \cdot \cos \left(K \cdot 0.5\right)\right)\right)\right) + U
\end{array}
Initial program 82.7%
Taylor expanded in l around 0 65.8%
log1p-expm1-u98.7%
*-commutative98.7%
Applied egg-rr98.7%
(FPCore (J l K U)
:precision binary64
(if (or (<= l -6.8e+84)
(not (or (<= l -0.0126) (and (not (<= l 2.0)) (<= l 9.8e+89)))))
(+
U
(* J (* l (* (cos (* K 0.5)) (+ 2.0 (* 0.3333333333333333 (pow l 2.0)))))))
(+ U (* J (- (exp l) (exp (- l)))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -6.8e+84) || !((l <= -0.0126) || (!(l <= 2.0) && (l <= 9.8e+89)))) {
tmp = U + (J * (l * (cos((K * 0.5)) * (2.0 + (0.3333333333333333 * pow(l, 2.0))))));
} else {
tmp = U + (J * (exp(l) - exp(-l)));
}
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 <= (-6.8d+84)) .or. (.not. (l <= (-0.0126d0)) .or. (.not. (l <= 2.0d0)) .and. (l <= 9.8d+89))) then
tmp = u + (j * (l * (cos((k * 0.5d0)) * (2.0d0 + (0.3333333333333333d0 * (l ** 2.0d0))))))
else
tmp = u + (j * (exp(l) - exp(-l)))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -6.8e+84) || !((l <= -0.0126) || (!(l <= 2.0) && (l <= 9.8e+89)))) {
tmp = U + (J * (l * (Math.cos((K * 0.5)) * (2.0 + (0.3333333333333333 * Math.pow(l, 2.0))))));
} else {
tmp = U + (J * (Math.exp(l) - Math.exp(-l)));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -6.8e+84) or not ((l <= -0.0126) or (not (l <= 2.0) and (l <= 9.8e+89))): tmp = U + (J * (l * (math.cos((K * 0.5)) * (2.0 + (0.3333333333333333 * math.pow(l, 2.0)))))) else: tmp = U + (J * (math.exp(l) - math.exp(-l))) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -6.8e+84) || !((l <= -0.0126) || (!(l <= 2.0) && (l <= 9.8e+89)))) tmp = Float64(U + Float64(J * Float64(l * Float64(cos(Float64(K * 0.5)) * Float64(2.0 + Float64(0.3333333333333333 * (l ^ 2.0))))))); else tmp = Float64(U + Float64(J * Float64(exp(l) - exp(Float64(-l))))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -6.8e+84) || ~(((l <= -0.0126) || (~((l <= 2.0)) && (l <= 9.8e+89))))) tmp = U + (J * (l * (cos((K * 0.5)) * (2.0 + (0.3333333333333333 * (l ^ 2.0)))))); else tmp = U + (J * (exp(l) - exp(-l))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -6.8e+84], N[Not[Or[LessEqual[l, -0.0126], And[N[Not[LessEqual[l, 2.0]], $MachinePrecision], LessEqual[l, 9.8e+89]]]], $MachinePrecision]], N[(U + N[(J * N[(l * N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(2.0 + N[(0.3333333333333333 * N[Power[l, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -6.8 \cdot 10^{+84} \lor \neg \left(\ell \leq -0.0126 \lor \neg \left(\ell \leq 2\right) \land \ell \leq 9.8 \cdot 10^{+89}\right):\\
\;\;\;\;U + J \cdot \left(\ell \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \left(2 + 0.3333333333333333 \cdot {\ell}^{2}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(e^{\ell} - e^{-\ell}\right)\\
\end{array}
\end{array}
if l < -6.7999999999999996e84 or -0.0126 < l < 2 or 9.79999999999999992e89 < l Initial program 79.5%
Taylor expanded in l around 0 98.3%
Taylor expanded in J around 0 98.2%
if -6.7999999999999996e84 < l < -0.0126 or 2 < l < 9.79999999999999992e89Initial program 99.9%
Taylor expanded in K around 0 82.9%
Final simplification95.8%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (+ 2.0 (* 0.3333333333333333 (pow l 2.0))))
(t_1 (+ U (* J (* l (* (cos (* K 0.5)) t_0)))))
(t_2 (+ U (* J (- (exp l) (exp (- l)))))))
(if (<= l -6.8e+84)
t_1
(if (<= l -0.05)
t_2
(if (<= l 2.0)
(+ U (* (* J (* l t_0)) (cos (/ K 2.0))))
(if (<= l 8.5e+89) t_2 t_1))))))
double code(double J, double l, double K, double U) {
double t_0 = 2.0 + (0.3333333333333333 * pow(l, 2.0));
double t_1 = U + (J * (l * (cos((K * 0.5)) * t_0)));
double t_2 = U + (J * (exp(l) - exp(-l)));
double tmp;
if (l <= -6.8e+84) {
tmp = t_1;
} else if (l <= -0.05) {
tmp = t_2;
} else if (l <= 2.0) {
tmp = U + ((J * (l * t_0)) * cos((K / 2.0)));
} else if (l <= 8.5e+89) {
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 = 2.0d0 + (0.3333333333333333d0 * (l ** 2.0d0))
t_1 = u + (j * (l * (cos((k * 0.5d0)) * t_0)))
t_2 = u + (j * (exp(l) - exp(-l)))
if (l <= (-6.8d+84)) then
tmp = t_1
else if (l <= (-0.05d0)) then
tmp = t_2
else if (l <= 2.0d0) then
tmp = u + ((j * (l * t_0)) * cos((k / 2.0d0)))
else if (l <= 8.5d+89) 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 = 2.0 + (0.3333333333333333 * Math.pow(l, 2.0));
double t_1 = U + (J * (l * (Math.cos((K * 0.5)) * t_0)));
double t_2 = U + (J * (Math.exp(l) - Math.exp(-l)));
double tmp;
if (l <= -6.8e+84) {
tmp = t_1;
} else if (l <= -0.05) {
tmp = t_2;
} else if (l <= 2.0) {
tmp = U + ((J * (l * t_0)) * Math.cos((K / 2.0)));
} else if (l <= 8.5e+89) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(J, l, K, U): t_0 = 2.0 + (0.3333333333333333 * math.pow(l, 2.0)) t_1 = U + (J * (l * (math.cos((K * 0.5)) * t_0))) t_2 = U + (J * (math.exp(l) - math.exp(-l))) tmp = 0 if l <= -6.8e+84: tmp = t_1 elif l <= -0.05: tmp = t_2 elif l <= 2.0: tmp = U + ((J * (l * t_0)) * math.cos((K / 2.0))) elif l <= 8.5e+89: tmp = t_2 else: tmp = t_1 return tmp
function code(J, l, K, U) t_0 = Float64(2.0 + Float64(0.3333333333333333 * (l ^ 2.0))) t_1 = Float64(U + Float64(J * Float64(l * Float64(cos(Float64(K * 0.5)) * t_0)))) t_2 = Float64(U + Float64(J * Float64(exp(l) - exp(Float64(-l))))) tmp = 0.0 if (l <= -6.8e+84) tmp = t_1; elseif (l <= -0.05) tmp = t_2; elseif (l <= 2.0) tmp = Float64(U + Float64(Float64(J * Float64(l * t_0)) * cos(Float64(K / 2.0)))); elseif (l <= 8.5e+89) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = 2.0 + (0.3333333333333333 * (l ^ 2.0)); t_1 = U + (J * (l * (cos((K * 0.5)) * t_0))); t_2 = U + (J * (exp(l) - exp(-l))); tmp = 0.0; if (l <= -6.8e+84) tmp = t_1; elseif (l <= -0.05) tmp = t_2; elseif (l <= 2.0) tmp = U + ((J * (l * t_0)) * cos((K / 2.0))); elseif (l <= 8.5e+89) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(2.0 + N[(0.3333333333333333 * N[Power[l, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(U + N[(J * N[(l * N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(U + N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -6.8e+84], t$95$1, If[LessEqual[l, -0.05], t$95$2, If[LessEqual[l, 2.0], N[(U + N[(N[(J * N[(l * t$95$0), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 8.5e+89], t$95$2, t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 2 + 0.3333333333333333 \cdot {\ell}^{2}\\
t_1 := U + J \cdot \left(\ell \cdot \left(\cos \left(K \cdot 0.5\right) \cdot t\_0\right)\right)\\
t_2 := U + J \cdot \left(e^{\ell} - e^{-\ell}\right)\\
\mathbf{if}\;\ell \leq -6.8 \cdot 10^{+84}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\ell \leq -0.05:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;\ell \leq 2:\\
\;\;\;\;U + \left(J \cdot \left(\ell \cdot t\_0\right)\right) \cdot \cos \left(\frac{K}{2}\right)\\
\mathbf{elif}\;\ell \leq 8.5 \cdot 10^{+89}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if l < -6.7999999999999996e84 or 8.50000000000000045e89 < l Initial program 100.0%
Taylor expanded in l around 0 97.0%
Taylor expanded in J around 0 97.0%
if -6.7999999999999996e84 < l < -0.050000000000000003 or 2 < l < 8.50000000000000045e89Initial program 99.9%
Taylor expanded in K around 0 82.9%
if -0.050000000000000003 < l < 2Initial program 63.5%
Taylor expanded in l around 0 99.3%
Final simplification95.8%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) 0.997) (+ U (* l (* J (* 2.0 (cos (* K 0.5)))))) (+ U (* J (* l (+ 2.0 (* 0.3333333333333333 (pow l 2.0))))))))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= 0.997) {
tmp = U + (l * (J * (2.0 * cos((K * 0.5)))));
} else {
tmp = U + (J * (l * (2.0 + (0.3333333333333333 * pow(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.997d0) then
tmp = u + (l * (j * (2.0d0 * cos((k * 0.5d0)))))
else
tmp = u + (j * (l * (2.0d0 + (0.3333333333333333d0 * (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.997) {
tmp = U + (l * (J * (2.0 * Math.cos((K * 0.5)))));
} else {
tmp = U + (J * (l * (2.0 + (0.3333333333333333 * Math.pow(l, 2.0)))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if math.cos((K / 2.0)) <= 0.997: tmp = U + (l * (J * (2.0 * math.cos((K * 0.5))))) else: tmp = U + (J * (l * (2.0 + (0.3333333333333333 * math.pow(l, 2.0))))) return tmp
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= 0.997) tmp = Float64(U + Float64(l * Float64(J * Float64(2.0 * cos(Float64(K * 0.5)))))); else tmp = Float64(U + 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) tmp = 0.0; if (cos((K / 2.0)) <= 0.997) tmp = U + (l * (J * (2.0 * cos((K * 0.5))))); else tmp = U + (J * (l * (2.0 + (0.3333333333333333 * (l ^ 2.0))))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], 0.997], 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[(l * N[(2.0 + N[(0.3333333333333333 * N[Power[l, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq 0.997:\\
\;\;\;\;U + \ell \cdot \left(J \cdot \left(2 \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\ell \cdot \left(2 + 0.3333333333333333 \cdot {\ell}^{2}\right)\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.996999999999999997Initial program 79.9%
Taylor expanded in l around 0 65.4%
*-commutative65.4%
associate-*r*65.5%
associate-*l*65.5%
*-commutative65.5%
*-commutative65.5%
associate-*l*65.5%
*-commutative65.5%
Simplified65.5%
if 0.996999999999999997 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 85.2%
Taylor expanded in l around 0 84.2%
Taylor expanded in K around 0 84.1%
Final simplification75.5%
(FPCore (J l K U) :precision binary64 (if (or (<= l -0.0007) (not (<= l 1.9e-6))) (+ U (* J (- (exp l) (exp (- l))))) (+ U (* (cos (/ K 2.0)) (* l (* 2.0 J))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -0.0007) || !(l <= 1.9e-6)) {
tmp = U + (J * (exp(l) - exp(-l)));
} else {
tmp = U + (cos((K / 2.0)) * (l * (2.0 * 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 <= (-0.0007d0)) .or. (.not. (l <= 1.9d-6))) then
tmp = u + (j * (exp(l) - exp(-l)))
else
tmp = u + (cos((k / 2.0d0)) * (l * (2.0d0 * j)))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -0.0007) || !(l <= 1.9e-6)) {
tmp = U + (J * (Math.exp(l) - Math.exp(-l)));
} else {
tmp = U + (Math.cos((K / 2.0)) * (l * (2.0 * J)));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -0.0007) or not (l <= 1.9e-6): tmp = U + (J * (math.exp(l) - math.exp(-l))) else: tmp = U + (math.cos((K / 2.0)) * (l * (2.0 * J))) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -0.0007) || !(l <= 1.9e-6)) tmp = Float64(U + Float64(J * Float64(exp(l) - exp(Float64(-l))))); else tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(l * Float64(2.0 * J)))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -0.0007) || ~((l <= 1.9e-6))) tmp = U + (J * (exp(l) - exp(-l))); else tmp = U + (cos((K / 2.0)) * (l * (2.0 * J))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -0.0007], N[Not[LessEqual[l, 1.9e-6]], $MachinePrecision]], N[(U + N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(l * N[(2.0 * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -0.0007 \lor \neg \left(\ell \leq 1.9 \cdot 10^{-6}\right):\\
\;\;\;\;U + J \cdot \left(e^{\ell} - e^{-\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(\ell \cdot \left(2 \cdot J\right)\right)\\
\end{array}
\end{array}
if l < -6.99999999999999993e-4 or 1.9e-6 < l Initial program 99.9%
Taylor expanded in K around 0 72.5%
if -6.99999999999999993e-4 < l < 1.9e-6Initial program 62.4%
Taylor expanded in l around 0 99.7%
associate-*r*99.7%
Simplified99.7%
Final simplification85.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (* (pow l 3.0) (* J 0.3333333333333333))))
(if (<= l -1.7e+70)
t_0
(if (<= l -1.1e+24)
(* U (- U -4.0))
(if (<= l 1900000000.0)
(fma J (* 2.0 l) U)
(if (<= l 8.4e+82) (pow U -4.0) t_0))))))
double code(double J, double l, double K, double U) {
double t_0 = pow(l, 3.0) * (J * 0.3333333333333333);
double tmp;
if (l <= -1.7e+70) {
tmp = t_0;
} else if (l <= -1.1e+24) {
tmp = U * (U - -4.0);
} else if (l <= 1900000000.0) {
tmp = fma(J, (2.0 * l), U);
} else if (l <= 8.4e+82) {
tmp = pow(U, -4.0);
} else {
tmp = t_0;
}
return tmp;
}
function code(J, l, K, U) t_0 = Float64((l ^ 3.0) * Float64(J * 0.3333333333333333)) tmp = 0.0 if (l <= -1.7e+70) tmp = t_0; elseif (l <= -1.1e+24) tmp = Float64(U * Float64(U - -4.0)); elseif (l <= 1900000000.0) tmp = fma(J, Float64(2.0 * l), U); elseif (l <= 8.4e+82) tmp = U ^ -4.0; else tmp = t_0; end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[Power[l, 3.0], $MachinePrecision] * N[(J * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -1.7e+70], t$95$0, If[LessEqual[l, -1.1e+24], N[(U * N[(U - -4.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1900000000.0], N[(J * N[(2.0 * l), $MachinePrecision] + U), $MachinePrecision], If[LessEqual[l, 8.4e+82], N[Power[U, -4.0], $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\ell}^{3} \cdot \left(J \cdot 0.3333333333333333\right)\\
\mathbf{if}\;\ell \leq -1.7 \cdot 10^{+70}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq -1.1 \cdot 10^{+24}:\\
\;\;\;\;U \cdot \left(U - -4\right)\\
\mathbf{elif}\;\ell \leq 1900000000:\\
\;\;\;\;\mathsf{fma}\left(J, 2 \cdot \ell, U\right)\\
\mathbf{elif}\;\ell \leq 8.4 \cdot 10^{+82}:\\
\;\;\;\;{U}^{-4}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if l < -1.7e70 or 8.4000000000000001e82 < l Initial program 100.0%
Taylor expanded in l around 0 94.2%
Taylor expanded in K around 0 66.5%
Taylor expanded in l around inf 66.5%
*-commutative66.5%
*-commutative66.5%
associate-*r*66.5%
Simplified66.5%
if -1.7e70 < l < -1.10000000000000001e24Initial program 100.0%
Applied egg-rr43.0%
if -1.10000000000000001e24 < l < 1.9e9Initial program 66.0%
Taylor expanded in l around 0 92.2%
Taylor expanded in K around 0 75.3%
+-commutative75.3%
*-commutative75.3%
associate-*r*75.3%
fma-define75.3%
*-commutative75.3%
Simplified75.3%
if 1.9e9 < l < 8.4000000000000001e82Initial program 100.0%
Applied egg-rr44.6%
(FPCore (J l K U) :precision binary64 (if (<= (/ K 2.0) 5e-5) (+ U (* J (* l (+ 2.0 (* 0.3333333333333333 (pow l 2.0)))))) (* U (+ 1.0 (* 2.0 (/ (* (cos (* K 0.5)) (* J l)) U))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((K / 2.0) <= 5e-5) {
tmp = U + (J * (l * (2.0 + (0.3333333333333333 * pow(l, 2.0)))));
} else {
tmp = U * (1.0 + (2.0 * ((cos((K * 0.5)) * (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 ((k / 2.0d0) <= 5d-5) then
tmp = u + (j * (l * (2.0d0 + (0.3333333333333333d0 * (l ** 2.0d0)))))
else
tmp = u * (1.0d0 + (2.0d0 * ((cos((k * 0.5d0)) * (j * l)) / u)))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((K / 2.0) <= 5e-5) {
tmp = U + (J * (l * (2.0 + (0.3333333333333333 * Math.pow(l, 2.0)))));
} else {
tmp = U * (1.0 + (2.0 * ((Math.cos((K * 0.5)) * (J * l)) / U)));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (K / 2.0) <= 5e-5: tmp = U + (J * (l * (2.0 + (0.3333333333333333 * math.pow(l, 2.0))))) else: tmp = U * (1.0 + (2.0 * ((math.cos((K * 0.5)) * (J * l)) / U))) return tmp
function code(J, l, K, U) tmp = 0.0 if (Float64(K / 2.0) <= 5e-5) tmp = Float64(U + Float64(J * Float64(l * Float64(2.0 + Float64(0.3333333333333333 * (l ^ 2.0)))))); else tmp = Float64(U * Float64(1.0 + Float64(2.0 * Float64(Float64(cos(Float64(K * 0.5)) * Float64(J * l)) / U)))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((K / 2.0) <= 5e-5) tmp = U + (J * (l * (2.0 + (0.3333333333333333 * (l ^ 2.0))))); else tmp = U * (1.0 + (2.0 * ((cos((K * 0.5)) * (J * l)) / U))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[N[(K / 2.0), $MachinePrecision], 5e-5], N[(U + N[(J * N[(l * N[(2.0 + N[(0.3333333333333333 * N[Power[l, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U * N[(1.0 + N[(2.0 * N[(N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(J * l), $MachinePrecision]), $MachinePrecision] / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{K}{2} \leq 5 \cdot 10^{-5}:\\
\;\;\;\;U + J \cdot \left(\ell \cdot \left(2 + 0.3333333333333333 \cdot {\ell}^{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U \cdot \left(1 + 2 \cdot \frac{\cos \left(K \cdot 0.5\right) \cdot \left(J \cdot \ell\right)}{U}\right)\\
\end{array}
\end{array}
if (/.f64 K #s(literal 2 binary64)) < 5.00000000000000024e-5Initial program 83.4%
Taylor expanded in l around 0 84.0%
Taylor expanded in K around 0 72.0%
if 5.00000000000000024e-5 < (/.f64 K #s(literal 2 binary64)) Initial program 80.4%
Taylor expanded in l around 0 64.2%
Taylor expanded in U around inf 65.9%
associate-*r*65.9%
Simplified65.9%
Final simplification70.6%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (* (pow l 3.0) (* J 0.3333333333333333))))
(if (<= l -6e+94)
t_0
(if (<= l 1900000000.0)
(+ U (* (cos (/ K 2.0)) (* l (* 2.0 J))))
(if (<= l 9.5e+76) (pow U -4.0) t_0)))))
double code(double J, double l, double K, double U) {
double t_0 = pow(l, 3.0) * (J * 0.3333333333333333);
double tmp;
if (l <= -6e+94) {
tmp = t_0;
} else if (l <= 1900000000.0) {
tmp = U + (cos((K / 2.0)) * (l * (2.0 * J)));
} else if (l <= 9.5e+76) {
tmp = pow(U, -4.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 ** 3.0d0) * (j * 0.3333333333333333d0)
if (l <= (-6d+94)) then
tmp = t_0
else if (l <= 1900000000.0d0) then
tmp = u + (cos((k / 2.0d0)) * (l * (2.0d0 * j)))
else if (l <= 9.5d+76) then
tmp = u ** (-4.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, 3.0) * (J * 0.3333333333333333);
double tmp;
if (l <= -6e+94) {
tmp = t_0;
} else if (l <= 1900000000.0) {
tmp = U + (Math.cos((K / 2.0)) * (l * (2.0 * J)));
} else if (l <= 9.5e+76) {
tmp = Math.pow(U, -4.0);
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = math.pow(l, 3.0) * (J * 0.3333333333333333) tmp = 0 if l <= -6e+94: tmp = t_0 elif l <= 1900000000.0: tmp = U + (math.cos((K / 2.0)) * (l * (2.0 * J))) elif l <= 9.5e+76: tmp = math.pow(U, -4.0) else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64((l ^ 3.0) * Float64(J * 0.3333333333333333)) tmp = 0.0 if (l <= -6e+94) tmp = t_0; elseif (l <= 1900000000.0) tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(l * Float64(2.0 * J)))); elseif (l <= 9.5e+76) tmp = U ^ -4.0; else tmp = t_0; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = (l ^ 3.0) * (J * 0.3333333333333333); tmp = 0.0; if (l <= -6e+94) tmp = t_0; elseif (l <= 1900000000.0) tmp = U + (cos((K / 2.0)) * (l * (2.0 * J))); elseif (l <= 9.5e+76) tmp = U ^ -4.0; else tmp = t_0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[Power[l, 3.0], $MachinePrecision] * N[(J * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -6e+94], t$95$0, If[LessEqual[l, 1900000000.0], N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(l * N[(2.0 * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 9.5e+76], N[Power[U, -4.0], $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\ell}^{3} \cdot \left(J \cdot 0.3333333333333333\right)\\
\mathbf{if}\;\ell \leq -6 \cdot 10^{+94}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq 1900000000:\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(\ell \cdot \left(2 \cdot J\right)\right)\\
\mathbf{elif}\;\ell \leq 9.5 \cdot 10^{+76}:\\
\;\;\;\;{U}^{-4}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if l < -6.0000000000000001e94 or 9.5000000000000003e76 < l Initial program 100.0%
Taylor expanded in l around 0 96.9%
Taylor expanded in K around 0 68.6%
Taylor expanded in l around inf 68.5%
*-commutative68.5%
*-commutative68.5%
associate-*r*68.5%
Simplified68.5%
if -6.0000000000000001e94 < l < 1.9e9Initial program 70.1%
Taylor expanded in l around 0 83.5%
associate-*r*83.5%
Simplified83.5%
if 1.9e9 < l < 9.5000000000000003e76Initial program 100.0%
Applied egg-rr44.6%
Final simplification75.7%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (* (pow l 3.0) (* J 0.3333333333333333))))
(if (<= l -6.6e+94)
t_0
(if (<= l 3900000000.0)
(+ U (* l (* J (* 2.0 (cos (* K 0.5))))))
(if (<= l 1.45e+77) (pow U -4.0) t_0)))))
double code(double J, double l, double K, double U) {
double t_0 = pow(l, 3.0) * (J * 0.3333333333333333);
double tmp;
if (l <= -6.6e+94) {
tmp = t_0;
} else if (l <= 3900000000.0) {
tmp = U + (l * (J * (2.0 * cos((K * 0.5)))));
} else if (l <= 1.45e+77) {
tmp = pow(U, -4.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 ** 3.0d0) * (j * 0.3333333333333333d0)
if (l <= (-6.6d+94)) then
tmp = t_0
else if (l <= 3900000000.0d0) then
tmp = u + (l * (j * (2.0d0 * cos((k * 0.5d0)))))
else if (l <= 1.45d+77) then
tmp = u ** (-4.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, 3.0) * (J * 0.3333333333333333);
double tmp;
if (l <= -6.6e+94) {
tmp = t_0;
} else if (l <= 3900000000.0) {
tmp = U + (l * (J * (2.0 * Math.cos((K * 0.5)))));
} else if (l <= 1.45e+77) {
tmp = Math.pow(U, -4.0);
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = math.pow(l, 3.0) * (J * 0.3333333333333333) tmp = 0 if l <= -6.6e+94: tmp = t_0 elif l <= 3900000000.0: tmp = U + (l * (J * (2.0 * math.cos((K * 0.5))))) elif l <= 1.45e+77: tmp = math.pow(U, -4.0) else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64((l ^ 3.0) * Float64(J * 0.3333333333333333)) tmp = 0.0 if (l <= -6.6e+94) tmp = t_0; elseif (l <= 3900000000.0) tmp = Float64(U + Float64(l * Float64(J * Float64(2.0 * cos(Float64(K * 0.5)))))); elseif (l <= 1.45e+77) tmp = U ^ -4.0; else tmp = t_0; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = (l ^ 3.0) * (J * 0.3333333333333333); tmp = 0.0; if (l <= -6.6e+94) tmp = t_0; elseif (l <= 3900000000.0) tmp = U + (l * (J * (2.0 * cos((K * 0.5))))); elseif (l <= 1.45e+77) tmp = U ^ -4.0; else tmp = t_0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[Power[l, 3.0], $MachinePrecision] * N[(J * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -6.6e+94], t$95$0, If[LessEqual[l, 3900000000.0], N[(U + N[(l * N[(J * N[(2.0 * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.45e+77], N[Power[U, -4.0], $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\ell}^{3} \cdot \left(J \cdot 0.3333333333333333\right)\\
\mathbf{if}\;\ell \leq -6.6 \cdot 10^{+94}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq 3900000000:\\
\;\;\;\;U + \ell \cdot \left(J \cdot \left(2 \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{elif}\;\ell \leq 1.45 \cdot 10^{+77}:\\
\;\;\;\;{U}^{-4}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if l < -6.6e94 or 1.4500000000000001e77 < l Initial program 100.0%
Taylor expanded in l around 0 96.9%
Taylor expanded in K around 0 68.6%
Taylor expanded in l around inf 68.5%
*-commutative68.5%
*-commutative68.5%
associate-*r*68.5%
Simplified68.5%
if -6.6e94 < l < 3.9e9Initial program 70.1%
Taylor expanded in l around 0 83.4%
*-commutative83.4%
associate-*r*83.5%
associate-*l*83.5%
*-commutative83.5%
*-commutative83.5%
associate-*l*83.5%
*-commutative83.5%
Simplified83.5%
if 3.9e9 < l < 1.4500000000000001e77Initial program 100.0%
Applied egg-rr44.6%
Final simplification75.7%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (* (pow l 3.0) (* J 0.3333333333333333))))
(if (<= l -6e+94)
t_0
(if (<= l 1900000000.0)
(+ U (* 2.0 (* J (* l (cos (* K 0.5))))))
(if (<= l 1.25e+76) (pow U -4.0) t_0)))))
double code(double J, double l, double K, double U) {
double t_0 = pow(l, 3.0) * (J * 0.3333333333333333);
double tmp;
if (l <= -6e+94) {
tmp = t_0;
} else if (l <= 1900000000.0) {
tmp = U + (2.0 * (J * (l * cos((K * 0.5)))));
} else if (l <= 1.25e+76) {
tmp = pow(U, -4.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 ** 3.0d0) * (j * 0.3333333333333333d0)
if (l <= (-6d+94)) then
tmp = t_0
else if (l <= 1900000000.0d0) then
tmp = u + (2.0d0 * (j * (l * cos((k * 0.5d0)))))
else if (l <= 1.25d+76) then
tmp = u ** (-4.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, 3.0) * (J * 0.3333333333333333);
double tmp;
if (l <= -6e+94) {
tmp = t_0;
} else if (l <= 1900000000.0) {
tmp = U + (2.0 * (J * (l * Math.cos((K * 0.5)))));
} else if (l <= 1.25e+76) {
tmp = Math.pow(U, -4.0);
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = math.pow(l, 3.0) * (J * 0.3333333333333333) tmp = 0 if l <= -6e+94: tmp = t_0 elif l <= 1900000000.0: tmp = U + (2.0 * (J * (l * math.cos((K * 0.5))))) elif l <= 1.25e+76: tmp = math.pow(U, -4.0) else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64((l ^ 3.0) * Float64(J * 0.3333333333333333)) tmp = 0.0 if (l <= -6e+94) tmp = t_0; elseif (l <= 1900000000.0) tmp = Float64(U + Float64(2.0 * Float64(J * Float64(l * cos(Float64(K * 0.5)))))); elseif (l <= 1.25e+76) tmp = U ^ -4.0; else tmp = t_0; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = (l ^ 3.0) * (J * 0.3333333333333333); tmp = 0.0; if (l <= -6e+94) tmp = t_0; elseif (l <= 1900000000.0) tmp = U + (2.0 * (J * (l * cos((K * 0.5))))); elseif (l <= 1.25e+76) tmp = U ^ -4.0; else tmp = t_0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[Power[l, 3.0], $MachinePrecision] * N[(J * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -6e+94], t$95$0, If[LessEqual[l, 1900000000.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, 1.25e+76], N[Power[U, -4.0], $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\ell}^{3} \cdot \left(J \cdot 0.3333333333333333\right)\\
\mathbf{if}\;\ell \leq -6 \cdot 10^{+94}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq 1900000000:\\
\;\;\;\;U + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{elif}\;\ell \leq 1.25 \cdot 10^{+76}:\\
\;\;\;\;{U}^{-4}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if l < -6.0000000000000001e94 or 1.24999999999999998e76 < l Initial program 100.0%
Taylor expanded in l around 0 96.9%
Taylor expanded in K around 0 68.6%
Taylor expanded in l around inf 68.5%
*-commutative68.5%
*-commutative68.5%
associate-*r*68.5%
Simplified68.5%
if -6.0000000000000001e94 < l < 1.9e9Initial program 70.1%
Taylor expanded in l around 0 83.4%
if 1.9e9 < l < 1.24999999999999998e76Initial program 100.0%
Applied egg-rr44.6%
Final simplification75.7%
(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(J, Float64(2.0 * l), U) end
code[J_, l_, K_, U_] := N[(J * N[(2.0 * l), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(J, 2 \cdot \ell, U\right)
\end{array}
Initial program 82.7%
Taylor expanded in l around 0 65.8%
Taylor expanded in K around 0 53.0%
+-commutative53.0%
*-commutative53.0%
associate-*r*53.0%
fma-define53.0%
*-commutative53.0%
Simplified53.0%
(FPCore (J l K U) :precision binary64 (if (<= l -3.9e+151) (- -4.0 (* U U)) (if (or (<= l -7.8e+23) (not (<= l 1.95))) (* U (- U -4.0)) U)))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -3.9e+151) {
tmp = -4.0 - (U * U);
} else if ((l <= -7.8e+23) || !(l <= 1.95)) {
tmp = U * (U - -4.0);
} else {
tmp = U;
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if (l <= (-3.9d+151)) then
tmp = (-4.0d0) - (u * u)
else if ((l <= (-7.8d+23)) .or. (.not. (l <= 1.95d0))) then
tmp = u * (u - (-4.0d0))
else
tmp = u
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= -3.9e+151) {
tmp = -4.0 - (U * U);
} else if ((l <= -7.8e+23) || !(l <= 1.95)) {
tmp = U * (U - -4.0);
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -3.9e+151: tmp = -4.0 - (U * U) elif (l <= -7.8e+23) or not (l <= 1.95): tmp = U * (U - -4.0) else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -3.9e+151) tmp = Float64(-4.0 - Float64(U * U)); elseif ((l <= -7.8e+23) || !(l <= 1.95)) tmp = Float64(U * Float64(U - -4.0)); else tmp = U; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -3.9e+151) tmp = -4.0 - (U * U); elseif ((l <= -7.8e+23) || ~((l <= 1.95))) tmp = U * (U - -4.0); else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -3.9e+151], N[(-4.0 - N[(U * U), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[l, -7.8e+23], N[Not[LessEqual[l, 1.95]], $MachinePrecision]], N[(U * N[(U - -4.0), $MachinePrecision]), $MachinePrecision], U]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -3.9 \cdot 10^{+151}:\\
\;\;\;\;-4 - U \cdot U\\
\mathbf{elif}\;\ell \leq -7.8 \cdot 10^{+23} \lor \neg \left(\ell \leq 1.95\right):\\
\;\;\;\;U \cdot \left(U - -4\right)\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if l < -3.89999999999999976e151Initial program 100.0%
associate-*l*100.0%
fma-define100.0%
Simplified100.0%
Applied egg-rr22.4%
cancel-sign-sub-inv22.4%
Simplified22.4%
if -3.89999999999999976e151 < l < -7.8000000000000001e23 or 1.94999999999999996 < l Initial program 100.0%
Applied egg-rr22.2%
if -7.8000000000000001e23 < l < 1.94999999999999996Initial program 65.0%
Taylor expanded in J around 0 57.7%
Final simplification39.7%
(FPCore (J l K U) :precision binary64 (if (or (<= l -1.85e+24) (not (<= l 1.95))) (* U (- U -4.0)) U))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -1.85e+24) || !(l <= 1.95)) {
tmp = U * (U - -4.0);
} else {
tmp = U;
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if ((l <= (-1.85d+24)) .or. (.not. (l <= 1.95d0))) then
tmp = u * (u - (-4.0d0))
else
tmp = u
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -1.85e+24) || !(l <= 1.95)) {
tmp = U * (U - -4.0);
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -1.85e+24) or not (l <= 1.95): tmp = U * (U - -4.0) else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -1.85e+24) || !(l <= 1.95)) tmp = Float64(U * Float64(U - -4.0)); else tmp = U; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -1.85e+24) || ~((l <= 1.95))) tmp = U * (U - -4.0); else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -1.85e+24], N[Not[LessEqual[l, 1.95]], $MachinePrecision]], N[(U * N[(U - -4.0), $MachinePrecision]), $MachinePrecision], U]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.85 \cdot 10^{+24} \lor \neg \left(\ell \leq 1.95\right):\\
\;\;\;\;U \cdot \left(U - -4\right)\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if l < -1.85e24 or 1.94999999999999996 < l Initial program 100.0%
Applied egg-rr19.1%
if -1.85e24 < l < 1.94999999999999996Initial program 65.0%
Taylor expanded in J around 0 57.7%
Final simplification38.1%
(FPCore (J l K U) :precision binary64 (if (or (<= l -9.1e-7) (not (<= l 1.95))) (* U U) U))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -9.1e-7) || !(l <= 1.95)) {
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 <= (-9.1d-7)) .or. (.not. (l <= 1.95d0))) 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 <= -9.1e-7) || !(l <= 1.95)) {
tmp = U * U;
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -9.1e-7) or not (l <= 1.95): tmp = U * U else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -9.1e-7) || !(l <= 1.95)) tmp = Float64(U * U); else tmp = U; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -9.1e-7) || ~((l <= 1.95))) tmp = U * U; else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -9.1e-7], N[Not[LessEqual[l, 1.95]], $MachinePrecision]], N[(U * U), $MachinePrecision], U]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -9.1 \cdot 10^{-7} \lor \neg \left(\ell \leq 1.95\right):\\
\;\;\;\;U \cdot U\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if l < -9.0999999999999997e-7 or 1.94999999999999996 < l Initial program 99.8%
Applied egg-rr18.2%
if -9.0999999999999997e-7 < l < 1.94999999999999996Initial program 63.1%
Taylor expanded in J around 0 61.0%
Final simplification38.1%
(FPCore (J l K U) :precision binary64 (+ U (* J (* 2.0 l))))
double code(double J, double l, double K, double U) {
return U + (J * (2.0 * l));
}
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 * (2.0d0 * l))
end function
public static double code(double J, double l, double K, double U) {
return U + (J * (2.0 * l));
}
def code(J, l, K, U): return U + (J * (2.0 * l))
function code(J, l, K, U) return Float64(U + Float64(J * Float64(2.0 * l))) end
function tmp = code(J, l, K, U) tmp = U + (J * (2.0 * l)); end
code[J_, l_, K_, U_] := N[(U + N[(J * N[(2.0 * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + J \cdot \left(2 \cdot \ell\right)
\end{array}
Initial program 82.7%
Taylor expanded in l around 0 65.8%
Taylor expanded in K around 0 53.0%
+-commutative53.0%
*-commutative53.0%
associate-*r*53.0%
*-commutative53.0%
Simplified53.0%
Final simplification53.0%
(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 82.7%
Taylor expanded in J around 0 29.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 82.7%
Applied egg-rr2.8%
*-inverses2.8%
Simplified2.8%
herbie shell --seed 2024094
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))