
(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 18 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 (* -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 84.2%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites100.0%
Final simplification100.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (- (exp l) (exp (- l))))
(t_1 (fma (* J l) (fma (* K K) -0.25 2.0) U)))
(if (<= t_0 -5e-5) t_1 (if (<= t_0 1e-6) (fma (* J l) 2.0 U) t_1))))
double code(double J, double l, double K, double U) {
double t_0 = exp(l) - exp(-l);
double t_1 = fma((J * l), fma((K * K), -0.25, 2.0), U);
double tmp;
if (t_0 <= -5e-5) {
tmp = t_1;
} else if (t_0 <= 1e-6) {
tmp = fma((J * l), 2.0, U);
} else {
tmp = t_1;
}
return tmp;
}
function code(J, l, K, U) t_0 = Float64(exp(l) - exp(Float64(-l))) t_1 = fma(Float64(J * l), fma(Float64(K * K), -0.25, 2.0), U) tmp = 0.0 if (t_0 <= -5e-5) tmp = t_1; elseif (t_0 <= 1e-6) tmp = fma(Float64(J * l), 2.0, U); else tmp = t_1; end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(J * l), $MachinePrecision] * N[(N[(K * K), $MachinePrecision] * -0.25 + 2.0), $MachinePrecision] + U), $MachinePrecision]}, If[LessEqual[t$95$0, -5e-5], t$95$1, If[LessEqual[t$95$0, 1e-6], N[(N[(J * l), $MachinePrecision] * 2.0 + U), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{\ell} - e^{-\ell}\\
t_1 := \mathsf{fma}\left(J \cdot \ell, \mathsf{fma}\left(K \cdot K, -0.25, 2\right), U\right)\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-5}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 10^{-6}:\\
\;\;\;\;\mathsf{fma}\left(J \cdot \ell, 2, U\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -5.00000000000000024e-5 or 9.99999999999999955e-7 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 99.8%
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-*.f6424.9
Applied rewrites24.9%
Taylor expanded in K around 0
Applied rewrites32.0%
if -5.00000000000000024e-5 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 9.99999999999999955e-7Initial program 70.2%
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-*.f6499.9
Applied rewrites99.9%
Taylor expanded in K around 0
Applied rewrites89.1%
Final simplification62.1%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 0.72)
(+
(*
(*
(*
(fma
(fma
(fma 0.0003968253968253968 (* l l) 0.016666666666666666)
(* l l)
0.3333333333333333)
(* l l)
2.0)
l)
J)
t_0)
U)
(fma (* 1.0 (* 2.0 (sinh 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.72) {
tmp = (((fma(fma(fma(0.0003968253968253968, (l * l), 0.016666666666666666), (l * l), 0.3333333333333333), (l * l), 2.0) * l) * J) * t_0) + U;
} else {
tmp = fma((1.0 * (2.0 * sinh(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.72) tmp = Float64(Float64(Float64(Float64(fma(fma(fma(0.0003968253968253968, Float64(l * l), 0.016666666666666666), Float64(l * l), 0.3333333333333333), Float64(l * l), 2.0) * l) * J) * t_0) + U); else tmp = fma(Float64(1.0 * Float64(2.0 * sinh(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.72], N[(N[(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), $MachinePrecision] * t$95$0), $MachinePrecision] + U), $MachinePrecision], N[(N[(1.0 * N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t\_0 \leq 0.72:\\
\;\;\;\;\left(\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\right) \cdot J\right) \cdot t\_0 + U\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1 \cdot \left(2 \cdot \sinh \ell\right), J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.71999999999999997Initial program 85.4%
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-*.f6495.7
Applied rewrites95.7%
if 0.71999999999999997 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 83.5%
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 rewrites99.2%
Final simplification97.8%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) 0.72)
(fma
(* (cos (* 0.5 K)) J)
(*
(fma
(fma
(fma 0.0003968253968253968 (* l l) 0.016666666666666666)
(* l l)
0.3333333333333333)
(* l l)
2.0)
l)
U)
(fma (* 1.0 (* 2.0 (sinh l))) J U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= 0.72) {
tmp = fma((cos((0.5 * K)) * J), (fma(fma(fma(0.0003968253968253968, (l * l), 0.016666666666666666), (l * l), 0.3333333333333333), (l * l), 2.0) * l), U);
} else {
tmp = fma((1.0 * (2.0 * sinh(l))), J, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= 0.72) tmp = fma(Float64(cos(Float64(0.5 * K)) * J), Float64(fma(fma(fma(0.0003968253968253968, Float64(l * l), 0.016666666666666666), Float64(l * l), 0.3333333333333333), Float64(l * l), 2.0) * l), U); else tmp = fma(Float64(1.0 * Float64(2.0 * sinh(l))), J, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], 0.72], N[(N[(N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision] * J), $MachinePrecision] * 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] + U), $MachinePrecision], N[(N[(1.0 * N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq 0.72:\\
\;\;\;\;\mathsf{fma}\left(\cos \left(0.5 \cdot K\right) \cdot J, \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, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1 \cdot \left(2 \cdot \sinh \ell\right), J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.71999999999999997Initial program 85.4%
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-*.f6495.7
Applied rewrites95.7%
lift-+.f64N/A
Applied rewrites95.6%
if 0.71999999999999997 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 83.5%
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 rewrites99.2%
Final simplification97.8%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) 0.72)
(fma
(*
(*
(fma (fma 0.016666666666666666 (* l l) 0.3333333333333333) (* l l) 2.0)
l)
(cos (* 0.5 K)))
J
U)
(fma (* 1.0 (* 2.0 (sinh l))) J U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= 0.72) {
tmp = fma(((fma(fma(0.016666666666666666, (l * l), 0.3333333333333333), (l * l), 2.0) * l) * cos((0.5 * K))), J, U);
} else {
tmp = fma((1.0 * (2.0 * sinh(l))), J, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= 0.72) tmp = fma(Float64(Float64(fma(fma(0.016666666666666666, Float64(l * l), 0.3333333333333333), Float64(l * l), 2.0) * l) * cos(Float64(0.5 * K))), J, U); else tmp = fma(Float64(1.0 * Float64(2.0 * sinh(l))), J, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], 0.72], N[(N[(N[(N[(N[(0.016666666666666666 * N[(l * l), $MachinePrecision] + 0.3333333333333333), $MachinePrecision] * N[(l * l), $MachinePrecision] + 2.0), $MachinePrecision] * l), $MachinePrecision] * N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision], N[(N[(1.0 * N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq 0.72:\\
\;\;\;\;\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 \cos \left(0.5 \cdot K\right), J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1 \cdot \left(2 \cdot \sinh \ell\right), J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.71999999999999997Initial program 85.4%
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-*.f6492.5
Applied rewrites92.5%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites92.5%
if 0.71999999999999997 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 83.5%
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 rewrites99.2%
Final simplification96.6%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) 0.72) (fma (* (* (fma 0.3333333333333333 (* l l) 2.0) (cos (* -0.5 K))) l) J U) (fma (* 1.0 (* 2.0 (sinh l))) J U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= 0.72) {
tmp = fma(((fma(0.3333333333333333, (l * l), 2.0) * cos((-0.5 * K))) * l), J, U);
} else {
tmp = fma((1.0 * (2.0 * sinh(l))), J, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= 0.72) tmp = fma(Float64(Float64(fma(0.3333333333333333, Float64(l * l), 2.0) * cos(Float64(-0.5 * K))) * l), J, U); else tmp = fma(Float64(1.0 * Float64(2.0 * sinh(l))), J, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], 0.72], N[(N[(N[(N[(0.3333333333333333 * N[(l * l), $MachinePrecision] + 2.0), $MachinePrecision] * N[Cos[N[(-0.5 * K), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * l), $MachinePrecision] * J + U), $MachinePrecision], N[(N[(1.0 * N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq 0.72:\\
\;\;\;\;\mathsf{fma}\left(\left(\mathsf{fma}\left(0.3333333333333333, \ell \cdot \ell, 2\right) \cdot \cos \left(-0.5 \cdot K\right)\right) \cdot \ell, J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1 \cdot \left(2 \cdot \sinh \ell\right), J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.71999999999999997Initial program 85.4%
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
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6464.3
Applied rewrites64.3%
Taylor expanded in l around 0
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites86.5%
if 0.71999999999999997 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 83.5%
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 rewrites99.2%
Final simplification94.4%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) 0.72) (fma (* (* (fma (* l l) 0.3333333333333333 2.0) l) (cos (* -0.5 K))) J U) (fma (* 1.0 (* 2.0 (sinh l))) J U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= 0.72) {
tmp = fma(((fma((l * l), 0.3333333333333333, 2.0) * l) * cos((-0.5 * K))), J, U);
} else {
tmp = fma((1.0 * (2.0 * sinh(l))), J, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= 0.72) tmp = fma(Float64(Float64(fma(Float64(l * l), 0.3333333333333333, 2.0) * l) * cos(Float64(-0.5 * K))), J, U); else tmp = fma(Float64(1.0 * Float64(2.0 * sinh(l))), J, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], 0.72], N[(N[(N[(N[(N[(l * l), $MachinePrecision] * 0.3333333333333333 + 2.0), $MachinePrecision] * l), $MachinePrecision] * N[Cos[N[(-0.5 * K), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision], N[(N[(1.0 * N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq 0.72:\\
\;\;\;\;\mathsf{fma}\left(\left(\mathsf{fma}\left(\ell \cdot \ell, 0.3333333333333333, 2\right) \cdot \ell\right) \cdot \cos \left(-0.5 \cdot K\right), J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1 \cdot \left(2 \cdot \sinh \ell\right), J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.71999999999999997Initial program 85.4%
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
+-commutativeN/A
distribute-lft-inN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
distribute-rgt-outN/A
*-commutativeN/A
distribute-lft-inN/A
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites86.5%
if 0.71999999999999997 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 83.5%
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 rewrites99.2%
Final simplification94.4%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) 0.72) (fma (* (* (fma (* l l) 0.3333333333333333 2.0) J) (cos (* 0.5 K))) l U) (fma (* 1.0 (* 2.0 (sinh l))) J U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= 0.72) {
tmp = fma(((fma((l * l), 0.3333333333333333, 2.0) * J) * cos((0.5 * K))), l, U);
} else {
tmp = fma((1.0 * (2.0 * sinh(l))), J, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= 0.72) tmp = fma(Float64(Float64(fma(Float64(l * l), 0.3333333333333333, 2.0) * J) * cos(Float64(0.5 * K))), l, U); else tmp = fma(Float64(1.0 * Float64(2.0 * sinh(l))), J, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], 0.72], 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], N[(N[(1.0 * N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq 0.72:\\
\;\;\;\;\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)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1 \cdot \left(2 \cdot \sinh \ell\right), J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.71999999999999997Initial program 85.4%
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 rewrites85.5%
if 0.71999999999999997 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 83.5%
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 rewrites99.2%
Final simplification94.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (* 2.0 (sinh l))))
(if (<= (cos (/ K 2.0)) -0.005)
(fma (* (fma (* K K) -0.125 1.0) t_0) J U)
(fma (* 1.0 t_0) J U))))
double code(double J, double l, double K, double U) {
double t_0 = 2.0 * sinh(l);
double tmp;
if (cos((K / 2.0)) <= -0.005) {
tmp = fma((fma((K * K), -0.125, 1.0) * t_0), J, U);
} else {
tmp = fma((1.0 * t_0), J, U);
}
return tmp;
}
function code(J, l, K, U) t_0 = Float64(2.0 * sinh(l)) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.005) tmp = fma(Float64(fma(Float64(K * K), -0.125, 1.0) * t_0), J, U); else tmp = fma(Float64(1.0 * t_0), J, U); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.005], N[(N[(N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] * t$95$0), $MachinePrecision] * J + U), $MachinePrecision], N[(N[(1.0 * t$95$0), $MachinePrecision] * J + U), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 2 \cdot \sinh \ell\\
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.005:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(K \cdot K, -0.125, 1\right) \cdot t\_0, J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1 \cdot t\_0, J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0050000000000000001Initial program 89.9%
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 K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6464.0
Applied rewrites64.0%
if -0.0050000000000000001 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 82.5%
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 rewrites95.6%
Final simplification88.3%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.005)
(fma
(* (fma (* K K) -0.125 1.0) J)
(*
(fma
(fma
(fma 0.0003968253968253968 (* l l) 0.016666666666666666)
(* l l)
0.3333333333333333)
(* l l)
2.0)
l)
U)
(fma (* 1.0 (* 2.0 (sinh l))) J U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.005) {
tmp = fma((fma((K * K), -0.125, 1.0) * J), (fma(fma(fma(0.0003968253968253968, (l * l), 0.016666666666666666), (l * l), 0.3333333333333333), (l * l), 2.0) * l), U);
} else {
tmp = fma((1.0 * (2.0 * sinh(l))), J, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.005) tmp = fma(Float64(fma(Float64(K * K), -0.125, 1.0) * J), Float64(fma(fma(fma(0.0003968253968253968, Float64(l * l), 0.016666666666666666), Float64(l * l), 0.3333333333333333), Float64(l * l), 2.0) * l), U); else tmp = fma(Float64(1.0 * Float64(2.0 * sinh(l))), J, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.005], N[(N[(N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] * J), $MachinePrecision] * 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] + U), $MachinePrecision], N[(N[(1.0 * N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.005:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(K \cdot K, -0.125, 1\right) \cdot J, \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, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1 \cdot \left(2 \cdot \sinh \ell\right), J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0050000000000000001Initial program 89.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-*.f6493.0
Applied rewrites93.0%
lift-+.f64N/A
Applied rewrites92.9%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6464.0
Applied rewrites64.0%
if -0.0050000000000000001 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 82.5%
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 rewrites95.6%
Final simplification88.3%
(FPCore (J l K U)
:precision binary64
(let* ((t_0
(*
(fma
(fma
(fma 0.0003968253968253968 (* l l) 0.016666666666666666)
(* l l)
0.3333333333333333)
(* l l)
2.0)
l)))
(if (<= (cos (/ K 2.0)) -0.005)
(fma (* (fma (* K K) -0.125 1.0) J) t_0 U)
(fma (* 1.0 J) t_0 U))))
double code(double J, double l, double K, double U) {
double t_0 = fma(fma(fma(0.0003968253968253968, (l * l), 0.016666666666666666), (l * l), 0.3333333333333333), (l * l), 2.0) * l;
double tmp;
if (cos((K / 2.0)) <= -0.005) {
tmp = fma((fma((K * K), -0.125, 1.0) * J), t_0, U);
} else {
tmp = fma((1.0 * J), t_0, U);
}
return tmp;
}
function code(J, l, K, U) t_0 = Float64(fma(fma(fma(0.0003968253968253968, Float64(l * l), 0.016666666666666666), Float64(l * l), 0.3333333333333333), Float64(l * l), 2.0) * l) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.005) tmp = fma(Float64(fma(Float64(K * K), -0.125, 1.0) * J), t_0, U); else tmp = fma(Float64(1.0 * J), t_0, U); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = 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]}, If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.005], N[(N[(N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] * J), $MachinePrecision] * t$95$0 + U), $MachinePrecision], N[(N[(1.0 * J), $MachinePrecision] * t$95$0 + U), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \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\\
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.005:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(K \cdot K, -0.125, 1\right) \cdot J, t\_0, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1 \cdot J, t\_0, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0050000000000000001Initial program 89.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-*.f6493.0
Applied rewrites93.0%
lift-+.f64N/A
Applied rewrites92.9%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6464.0
Applied rewrites64.0%
if -0.0050000000000000001 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 82.5%
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-*.f6494.7
Applied rewrites94.7%
lift-+.f64N/A
Applied rewrites94.6%
Taylor expanded in K around 0
Applied rewrites90.3%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.005)
(fma (* (fma (* K K) -0.25 2.0) l) J U)
(fma
(* 1.0 J)
(*
(fma
(fma
(fma 0.0003968253968253968 (* l l) 0.016666666666666666)
(* l l)
0.3333333333333333)
(* l l)
2.0)
l)
U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.005) {
tmp = fma((fma((K * K), -0.25, 2.0) * l), J, U);
} else {
tmp = fma((1.0 * J), (fma(fma(fma(0.0003968253968253968, (l * l), 0.016666666666666666), (l * l), 0.3333333333333333), (l * l), 2.0) * l), U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.005) tmp = fma(Float64(fma(Float64(K * K), -0.25, 2.0) * l), J, U); else tmp = fma(Float64(1.0 * J), Float64(fma(fma(fma(0.0003968253968253968, Float64(l * l), 0.016666666666666666), Float64(l * l), 0.3333333333333333), Float64(l * l), 2.0) * l), U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.005], N[(N[(N[(N[(K * K), $MachinePrecision] * -0.25 + 2.0), $MachinePrecision] * l), $MachinePrecision] * J + U), $MachinePrecision], N[(N[(1.0 * J), $MachinePrecision] * 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] + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.005:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(K \cdot K, -0.25, 2\right) \cdot \ell, J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1 \cdot J, \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, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0050000000000000001Initial program 89.9%
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
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6459.3
Applied rewrites59.3%
Taylor expanded in K around 0
Applied rewrites59.3%
if -0.0050000000000000001 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 82.5%
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-*.f6494.7
Applied rewrites94.7%
lift-+.f64N/A
Applied rewrites94.6%
Taylor expanded in K around 0
Applied rewrites90.3%
Final simplification83.1%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.005) (fma (* (fma (* K K) -0.25 2.0) l) J U) (* (fma (/ (* J l) U) 2.0 1.0) U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.005) {
tmp = fma((fma((K * K), -0.25, 2.0) * l), J, U);
} else {
tmp = fma(((J * l) / U), 2.0, 1.0) * U;
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.005) tmp = fma(Float64(fma(Float64(K * K), -0.25, 2.0) * l), J, U); else tmp = Float64(fma(Float64(Float64(J * l) / U), 2.0, 1.0) * U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.005], N[(N[(N[(N[(K * K), $MachinePrecision] * -0.25 + 2.0), $MachinePrecision] * l), $MachinePrecision] * J + U), $MachinePrecision], N[(N[(N[(N[(J * l), $MachinePrecision] / U), $MachinePrecision] * 2.0 + 1.0), $MachinePrecision] * U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.005:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(K \cdot K, -0.25, 2\right) \cdot \ell, J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{J \cdot \ell}{U}, 2, 1\right) \cdot U\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0050000000000000001Initial program 89.9%
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
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6459.3
Applied rewrites59.3%
Taylor expanded in K around 0
Applied rewrites59.3%
if -0.0050000000000000001 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 82.5%
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-*.f6466.0
Applied rewrites66.0%
Taylor expanded in K around 0
Applied rewrites61.6%
Taylor expanded in U around inf
Applied rewrites66.2%
Final simplification64.6%
(FPCore (J l K U)
:precision binary64
(if (<= l -2.8e-5)
(* (fma l (fma -0.25 (* K K) 2.0) (/ U J)) J)
(if (<= l 390.0)
(fma (* J l) 2.0 U)
(if (<= l 4.8e+267)
(/ (fma -4.0 (* (* (* l l) J) J) (* U U)) (fma -2.0 (* J l) U))
(fma
(* (* 2.0 l) J)
(fma (fma 0.0026041666666666665 (* K K) -0.125) (* K K) 1.0)
U)))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -2.8e-5) {
tmp = fma(l, fma(-0.25, (K * K), 2.0), (U / J)) * J;
} else if (l <= 390.0) {
tmp = fma((J * l), 2.0, U);
} else if (l <= 4.8e+267) {
tmp = fma(-4.0, (((l * l) * J) * J), (U * U)) / fma(-2.0, (J * l), U);
} else {
tmp = fma(((2.0 * l) * J), fma(fma(0.0026041666666666665, (K * K), -0.125), (K * K), 1.0), U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (l <= -2.8e-5) tmp = Float64(fma(l, fma(-0.25, Float64(K * K), 2.0), Float64(U / J)) * J); elseif (l <= 390.0) tmp = fma(Float64(J * l), 2.0, U); elseif (l <= 4.8e+267) tmp = Float64(fma(-4.0, Float64(Float64(Float64(l * l) * J) * J), Float64(U * U)) / fma(-2.0, Float64(J * l), U)); else tmp = fma(Float64(Float64(2.0 * l) * J), fma(fma(0.0026041666666666665, Float64(K * K), -0.125), Float64(K * K), 1.0), U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[l, -2.8e-5], N[(N[(l * N[(-0.25 * N[(K * K), $MachinePrecision] + 2.0), $MachinePrecision] + N[(U / J), $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision], If[LessEqual[l, 390.0], N[(N[(J * l), $MachinePrecision] * 2.0 + U), $MachinePrecision], If[LessEqual[l, 4.8e+267], N[(N[(-4.0 * N[(N[(N[(l * l), $MachinePrecision] * J), $MachinePrecision] * J), $MachinePrecision] + N[(U * U), $MachinePrecision]), $MachinePrecision] / N[(-2.0 * N[(J * l), $MachinePrecision] + U), $MachinePrecision]), $MachinePrecision], N[(N[(N[(2.0 * l), $MachinePrecision] * J), $MachinePrecision] * N[(N[(0.0026041666666666665 * N[(K * K), $MachinePrecision] + -0.125), $MachinePrecision] * N[(K * K), $MachinePrecision] + 1.0), $MachinePrecision] + U), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.8 \cdot 10^{-5}:\\
\;\;\;\;\mathsf{fma}\left(\ell, \mathsf{fma}\left(-0.25, K \cdot K, 2\right), \frac{U}{J}\right) \cdot J\\
\mathbf{elif}\;\ell \leq 390:\\
\;\;\;\;\mathsf{fma}\left(J \cdot \ell, 2, U\right)\\
\mathbf{elif}\;\ell \leq 4.8 \cdot 10^{+267}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-4, \left(\left(\ell \cdot \ell\right) \cdot J\right) \cdot J, U \cdot U\right)}{\mathsf{fma}\left(-2, J \cdot \ell, U\right)}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(2 \cdot \ell\right) \cdot J, \mathsf{fma}\left(\mathsf{fma}\left(0.0026041666666666665, K \cdot K, -0.125\right), K \cdot K, 1\right), U\right)\\
\end{array}
\end{array}
if l < -2.79999999999999996e-5Initial program 99.7%
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-*.f6425.1
Applied rewrites25.1%
Taylor expanded in J around inf
Applied rewrites34.1%
Taylor expanded in K around 0
Applied rewrites42.7%
if -2.79999999999999996e-5 < l < 390Initial program 70.2%
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-*.f6499.9
Applied rewrites99.9%
Taylor expanded in K around 0
Applied rewrites89.1%
if 390 < l < 4.79999999999999969e267Initial program 100.0%
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-*.f6419.0
Applied rewrites19.0%
Taylor expanded in K around 0
Applied rewrites12.2%
Applied rewrites12.2%
Applied rewrites45.1%
if 4.79999999999999969e267 < l Initial program 100.0%
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-*.f6448.4
Applied rewrites48.4%
Taylor expanded in K around 0
Applied rewrites64.6%
Final simplification68.5%
(FPCore (J l K U) :precision binary64 (let* ((t_0 (fma (* (fma (* K K) -0.25 2.0) l) J U))) (if (<= l -2.8e-5) t_0 (if (<= l 4.1e+15) (fma (* J l) 2.0 U) t_0))))
double code(double J, double l, double K, double U) {
double t_0 = fma((fma((K * K), -0.25, 2.0) * l), J, U);
double tmp;
if (l <= -2.8e-5) {
tmp = t_0;
} else if (l <= 4.1e+15) {
tmp = fma((J * l), 2.0, U);
} else {
tmp = t_0;
}
return tmp;
}
function code(J, l, K, U) t_0 = fma(Float64(fma(Float64(K * K), -0.25, 2.0) * l), J, U) tmp = 0.0 if (l <= -2.8e-5) tmp = t_0; elseif (l <= 4.1e+15) tmp = fma(Float64(J * l), 2.0, U); else tmp = t_0; end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[(N[(N[(K * K), $MachinePrecision] * -0.25 + 2.0), $MachinePrecision] * l), $MachinePrecision] * J + U), $MachinePrecision]}, If[LessEqual[l, -2.8e-5], t$95$0, If[LessEqual[l, 4.1e+15], N[(N[(J * l), $MachinePrecision] * 2.0 + U), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(\mathsf{fma}\left(K \cdot K, -0.25, 2\right) \cdot \ell, J, U\right)\\
\mathbf{if}\;\ell \leq -2.8 \cdot 10^{-5}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq 4.1 \cdot 10^{+15}:\\
\;\;\;\;\mathsf{fma}\left(J \cdot \ell, 2, U\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if l < -2.79999999999999996e-5 or 4.1e15 < l Initial program 99.8%
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
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6425.3
Applied rewrites25.3%
Taylor expanded in K around 0
Applied rewrites35.6%
if -2.79999999999999996e-5 < l < 4.1e15Initial program 70.6%
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-*.f6498.4
Applied rewrites98.4%
Taylor expanded in K around 0
Applied rewrites87.8%
Final simplification63.6%
(FPCore (J l K U) :precision binary64 (let* ((t_0 (* (* J l) (fma -0.25 (* K K) 2.0)))) (if (<= l -2.8e-5) t_0 (if (<= l 3.6e+29) (fma (* J l) 2.0 U) t_0))))
double code(double J, double l, double K, double U) {
double t_0 = (J * l) * fma(-0.25, (K * K), 2.0);
double tmp;
if (l <= -2.8e-5) {
tmp = t_0;
} else if (l <= 3.6e+29) {
tmp = fma((J * l), 2.0, U);
} else {
tmp = t_0;
}
return tmp;
}
function code(J, l, K, U) t_0 = Float64(Float64(J * l) * fma(-0.25, Float64(K * K), 2.0)) tmp = 0.0 if (l <= -2.8e-5) tmp = t_0; elseif (l <= 3.6e+29) tmp = fma(Float64(J * l), 2.0, U); else tmp = t_0; end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[(J * l), $MachinePrecision] * N[(-0.25 * N[(K * K), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -2.8e-5], t$95$0, If[LessEqual[l, 3.6e+29], N[(N[(J * l), $MachinePrecision] * 2.0 + U), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(J \cdot \ell\right) \cdot \mathsf{fma}\left(-0.25, K \cdot K, 2\right)\\
\mathbf{if}\;\ell \leq -2.8 \cdot 10^{-5}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq 3.6 \cdot 10^{+29}:\\
\;\;\;\;\mathsf{fma}\left(J \cdot \ell, 2, U\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if l < -2.79999999999999996e-5 or 3.59999999999999976e29 < l Initial program 99.8%
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-*.f6425.8
Applied rewrites25.8%
Taylor expanded in U around 0
Applied rewrites25.7%
Taylor expanded in K around 0
Applied rewrites32.9%
if -2.79999999999999996e-5 < l < 3.59999999999999976e29Initial program 71.3%
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-*.f6496.4
Applied rewrites96.4%
Taylor expanded in K around 0
Applied rewrites86.1%
Final simplification62.0%
(FPCore (J l K U) :precision binary64 (fma (* J l) 2.0 U))
double code(double J, double l, double K, double U) {
return fma((J * l), 2.0, U);
}
function code(J, l, K, U) return fma(Float64(J * l), 2.0, U) end
code[J_, l_, K_, U_] := N[(N[(J * l), $MachinePrecision] * 2.0 + U), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(J \cdot \ell, 2, U\right)
\end{array}
Initial program 84.2%
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-*.f6464.4
Applied rewrites64.4%
Taylor expanded in K around 0
Applied rewrites55.0%
Final simplification55.0%
(FPCore (J l K U) :precision binary64 (* (* 2.0 l) J))
double code(double J, double l, double K, double U) {
return (2.0 * l) * 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 = (2.0d0 * l) * j
end function
public static double code(double J, double l, double K, double U) {
return (2.0 * l) * J;
}
def code(J, l, K, U): return (2.0 * l) * J
function code(J, l, K, U) return Float64(Float64(2.0 * l) * J) end
function tmp = code(J, l, K, U) tmp = (2.0 * l) * J; end
code[J_, l_, K_, U_] := N[(N[(2.0 * l), $MachinePrecision] * J), $MachinePrecision]
\begin{array}{l}
\\
\left(2 \cdot \ell\right) \cdot J
\end{array}
Initial program 84.2%
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-*.f6464.4
Applied rewrites64.4%
Taylor expanded in K around 0
Applied rewrites55.0%
Taylor expanded in U around 0
Applied rewrites21.0%
Applied rewrites21.0%
herbie shell --seed 2024240
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))