
(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 23 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 (fma (* (* 2.0 (sinh l)) (cos (* K 0.5))) J U))
double code(double J, double l, double K, double U) {
return fma(((2.0 * sinh(l)) * cos((K * 0.5))), J, U);
}
function code(J, l, K, U) return fma(Float64(Float64(2.0 * sinh(l)) * cos(Float64(K * 0.5))), J, U) end
code[J_, l_, K_, U_] := N[(N[(N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\left(2 \cdot \sinh \ell\right) \cdot \cos \left(K \cdot 0.5\right), J, U\right)
\end{array}
Initial program 86.2%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites100.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 -0.991)
(+
U
(*
(* l (fma l (* l 0.3333333333333333) 2.0))
(fma -0.125 (* J (* K K)) J)))
(if (<= t_0 -0.05)
(fma (* (cos (* K 0.5)) (* 2.0 l)) J U)
(fma (* (* 2.0 (sinh l)) 1.0) J U)))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double tmp;
if (t_0 <= -0.991) {
tmp = U + ((l * fma(l, (l * 0.3333333333333333), 2.0)) * fma(-0.125, (J * (K * K)), J));
} else if (t_0 <= -0.05) {
tmp = fma((cos((K * 0.5)) * (2.0 * l)), J, U);
} else {
tmp = fma(((2.0 * sinh(l)) * 1.0), J, U);
}
return tmp;
}
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (t_0 <= -0.991) tmp = Float64(U + Float64(Float64(l * fma(l, Float64(l * 0.3333333333333333), 2.0)) * fma(-0.125, Float64(J * Float64(K * K)), J))); elseif (t_0 <= -0.05) tmp = fma(Float64(cos(Float64(K * 0.5)) * Float64(2.0 * l)), J, U); else tmp = fma(Float64(Float64(2.0 * sinh(l)) * 1.0), J, U); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, -0.991], N[(U + N[(N[(l * N[(l * N[(l * 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] * N[(-0.125 * N[(J * N[(K * K), $MachinePrecision]), $MachinePrecision] + J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, -0.05], N[(N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(2.0 * l), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision], N[(N[(N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision] * J + U), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t\_0 \leq -0.991:\\
\;\;\;\;U + \left(\ell \cdot \mathsf{fma}\left(\ell, \ell \cdot 0.3333333333333333, 2\right)\right) \cdot \mathsf{fma}\left(-0.125, J \cdot \left(K \cdot K\right), J\right)\\
\mathbf{elif}\;t\_0 \leq -0.05:\\
\;\;\;\;\mathsf{fma}\left(\cos \left(K \cdot 0.5\right) \cdot \left(2 \cdot \ell\right), J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(2 \cdot \sinh \ell\right) \cdot 1, J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.990999999999999992Initial program 100.0%
Taylor expanded in l around 0
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
distribute-lft-outN/A
distribute-rgt-outN/A
Applied rewrites73.7%
Taylor expanded in K around 0
Applied rewrites100.0%
if -0.990999999999999992 < (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.050000000000000003Initial program 79.2%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites99.9%
Taylor expanded in l around 0
lower-*.f6472.1
Applied rewrites72.1%
if -0.050000000000000003 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 87.4%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in K around 0
Applied rewrites96.0%
Final simplification91.5%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 -0.991)
(+
U
(*
(* l (fma l (* l 0.3333333333333333) 2.0))
(fma -0.125 (* J (* K K)) J)))
(if (<= t_0 -0.05)
(fma (cos (* K 0.5)) (* J (* 2.0 l)) U)
(fma (* (* 2.0 (sinh l)) 1.0) J U)))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double tmp;
if (t_0 <= -0.991) {
tmp = U + ((l * fma(l, (l * 0.3333333333333333), 2.0)) * fma(-0.125, (J * (K * K)), J));
} else if (t_0 <= -0.05) {
tmp = fma(cos((K * 0.5)), (J * (2.0 * l)), U);
} else {
tmp = fma(((2.0 * sinh(l)) * 1.0), J, U);
}
return tmp;
}
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (t_0 <= -0.991) tmp = Float64(U + Float64(Float64(l * fma(l, Float64(l * 0.3333333333333333), 2.0)) * fma(-0.125, Float64(J * Float64(K * K)), J))); elseif (t_0 <= -0.05) tmp = fma(cos(Float64(K * 0.5)), Float64(J * Float64(2.0 * l)), U); else tmp = fma(Float64(Float64(2.0 * sinh(l)) * 1.0), J, U); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, -0.991], N[(U + N[(N[(l * N[(l * N[(l * 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] * N[(-0.125 * N[(J * N[(K * K), $MachinePrecision]), $MachinePrecision] + J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, -0.05], N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(J * N[(2.0 * l), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(N[(N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision] * J + U), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t\_0 \leq -0.991:\\
\;\;\;\;U + \left(\ell \cdot \mathsf{fma}\left(\ell, \ell \cdot 0.3333333333333333, 2\right)\right) \cdot \mathsf{fma}\left(-0.125, J \cdot \left(K \cdot K\right), J\right)\\
\mathbf{elif}\;t\_0 \leq -0.05:\\
\;\;\;\;\mathsf{fma}\left(\cos \left(K \cdot 0.5\right), J \cdot \left(2 \cdot \ell\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(2 \cdot \sinh \ell\right) \cdot 1, J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.990999999999999992Initial program 100.0%
Taylor expanded in l around 0
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
distribute-lft-outN/A
distribute-rgt-outN/A
Applied rewrites73.7%
Taylor expanded in K around 0
Applied rewrites100.0%
if -0.990999999999999992 < (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.050000000000000003Initial program 79.2%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6472.1
Applied rewrites72.1%
if -0.050000000000000003 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 87.4%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in K around 0
Applied rewrites96.0%
Final simplification91.5%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.05)
(fma
(* J (fma K (* K -0.125) 1.0))
(*
l
(fma
l
(* l (fma (* l l) (* (* l l) 0.0003968253968253968) 0.3333333333333333))
2.0))
U)
(fma (* (* 2.0 (sinh l)) 1.0) J U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.05) {
tmp = fma((J * fma(K, (K * -0.125), 1.0)), (l * fma(l, (l * fma((l * l), ((l * l) * 0.0003968253968253968), 0.3333333333333333)), 2.0)), U);
} else {
tmp = fma(((2.0 * sinh(l)) * 1.0), J, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.05) tmp = fma(Float64(J * fma(K, Float64(K * -0.125), 1.0)), Float64(l * fma(l, Float64(l * fma(Float64(l * l), Float64(Float64(l * l) * 0.0003968253968253968), 0.3333333333333333)), 2.0)), U); else tmp = fma(Float64(Float64(2.0 * sinh(l)) * 1.0), J, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.05], N[(N[(J * N[(K * N[(K * -0.125), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] * N[(l * N[(l * N[(l * N[(N[(l * l), $MachinePrecision] * N[(N[(l * l), $MachinePrecision] * 0.0003968253968253968), $MachinePrecision] + 0.3333333333333333), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(N[(N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision] * J + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.05:\\
\;\;\;\;\mathsf{fma}\left(J \cdot \mathsf{fma}\left(K, K \cdot -0.125, 1\right), \ell \cdot \mathsf{fma}\left(\ell, \ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \left(\ell \cdot \ell\right) \cdot 0.0003968253968253968, 0.3333333333333333\right), 2\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(2 \cdot \sinh \ell\right) \cdot 1, J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.050000000000000003Initial program 81.8%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6496.5
Applied rewrites96.5%
lift-+.f64N/A
Applied rewrites96.5%
Taylor expanded in l around inf
Applied rewrites96.5%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6458.2
Applied rewrites58.2%
if -0.050000000000000003 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 87.4%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in K around 0
Applied rewrites96.0%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.05)
(fma
(* J (fma K (* K -0.125) 1.0))
(*
l
(fma
l
(* l (fma (* l l) (* (* l l) 0.0003968253968253968) 0.3333333333333333))
2.0))
U)
(fma
(* J 1.0)
(*
l
(fma
l
(*
l
(fma
(* l l)
(fma l (* l 0.0003968253968253968) 0.016666666666666666)
0.3333333333333333))
2.0))
U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.05) {
tmp = fma((J * fma(K, (K * -0.125), 1.0)), (l * fma(l, (l * fma((l * l), ((l * l) * 0.0003968253968253968), 0.3333333333333333)), 2.0)), U);
} else {
tmp = fma((J * 1.0), (l * fma(l, (l * fma((l * l), fma(l, (l * 0.0003968253968253968), 0.016666666666666666), 0.3333333333333333)), 2.0)), U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.05) tmp = fma(Float64(J * fma(K, Float64(K * -0.125), 1.0)), Float64(l * fma(l, Float64(l * fma(Float64(l * l), Float64(Float64(l * l) * 0.0003968253968253968), 0.3333333333333333)), 2.0)), U); else tmp = fma(Float64(J * 1.0), Float64(l * fma(l, Float64(l * fma(Float64(l * l), fma(l, Float64(l * 0.0003968253968253968), 0.016666666666666666), 0.3333333333333333)), 2.0)), U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.05], N[(N[(J * N[(K * N[(K * -0.125), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] * N[(l * N[(l * N[(l * N[(N[(l * l), $MachinePrecision] * N[(N[(l * l), $MachinePrecision] * 0.0003968253968253968), $MachinePrecision] + 0.3333333333333333), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(N[(J * 1.0), $MachinePrecision] * N[(l * N[(l * N[(l * N[(N[(l * l), $MachinePrecision] * N[(l * N[(l * 0.0003968253968253968), $MachinePrecision] + 0.016666666666666666), $MachinePrecision] + 0.3333333333333333), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.05:\\
\;\;\;\;\mathsf{fma}\left(J \cdot \mathsf{fma}\left(K, K \cdot -0.125, 1\right), \ell \cdot \mathsf{fma}\left(\ell, \ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \left(\ell \cdot \ell\right) \cdot 0.0003968253968253968, 0.3333333333333333\right), 2\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(J \cdot 1, \ell \cdot \mathsf{fma}\left(\ell, \ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell, \ell \cdot 0.0003968253968253968, 0.016666666666666666\right), 0.3333333333333333\right), 2\right), U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.050000000000000003Initial program 81.8%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6496.5
Applied rewrites96.5%
lift-+.f64N/A
Applied rewrites96.5%
Taylor expanded in l around inf
Applied rewrites96.5%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6458.2
Applied rewrites58.2%
if -0.050000000000000003 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 87.4%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6496.0
Applied rewrites96.0%
lift-+.f64N/A
Applied rewrites96.0%
Taylor expanded in K around 0
Applied rewrites92.6%
(FPCore (J l K U)
:precision binary64
(if (<= (/ K 2.0) 4e-105)
(fma (* (* 2.0 (sinh l)) 1.0) J U)
(fma
(* (cos (* K 0.5)) J)
(*
l
(fma
l
(*
l
(fma
(* l l)
(fma l (* l 0.0003968253968253968) 0.016666666666666666)
0.3333333333333333))
2.0))
U)))
double code(double J, double l, double K, double U) {
double tmp;
if ((K / 2.0) <= 4e-105) {
tmp = fma(((2.0 * sinh(l)) * 1.0), J, U);
} else {
tmp = fma((cos((K * 0.5)) * J), (l * fma(l, (l * fma((l * l), fma(l, (l * 0.0003968253968253968), 0.016666666666666666), 0.3333333333333333)), 2.0)), U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (Float64(K / 2.0) <= 4e-105) tmp = fma(Float64(Float64(2.0 * sinh(l)) * 1.0), J, U); else tmp = fma(Float64(cos(Float64(K * 0.5)) * J), Float64(l * fma(l, Float64(l * fma(Float64(l * l), fma(l, Float64(l * 0.0003968253968253968), 0.016666666666666666), 0.3333333333333333)), 2.0)), U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[(K / 2.0), $MachinePrecision], 4e-105], N[(N[(N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision] * J + U), $MachinePrecision], N[(N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * J), $MachinePrecision] * N[(l * N[(l * N[(l * N[(N[(l * l), $MachinePrecision] * N[(l * N[(l * 0.0003968253968253968), $MachinePrecision] + 0.016666666666666666), $MachinePrecision] + 0.3333333333333333), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{K}{2} \leq 4 \cdot 10^{-105}:\\
\;\;\;\;\mathsf{fma}\left(\left(2 \cdot \sinh \ell\right) \cdot 1, J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\cos \left(K \cdot 0.5\right) \cdot J, \ell \cdot \mathsf{fma}\left(\ell, \ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell, \ell \cdot 0.0003968253968253968, 0.016666666666666666\right), 0.3333333333333333\right), 2\right), U\right)\\
\end{array}
\end{array}
if (/.f64 K #s(literal 2 binary64)) < 3.99999999999999986e-105Initial program 85.7%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in K around 0
Applied rewrites83.3%
if 3.99999999999999986e-105 < (/.f64 K #s(literal 2 binary64)) Initial program 87.2%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6496.5
Applied rewrites96.5%
lift-+.f64N/A
Applied rewrites96.5%
Final simplification87.5%
(FPCore (J l K U)
:precision binary64
(if (<= (/ K 2.0) 4e-105)
(fma (* (* 2.0 (sinh l)) 1.0) J U)
(fma
(* (cos (* K 0.5)) J)
(*
l
(fma
l
(* l (fma (* l l) (* (* l l) 0.0003968253968253968) 0.3333333333333333))
2.0))
U)))
double code(double J, double l, double K, double U) {
double tmp;
if ((K / 2.0) <= 4e-105) {
tmp = fma(((2.0 * sinh(l)) * 1.0), J, U);
} else {
tmp = fma((cos((K * 0.5)) * J), (l * fma(l, (l * fma((l * l), ((l * l) * 0.0003968253968253968), 0.3333333333333333)), 2.0)), U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (Float64(K / 2.0) <= 4e-105) tmp = fma(Float64(Float64(2.0 * sinh(l)) * 1.0), J, U); else tmp = fma(Float64(cos(Float64(K * 0.5)) * J), Float64(l * fma(l, Float64(l * fma(Float64(l * l), Float64(Float64(l * l) * 0.0003968253968253968), 0.3333333333333333)), 2.0)), U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[(K / 2.0), $MachinePrecision], 4e-105], N[(N[(N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision] * J + U), $MachinePrecision], N[(N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * J), $MachinePrecision] * N[(l * N[(l * N[(l * N[(N[(l * l), $MachinePrecision] * N[(N[(l * l), $MachinePrecision] * 0.0003968253968253968), $MachinePrecision] + 0.3333333333333333), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{K}{2} \leq 4 \cdot 10^{-105}:\\
\;\;\;\;\mathsf{fma}\left(\left(2 \cdot \sinh \ell\right) \cdot 1, J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\cos \left(K \cdot 0.5\right) \cdot J, \ell \cdot \mathsf{fma}\left(\ell, \ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \left(\ell \cdot \ell\right) \cdot 0.0003968253968253968, 0.3333333333333333\right), 2\right), U\right)\\
\end{array}
\end{array}
if (/.f64 K #s(literal 2 binary64)) < 3.99999999999999986e-105Initial program 85.7%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in K around 0
Applied rewrites83.3%
if 3.99999999999999986e-105 < (/.f64 K #s(literal 2 binary64)) Initial program 87.2%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6496.5
Applied rewrites96.5%
lift-+.f64N/A
Applied rewrites96.5%
Taylor expanded in l around inf
Applied rewrites96.5%
Final simplification87.5%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.05)
(+
U
(*
(* l (fma l (* l 0.3333333333333333) 2.0))
(fma -0.125 (* J (* K K)) J)))
(fma
(* J 1.0)
(*
l
(fma
l
(*
l
(fma
(* l l)
(fma l (* l 0.0003968253968253968) 0.016666666666666666)
0.3333333333333333))
2.0))
U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.05) {
tmp = U + ((l * fma(l, (l * 0.3333333333333333), 2.0)) * fma(-0.125, (J * (K * K)), J));
} else {
tmp = fma((J * 1.0), (l * fma(l, (l * fma((l * l), fma(l, (l * 0.0003968253968253968), 0.016666666666666666), 0.3333333333333333)), 2.0)), U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.05) tmp = Float64(U + Float64(Float64(l * fma(l, Float64(l * 0.3333333333333333), 2.0)) * fma(-0.125, Float64(J * Float64(K * K)), J))); else tmp = fma(Float64(J * 1.0), Float64(l * fma(l, Float64(l * fma(Float64(l * l), fma(l, Float64(l * 0.0003968253968253968), 0.016666666666666666), 0.3333333333333333)), 2.0)), U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.05], N[(U + N[(N[(l * N[(l * N[(l * 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] * N[(-0.125 * N[(J * N[(K * K), $MachinePrecision]), $MachinePrecision] + J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(J * 1.0), $MachinePrecision] * N[(l * N[(l * N[(l * N[(N[(l * l), $MachinePrecision] * N[(l * N[(l * 0.0003968253968253968), $MachinePrecision] + 0.016666666666666666), $MachinePrecision] + 0.3333333333333333), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.05:\\
\;\;\;\;U + \left(\ell \cdot \mathsf{fma}\left(\ell, \ell \cdot 0.3333333333333333, 2\right)\right) \cdot \mathsf{fma}\left(-0.125, J \cdot \left(K \cdot K\right), J\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(J \cdot 1, \ell \cdot \mathsf{fma}\left(\ell, \ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell, \ell \cdot 0.0003968253968253968, 0.016666666666666666\right), 0.3333333333333333\right), 2\right), U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.050000000000000003Initial program 81.8%
Taylor expanded in l around 0
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
distribute-lft-outN/A
distribute-rgt-outN/A
Applied rewrites82.8%
Taylor expanded in K around 0
Applied rewrites54.7%
if -0.050000000000000003 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 87.4%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6496.0
Applied rewrites96.0%
lift-+.f64N/A
Applied rewrites96.0%
Taylor expanded in K around 0
Applied rewrites92.6%
Final simplification84.3%
(FPCore (J l K U)
:precision binary64
(if (<= (/ K 2.0) 4e-105)
(fma (* (* 2.0 (sinh l)) 1.0) J U)
(fma
(*
(cos (* K 0.5))
(*
2.0
(fma
(* l l)
(* l (fma l (* l 0.008333333333333333) 0.16666666666666666))
l)))
J
U)))
double code(double J, double l, double K, double U) {
double tmp;
if ((K / 2.0) <= 4e-105) {
tmp = fma(((2.0 * sinh(l)) * 1.0), J, U);
} else {
tmp = fma((cos((K * 0.5)) * (2.0 * fma((l * l), (l * fma(l, (l * 0.008333333333333333), 0.16666666666666666)), l))), J, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (Float64(K / 2.0) <= 4e-105) tmp = fma(Float64(Float64(2.0 * sinh(l)) * 1.0), J, U); else tmp = fma(Float64(cos(Float64(K * 0.5)) * Float64(2.0 * fma(Float64(l * l), Float64(l * fma(l, Float64(l * 0.008333333333333333), 0.16666666666666666)), l))), J, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[(K / 2.0), $MachinePrecision], 4e-105], N[(N[(N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision] * J + U), $MachinePrecision], N[(N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(2.0 * N[(N[(l * l), $MachinePrecision] * N[(l * N[(l * N[(l * 0.008333333333333333), $MachinePrecision] + 0.16666666666666666), $MachinePrecision]), $MachinePrecision] + l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{K}{2} \leq 4 \cdot 10^{-105}:\\
\;\;\;\;\mathsf{fma}\left(\left(2 \cdot \sinh \ell\right) \cdot 1, J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\cos \left(K \cdot 0.5\right) \cdot \left(2 \cdot \mathsf{fma}\left(\ell \cdot \ell, \ell \cdot \mathsf{fma}\left(\ell, \ell \cdot 0.008333333333333333, 0.16666666666666666\right), \ell\right)\right), J, U\right)\\
\end{array}
\end{array}
if (/.f64 K #s(literal 2 binary64)) < 3.99999999999999986e-105Initial program 85.7%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in K around 0
Applied rewrites83.3%
if 3.99999999999999986e-105 < (/.f64 K #s(literal 2 binary64)) Initial program 87.2%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in l around 0
distribute-rgt-inN/A
*-lft-identityN/A
+-commutativeN/A
associate-*l*N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6496.5
Applied rewrites96.5%
Final simplification87.5%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.05)
(+
U
(*
(* l (fma l (* l 0.3333333333333333) 2.0))
(fma -0.125 (* J (* K K)) J)))
(fma
(* J 1.0)
(*
l
(fma
l
(* l (fma (* l l) (* (* l l) 0.0003968253968253968) 0.3333333333333333))
2.0))
U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.05) {
tmp = U + ((l * fma(l, (l * 0.3333333333333333), 2.0)) * fma(-0.125, (J * (K * K)), J));
} else {
tmp = fma((J * 1.0), (l * fma(l, (l * fma((l * l), ((l * l) * 0.0003968253968253968), 0.3333333333333333)), 2.0)), U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.05) tmp = Float64(U + Float64(Float64(l * fma(l, Float64(l * 0.3333333333333333), 2.0)) * fma(-0.125, Float64(J * Float64(K * K)), J))); else tmp = fma(Float64(J * 1.0), Float64(l * fma(l, Float64(l * fma(Float64(l * l), Float64(Float64(l * l) * 0.0003968253968253968), 0.3333333333333333)), 2.0)), U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.05], N[(U + N[(N[(l * N[(l * N[(l * 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] * N[(-0.125 * N[(J * N[(K * K), $MachinePrecision]), $MachinePrecision] + J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(J * 1.0), $MachinePrecision] * N[(l * N[(l * N[(l * N[(N[(l * l), $MachinePrecision] * N[(N[(l * l), $MachinePrecision] * 0.0003968253968253968), $MachinePrecision] + 0.3333333333333333), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.05:\\
\;\;\;\;U + \left(\ell \cdot \mathsf{fma}\left(\ell, \ell \cdot 0.3333333333333333, 2\right)\right) \cdot \mathsf{fma}\left(-0.125, J \cdot \left(K \cdot K\right), J\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(J \cdot 1, \ell \cdot \mathsf{fma}\left(\ell, \ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \left(\ell \cdot \ell\right) \cdot 0.0003968253968253968, 0.3333333333333333\right), 2\right), U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.050000000000000003Initial program 81.8%
Taylor expanded in l around 0
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
distribute-lft-outN/A
distribute-rgt-outN/A
Applied rewrites82.8%
Taylor expanded in K around 0
Applied rewrites54.7%
if -0.050000000000000003 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 87.4%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6496.0
Applied rewrites96.0%
lift-+.f64N/A
Applied rewrites96.0%
Taylor expanded in l around inf
Applied rewrites95.9%
Taylor expanded in K around 0
Applied rewrites92.6%
Final simplification84.3%
(FPCore (J l K U)
:precision binary64
(if (<= (/ K 2.0) 4e-105)
(fma (* (* 2.0 (sinh l)) 1.0) J U)
(fma
(*
(cos (* K 0.5))
(*
l
(fma (* l l) (fma l (* l 0.016666666666666666) 0.3333333333333333) 2.0)))
J
U)))
double code(double J, double l, double K, double U) {
double tmp;
if ((K / 2.0) <= 4e-105) {
tmp = fma(((2.0 * sinh(l)) * 1.0), J, U);
} else {
tmp = fma((cos((K * 0.5)) * (l * fma((l * l), fma(l, (l * 0.016666666666666666), 0.3333333333333333), 2.0))), J, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (Float64(K / 2.0) <= 4e-105) tmp = fma(Float64(Float64(2.0 * sinh(l)) * 1.0), J, U); else tmp = fma(Float64(cos(Float64(K * 0.5)) * Float64(l * fma(Float64(l * l), fma(l, Float64(l * 0.016666666666666666), 0.3333333333333333), 2.0))), J, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[(K / 2.0), $MachinePrecision], 4e-105], N[(N[(N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision] * J + U), $MachinePrecision], N[(N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(l * N[(N[(l * l), $MachinePrecision] * N[(l * N[(l * 0.016666666666666666), $MachinePrecision] + 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{K}{2} \leq 4 \cdot 10^{-105}:\\
\;\;\;\;\mathsf{fma}\left(\left(2 \cdot \sinh \ell\right) \cdot 1, J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\cos \left(K \cdot 0.5\right) \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell, \ell \cdot 0.016666666666666666, 0.3333333333333333\right), 2\right)\right), J, U\right)\\
\end{array}
\end{array}
if (/.f64 K #s(literal 2 binary64)) < 3.99999999999999986e-105Initial program 85.7%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in K around 0
Applied rewrites83.3%
if 3.99999999999999986e-105 < (/.f64 K #s(literal 2 binary64)) Initial program 87.2%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6496.5
Applied rewrites96.5%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites96.5%
Final simplification87.5%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.05)
(+
U
(*
(* l (fma l (* l 0.3333333333333333) 2.0))
(fma -0.125 (* J (* K K)) J)))
(fma
(* J 1.0)
(*
l
(fma (* l l) (fma (* l l) 0.016666666666666666 0.3333333333333333) 2.0))
U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.05) {
tmp = U + ((l * fma(l, (l * 0.3333333333333333), 2.0)) * fma(-0.125, (J * (K * K)), J));
} else {
tmp = fma((J * 1.0), (l * fma((l * l), fma((l * l), 0.016666666666666666, 0.3333333333333333), 2.0)), U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.05) tmp = Float64(U + Float64(Float64(l * fma(l, Float64(l * 0.3333333333333333), 2.0)) * fma(-0.125, Float64(J * Float64(K * K)), J))); else tmp = fma(Float64(J * 1.0), Float64(l * fma(Float64(l * l), fma(Float64(l * l), 0.016666666666666666, 0.3333333333333333), 2.0)), U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.05], N[(U + N[(N[(l * N[(l * N[(l * 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] * N[(-0.125 * N[(J * N[(K * K), $MachinePrecision]), $MachinePrecision] + J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(J * 1.0), $MachinePrecision] * N[(l * N[(N[(l * l), $MachinePrecision] * N[(N[(l * l), $MachinePrecision] * 0.016666666666666666 + 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.05:\\
\;\;\;\;U + \left(\ell \cdot \mathsf{fma}\left(\ell, \ell \cdot 0.3333333333333333, 2\right)\right) \cdot \mathsf{fma}\left(-0.125, J \cdot \left(K \cdot K\right), J\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(J \cdot 1, \ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell \cdot \ell, 0.016666666666666666, 0.3333333333333333\right), 2\right), U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.050000000000000003Initial program 81.8%
Taylor expanded in l around 0
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
distribute-lft-outN/A
distribute-rgt-outN/A
Applied rewrites82.8%
Taylor expanded in K around 0
Applied rewrites54.7%
if -0.050000000000000003 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 87.4%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6496.0
Applied rewrites96.0%
lift-+.f64N/A
Applied rewrites96.0%
Taylor expanded in K around 0
Applied rewrites92.6%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6490.7
Applied rewrites90.7%
Final simplification82.8%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.05)
(fma (* (* 2.0 l) (fma -0.125 (* K K) 1.0)) J U)
(fma
(* J 1.0)
(*
l
(fma (* l l) (fma (* l l) 0.016666666666666666 0.3333333333333333) 2.0))
U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.05) {
tmp = fma(((2.0 * l) * fma(-0.125, (K * K), 1.0)), J, U);
} else {
tmp = fma((J * 1.0), (l * fma((l * l), fma((l * l), 0.016666666666666666, 0.3333333333333333), 2.0)), U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.05) tmp = fma(Float64(Float64(2.0 * l) * fma(-0.125, Float64(K * K), 1.0)), J, U); else tmp = fma(Float64(J * 1.0), Float64(l * fma(Float64(l * l), fma(Float64(l * l), 0.016666666666666666, 0.3333333333333333), 2.0)), U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.05], N[(N[(N[(2.0 * l), $MachinePrecision] * N[(-0.125 * N[(K * K), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision], N[(N[(J * 1.0), $MachinePrecision] * N[(l * N[(N[(l * l), $MachinePrecision] * N[(N[(l * l), $MachinePrecision] * 0.016666666666666666 + 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.05:\\
\;\;\;\;\mathsf{fma}\left(\left(2 \cdot \ell\right) \cdot \mathsf{fma}\left(-0.125, K \cdot K, 1\right), J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(J \cdot 1, \ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell \cdot \ell, 0.016666666666666666, 0.3333333333333333\right), 2\right), U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.050000000000000003Initial program 81.8%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites99.9%
Taylor expanded in l around 0
lower-*.f6467.3
Applied rewrites67.3%
Taylor expanded in K around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6452.9
Applied rewrites52.9%
if -0.050000000000000003 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 87.4%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6496.0
Applied rewrites96.0%
lift-+.f64N/A
Applied rewrites96.0%
Taylor expanded in K around 0
Applied rewrites92.6%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6490.7
Applied rewrites90.7%
(FPCore (J l K U) :precision binary64 (if (<= (/ K 2.0) 5000000000000.0) (fma (* (* 2.0 (sinh l)) 1.0) J U) (fma (* (cos (* K 0.5)) J) (* l (fma l (* l 0.3333333333333333) 2.0)) U)))
double code(double J, double l, double K, double U) {
double tmp;
if ((K / 2.0) <= 5000000000000.0) {
tmp = fma(((2.0 * sinh(l)) * 1.0), J, U);
} else {
tmp = fma((cos((K * 0.5)) * J), (l * fma(l, (l * 0.3333333333333333), 2.0)), U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (Float64(K / 2.0) <= 5000000000000.0) tmp = fma(Float64(Float64(2.0 * sinh(l)) * 1.0), J, U); else tmp = fma(Float64(cos(Float64(K * 0.5)) * J), Float64(l * fma(l, Float64(l * 0.3333333333333333), 2.0)), U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[(K / 2.0), $MachinePrecision], 5000000000000.0], N[(N[(N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision] * J + U), $MachinePrecision], N[(N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * J), $MachinePrecision] * N[(l * N[(l * N[(l * 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{K}{2} \leq 5000000000000:\\
\;\;\;\;\mathsf{fma}\left(\left(2 \cdot \sinh \ell\right) \cdot 1, J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\cos \left(K \cdot 0.5\right) \cdot J, \ell \cdot \mathsf{fma}\left(\ell, \ell \cdot 0.3333333333333333, 2\right), U\right)\\
\end{array}
\end{array}
if (/.f64 K #s(literal 2 binary64)) < 5e12Initial program 85.2%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in K around 0
Applied rewrites86.0%
if 5e12 < (/.f64 K #s(literal 2 binary64)) Initial program 90.3%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6496.1
Applied rewrites96.1%
lift-+.f64N/A
Applied rewrites96.1%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6493.9
Applied rewrites93.9%
Final simplification87.5%
(FPCore (J l K U) :precision binary64 (if (<= (/ K 2.0) 5000000000000.0) (fma (* (* 2.0 (sinh l)) 1.0) J U) (fma l (* (cos (* K 0.5)) (* J (fma 0.3333333333333333 (* l l) 2.0))) U)))
double code(double J, double l, double K, double U) {
double tmp;
if ((K / 2.0) <= 5000000000000.0) {
tmp = fma(((2.0 * sinh(l)) * 1.0), J, U);
} else {
tmp = fma(l, (cos((K * 0.5)) * (J * fma(0.3333333333333333, (l * l), 2.0))), U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (Float64(K / 2.0) <= 5000000000000.0) tmp = fma(Float64(Float64(2.0 * sinh(l)) * 1.0), J, U); else tmp = fma(l, Float64(cos(Float64(K * 0.5)) * Float64(J * fma(0.3333333333333333, Float64(l * l), 2.0))), U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[(K / 2.0), $MachinePrecision], 5000000000000.0], N[(N[(N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision] * J + U), $MachinePrecision], N[(l * N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(J * N[(0.3333333333333333 * N[(l * l), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{K}{2} \leq 5000000000000:\\
\;\;\;\;\mathsf{fma}\left(\left(2 \cdot \sinh \ell\right) \cdot 1, J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\ell, \cos \left(K \cdot 0.5\right) \cdot \left(J \cdot \mathsf{fma}\left(0.3333333333333333, \ell \cdot \ell, 2\right)\right), U\right)\\
\end{array}
\end{array}
if (/.f64 K #s(literal 2 binary64)) < 5e12Initial program 85.2%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in K around 0
Applied rewrites86.0%
if 5e12 < (/.f64 K #s(literal 2 binary64)) Initial program 90.3%
Taylor expanded in l around 0
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites85.8%
Final simplification86.0%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.05) (fma (* (* 2.0 l) (fma -0.125 (* K K) 1.0)) J U) (fma (* J 1.0) (* l (fma l (* l 0.3333333333333333) 2.0)) U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.05) {
tmp = fma(((2.0 * l) * fma(-0.125, (K * K), 1.0)), J, U);
} else {
tmp = fma((J * 1.0), (l * fma(l, (l * 0.3333333333333333), 2.0)), U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.05) tmp = fma(Float64(Float64(2.0 * l) * fma(-0.125, Float64(K * K), 1.0)), J, U); else tmp = fma(Float64(J * 1.0), Float64(l * fma(l, Float64(l * 0.3333333333333333), 2.0)), U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.05], N[(N[(N[(2.0 * l), $MachinePrecision] * N[(-0.125 * N[(K * K), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision], N[(N[(J * 1.0), $MachinePrecision] * N[(l * N[(l * N[(l * 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.05:\\
\;\;\;\;\mathsf{fma}\left(\left(2 \cdot \ell\right) \cdot \mathsf{fma}\left(-0.125, K \cdot K, 1\right), J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(J \cdot 1, \ell \cdot \mathsf{fma}\left(\ell, \ell \cdot 0.3333333333333333, 2\right), U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.050000000000000003Initial program 81.8%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites99.9%
Taylor expanded in l around 0
lower-*.f6467.3
Applied rewrites67.3%
Taylor expanded in K around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6452.9
Applied rewrites52.9%
if -0.050000000000000003 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 87.4%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6496.0
Applied rewrites96.0%
lift-+.f64N/A
Applied rewrites96.0%
Taylor expanded in K around 0
Applied rewrites92.6%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6485.9
Applied rewrites85.9%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.05) (fma (* l J) (fma -0.25 (* K K) 2.0) U) (fma (* J 1.0) (* l (fma l (* l 0.3333333333333333) 2.0)) U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.05) {
tmp = fma((l * J), fma(-0.25, (K * K), 2.0), U);
} else {
tmp = fma((J * 1.0), (l * fma(l, (l * 0.3333333333333333), 2.0)), U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.05) tmp = fma(Float64(l * J), fma(-0.25, Float64(K * K), 2.0), U); else tmp = fma(Float64(J * 1.0), Float64(l * fma(l, Float64(l * 0.3333333333333333), 2.0)), U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.05], N[(N[(l * J), $MachinePrecision] * N[(-0.25 * N[(K * K), $MachinePrecision] + 2.0), $MachinePrecision] + U), $MachinePrecision], N[(N[(J * 1.0), $MachinePrecision] * N[(l * N[(l * N[(l * 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.05:\\
\;\;\;\;\mathsf{fma}\left(\ell \cdot J, \mathsf{fma}\left(-0.25, K \cdot K, 2\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(J \cdot 1, \ell \cdot \mathsf{fma}\left(\ell, \ell \cdot 0.3333333333333333, 2\right), U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.050000000000000003Initial program 81.8%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6467.2
Applied rewrites67.2%
Taylor expanded in K around 0
Applied rewrites51.2%
if -0.050000000000000003 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 87.4%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6496.0
Applied rewrites96.0%
lift-+.f64N/A
Applied rewrites96.0%
Taylor expanded in K around 0
Applied rewrites92.6%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6485.9
Applied rewrites85.9%
Final simplification78.3%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.05) (fma (* l J) (fma -0.25 (* K K) 2.0) U) (+ U (* (fma l (* l 0.3333333333333333) 2.0) (* l J)))))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.05) {
tmp = fma((l * J), fma(-0.25, (K * K), 2.0), U);
} else {
tmp = U + (fma(l, (l * 0.3333333333333333), 2.0) * (l * J));
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.05) tmp = fma(Float64(l * J), fma(-0.25, Float64(K * K), 2.0), U); else tmp = Float64(U + Float64(fma(l, Float64(l * 0.3333333333333333), 2.0) * Float64(l * J))); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.05], N[(N[(l * J), $MachinePrecision] * N[(-0.25 * N[(K * K), $MachinePrecision] + 2.0), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(N[(l * N[(l * 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision] * N[(l * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.05:\\
\;\;\;\;\mathsf{fma}\left(\ell \cdot J, \mathsf{fma}\left(-0.25, K \cdot K, 2\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;U + \mathsf{fma}\left(\ell, \ell \cdot 0.3333333333333333, 2\right) \cdot \left(\ell \cdot J\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.050000000000000003Initial program 81.8%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6467.2
Applied rewrites67.2%
Taylor expanded in K around 0
Applied rewrites51.2%
if -0.050000000000000003 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 87.4%
Taylor expanded in l around 0
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
distribute-lft-outN/A
distribute-rgt-outN/A
Applied rewrites84.9%
Taylor expanded in K around 0
Applied rewrites81.7%
Final simplification75.0%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.05) (fma (* l J) (fma -0.25 (* K K) 2.0) U) (* J (fma l 2.0 (/ U J)))))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.05) {
tmp = fma((l * J), fma(-0.25, (K * K), 2.0), U);
} else {
tmp = J * fma(l, 2.0, (U / J));
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.05) tmp = fma(Float64(l * J), fma(-0.25, Float64(K * K), 2.0), U); else tmp = Float64(J * fma(l, 2.0, Float64(U / J))); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.05], N[(N[(l * J), $MachinePrecision] * N[(-0.25 * N[(K * K), $MachinePrecision] + 2.0), $MachinePrecision] + U), $MachinePrecision], N[(J * N[(l * 2.0 + N[(U / J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.05:\\
\;\;\;\;\mathsf{fma}\left(\ell \cdot J, \mathsf{fma}\left(-0.25, K \cdot K, 2\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;J \cdot \mathsf{fma}\left(\ell, 2, \frac{U}{J}\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.050000000000000003Initial program 81.8%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6467.2
Applied rewrites67.2%
Taylor expanded in K around 0
Applied rewrites51.2%
if -0.050000000000000003 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 87.4%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6461.8
Applied rewrites61.8%
Taylor expanded in K around 0
Applied rewrites58.6%
Taylor expanded in J around inf
Applied rewrites59.1%
Final simplification57.4%
(FPCore (J l K U) :precision binary64 (if (<= l -2e+67) (* J (fma l 2.0 (/ U J))) (fma (* 2.0 l) J U)))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -2e+67) {
tmp = J * fma(l, 2.0, (U / J));
} else {
tmp = fma((2.0 * l), J, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (l <= -2e+67) tmp = Float64(J * fma(l, 2.0, Float64(U / J))); else tmp = fma(Float64(2.0 * l), J, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[l, -2e+67], N[(J * N[(l * 2.0 + N[(U / J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 * l), $MachinePrecision] * J + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2 \cdot 10^{+67}:\\
\;\;\;\;J \cdot \mathsf{fma}\left(\ell, 2, \frac{U}{J}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(2 \cdot \ell, J, U\right)\\
\end{array}
\end{array}
if l < -1.99999999999999997e67Initial program 100.0%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6421.5
Applied rewrites21.5%
Taylor expanded in K around 0
Applied rewrites17.2%
Taylor expanded in J around inf
Applied rewrites26.8%
if -1.99999999999999997e67 < l Initial program 82.9%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6472.8
Applied rewrites72.8%
Taylor expanded in K around 0
Applied rewrites60.0%
Applied rewrites60.0%
Final simplification53.7%
(FPCore (J l K U) :precision binary64 (fma (* 2.0 l) J U))
double code(double J, double l, double K, double U) {
return fma((2.0 * l), J, U);
}
function code(J, l, K, U) return fma(Float64(2.0 * l), J, U) end
code[J_, l_, K_, U_] := N[(N[(2.0 * l), $MachinePrecision] * J + U), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(2 \cdot \ell, J, U\right)
\end{array}
Initial program 86.2%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6463.0
Applied rewrites63.0%
Taylor expanded in K around 0
Applied rewrites51.8%
Applied rewrites51.8%
Final simplification51.8%
(FPCore (J l K U) :precision binary64 (fma 2.0 (* l J) U))
double code(double J, double l, double K, double U) {
return fma(2.0, (l * J), U);
}
function code(J, l, K, U) return fma(2.0, Float64(l * J), U) end
code[J_, l_, K_, U_] := N[(2.0 * N[(l * J), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(2, \ell \cdot J, U\right)
\end{array}
Initial program 86.2%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6463.0
Applied rewrites63.0%
Taylor expanded in K around 0
Applied rewrites51.8%
Final simplification51.8%
(FPCore (J l K U) :precision binary64 (* l (* 2.0 J)))
double code(double J, double l, double K, double U) {
return l * (2.0 * J);
}
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 = l * (2.0d0 * j)
end function
public static double code(double J, double l, double K, double U) {
return l * (2.0 * J);
}
def code(J, l, K, U): return l * (2.0 * J)
function code(J, l, K, U) return Float64(l * Float64(2.0 * J)) end
function tmp = code(J, l, K, U) tmp = l * (2.0 * J); end
code[J_, l_, K_, U_] := N[(l * N[(2.0 * J), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\ell \cdot \left(2 \cdot J\right)
\end{array}
Initial program 86.2%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6463.0
Applied rewrites63.0%
Taylor expanded in K around 0
Applied rewrites51.8%
Taylor expanded in J around inf
Applied rewrites21.2%
Final simplification21.2%
herbie shell --seed 2024221
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))