
(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 20 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 (* J (sinh l))) (cos (* -0.5 K)) U))
double code(double J, double l, double K, double U) {
return fma((2.0 * (J * sinh(l))), cos((-0.5 * K)), U);
}
function code(J, l, K, U) return fma(Float64(2.0 * Float64(J * sinh(l))), cos(Float64(-0.5 * K)), U) end
code[J_, l_, K_, U_] := N[(N[(2.0 * N[(J * N[Sinh[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(-0.5 * K), $MachinePrecision]], $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(2 \cdot \left(J \cdot \sinh \ell\right), \cos \left(-0.5 \cdot K\right), U\right)
\end{array}
Initial program 85.2%
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f6485.2
Applied rewrites100.0%
Final simplification100.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0)))
(t_1 (fma (* 2.0 (* J (sinh l))) (fma (* K K) -0.125 1.0) U)))
(if (<= t_0 -0.05)
t_1
(if (<= t_0 0.99999)
(fma
(*
(fma
(fma
(fma 0.0003968253968253968 (* l l) 0.016666666666666666)
(* l l)
0.3333333333333333)
(* l l)
2.0)
l)
J
U)
t_1))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double t_1 = fma((2.0 * (J * sinh(l))), fma((K * K), -0.125, 1.0), U);
double tmp;
if (t_0 <= -0.05) {
tmp = t_1;
} else if (t_0 <= 0.99999) {
tmp = fma((fma(fma(fma(0.0003968253968253968, (l * l), 0.016666666666666666), (l * l), 0.3333333333333333), (l * l), 2.0) * l), J, U);
} else {
tmp = t_1;
}
return tmp;
}
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) t_1 = fma(Float64(2.0 * Float64(J * sinh(l))), fma(Float64(K * K), -0.125, 1.0), U) tmp = 0.0 if (t_0 <= -0.05) tmp = t_1; elseif (t_0 <= 0.99999) tmp = fma(Float64(fma(fma(fma(0.0003968253968253968, Float64(l * l), 0.016666666666666666), Float64(l * l), 0.3333333333333333), Float64(l * l), 2.0) * l), J, U); else tmp = t_1; end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(2.0 * N[(J * N[Sinh[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] + U), $MachinePrecision]}, If[LessEqual[t$95$0, -0.05], t$95$1, If[LessEqual[t$95$0, 0.99999], N[(N[(N[(N[(N[(0.0003968253968253968 * N[(l * l), $MachinePrecision] + 0.016666666666666666), $MachinePrecision] * N[(l * l), $MachinePrecision] + 0.3333333333333333), $MachinePrecision] * N[(l * l), $MachinePrecision] + 2.0), $MachinePrecision] * l), $MachinePrecision] * J + U), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := \mathsf{fma}\left(2 \cdot \left(J \cdot \sinh \ell\right), \mathsf{fma}\left(K \cdot K, -0.125, 1\right), U\right)\\
\mathbf{if}\;t\_0 \leq -0.05:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 0.99999:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.0003968253968253968, \ell \cdot \ell, 0.016666666666666666\right), \ell \cdot \ell, 0.3333333333333333\right), \ell \cdot \ell, 2\right) \cdot \ell, J, U\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.050000000000000003 or 0.999990000000000046 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 84.9%
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f6484.9
Applied rewrites100.0%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6488.6
Applied rewrites88.6%
if -0.050000000000000003 < (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.999990000000000046Initial program 86.3%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6483.3
Applied rewrites83.3%
Taylor expanded in l around 0
Applied rewrites82.2%
Final simplification87.1%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 -0.82)
(fma (* (* 2.0 l) J) (cos (* 0.5 K)) U)
(if (<= t_0 -0.05)
(fma
(* (* (fma (* l l) 0.3333333333333333 2.0) J) l)
(fma (* K K) -0.125 1.0)
U)
(fma
(*
(fma
(fma
(fma 0.0003968253968253968 (* l l) 0.016666666666666666)
(* l l)
0.3333333333333333)
(* l l)
2.0)
l)
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.82) {
tmp = fma(((2.0 * l) * J), cos((0.5 * K)), U);
} else if (t_0 <= -0.05) {
tmp = fma(((fma((l * l), 0.3333333333333333, 2.0) * J) * l), fma((K * K), -0.125, 1.0), U);
} else {
tmp = fma((fma(fma(fma(0.0003968253968253968, (l * l), 0.016666666666666666), (l * l), 0.3333333333333333), (l * l), 2.0) * l), J, U);
}
return tmp;
}
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (t_0 <= -0.82) tmp = fma(Float64(Float64(2.0 * l) * J), cos(Float64(0.5 * K)), U); elseif (t_0 <= -0.05) tmp = fma(Float64(Float64(fma(Float64(l * l), 0.3333333333333333, 2.0) * J) * l), fma(Float64(K * K), -0.125, 1.0), U); else tmp = fma(Float64(fma(fma(fma(0.0003968253968253968, Float64(l * l), 0.016666666666666666), Float64(l * l), 0.3333333333333333), Float64(l * l), 2.0) * l), 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.82], N[(N[(N[(2.0 * l), $MachinePrecision] * J), $MachinePrecision] * N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision] + U), $MachinePrecision], If[LessEqual[t$95$0, -0.05], N[(N[(N[(N[(N[(l * l), $MachinePrecision] * 0.3333333333333333 + 2.0), $MachinePrecision] * J), $MachinePrecision] * l), $MachinePrecision] * N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] + U), $MachinePrecision], N[(N[(N[(N[(N[(0.0003968253968253968 * N[(l * l), $MachinePrecision] + 0.016666666666666666), $MachinePrecision] * N[(l * l), $MachinePrecision] + 0.3333333333333333), $MachinePrecision] * N[(l * l), $MachinePrecision] + 2.0), $MachinePrecision] * l), $MachinePrecision] * J + U), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t\_0 \leq -0.82:\\
\;\;\;\;\mathsf{fma}\left(\left(2 \cdot \ell\right) \cdot J, \cos \left(0.5 \cdot K\right), U\right)\\
\mathbf{elif}\;t\_0 \leq -0.05:\\
\;\;\;\;\mathsf{fma}\left(\left(\mathsf{fma}\left(\ell \cdot \ell, 0.3333333333333333, 2\right) \cdot J\right) \cdot \ell, \mathsf{fma}\left(K \cdot K, -0.125, 1\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.0003968253968253968, \ell \cdot \ell, 0.016666666666666666\right), \ell \cdot \ell, 0.3333333333333333\right), \ell \cdot \ell, 2\right) \cdot \ell, J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.819999999999999951Initial program 79.9%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6468.1
Applied rewrites68.1%
if -0.819999999999999951 < (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.050000000000000003Initial program 86.4%
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f6486.4
Applied rewrites99.9%
Taylor expanded in l around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
associate-*r*N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6479.2
Applied rewrites79.2%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6468.5
Applied rewrites68.5%
if -0.050000000000000003 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 85.6%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6484.7
Applied rewrites84.7%
Taylor expanded in l around 0
Applied rewrites91.6%
Final simplification85.5%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) 0.99999)
(fma
(*
(*
(fma (fma 0.016666666666666666 (* l l) 0.3333333333333333) (* l l) 2.0)
l)
J)
(cos (/ K -2.0))
U)
(fma (* 2.0 (* J (sinh l))) (fma (* K K) -0.125 1.0) U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= 0.99999) {
tmp = fma(((fma(fma(0.016666666666666666, (l * l), 0.3333333333333333), (l * l), 2.0) * l) * J), cos((K / -2.0)), U);
} else {
tmp = fma((2.0 * (J * sinh(l))), fma((K * K), -0.125, 1.0), U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= 0.99999) tmp = fma(Float64(Float64(fma(fma(0.016666666666666666, Float64(l * l), 0.3333333333333333), Float64(l * l), 2.0) * l) * J), cos(Float64(K / -2.0)), U); else tmp = fma(Float64(2.0 * Float64(J * sinh(l))), fma(Float64(K * K), -0.125, 1.0), U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], 0.99999], N[(N[(N[(N[(N[(0.016666666666666666 * N[(l * l), $MachinePrecision] + 0.3333333333333333), $MachinePrecision] * N[(l * l), $MachinePrecision] + 2.0), $MachinePrecision] * l), $MachinePrecision] * J), $MachinePrecision] * N[Cos[N[(K / -2.0), $MachinePrecision]], $MachinePrecision] + U), $MachinePrecision], N[(N[(2.0 * N[(J * N[Sinh[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq 0.99999:\\
\;\;\;\;\mathsf{fma}\left(\left(\mathsf{fma}\left(\mathsf{fma}\left(0.016666666666666666, \ell \cdot \ell, 0.3333333333333333\right), \ell \cdot \ell, 2\right) \cdot \ell\right) \cdot J, \cos \left(\frac{K}{-2}\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(2 \cdot \left(J \cdot \sinh \ell\right), \mathsf{fma}\left(K \cdot K, -0.125, 1\right), U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.999990000000000046Initial program 85.1%
Taylor expanded in l around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6495.2
Applied rewrites95.2%
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f6495.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6495.2
lift-cos.f64N/A
lift-/.f64N/A
frac-2negN/A
distribute-frac-negN/A
cos-negN/A
lower-cos.f64N/A
lower-/.f64N/A
metadata-eval95.2
Applied rewrites95.2%
if 0.999990000000000046 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 85.3%
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f6485.3
Applied rewrites100.0%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64100.0
Applied rewrites100.0%
Final simplification97.6%
(FPCore (J l K U) :precision binary64 (fma (* (* 2.0 (sinh l)) (cos (* -0.5 K))) J U))
double code(double J, double l, double K, double U) {
return fma(((2.0 * sinh(l)) * cos((-0.5 * K))), J, U);
}
function code(J, l, K, U) return fma(Float64(Float64(2.0 * sinh(l)) * cos(Float64(-0.5 * K))), J, U) end
code[J_, l_, K_, U_] := N[(N[(N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(-0.5 * K), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\left(2 \cdot \sinh \ell\right) \cdot \cos \left(-0.5 \cdot K\right), J, U\right)
\end{array}
Initial program 85.2%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites99.9%
Final simplification99.9%
(FPCore (J l K U)
:precision binary64
(if (<= (/ K 2.0) 0.0002)
(fma (* 2.0 (* J (sinh l))) (fma (* K K) -0.125 1.0) U)
(fma
(*
(*
(fma
(fma
(fma (* l l) 0.0003968253968253968 0.016666666666666666)
(* l l)
0.3333333333333333)
(* l l)
2.0)
l)
(cos (/ K -2.0)))
J
U)))
double code(double J, double l, double K, double U) {
double tmp;
if ((K / 2.0) <= 0.0002) {
tmp = fma((2.0 * (J * sinh(l))), fma((K * K), -0.125, 1.0), U);
} else {
tmp = fma(((fma(fma(fma((l * l), 0.0003968253968253968, 0.016666666666666666), (l * l), 0.3333333333333333), (l * l), 2.0) * l) * cos((K / -2.0))), J, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (Float64(K / 2.0) <= 0.0002) tmp = fma(Float64(2.0 * Float64(J * sinh(l))), fma(Float64(K * K), -0.125, 1.0), U); else tmp = fma(Float64(Float64(fma(fma(fma(Float64(l * l), 0.0003968253968253968, 0.016666666666666666), Float64(l * l), 0.3333333333333333), Float64(l * l), 2.0) * l) * cos(Float64(K / -2.0))), J, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[(K / 2.0), $MachinePrecision], 0.0002], N[(N[(2.0 * N[(J * N[Sinh[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] + U), $MachinePrecision], N[(N[(N[(N[(N[(N[(N[(l * l), $MachinePrecision] * 0.0003968253968253968 + 0.016666666666666666), $MachinePrecision] * N[(l * l), $MachinePrecision] + 0.3333333333333333), $MachinePrecision] * N[(l * l), $MachinePrecision] + 2.0), $MachinePrecision] * l), $MachinePrecision] * N[Cos[N[(K / -2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{K}{2} \leq 0.0002:\\
\;\;\;\;\mathsf{fma}\left(2 \cdot \left(J \cdot \sinh \ell\right), \mathsf{fma}\left(K \cdot K, -0.125, 1\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\ell \cdot \ell, 0.0003968253968253968, 0.016666666666666666\right), \ell \cdot \ell, 0.3333333333333333\right), \ell \cdot \ell, 2\right) \cdot \ell\right) \cdot \cos \left(\frac{K}{-2}\right), J, U\right)\\
\end{array}
\end{array}
if (/.f64 K #s(literal 2 binary64)) < 2.0000000000000001e-4Initial program 85.6%
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f6485.6
Applied rewrites100.0%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6479.9
Applied rewrites79.9%
if 2.0000000000000001e-4 < (/.f64 K #s(literal 2 binary64)) Initial program 83.9%
Taylor expanded in l around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6496.7
Applied rewrites96.7%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites96.7%
Final simplification83.9%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.05)
(fma
(* (* (fma (* l l) 0.3333333333333333 2.0) J) l)
(fma
(fma
(fma -2.170138888888889e-5 (* K K) 0.0026041666666666665)
(* K K)
-0.125)
(* K K)
1.0)
U)
(fma
(*
(fma
(fma
(fma 0.0003968253968253968 (* l l) 0.016666666666666666)
(* l l)
0.3333333333333333)
(* l l)
2.0)
l)
J
U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.05) {
tmp = fma(((fma((l * l), 0.3333333333333333, 2.0) * J) * l), fma(fma(fma(-2.170138888888889e-5, (K * K), 0.0026041666666666665), (K * K), -0.125), (K * K), 1.0), U);
} else {
tmp = fma((fma(fma(fma(0.0003968253968253968, (l * l), 0.016666666666666666), (l * l), 0.3333333333333333), (l * l), 2.0) * l), J, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.05) tmp = fma(Float64(Float64(fma(Float64(l * l), 0.3333333333333333, 2.0) * J) * l), fma(fma(fma(-2.170138888888889e-5, Float64(K * K), 0.0026041666666666665), Float64(K * K), -0.125), Float64(K * K), 1.0), U); else tmp = fma(Float64(fma(fma(fma(0.0003968253968253968, Float64(l * l), 0.016666666666666666), Float64(l * l), 0.3333333333333333), Float64(l * l), 2.0) * l), 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[(N[(N[(N[(l * l), $MachinePrecision] * 0.3333333333333333 + 2.0), $MachinePrecision] * J), $MachinePrecision] * l), $MachinePrecision] * N[(N[(N[(-2.170138888888889e-5 * N[(K * K), $MachinePrecision] + 0.0026041666666666665), $MachinePrecision] * N[(K * K), $MachinePrecision] + -0.125), $MachinePrecision] * N[(K * K), $MachinePrecision] + 1.0), $MachinePrecision] + U), $MachinePrecision], N[(N[(N[(N[(N[(0.0003968253968253968 * N[(l * l), $MachinePrecision] + 0.016666666666666666), $MachinePrecision] * N[(l * l), $MachinePrecision] + 0.3333333333333333), $MachinePrecision] * N[(l * l), $MachinePrecision] + 2.0), $MachinePrecision] * l), $MachinePrecision] * J + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.05:\\
\;\;\;\;\mathsf{fma}\left(\left(\mathsf{fma}\left(\ell \cdot \ell, 0.3333333333333333, 2\right) \cdot J\right) \cdot \ell, \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-2.170138888888889 \cdot 10^{-5}, K \cdot K, 0.0026041666666666665\right), K \cdot K, -0.125\right), K \cdot K, 1\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.0003968253968253968, \ell \cdot \ell, 0.016666666666666666\right), \ell \cdot \ell, 0.3333333333333333\right), \ell \cdot \ell, 2\right) \cdot \ell, J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.050000000000000003Initial program 84.1%
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f6484.1
Applied rewrites99.9%
Taylor expanded in l around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
associate-*r*N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6482.3
Applied rewrites82.3%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6461.6
Applied rewrites61.6%
if -0.050000000000000003 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 85.6%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6484.7
Applied rewrites84.7%
Taylor expanded in l around 0
Applied rewrites91.6%
(FPCore (J l K U)
:precision binary64
(if (<= (/ K 2.0) 6.5e-33)
(fma (* 2.0 (* J (sinh l))) (fma (* K K) -0.125 1.0) U)
(fma
(*
(*
(fma
(* (fma 0.008333333333333333 (* l l) 0.16666666666666666) J)
(* l l)
J)
l)
2.0)
(cos (* -0.5 K))
U)))
double code(double J, double l, double K, double U) {
double tmp;
if ((K / 2.0) <= 6.5e-33) {
tmp = fma((2.0 * (J * sinh(l))), fma((K * K), -0.125, 1.0), U);
} else {
tmp = fma(((fma((fma(0.008333333333333333, (l * l), 0.16666666666666666) * J), (l * l), J) * l) * 2.0), cos((-0.5 * K)), U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (Float64(K / 2.0) <= 6.5e-33) tmp = fma(Float64(2.0 * Float64(J * sinh(l))), fma(Float64(K * K), -0.125, 1.0), U); else tmp = fma(Float64(Float64(fma(Float64(fma(0.008333333333333333, Float64(l * l), 0.16666666666666666) * J), Float64(l * l), J) * l) * 2.0), cos(Float64(-0.5 * K)), U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[(K / 2.0), $MachinePrecision], 6.5e-33], N[(N[(2.0 * N[(J * N[Sinh[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] + U), $MachinePrecision], N[(N[(N[(N[(N[(N[(0.008333333333333333 * N[(l * l), $MachinePrecision] + 0.16666666666666666), $MachinePrecision] * J), $MachinePrecision] * N[(l * l), $MachinePrecision] + J), $MachinePrecision] * l), $MachinePrecision] * 2.0), $MachinePrecision] * N[Cos[N[(-0.5 * K), $MachinePrecision]], $MachinePrecision] + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{K}{2} \leq 6.5 \cdot 10^{-33}:\\
\;\;\;\;\mathsf{fma}\left(2 \cdot \left(J \cdot \sinh \ell\right), \mathsf{fma}\left(K \cdot K, -0.125, 1\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(\mathsf{fma}\left(\mathsf{fma}\left(0.008333333333333333, \ell \cdot \ell, 0.16666666666666666\right) \cdot J, \ell \cdot \ell, J\right) \cdot \ell\right) \cdot 2, \cos \left(-0.5 \cdot K\right), U\right)\\
\end{array}
\end{array}
if (/.f64 K #s(literal 2 binary64)) < 6.4999999999999993e-33Initial program 85.4%
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f6485.4
Applied rewrites100.0%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6478.8
Applied rewrites78.8%
if 6.4999999999999993e-33 < (/.f64 K #s(literal 2 binary64)) Initial program 84.8%
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f6484.8
Applied rewrites99.9%
Taylor expanded in l around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
+-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6490.3
Applied rewrites90.3%
Final simplification82.0%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.05)
(fma
(* (* (fma (* l l) 0.3333333333333333 2.0) J) l)
(fma (* K K) -0.125 1.0)
U)
(fma
(*
(fma
(fma
(fma 0.0003968253968253968 (* l l) 0.016666666666666666)
(* l l)
0.3333333333333333)
(* l l)
2.0)
l)
J
U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.05) {
tmp = fma(((fma((l * l), 0.3333333333333333, 2.0) * J) * l), fma((K * K), -0.125, 1.0), U);
} else {
tmp = fma((fma(fma(fma(0.0003968253968253968, (l * l), 0.016666666666666666), (l * l), 0.3333333333333333), (l * l), 2.0) * l), J, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.05) tmp = fma(Float64(Float64(fma(Float64(l * l), 0.3333333333333333, 2.0) * J) * l), fma(Float64(K * K), -0.125, 1.0), U); else tmp = fma(Float64(fma(fma(fma(0.0003968253968253968, Float64(l * l), 0.016666666666666666), Float64(l * l), 0.3333333333333333), Float64(l * l), 2.0) * l), 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[(N[(N[(N[(l * l), $MachinePrecision] * 0.3333333333333333 + 2.0), $MachinePrecision] * J), $MachinePrecision] * l), $MachinePrecision] * N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] + U), $MachinePrecision], N[(N[(N[(N[(N[(0.0003968253968253968 * N[(l * l), $MachinePrecision] + 0.016666666666666666), $MachinePrecision] * N[(l * l), $MachinePrecision] + 0.3333333333333333), $MachinePrecision] * N[(l * l), $MachinePrecision] + 2.0), $MachinePrecision] * l), $MachinePrecision] * J + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.05:\\
\;\;\;\;\mathsf{fma}\left(\left(\mathsf{fma}\left(\ell \cdot \ell, 0.3333333333333333, 2\right) \cdot J\right) \cdot \ell, \mathsf{fma}\left(K \cdot K, -0.125, 1\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.0003968253968253968, \ell \cdot \ell, 0.016666666666666666\right), \ell \cdot \ell, 0.3333333333333333\right), \ell \cdot \ell, 2\right) \cdot \ell, J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.050000000000000003Initial program 84.1%
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f6484.1
Applied rewrites99.9%
Taylor expanded in l around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
associate-*r*N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6482.3
Applied rewrites82.3%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6460.9
Applied rewrites60.9%
if -0.050000000000000003 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 85.6%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6484.7
Applied rewrites84.7%
Taylor expanded in l around 0
Applied rewrites91.6%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.05)
(fma
(* (* (fma (* l l) 0.3333333333333333 2.0) J) l)
(fma (* K K) -0.125 1.0)
U)
(fma
(*
(fma (fma 0.016666666666666666 (* l l) 0.3333333333333333) (* l l) 2.0)
l)
J
U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.05) {
tmp = fma(((fma((l * l), 0.3333333333333333, 2.0) * J) * l), fma((K * K), -0.125, 1.0), U);
} else {
tmp = fma((fma(fma(0.016666666666666666, (l * l), 0.3333333333333333), (l * l), 2.0) * l), J, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.05) tmp = fma(Float64(Float64(fma(Float64(l * l), 0.3333333333333333, 2.0) * J) * l), fma(Float64(K * K), -0.125, 1.0), U); else tmp = fma(Float64(fma(fma(0.016666666666666666, Float64(l * l), 0.3333333333333333), Float64(l * l), 2.0) * l), 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[(N[(N[(N[(l * l), $MachinePrecision] * 0.3333333333333333 + 2.0), $MachinePrecision] * J), $MachinePrecision] * l), $MachinePrecision] * N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] + U), $MachinePrecision], N[(N[(N[(N[(0.016666666666666666 * N[(l * l), $MachinePrecision] + 0.3333333333333333), $MachinePrecision] * N[(l * l), $MachinePrecision] + 2.0), $MachinePrecision] * l), $MachinePrecision] * J + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.05:\\
\;\;\;\;\mathsf{fma}\left(\left(\mathsf{fma}\left(\ell \cdot \ell, 0.3333333333333333, 2\right) \cdot J\right) \cdot \ell, \mathsf{fma}\left(K \cdot K, -0.125, 1\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.016666666666666666, \ell \cdot \ell, 0.3333333333333333\right), \ell \cdot \ell, 2\right) \cdot \ell, J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.050000000000000003Initial program 84.1%
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f6484.1
Applied rewrites99.9%
Taylor expanded in l around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
associate-*r*N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6482.3
Applied rewrites82.3%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6460.9
Applied rewrites60.9%
if -0.050000000000000003 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 85.6%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6484.7
Applied rewrites84.7%
Taylor expanded in l around 0
Applied rewrites89.5%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.05)
(fma (* J l) (fma (* K K) -0.25 2.0) U)
(fma
(*
(fma (fma 0.016666666666666666 (* l l) 0.3333333333333333) (* l l) 2.0)
l)
J
U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.05) {
tmp = fma((J * l), fma((K * K), -0.25, 2.0), U);
} else {
tmp = fma((fma(fma(0.016666666666666666, (l * l), 0.3333333333333333), (l * l), 2.0) * l), 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 * l), fma(Float64(K * K), -0.25, 2.0), U); else tmp = fma(Float64(fma(fma(0.016666666666666666, Float64(l * l), 0.3333333333333333), Float64(l * l), 2.0) * l), 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 * l), $MachinePrecision] * N[(N[(K * K), $MachinePrecision] * -0.25 + 2.0), $MachinePrecision] + U), $MachinePrecision], N[(N[(N[(N[(0.016666666666666666 * N[(l * l), $MachinePrecision] + 0.3333333333333333), $MachinePrecision] * N[(l * l), $MachinePrecision] + 2.0), $MachinePrecision] * l), $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 \ell, \mathsf{fma}\left(K \cdot K, -0.25, 2\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.016666666666666666, \ell \cdot \ell, 0.3333333333333333\right), \ell \cdot \ell, 2\right) \cdot \ell, J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.050000000000000003Initial program 84.1%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6457.4
Applied rewrites57.4%
Taylor expanded in K around 0
Applied rewrites49.6%
if -0.050000000000000003 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 85.6%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6484.7
Applied rewrites84.7%
Taylor expanded in l around 0
Applied rewrites89.5%
Final simplification79.1%
(FPCore (J l K U) :precision binary64 (if (<= (/ K 2.0) 6.5e-33) (fma (* 2.0 (* J (sinh l))) (fma (* K K) -0.125 1.0) U) (fma (* (* (fma 0.3333333333333333 (* l l) 2.0) l) J) (cos (* -0.5 K)) U)))
double code(double J, double l, double K, double U) {
double tmp;
if ((K / 2.0) <= 6.5e-33) {
tmp = fma((2.0 * (J * sinh(l))), fma((K * K), -0.125, 1.0), U);
} else {
tmp = fma(((fma(0.3333333333333333, (l * l), 2.0) * l) * J), cos((-0.5 * K)), U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (Float64(K / 2.0) <= 6.5e-33) tmp = fma(Float64(2.0 * Float64(J * sinh(l))), fma(Float64(K * K), -0.125, 1.0), U); else tmp = fma(Float64(Float64(fma(0.3333333333333333, Float64(l * l), 2.0) * l) * J), cos(Float64(-0.5 * K)), U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[(K / 2.0), $MachinePrecision], 6.5e-33], N[(N[(2.0 * N[(J * N[Sinh[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] + U), $MachinePrecision], N[(N[(N[(N[(0.3333333333333333 * N[(l * l), $MachinePrecision] + 2.0), $MachinePrecision] * l), $MachinePrecision] * J), $MachinePrecision] * N[Cos[N[(-0.5 * K), $MachinePrecision]], $MachinePrecision] + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{K}{2} \leq 6.5 \cdot 10^{-33}:\\
\;\;\;\;\mathsf{fma}\left(2 \cdot \left(J \cdot \sinh \ell\right), \mathsf{fma}\left(K \cdot K, -0.125, 1\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(\mathsf{fma}\left(0.3333333333333333, \ell \cdot \ell, 2\right) \cdot \ell\right) \cdot J, \cos \left(-0.5 \cdot K\right), U\right)\\
\end{array}
\end{array}
if (/.f64 K #s(literal 2 binary64)) < 6.4999999999999993e-33Initial program 85.4%
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f6485.4
Applied rewrites100.0%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6478.8
Applied rewrites78.8%
if 6.4999999999999993e-33 < (/.f64 K #s(literal 2 binary64)) Initial program 84.8%
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f6484.8
Applied rewrites99.9%
Taylor expanded in l around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
associate-*r*N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6479.1
Applied rewrites79.1%
Applied rewrites85.8%
Final simplification80.7%
(FPCore (J l K U) :precision binary64 (if (<= (/ K 2.0) 0.0002) (fma (* 2.0 (* J (sinh l))) (fma (* K K) -0.125 1.0) U) (fma (* (* (fma (* l l) 0.3333333333333333 2.0) J) (cos (* 0.5 K))) l U)))
double code(double J, double l, double K, double U) {
double tmp;
if ((K / 2.0) <= 0.0002) {
tmp = fma((2.0 * (J * sinh(l))), fma((K * K), -0.125, 1.0), U);
} else {
tmp = fma(((fma((l * l), 0.3333333333333333, 2.0) * J) * cos((0.5 * K))), l, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (Float64(K / 2.0) <= 0.0002) tmp = fma(Float64(2.0 * Float64(J * sinh(l))), fma(Float64(K * K), -0.125, 1.0), U); else tmp = fma(Float64(Float64(fma(Float64(l * l), 0.3333333333333333, 2.0) * J) * cos(Float64(0.5 * K))), l, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[(K / 2.0), $MachinePrecision], 0.0002], N[(N[(2.0 * N[(J * N[Sinh[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] + U), $MachinePrecision], N[(N[(N[(N[(N[(l * l), $MachinePrecision] * 0.3333333333333333 + 2.0), $MachinePrecision] * J), $MachinePrecision] * N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * l + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{K}{2} \leq 0.0002:\\
\;\;\;\;\mathsf{fma}\left(2 \cdot \left(J \cdot \sinh \ell\right), \mathsf{fma}\left(K \cdot K, -0.125, 1\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(\mathsf{fma}\left(\ell \cdot \ell, 0.3333333333333333, 2\right) \cdot J\right) \cdot \cos \left(0.5 \cdot K\right), \ell, U\right)\\
\end{array}
\end{array}
if (/.f64 K #s(literal 2 binary64)) < 2.0000000000000001e-4Initial program 85.6%
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f6485.6
Applied rewrites100.0%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6479.9
Applied rewrites79.9%
if 2.0000000000000001e-4 < (/.f64 K #s(literal 2 binary64)) Initial program 83.9%
Taylor expanded in l around 0
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites77.2%
Final simplification79.3%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.05) (fma (* J l) (fma (* K K) -0.25 2.0) U) (fma (* (fma (* 0.016666666666666666 (* l l)) (* l l) 2.0) l) J U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.05) {
tmp = fma((J * l), fma((K * K), -0.25, 2.0), U);
} else {
tmp = fma((fma((0.016666666666666666 * (l * l)), (l * l), 2.0) * l), 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 * l), fma(Float64(K * K), -0.25, 2.0), U); else tmp = fma(Float64(fma(Float64(0.016666666666666666 * Float64(l * l)), Float64(l * l), 2.0) * l), 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 * l), $MachinePrecision] * N[(N[(K * K), $MachinePrecision] * -0.25 + 2.0), $MachinePrecision] + U), $MachinePrecision], N[(N[(N[(N[(0.016666666666666666 * N[(l * l), $MachinePrecision]), $MachinePrecision] * N[(l * l), $MachinePrecision] + 2.0), $MachinePrecision] * l), $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 \ell, \mathsf{fma}\left(K \cdot K, -0.25, 2\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.016666666666666666 \cdot \left(\ell \cdot \ell\right), \ell \cdot \ell, 2\right) \cdot \ell, J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.050000000000000003Initial program 84.1%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6457.4
Applied rewrites57.4%
Taylor expanded in K around 0
Applied rewrites49.6%
if -0.050000000000000003 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 85.6%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6484.7
Applied rewrites84.7%
Taylor expanded in l around 0
Applied rewrites89.5%
Taylor expanded in l around inf
Applied rewrites89.2%
Final simplification78.9%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.05) (fma (* J l) (fma (* K K) -0.25 2.0) U) (fma (* (fma (* l l) 0.3333333333333333 2.0) l) J U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.05) {
tmp = fma((J * l), fma((K * K), -0.25, 2.0), U);
} else {
tmp = fma((fma((l * l), 0.3333333333333333, 2.0) * l), 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 * l), fma(Float64(K * K), -0.25, 2.0), U); else tmp = fma(Float64(fma(Float64(l * l), 0.3333333333333333, 2.0) * l), 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 * l), $MachinePrecision] * N[(N[(K * K), $MachinePrecision] * -0.25 + 2.0), $MachinePrecision] + U), $MachinePrecision], N[(N[(N[(N[(l * l), $MachinePrecision] * 0.3333333333333333 + 2.0), $MachinePrecision] * l), $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 \ell, \mathsf{fma}\left(K \cdot K, -0.25, 2\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\ell \cdot \ell, 0.3333333333333333, 2\right) \cdot \ell, J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.050000000000000003Initial program 84.1%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6457.4
Applied rewrites57.4%
Taylor expanded in K around 0
Applied rewrites49.6%
if -0.050000000000000003 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 85.6%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6484.7
Applied rewrites84.7%
Taylor expanded in l around 0
Applied rewrites83.8%
Final simplification74.8%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.05) (fma (* J l) (fma (* K K) -0.25 2.0) U) (fma (* (fma (* l l) 0.3333333333333333 2.0) J) l U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.05) {
tmp = fma((J * l), fma((K * K), -0.25, 2.0), U);
} else {
tmp = fma((fma((l * l), 0.3333333333333333, 2.0) * J), l, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.05) tmp = fma(Float64(J * l), fma(Float64(K * K), -0.25, 2.0), U); else tmp = fma(Float64(fma(Float64(l * l), 0.3333333333333333, 2.0) * J), l, 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 * l), $MachinePrecision] * N[(N[(K * K), $MachinePrecision] * -0.25 + 2.0), $MachinePrecision] + U), $MachinePrecision], N[(N[(N[(N[(l * l), $MachinePrecision] * 0.3333333333333333 + 2.0), $MachinePrecision] * J), $MachinePrecision] * l + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.05:\\
\;\;\;\;\mathsf{fma}\left(J \cdot \ell, \mathsf{fma}\left(K \cdot K, -0.25, 2\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\ell \cdot \ell, 0.3333333333333333, 2\right) \cdot J, \ell, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.050000000000000003Initial program 84.1%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6457.4
Applied rewrites57.4%
Taylor expanded in K around 0
Applied rewrites49.6%
if -0.050000000000000003 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 85.6%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6484.7
Applied rewrites84.7%
Taylor expanded in l around 0
Applied rewrites78.3%
Final simplification70.8%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (fma (* J l) (fma (* K K) -0.25 2.0) U)))
(if (<= l -1.85e+90)
t_0
(if (<= l 1.05e-39)
(fma (* 2.0 l) J U)
(if (<= l 2.25e+117)
t_0
(fma (- (fma (fma l 0.5 1.0) l 1.0) 1.0) J U))))))
double code(double J, double l, double K, double U) {
double t_0 = fma((J * l), fma((K * K), -0.25, 2.0), U);
double tmp;
if (l <= -1.85e+90) {
tmp = t_0;
} else if (l <= 1.05e-39) {
tmp = fma((2.0 * l), J, U);
} else if (l <= 2.25e+117) {
tmp = t_0;
} else {
tmp = fma((fma(fma(l, 0.5, 1.0), l, 1.0) - 1.0), J, U);
}
return tmp;
}
function code(J, l, K, U) t_0 = fma(Float64(J * l), fma(Float64(K * K), -0.25, 2.0), U) tmp = 0.0 if (l <= -1.85e+90) tmp = t_0; elseif (l <= 1.05e-39) tmp = fma(Float64(2.0 * l), J, U); elseif (l <= 2.25e+117) tmp = t_0; else tmp = fma(Float64(fma(fma(l, 0.5, 1.0), l, 1.0) - 1.0), J, U); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[(J * l), $MachinePrecision] * N[(N[(K * K), $MachinePrecision] * -0.25 + 2.0), $MachinePrecision] + U), $MachinePrecision]}, If[LessEqual[l, -1.85e+90], t$95$0, If[LessEqual[l, 1.05e-39], N[(N[(2.0 * l), $MachinePrecision] * J + U), $MachinePrecision], If[LessEqual[l, 2.25e+117], t$95$0, N[(N[(N[(N[(l * 0.5 + 1.0), $MachinePrecision] * l + 1.0), $MachinePrecision] - 1.0), $MachinePrecision] * J + U), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(J \cdot \ell, \mathsf{fma}\left(K \cdot K, -0.25, 2\right), U\right)\\
\mathbf{if}\;\ell \leq -1.85 \cdot 10^{+90}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq 1.05 \cdot 10^{-39}:\\
\;\;\;\;\mathsf{fma}\left(2 \cdot \ell, J, U\right)\\
\mathbf{elif}\;\ell \leq 2.25 \cdot 10^{+117}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\ell, 0.5, 1\right), \ell, 1\right) - 1, J, U\right)\\
\end{array}
\end{array}
if l < -1.85e90 or 1.04999999999999997e-39 < l < 2.25e117Initial program 97.9%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6436.6
Applied rewrites36.6%
Taylor expanded in K around 0
Applied rewrites40.9%
if -1.85e90 < l < 1.04999999999999997e-39Initial program 71.5%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6468.3
Applied rewrites68.3%
Taylor expanded in l around 0
Applied rewrites74.5%
if 2.25e117 < l Initial program 100.0%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6475.0
Applied rewrites75.0%
Taylor expanded in l around 0
Applied rewrites27.4%
Taylor expanded in l around 0
Applied rewrites27.4%
Taylor expanded in l around 0
Applied rewrites60.7%
Final simplification60.5%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (fma (- (fma (fma l 0.5 1.0) l 1.0) 1.0) J U))
(t_1 (fma (* 2.0 l) J U)))
(if (<= l -4.9e+250) t_1 (if (<= l -6.5e+93) t_0 (if (<= l 2.0) t_1 t_0)))))
double code(double J, double l, double K, double U) {
double t_0 = fma((fma(fma(l, 0.5, 1.0), l, 1.0) - 1.0), J, U);
double t_1 = fma((2.0 * l), J, U);
double tmp;
if (l <= -4.9e+250) {
tmp = t_1;
} else if (l <= -6.5e+93) {
tmp = t_0;
} else if (l <= 2.0) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
function code(J, l, K, U) t_0 = fma(Float64(fma(fma(l, 0.5, 1.0), l, 1.0) - 1.0), J, U) t_1 = fma(Float64(2.0 * l), J, U) tmp = 0.0 if (l <= -4.9e+250) tmp = t_1; elseif (l <= -6.5e+93) tmp = t_0; elseif (l <= 2.0) tmp = t_1; else tmp = t_0; end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[(N[(N[(l * 0.5 + 1.0), $MachinePrecision] * l + 1.0), $MachinePrecision] - 1.0), $MachinePrecision] * J + U), $MachinePrecision]}, Block[{t$95$1 = N[(N[(2.0 * l), $MachinePrecision] * J + U), $MachinePrecision]}, If[LessEqual[l, -4.9e+250], t$95$1, If[LessEqual[l, -6.5e+93], t$95$0, If[LessEqual[l, 2.0], t$95$1, t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\ell, 0.5, 1\right), \ell, 1\right) - 1, J, U\right)\\
t_1 := \mathsf{fma}\left(2 \cdot \ell, J, U\right)\\
\mathbf{if}\;\ell \leq -4.9 \cdot 10^{+250}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\ell \leq -6.5 \cdot 10^{+93}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq 2:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if l < -4.89999999999999993e250 or -6.4999999999999998e93 < l < 2Initial program 75.3%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6471.5
Applied rewrites71.5%
Taylor expanded in l around 0
Applied rewrites73.3%
if -4.89999999999999993e250 < l < -6.4999999999999998e93 or 2 < l Initial program 100.0%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6464.1
Applied rewrites64.1%
Taylor expanded in l around 0
Applied rewrites31.9%
Taylor expanded in l around 0
Applied rewrites15.3%
Taylor expanded in l around 0
Applied rewrites39.1%
(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 85.2%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6468.5
Applied rewrites68.5%
Taylor expanded in l around 0
Applied rewrites49.9%
(FPCore (J l K U) :precision binary64 (fma (- 1.0 1.0) J U))
double code(double J, double l, double K, double U) {
return fma((1.0 - 1.0), J, U);
}
function code(J, l, K, U) return fma(Float64(1.0 - 1.0), J, U) end
code[J_, l_, K_, U_] := N[(N[(1.0 - 1.0), $MachinePrecision] * J + U), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(1 - 1, J, U\right)
\end{array}
Initial program 85.2%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6468.5
Applied rewrites68.5%
Taylor expanded in l around 0
Applied rewrites55.3%
Taylor expanded in l around 0
Applied rewrites41.8%
Taylor expanded in l around 0
Applied rewrites32.6%
herbie shell --seed 2024284
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))