
(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 13 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 86.8%
Taylor expanded in l around 0 63.3%
log1p-expm1-u99.8%
*-commutative99.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (J l K U)
:precision binary64
(let* ((t_0
(+
U
(* (* J (* (pow l 7.0) 0.0003968253968253968)) (cos (/ K 2.0))))))
(if (<= l -4.0)
t_0
(if (<= l 3400.0)
(+ U (* 2.0 (* J (* l (cos (* K 0.5))))))
(if (<= l 6.8e+43) (+ U (* J (- (exp l) (exp (- l))))) t_0)))))
double code(double J, double l, double K, double U) {
double t_0 = U + ((J * (pow(l, 7.0) * 0.0003968253968253968)) * cos((K / 2.0)));
double tmp;
if (l <= -4.0) {
tmp = t_0;
} else if (l <= 3400.0) {
tmp = U + (2.0 * (J * (l * cos((K * 0.5)))));
} else if (l <= 6.8e+43) {
tmp = U + (J * (exp(l) - exp(-l)));
} 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 + ((j * ((l ** 7.0d0) * 0.0003968253968253968d0)) * cos((k / 2.0d0)))
if (l <= (-4.0d0)) then
tmp = t_0
else if (l <= 3400.0d0) then
tmp = u + (2.0d0 * (j * (l * cos((k * 0.5d0)))))
else if (l <= 6.8d+43) then
tmp = u + (j * (exp(l) - exp(-l)))
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 + ((J * (Math.pow(l, 7.0) * 0.0003968253968253968)) * Math.cos((K / 2.0)));
double tmp;
if (l <= -4.0) {
tmp = t_0;
} else if (l <= 3400.0) {
tmp = U + (2.0 * (J * (l * Math.cos((K * 0.5)))));
} else if (l <= 6.8e+43) {
tmp = U + (J * (Math.exp(l) - Math.exp(-l)));
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = U + ((J * (math.pow(l, 7.0) * 0.0003968253968253968)) * math.cos((K / 2.0))) tmp = 0 if l <= -4.0: tmp = t_0 elif l <= 3400.0: tmp = U + (2.0 * (J * (l * math.cos((K * 0.5))))) elif l <= 6.8e+43: tmp = U + (J * (math.exp(l) - math.exp(-l))) else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64(U + Float64(Float64(J * Float64((l ^ 7.0) * 0.0003968253968253968)) * cos(Float64(K / 2.0)))) tmp = 0.0 if (l <= -4.0) tmp = t_0; elseif (l <= 3400.0) tmp = Float64(U + Float64(2.0 * Float64(J * Float64(l * cos(Float64(K * 0.5)))))); elseif (l <= 6.8e+43) tmp = Float64(U + Float64(J * Float64(exp(l) - exp(Float64(-l))))); else tmp = t_0; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U + ((J * ((l ^ 7.0) * 0.0003968253968253968)) * cos((K / 2.0))); tmp = 0.0; if (l <= -4.0) tmp = t_0; elseif (l <= 3400.0) tmp = U + (2.0 * (J * (l * cos((K * 0.5))))); elseif (l <= 6.8e+43) tmp = U + (J * (exp(l) - exp(-l))); else tmp = t_0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(N[(J * N[(N[Power[l, 7.0], $MachinePrecision] * 0.0003968253968253968), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -4.0], t$95$0, If[LessEqual[l, 3400.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, 6.8e+43], N[(U + N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + \left(J \cdot \left({\ell}^{7} \cdot 0.0003968253968253968\right)\right) \cdot \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;\ell \leq -4:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq 3400:\\
\;\;\;\;U + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{elif}\;\ell \leq 6.8 \cdot 10^{+43}:\\
\;\;\;\;U + J \cdot \left(e^{\ell} - e^{-\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if l < -4 or 6.80000000000000024e43 < l Initial program 100.0%
Taylor expanded in l around 0 95.0%
*-commutative95.0%
Simplified95.0%
Taylor expanded in l around inf 95.0%
*-commutative95.0%
associate-*l*95.0%
Simplified95.0%
if -4 < l < 3400Initial program 73.7%
Taylor expanded in l around 0 98.8%
if 3400 < l < 6.80000000000000024e43Initial program 100.0%
Taylor expanded in K around 0 84.6%
Final simplification96.3%
(FPCore (J l K U)
:precision binary64
(let* ((t_0
(+
U
(* (* J (* (pow l 7.0) 0.0003968253968253968)) (cos (/ K 2.0))))))
(if (<= l -5.5)
t_0
(if (<= l 3400.0)
(+
U
(*
J
(* l (* (cos (* K 0.5)) (+ 2.0 (* 0.3333333333333333 (pow l 2.0)))))))
(if (<= l 1.2e+44) (+ U (* J (- (exp l) (exp (- l))))) t_0)))))
double code(double J, double l, double K, double U) {
double t_0 = U + ((J * (pow(l, 7.0) * 0.0003968253968253968)) * cos((K / 2.0)));
double tmp;
if (l <= -5.5) {
tmp = t_0;
} else if (l <= 3400.0) {
tmp = U + (J * (l * (cos((K * 0.5)) * (2.0 + (0.3333333333333333 * pow(l, 2.0))))));
} else if (l <= 1.2e+44) {
tmp = U + (J * (exp(l) - exp(-l)));
} 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 + ((j * ((l ** 7.0d0) * 0.0003968253968253968d0)) * cos((k / 2.0d0)))
if (l <= (-5.5d0)) then
tmp = t_0
else if (l <= 3400.0d0) then
tmp = u + (j * (l * (cos((k * 0.5d0)) * (2.0d0 + (0.3333333333333333d0 * (l ** 2.0d0))))))
else if (l <= 1.2d+44) then
tmp = u + (j * (exp(l) - exp(-l)))
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 + ((J * (Math.pow(l, 7.0) * 0.0003968253968253968)) * Math.cos((K / 2.0)));
double tmp;
if (l <= -5.5) {
tmp = t_0;
} else if (l <= 3400.0) {
tmp = U + (J * (l * (Math.cos((K * 0.5)) * (2.0 + (0.3333333333333333 * Math.pow(l, 2.0))))));
} else if (l <= 1.2e+44) {
tmp = U + (J * (Math.exp(l) - Math.exp(-l)));
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = U + ((J * (math.pow(l, 7.0) * 0.0003968253968253968)) * math.cos((K / 2.0))) tmp = 0 if l <= -5.5: tmp = t_0 elif l <= 3400.0: tmp = U + (J * (l * (math.cos((K * 0.5)) * (2.0 + (0.3333333333333333 * math.pow(l, 2.0)))))) elif l <= 1.2e+44: tmp = U + (J * (math.exp(l) - math.exp(-l))) else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64(U + Float64(Float64(J * Float64((l ^ 7.0) * 0.0003968253968253968)) * cos(Float64(K / 2.0)))) tmp = 0.0 if (l <= -5.5) tmp = t_0; elseif (l <= 3400.0) tmp = Float64(U + Float64(J * Float64(l * Float64(cos(Float64(K * 0.5)) * Float64(2.0 + Float64(0.3333333333333333 * (l ^ 2.0))))))); elseif (l <= 1.2e+44) tmp = Float64(U + Float64(J * Float64(exp(l) - exp(Float64(-l))))); else tmp = t_0; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U + ((J * ((l ^ 7.0) * 0.0003968253968253968)) * cos((K / 2.0))); tmp = 0.0; if (l <= -5.5) tmp = t_0; elseif (l <= 3400.0) tmp = U + (J * (l * (cos((K * 0.5)) * (2.0 + (0.3333333333333333 * (l ^ 2.0)))))); elseif (l <= 1.2e+44) tmp = U + (J * (exp(l) - exp(-l))); else tmp = t_0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(N[(J * N[(N[Power[l, 7.0], $MachinePrecision] * 0.0003968253968253968), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -5.5], t$95$0, If[LessEqual[l, 3400.0], 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], If[LessEqual[l, 1.2e+44], N[(U + N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + \left(J \cdot \left({\ell}^{7} \cdot 0.0003968253968253968\right)\right) \cdot \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;\ell \leq -5.5:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq 3400:\\
\;\;\;\;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{elif}\;\ell \leq 1.2 \cdot 10^{+44}:\\
\;\;\;\;U + J \cdot \left(e^{\ell} - e^{-\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if l < -5.5 or 1.20000000000000007e44 < l Initial program 100.0%
Taylor expanded in l around 0 95.0%
*-commutative95.0%
Simplified95.0%
Taylor expanded in l around inf 95.0%
*-commutative95.0%
associate-*l*95.0%
Simplified95.0%
if -5.5 < l < 3400Initial program 73.7%
Taylor expanded in l around 0 99.2%
*-commutative99.2%
Simplified99.2%
Taylor expanded in l around 0 98.9%
*-commutative98.9%
Simplified98.9%
Taylor expanded in J around 0 99.0%
if 3400 < l < 1.20000000000000007e44Initial program 100.0%
Taylor expanded in K around 0 84.6%
Final simplification96.4%
(FPCore (J l K U) :precision binary64 (if (or (<= l -8500000000.0) (not (<= l 3400.0))) (+ U (* J (- (exp l) (exp (- l))))) (+ U (* 2.0 (* J (* l (cos (* K 0.5))))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -8500000000.0) || !(l <= 3400.0)) {
tmp = U + (J * (exp(l) - exp(-l)));
} else {
tmp = U + (2.0 * (J * (l * cos((K * 0.5)))));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if ((l <= (-8500000000.0d0)) .or. (.not. (l <= 3400.0d0))) then
tmp = u + (j * (exp(l) - exp(-l)))
else
tmp = u + (2.0d0 * (j * (l * cos((k * 0.5d0)))))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -8500000000.0) || !(l <= 3400.0)) {
tmp = U + (J * (Math.exp(l) - Math.exp(-l)));
} else {
tmp = U + (2.0 * (J * (l * Math.cos((K * 0.5)))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -8500000000.0) or not (l <= 3400.0): tmp = U + (J * (math.exp(l) - math.exp(-l))) else: tmp = U + (2.0 * (J * (l * math.cos((K * 0.5))))) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -8500000000.0) || !(l <= 3400.0)) tmp = Float64(U + Float64(J * Float64(exp(l) - exp(Float64(-l))))); else tmp = Float64(U + Float64(2.0 * Float64(J * Float64(l * cos(Float64(K * 0.5)))))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -8500000000.0) || ~((l <= 3400.0))) tmp = U + (J * (exp(l) - exp(-l))); else tmp = U + (2.0 * (J * (l * cos((K * 0.5))))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -8500000000.0], N[Not[LessEqual[l, 3400.0]], $MachinePrecision]], N[(U + N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(2.0 * N[(J * N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -8500000000 \lor \neg \left(\ell \leq 3400\right):\\
\;\;\;\;U + J \cdot \left(e^{\ell} - e^{-\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;U + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\end{array}
\end{array}
if l < -8.5e9 or 3400 < l Initial program 100.0%
Taylor expanded in K around 0 82.5%
if -8.5e9 < l < 3400Initial program 74.1%
Taylor expanded in l around 0 97.3%
Final simplification90.0%
(FPCore (J l K U) :precision binary64 (let* ((t_0 (* J (/ 2.0 (/ U l))))) (if (<= (cos (/ K 2.0)) -0.05) (* U (+ 1.0 (fabs t_0))) (* U (+ 1.0 t_0)))))
double code(double J, double l, double K, double U) {
double t_0 = J * (2.0 / (U / l));
double tmp;
if (cos((K / 2.0)) <= -0.05) {
tmp = U * (1.0 + fabs(t_0));
} else {
tmp = U * (1.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 = j * (2.0d0 / (u / l))
if (cos((k / 2.0d0)) <= (-0.05d0)) then
tmp = u * (1.0d0 + abs(t_0))
else
tmp = u * (1.0d0 + t_0)
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = J * (2.0 / (U / l));
double tmp;
if (Math.cos((K / 2.0)) <= -0.05) {
tmp = U * (1.0 + Math.abs(t_0));
} else {
tmp = U * (1.0 + t_0);
}
return tmp;
}
def code(J, l, K, U): t_0 = J * (2.0 / (U / l)) tmp = 0 if math.cos((K / 2.0)) <= -0.05: tmp = U * (1.0 + math.fabs(t_0)) else: tmp = U * (1.0 + t_0) return tmp
function code(J, l, K, U) t_0 = Float64(J * Float64(2.0 / Float64(U / l))) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.05) tmp = Float64(U * Float64(1.0 + abs(t_0))); else tmp = Float64(U * Float64(1.0 + t_0)); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = J * (2.0 / (U / l)); tmp = 0.0; if (cos((K / 2.0)) <= -0.05) tmp = U * (1.0 + abs(t_0)); else tmp = U * (1.0 + t_0); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(J * N[(2.0 / N[(U / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.05], N[(U * N[(1.0 + N[Abs[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U * N[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := J \cdot \frac{2}{\frac{U}{\ell}}\\
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.05:\\
\;\;\;\;U \cdot \left(1 + \left|t\_0\right|\right)\\
\mathbf{else}:\\
\;\;\;\;U \cdot \left(1 + t\_0\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.050000000000000003Initial program 84.3%
Taylor expanded in l around 0 70.5%
associate-*r*70.5%
associate-*r*70.5%
Simplified70.5%
Taylor expanded in U around inf 78.5%
associate-/l*78.5%
Simplified78.5%
Taylor expanded in K around 0 40.2%
associate-/l*40.2%
Simplified40.2%
add-sqr-sqrt21.0%
sqrt-unprod57.8%
*-commutative57.8%
*-commutative57.8%
swap-sqr57.8%
pow257.8%
metadata-eval57.8%
Applied egg-rr57.8%
*-commutative57.8%
metadata-eval57.8%
unpow257.8%
swap-sqr57.8%
rem-sqrt-square56.7%
associate-*r*56.7%
associate-*r/56.7%
associate-*l/56.3%
associate-/r/56.7%
*-commutative56.7%
associate-/l*56.7%
Simplified56.7%
if -0.050000000000000003 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 87.6%
Taylor expanded in l around 0 61.2%
associate-*r*61.2%
associate-*r*61.2%
Simplified61.2%
Taylor expanded in U around inf 63.8%
associate-/l*68.7%
Simplified68.7%
Taylor expanded in K around 0 61.5%
associate-/l*66.3%
Simplified66.3%
Taylor expanded in J around 0 61.5%
associate-*l/57.7%
associate-/r/65.8%
associate-/l*65.8%
*-commutative65.8%
associate-/l*66.3%
Simplified66.3%
Final simplification64.2%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (* l (cos (* K 0.5)))) (t_1 (* J (+ (/ U J) (* 2.0 t_0)))))
(if (<= l -4000000000000.0)
t_1
(if (<= l 65000000.0)
(+ U (* 2.0 (* J t_0)))
(if (<= l 6.2e+205) t_1 (* U (+ 1.0 (* 2.0 (* J (/ l U))))))))))
double code(double J, double l, double K, double U) {
double t_0 = l * cos((K * 0.5));
double t_1 = J * ((U / J) + (2.0 * t_0));
double tmp;
if (l <= -4000000000000.0) {
tmp = t_1;
} else if (l <= 65000000.0) {
tmp = U + (2.0 * (J * t_0));
} else if (l <= 6.2e+205) {
tmp = t_1;
} else {
tmp = U * (1.0 + (2.0 * (J * (l / U))));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = l * cos((k * 0.5d0))
t_1 = j * ((u / j) + (2.0d0 * t_0))
if (l <= (-4000000000000.0d0)) then
tmp = t_1
else if (l <= 65000000.0d0) then
tmp = u + (2.0d0 * (j * t_0))
else if (l <= 6.2d+205) then
tmp = t_1
else
tmp = u * (1.0d0 + (2.0d0 * (j * (l / u))))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = l * Math.cos((K * 0.5));
double t_1 = J * ((U / J) + (2.0 * t_0));
double tmp;
if (l <= -4000000000000.0) {
tmp = t_1;
} else if (l <= 65000000.0) {
tmp = U + (2.0 * (J * t_0));
} else if (l <= 6.2e+205) {
tmp = t_1;
} else {
tmp = U * (1.0 + (2.0 * (J * (l / U))));
}
return tmp;
}
def code(J, l, K, U): t_0 = l * math.cos((K * 0.5)) t_1 = J * ((U / J) + (2.0 * t_0)) tmp = 0 if l <= -4000000000000.0: tmp = t_1 elif l <= 65000000.0: tmp = U + (2.0 * (J * t_0)) elif l <= 6.2e+205: tmp = t_1 else: tmp = U * (1.0 + (2.0 * (J * (l / U)))) return tmp
function code(J, l, K, U) t_0 = Float64(l * cos(Float64(K * 0.5))) t_1 = Float64(J * Float64(Float64(U / J) + Float64(2.0 * t_0))) tmp = 0.0 if (l <= -4000000000000.0) tmp = t_1; elseif (l <= 65000000.0) tmp = Float64(U + Float64(2.0 * Float64(J * t_0))); elseif (l <= 6.2e+205) tmp = t_1; else tmp = Float64(U * Float64(1.0 + Float64(2.0 * Float64(J * Float64(l / U))))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = l * cos((K * 0.5)); t_1 = J * ((U / J) + (2.0 * t_0)); tmp = 0.0; if (l <= -4000000000000.0) tmp = t_1; elseif (l <= 65000000.0) tmp = U + (2.0 * (J * t_0)); elseif (l <= 6.2e+205) tmp = t_1; else tmp = U * (1.0 + (2.0 * (J * (l / U)))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(J * N[(N[(U / J), $MachinePrecision] + N[(2.0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -4000000000000.0], t$95$1, If[LessEqual[l, 65000000.0], N[(U + N[(2.0 * N[(J * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 6.2e+205], t$95$1, N[(U * N[(1.0 + N[(2.0 * N[(J * N[(l / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \ell \cdot \cos \left(K \cdot 0.5\right)\\
t_1 := J \cdot \left(\frac{U}{J} + 2 \cdot t\_0\right)\\
\mathbf{if}\;\ell \leq -4000000000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\ell \leq 65000000:\\
\;\;\;\;U + 2 \cdot \left(J \cdot t\_0\right)\\
\mathbf{elif}\;\ell \leq 6.2 \cdot 10^{+205}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;U \cdot \left(1 + 2 \cdot \left(J \cdot \frac{\ell}{U}\right)\right)\\
\end{array}
\end{array}
if l < -4e12 or 6.5e7 < l < 6.20000000000000035e205Initial program 100.0%
Taylor expanded in l around 0 23.9%
associate-*r*23.9%
associate-*r*23.9%
Simplified23.9%
Taylor expanded in J around inf 38.9%
if -4e12 < l < 6.5e7Initial program 74.7%
Taylor expanded in l around 0 95.2%
if 6.20000000000000035e205 < l Initial program 100.0%
Taylor expanded in l around 0 50.4%
associate-*r*50.4%
associate-*r*50.4%
Simplified50.4%
Taylor expanded in U around inf 62.7%
associate-/l*87.8%
Simplified87.8%
Taylor expanded in K around 0 54.0%
associate-/l*79.1%
Simplified79.1%
Final simplification71.7%
(FPCore (J l K U)
:precision binary64
(if (<= (/ K 2.0) 5e-239)
(* J (+ (* 2.0 l) (/ U J)))
(if (<= (/ K 2.0) 2e-21)
(* U (+ 1.0 (* J (/ 2.0 (/ U l)))))
(+ U (* 2.0 (* J (* l (cos (* K 0.5)))))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((K / 2.0) <= 5e-239) {
tmp = J * ((2.0 * l) + (U / J));
} else if ((K / 2.0) <= 2e-21) {
tmp = U * (1.0 + (J * (2.0 / (U / l))));
} else {
tmp = U + (2.0 * (J * (l * cos((K * 0.5)))));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if ((k / 2.0d0) <= 5d-239) then
tmp = j * ((2.0d0 * l) + (u / j))
else if ((k / 2.0d0) <= 2d-21) then
tmp = u * (1.0d0 + (j * (2.0d0 / (u / l))))
else
tmp = u + (2.0d0 * (j * (l * cos((k * 0.5d0)))))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((K / 2.0) <= 5e-239) {
tmp = J * ((2.0 * l) + (U / J));
} else if ((K / 2.0) <= 2e-21) {
tmp = U * (1.0 + (J * (2.0 / (U / l))));
} else {
tmp = U + (2.0 * (J * (l * Math.cos((K * 0.5)))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (K / 2.0) <= 5e-239: tmp = J * ((2.0 * l) + (U / J)) elif (K / 2.0) <= 2e-21: tmp = U * (1.0 + (J * (2.0 / (U / l)))) else: tmp = U + (2.0 * (J * (l * math.cos((K * 0.5))))) return tmp
function code(J, l, K, U) tmp = 0.0 if (Float64(K / 2.0) <= 5e-239) tmp = Float64(J * Float64(Float64(2.0 * l) + Float64(U / J))); elseif (Float64(K / 2.0) <= 2e-21) tmp = Float64(U * Float64(1.0 + Float64(J * Float64(2.0 / Float64(U / l))))); else tmp = Float64(U + Float64(2.0 * Float64(J * Float64(l * cos(Float64(K * 0.5)))))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((K / 2.0) <= 5e-239) tmp = J * ((2.0 * l) + (U / J)); elseif ((K / 2.0) <= 2e-21) tmp = U * (1.0 + (J * (2.0 / (U / l)))); else tmp = U + (2.0 * (J * (l * cos((K * 0.5))))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[N[(K / 2.0), $MachinePrecision], 5e-239], N[(J * N[(N[(2.0 * l), $MachinePrecision] + N[(U / J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(K / 2.0), $MachinePrecision], 2e-21], N[(U * N[(1.0 + N[(J * N[(2.0 / N[(U / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(2.0 * N[(J * N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{K}{2} \leq 5 \cdot 10^{-239}:\\
\;\;\;\;J \cdot \left(2 \cdot \ell + \frac{U}{J}\right)\\
\mathbf{elif}\;\frac{K}{2} \leq 2 \cdot 10^{-21}:\\
\;\;\;\;U \cdot \left(1 + J \cdot \frac{2}{\frac{U}{\ell}}\right)\\
\mathbf{else}:\\
\;\;\;\;U + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\end{array}
\end{array}
if (/.f64 K #s(literal 2 binary64)) < 5e-239Initial program 83.1%
Taylor expanded in l around 0 64.8%
associate-*r*64.8%
associate-*r*64.8%
Simplified64.8%
Taylor expanded in U around inf 67.6%
associate-/l*71.4%
Simplified71.4%
Taylor expanded in K around 0 55.5%
associate-/l*59.3%
Simplified59.3%
Taylor expanded in J around inf 55.7%
if 5e-239 < (/.f64 K #s(literal 2 binary64)) < 1.99999999999999982e-21Initial program 89.4%
Taylor expanded in l around 0 61.9%
associate-*r*61.9%
associate-*r*61.9%
Simplified61.9%
Taylor expanded in U around inf 66.6%
associate-/l*73.8%
Simplified73.8%
Taylor expanded in K around 0 66.6%
associate-/l*73.8%
Simplified73.8%
Taylor expanded in J around 0 66.6%
associate-*l/61.8%
associate-/r/73.8%
associate-/l*73.8%
*-commutative73.8%
associate-/l*73.8%
Simplified73.8%
if 1.99999999999999982e-21 < (/.f64 K #s(literal 2 binary64)) Initial program 93.9%
Taylor expanded in l around 0 60.6%
Final simplification59.8%
(FPCore (J l K U) :precision binary64 (if (<= (/ K 2.0) 5e-239) (* J (+ (* 2.0 l) (/ U J))) (* U (+ 1.0 (* 2.0 (* J (/ (* l (cos (* K 0.5))) U)))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((K / 2.0) <= 5e-239) {
tmp = J * ((2.0 * l) + (U / J));
} else {
tmp = U * (1.0 + (2.0 * (J * ((l * cos((K * 0.5))) / 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-239) then
tmp = j * ((2.0d0 * l) + (u / j))
else
tmp = u * (1.0d0 + (2.0d0 * (j * ((l * cos((k * 0.5d0))) / 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-239) {
tmp = J * ((2.0 * l) + (U / J));
} else {
tmp = U * (1.0 + (2.0 * (J * ((l * Math.cos((K * 0.5))) / U))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (K / 2.0) <= 5e-239: tmp = J * ((2.0 * l) + (U / J)) else: tmp = U * (1.0 + (2.0 * (J * ((l * math.cos((K * 0.5))) / U)))) return tmp
function code(J, l, K, U) tmp = 0.0 if (Float64(K / 2.0) <= 5e-239) tmp = Float64(J * Float64(Float64(2.0 * l) + Float64(U / J))); else tmp = Float64(U * Float64(1.0 + Float64(2.0 * Float64(J * Float64(Float64(l * cos(Float64(K * 0.5))) / U))))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((K / 2.0) <= 5e-239) tmp = J * ((2.0 * l) + (U / J)); else tmp = U * (1.0 + (2.0 * (J * ((l * cos((K * 0.5))) / U)))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[N[(K / 2.0), $MachinePrecision], 5e-239], N[(J * N[(N[(2.0 * l), $MachinePrecision] + N[(U / J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U * N[(1.0 + N[(2.0 * N[(J * N[(N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{K}{2} \leq 5 \cdot 10^{-239}:\\
\;\;\;\;J \cdot \left(2 \cdot \ell + \frac{U}{J}\right)\\
\mathbf{else}:\\
\;\;\;\;U \cdot \left(1 + 2 \cdot \left(J \cdot \frac{\ell \cdot \cos \left(K \cdot 0.5\right)}{U}\right)\right)\\
\end{array}
\end{array}
if (/.f64 K #s(literal 2 binary64)) < 5e-239Initial program 83.1%
Taylor expanded in l around 0 64.8%
associate-*r*64.8%
associate-*r*64.8%
Simplified64.8%
Taylor expanded in U around inf 67.6%
associate-/l*71.4%
Simplified71.4%
Taylor expanded in K around 0 55.5%
associate-/l*59.3%
Simplified59.3%
Taylor expanded in J around inf 55.7%
if 5e-239 < (/.f64 K #s(literal 2 binary64)) Initial program 92.2%
Taylor expanded in l around 0 61.1%
associate-*r*61.1%
associate-*r*61.1%
Simplified61.1%
Taylor expanded in U around inf 66.5%
associate-/l*70.1%
Simplified70.1%
Final simplification61.6%
(FPCore (J l K U) :precision binary64 (if (or (<= l -4300000000000.0) (not (<= l 65000000.0))) (* J (+ (* 2.0 l) (/ U J))) (+ U (* J (* 2.0 l)))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -4300000000000.0) || !(l <= 65000000.0)) {
tmp = J * ((2.0 * l) + (U / J));
} else {
tmp = U + (J * (2.0 * 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 <= (-4300000000000.0d0)) .or. (.not. (l <= 65000000.0d0))) then
tmp = j * ((2.0d0 * l) + (u / j))
else
tmp = u + (j * (2.0d0 * l))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -4300000000000.0) || !(l <= 65000000.0)) {
tmp = J * ((2.0 * l) + (U / J));
} else {
tmp = U + (J * (2.0 * l));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -4300000000000.0) or not (l <= 65000000.0): tmp = J * ((2.0 * l) + (U / J)) else: tmp = U + (J * (2.0 * l)) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -4300000000000.0) || !(l <= 65000000.0)) tmp = Float64(J * Float64(Float64(2.0 * l) + Float64(U / J))); else tmp = Float64(U + Float64(J * Float64(2.0 * l))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -4300000000000.0) || ~((l <= 65000000.0))) tmp = J * ((2.0 * l) + (U / J)); else tmp = U + (J * (2.0 * l)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -4300000000000.0], N[Not[LessEqual[l, 65000000.0]], $MachinePrecision]], N[(J * N[(N[(2.0 * l), $MachinePrecision] + N[(U / J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(2.0 * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -4300000000000 \lor \neg \left(\ell \leq 65000000\right):\\
\;\;\;\;J \cdot \left(2 \cdot \ell + \frac{U}{J}\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(2 \cdot \ell\right)\\
\end{array}
\end{array}
if l < -4.3e12 or 6.5e7 < l Initial program 100.0%
Taylor expanded in l around 0 28.8%
associate-*r*28.8%
associate-*r*28.8%
Simplified28.8%
Taylor expanded in U around inf 38.8%
associate-/l*46.6%
Simplified46.6%
Taylor expanded in K around 0 29.5%
associate-/l*37.4%
Simplified37.4%
Taylor expanded in J around inf 35.6%
if -4.3e12 < l < 6.5e7Initial program 74.7%
Taylor expanded in l around 0 95.2%
associate-*r*95.2%
associate-*r*95.1%
Simplified95.1%
Taylor expanded in K around 0 83.5%
*-commutative83.5%
associate-*r*83.5%
Simplified83.5%
Final simplification60.5%
(FPCore (J l K U) :precision binary64 (if (<= (/ K 2.0) 5e-239) (* J (+ (* 2.0 l) (/ U J))) (* U (+ 1.0 (* J (/ 2.0 (/ U l)))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((K / 2.0) <= 5e-239) {
tmp = J * ((2.0 * l) + (U / J));
} else {
tmp = U * (1.0 + (J * (2.0 / (U / 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 ((k / 2.0d0) <= 5d-239) then
tmp = j * ((2.0d0 * l) + (u / j))
else
tmp = u * (1.0d0 + (j * (2.0d0 / (u / l))))
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-239) {
tmp = J * ((2.0 * l) + (U / J));
} else {
tmp = U * (1.0 + (J * (2.0 / (U / l))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (K / 2.0) <= 5e-239: tmp = J * ((2.0 * l) + (U / J)) else: tmp = U * (1.0 + (J * (2.0 / (U / l)))) return tmp
function code(J, l, K, U) tmp = 0.0 if (Float64(K / 2.0) <= 5e-239) tmp = Float64(J * Float64(Float64(2.0 * l) + Float64(U / J))); else tmp = Float64(U * Float64(1.0 + Float64(J * Float64(2.0 / Float64(U / l))))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((K / 2.0) <= 5e-239) tmp = J * ((2.0 * l) + (U / J)); else tmp = U * (1.0 + (J * (2.0 / (U / l)))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[N[(K / 2.0), $MachinePrecision], 5e-239], N[(J * N[(N[(2.0 * l), $MachinePrecision] + N[(U / J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U * N[(1.0 + N[(J * N[(2.0 / N[(U / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{K}{2} \leq 5 \cdot 10^{-239}:\\
\;\;\;\;J \cdot \left(2 \cdot \ell + \frac{U}{J}\right)\\
\mathbf{else}:\\
\;\;\;\;U \cdot \left(1 + J \cdot \frac{2}{\frac{U}{\ell}}\right)\\
\end{array}
\end{array}
if (/.f64 K #s(literal 2 binary64)) < 5e-239Initial program 83.1%
Taylor expanded in l around 0 64.8%
associate-*r*64.8%
associate-*r*64.8%
Simplified64.8%
Taylor expanded in U around inf 67.6%
associate-/l*71.4%
Simplified71.4%
Taylor expanded in K around 0 55.5%
associate-/l*59.3%
Simplified59.3%
Taylor expanded in J around inf 55.7%
if 5e-239 < (/.f64 K #s(literal 2 binary64)) Initial program 92.2%
Taylor expanded in l around 0 61.1%
associate-*r*61.1%
associate-*r*61.1%
Simplified61.1%
Taylor expanded in U around inf 66.5%
associate-/l*70.1%
Simplified70.1%
Taylor expanded in K around 0 58.3%
associate-/l*62.0%
Simplified62.0%
Taylor expanded in J around 0 58.3%
associate-*l/56.2%
associate-/r/61.1%
associate-/l*61.1%
*-commutative61.1%
associate-/l*62.0%
Simplified62.0%
Final simplification58.3%
(FPCore (J l K U) :precision binary64 (if (<= K 2.2e-236) (* J (+ (* 2.0 l) (/ U J))) (* U (+ 1.0 (* 2.0 (* J (/ l U)))))))
double code(double J, double l, double K, double U) {
double tmp;
if (K <= 2.2e-236) {
tmp = J * ((2.0 * l) + (U / J));
} else {
tmp = U * (1.0 + (2.0 * (J * (l / U))));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if (k <= 2.2d-236) then
tmp = j * ((2.0d0 * l) + (u / j))
else
tmp = u * (1.0d0 + (2.0d0 * (j * (l / u))))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (K <= 2.2e-236) {
tmp = J * ((2.0 * l) + (U / J));
} else {
tmp = U * (1.0 + (2.0 * (J * (l / U))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if K <= 2.2e-236: tmp = J * ((2.0 * l) + (U / J)) else: tmp = U * (1.0 + (2.0 * (J * (l / U)))) return tmp
function code(J, l, K, U) tmp = 0.0 if (K <= 2.2e-236) tmp = Float64(J * Float64(Float64(2.0 * l) + Float64(U / J))); else tmp = Float64(U * Float64(1.0 + Float64(2.0 * Float64(J * Float64(l / U))))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (K <= 2.2e-236) tmp = J * ((2.0 * l) + (U / J)); else tmp = U * (1.0 + (2.0 * (J * (l / U)))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[K, 2.2e-236], N[(J * N[(N[(2.0 * l), $MachinePrecision] + N[(U / J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U * N[(1.0 + N[(2.0 * N[(J * N[(l / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;K \leq 2.2 \cdot 10^{-236}:\\
\;\;\;\;J \cdot \left(2 \cdot \ell + \frac{U}{J}\right)\\
\mathbf{else}:\\
\;\;\;\;U \cdot \left(1 + 2 \cdot \left(J \cdot \frac{\ell}{U}\right)\right)\\
\end{array}
\end{array}
if K < 2.19999999999999992e-236Initial program 83.1%
Taylor expanded in l around 0 64.8%
associate-*r*64.8%
associate-*r*64.8%
Simplified64.8%
Taylor expanded in U around inf 67.6%
associate-/l*71.4%
Simplified71.4%
Taylor expanded in K around 0 55.5%
associate-/l*59.3%
Simplified59.3%
Taylor expanded in J around inf 55.7%
if 2.19999999999999992e-236 < K Initial program 92.2%
Taylor expanded in l around 0 61.1%
associate-*r*61.1%
associate-*r*61.1%
Simplified61.1%
Taylor expanded in U around inf 66.5%
associate-/l*70.1%
Simplified70.1%
Taylor expanded in K around 0 58.3%
associate-/l*62.0%
Simplified62.0%
Final simplification58.3%
(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 86.8%
Taylor expanded in l around 0 63.3%
associate-*r*63.3%
associate-*r*63.3%
Simplified63.3%
Taylor expanded in K around 0 54.2%
*-commutative54.2%
associate-*r*54.2%
Simplified54.2%
Final simplification54.2%
(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%
Taylor expanded in l around 0 63.3%
associate-*r*63.3%
associate-*r*63.3%
Simplified63.3%
Taylor expanded in J around 0 36.9%
Final simplification36.9%
herbie shell --seed 2024060
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))