
(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;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(j, l, k, u)
use fmin_fmax_functions
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}
Herbie found 16 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;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(j, l, k, u)
use fmin_fmax_functions
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 (* (cos (* -0.5 K)) (* (sinh l) 2.0)) J U))
double code(double J, double l, double K, double U) {
return fma((cos((-0.5 * K)) * (sinh(l) * 2.0)), J, U);
}
function code(J, l, K, U) return fma(Float64(cos(Float64(-0.5 * K)) * Float64(sinh(l) * 2.0)), J, U) end
code[J_, l_, K_, U_] := N[(N[(N[Cos[N[(-0.5 * K), $MachinePrecision]], $MachinePrecision] * N[(N[Sinh[l], $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\cos \left(-0.5 \cdot K\right) \cdot \left(\sinh \ell \cdot 2\right), J, U\right)
\end{array}
Initial program 86.1%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
associate-*l*N/A
mult-flipN/A
metadata-evalN/A
*-commutativeN/A
*-commutativeN/A
*-commutativeN/A
Applied rewrites99.9%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (* (* (cos (* 0.5 K)) (sinh l)) (+ J J)))
(t_1 (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0)))))
(if (<= t_1 (- INFINITY))
t_0
(if (<= t_1 2e-169) (fma (* (cos (* -0.5 K)) (+ l l)) J U) t_0))))
double code(double J, double l, double K, double U) {
double t_0 = (cos((0.5 * K)) * sinh(l)) * (J + J);
double t_1 = (J * (exp(l) - exp(-l))) * cos((K / 2.0));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = t_0;
} else if (t_1 <= 2e-169) {
tmp = fma((cos((-0.5 * K)) * (l + l)), J, U);
} else {
tmp = t_0;
}
return tmp;
}
function code(J, l, K, U) t_0 = Float64(Float64(cos(Float64(0.5 * K)) * sinh(l)) * Float64(J + J)) t_1 = Float64(Float64(J * Float64(exp(l) - exp(Float64(-l)))) * cos(Float64(K / 2.0))) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = t_0; elseif (t_1 <= 2e-169) tmp = fma(Float64(cos(Float64(-0.5 * K)) * Float64(l + l)), J, U); else tmp = t_0; end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[(N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision] * N[Sinh[l], $MachinePrecision]), $MachinePrecision] * N[(J + J), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], t$95$0, If[LessEqual[t$95$1, 2e-169], N[(N[(N[Cos[N[(-0.5 * K), $MachinePrecision]], $MachinePrecision] * N[(l + l), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\cos \left(0.5 \cdot K\right) \cdot \sinh \ell\right) \cdot \left(J + J\right)\\
t_1 := \left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-169}:\\
\;\;\;\;\mathsf{fma}\left(\cos \left(-0.5 \cdot K\right) \cdot \left(\ell + \ell\right), J, U\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if (*.f64 (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) (cos.f64 (/.f64 K #s(literal 2 binary64)))) < -inf.0 or 2.00000000000000004e-169 < (*.f64 (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) (cos.f64 (/.f64 K #s(literal 2 binary64)))) Initial program 86.1%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
associate-*l*N/A
mult-flipN/A
metadata-evalN/A
*-commutativeN/A
*-commutativeN/A
*-commutativeN/A
Applied rewrites99.9%
Taylor expanded in J around inf
Applied rewrites65.0%
if -inf.0 < (*.f64 (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) (cos.f64 (/.f64 K #s(literal 2 binary64)))) < 2.00000000000000004e-169Initial program 86.1%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
associate-*l*N/A
mult-flipN/A
metadata-evalN/A
*-commutativeN/A
*-commutativeN/A
*-commutativeN/A
Applied rewrites99.9%
Taylor expanded in l around 0
*-commutativeN/A
sinh-undefN/A
count-2-revN/A
lift-+.f6463.9
Applied rewrites63.9%
(FPCore (J l K U) :precision binary64 (fma (* (+ J J) (cos (* -0.5 K))) (sinh l) U))
double code(double J, double l, double K, double U) {
return fma(((J + J) * cos((-0.5 * K))), sinh(l), U);
}
function code(J, l, K, U) return fma(Float64(Float64(J + J) * cos(Float64(-0.5 * K))), sinh(l), U) end
code[J_, l_, K_, U_] := N[(N[(N[(J + J), $MachinePrecision] * N[Cos[N[(-0.5 * K), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sinh[l], $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\left(J + J\right) \cdot \cos \left(-0.5 \cdot K\right), \sinh \ell, U\right)
\end{array}
Initial program 86.1%
Applied rewrites99.9%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) 0.99998) (fma (* (cos (* -0.5 K)) (* (fma (* l l) 0.3333333333333333 2.0) l)) J U) (fma (+ J J) (sinh l) U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= 0.99998) {
tmp = fma((cos((-0.5 * K)) * (fma((l * l), 0.3333333333333333, 2.0) * l)), J, U);
} else {
tmp = fma((J + J), sinh(l), U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= 0.99998) tmp = fma(Float64(cos(Float64(-0.5 * K)) * Float64(fma(Float64(l * l), 0.3333333333333333, 2.0) * l)), J, U); else tmp = fma(Float64(J + J), sinh(l), U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], 0.99998], N[(N[(N[Cos[N[(-0.5 * K), $MachinePrecision]], $MachinePrecision] * N[(N[(N[(l * l), $MachinePrecision] * 0.3333333333333333 + 2.0), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision], N[(N[(J + J), $MachinePrecision] * N[Sinh[l], $MachinePrecision] + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq 0.99998:\\
\;\;\;\;\mathsf{fma}\left(\cos \left(-0.5 \cdot K\right) \cdot \left(\mathsf{fma}\left(\ell \cdot \ell, 0.3333333333333333, 2\right) \cdot \ell\right), J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(J + J, \sinh \ell, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.99997999999999998Initial program 86.1%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
associate-*l*N/A
mult-flipN/A
metadata-evalN/A
*-commutativeN/A
*-commutativeN/A
*-commutativeN/A
Applied rewrites99.9%
Taylor expanded in l around 0
*-commutativeN/A
sinh-undefN/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6488.0
Applied rewrites88.0%
if 0.99997999999999998 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 86.1%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
mul-1-negN/A
*-commutativeN/A
mul-1-negN/A
sinh-undefN/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-sinh.f6481.1
Applied rewrites81.1%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) 0.25) (fma (* (cos (* -0.5 K)) (+ l l)) J U) (fma (+ J J) (sinh l) U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= 0.25) {
tmp = fma((cos((-0.5 * K)) * (l + l)), J, U);
} else {
tmp = fma((J + J), sinh(l), U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= 0.25) tmp = fma(Float64(cos(Float64(-0.5 * K)) * Float64(l + l)), J, U); else tmp = fma(Float64(J + J), sinh(l), U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], 0.25], N[(N[(N[Cos[N[(-0.5 * K), $MachinePrecision]], $MachinePrecision] * N[(l + l), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision], N[(N[(J + J), $MachinePrecision] * N[Sinh[l], $MachinePrecision] + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq 0.25:\\
\;\;\;\;\mathsf{fma}\left(\cos \left(-0.5 \cdot K\right) \cdot \left(\ell + \ell\right), J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(J + J, \sinh \ell, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.25Initial program 86.1%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
associate-*l*N/A
mult-flipN/A
metadata-evalN/A
*-commutativeN/A
*-commutativeN/A
*-commutativeN/A
Applied rewrites99.9%
Taylor expanded in l around 0
*-commutativeN/A
sinh-undefN/A
count-2-revN/A
lift-+.f6463.9
Applied rewrites63.9%
if 0.25 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 86.1%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
mul-1-negN/A
*-commutativeN/A
mul-1-negN/A
sinh-undefN/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-sinh.f6481.1
Applied rewrites81.1%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) 0.25) (fma (* (+ l l) J) (cos (* -0.5 K)) U) (fma (+ J J) (sinh l) U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= 0.25) {
tmp = fma(((l + l) * J), cos((-0.5 * K)), U);
} else {
tmp = fma((J + J), sinh(l), U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= 0.25) tmp = fma(Float64(Float64(l + l) * J), cos(Float64(-0.5 * K)), U); else tmp = fma(Float64(J + J), sinh(l), U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], 0.25], N[(N[(N[(l + l), $MachinePrecision] * J), $MachinePrecision] * N[Cos[N[(-0.5 * K), $MachinePrecision]], $MachinePrecision] + U), $MachinePrecision], N[(N[(J + J), $MachinePrecision] * N[Sinh[l], $MachinePrecision] + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq 0.25:\\
\;\;\;\;\mathsf{fma}\left(\left(\ell + \ell\right) \cdot J, \cos \left(-0.5 \cdot K\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(J + J, \sinh \ell, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.25Initial program 86.1%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-fma.f64N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
count-2-revN/A
lower-+.f64N/A
cos-neg-revN/A
*-commutativeN/A
metadata-evalN/A
mult-flipN/A
lower-cos.f64N/A
mult-flipN/A
metadata-evalN/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-eval63.9
Applied rewrites63.9%
if 0.25 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 86.1%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
mul-1-negN/A
*-commutativeN/A
mul-1-negN/A
sinh-undefN/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-sinh.f6481.1
Applied rewrites81.1%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.05) (+ (* (* J (- (exp l) (exp (- l)))) (fma (* K K) -0.125 1.0)) U) (fma (+ J J) (sinh l) U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.05) {
tmp = ((J * (exp(l) - exp(-l))) * fma((K * K), -0.125, 1.0)) + U;
} else {
tmp = fma((J + J), sinh(l), U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.05) tmp = Float64(Float64(Float64(J * Float64(exp(l) - exp(Float64(-l)))) * fma(Float64(K * K), -0.125, 1.0)) + U); else tmp = fma(Float64(J + J), sinh(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[(N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(N[(J + J), $MachinePrecision] * N[Sinh[l], $MachinePrecision] + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.05:\\
\;\;\;\;\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \mathsf{fma}\left(K \cdot K, -0.125, 1\right) + U\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(J + J, \sinh \ell, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.050000000000000003Initial program 86.1%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6463.6
Applied rewrites63.6%
if -0.050000000000000003 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 86.1%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
mul-1-negN/A
*-commutativeN/A
mul-1-negN/A
sinh-undefN/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-sinh.f6481.1
Applied rewrites81.1%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.05) (fma (* (fma (* K K) -0.125 1.0) (sinh l)) (+ J J) U) (fma (+ J J) (sinh l) U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.05) {
tmp = fma((fma((K * K), -0.125, 1.0) * sinh(l)), (J + J), U);
} else {
tmp = fma((J + J), sinh(l), U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.05) tmp = fma(Float64(fma(Float64(K * K), -0.125, 1.0) * sinh(l)), Float64(J + J), U); else tmp = fma(Float64(J + J), sinh(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[(N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] * N[Sinh[l], $MachinePrecision]), $MachinePrecision] * N[(J + J), $MachinePrecision] + U), $MachinePrecision], N[(N[(J + J), $MachinePrecision] * N[Sinh[l], $MachinePrecision] + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.05:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(K \cdot K, -0.125, 1\right) \cdot \sinh \ell, J + J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(J + J, \sinh \ell, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.050000000000000003Initial program 86.1%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6463.6
Applied rewrites63.6%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-neg.f64N/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites68.1%
lift-fma.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-sinh.f64N/A
associate-*r*N/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites68.1%
if -0.050000000000000003 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 86.1%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
mul-1-negN/A
*-commutativeN/A
mul-1-negN/A
sinh-undefN/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-sinh.f6481.1
Applied rewrites81.1%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.05) (fma (* (* (* K K) -0.125) (* (sinh l) 2.0)) J U) (fma (+ J J) (sinh l) U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.05) {
tmp = fma((((K * K) * -0.125) * (sinh(l) * 2.0)), J, U);
} else {
tmp = fma((J + J), sinh(l), U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.05) tmp = fma(Float64(Float64(Float64(K * K) * -0.125) * Float64(sinh(l) * 2.0)), J, U); else tmp = fma(Float64(J + J), sinh(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[(N[(N[(K * K), $MachinePrecision] * -0.125), $MachinePrecision] * N[(N[Sinh[l], $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision], N[(N[(J + J), $MachinePrecision] * N[Sinh[l], $MachinePrecision] + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.05:\\
\;\;\;\;\mathsf{fma}\left(\left(\left(K \cdot K\right) \cdot -0.125\right) \cdot \left(\sinh \ell \cdot 2\right), J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(J + J, \sinh \ell, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.050000000000000003Initial program 86.1%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6463.6
Applied rewrites63.6%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-neg.f64N/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites68.1%
Taylor expanded in K around inf
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6436.1
Applied rewrites36.1%
if -0.050000000000000003 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 86.1%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
mul-1-negN/A
*-commutativeN/A
mul-1-negN/A
sinh-undefN/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-sinh.f6481.1
Applied rewrites81.1%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.05)
(fma
(fma -0.125 (* K K) 1.0)
(* (* (fma (* l l) 0.3333333333333333 2.0) l) J)
U)
(fma (+ J J) (sinh l) U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.05) {
tmp = fma(fma(-0.125, (K * K), 1.0), ((fma((l * l), 0.3333333333333333, 2.0) * l) * J), U);
} else {
tmp = fma((J + J), sinh(l), U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.05) tmp = fma(fma(-0.125, Float64(K * K), 1.0), Float64(Float64(fma(Float64(l * l), 0.3333333333333333, 2.0) * l) * J), U); else tmp = fma(Float64(J + J), sinh(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[(-0.125 * N[(K * K), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[(N[(N[(l * l), $MachinePrecision] * 0.3333333333333333 + 2.0), $MachinePrecision] * l), $MachinePrecision] * J), $MachinePrecision] + U), $MachinePrecision], N[(N[(J + J), $MachinePrecision] * N[Sinh[l], $MachinePrecision] + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.05:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-0.125, K \cdot K, 1\right), \left(\mathsf{fma}\left(\ell \cdot \ell, 0.3333333333333333, 2\right) \cdot \ell\right) \cdot J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(J + J, \sinh \ell, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.050000000000000003Initial program 86.1%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
associate-*l*N/A
mult-flipN/A
metadata-evalN/A
*-commutativeN/A
*-commutativeN/A
*-commutativeN/A
Applied rewrites99.9%
Taylor expanded in l around 0
*-commutativeN/A
sinh-undefN/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6488.0
Applied rewrites88.0%
lift-fma.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
associate-*l*N/A
cos-neg-revN/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower-fma.f64N/A
Applied rewrites88.0%
Taylor expanded in K around 0
+-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6461.3
Applied rewrites61.3%
if -0.050000000000000003 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 86.1%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
mul-1-negN/A
*-commutativeN/A
mul-1-negN/A
sinh-undefN/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-sinh.f6481.1
Applied rewrites81.1%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.05) (fma (+ l l) (fma (* (* K K) J) -0.125 J) U) (fma (+ J J) (sinh l) U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.05) {
tmp = fma((l + l), fma(((K * K) * J), -0.125, J), U);
} else {
tmp = fma((J + J), sinh(l), U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.05) tmp = fma(Float64(l + l), fma(Float64(Float64(K * K) * J), -0.125, J), U); else tmp = fma(Float64(J + J), sinh(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[(l + l), $MachinePrecision] * N[(N[(N[(K * K), $MachinePrecision] * J), $MachinePrecision] * -0.125 + J), $MachinePrecision] + U), $MachinePrecision], N[(N[(J + J), $MachinePrecision] * N[Sinh[l], $MachinePrecision] + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.05:\\
\;\;\;\;\mathsf{fma}\left(\ell + \ell, \mathsf{fma}\left(\left(K \cdot K\right) \cdot J, -0.125, J\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(J + J, \sinh \ell, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.050000000000000003Initial program 86.1%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-fma.f64N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
count-2-revN/A
lower-+.f64N/A
cos-neg-revN/A
*-commutativeN/A
metadata-evalN/A
mult-flipN/A
lower-cos.f64N/A
mult-flipN/A
metadata-evalN/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-eval63.9
Applied rewrites63.9%
lift-fma.f64N/A
lift-*.f64N/A
lift-+.f64N/A
count-2-revN/A
lift-*.f64N/A
lift-cos.f64N/A
associate-*l*N/A
cos-neg-revN/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower-fma.f64N/A
Applied rewrites63.9%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6447.0
Applied rewrites47.0%
if -0.050000000000000003 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 86.1%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
mul-1-negN/A
*-commutativeN/A
mul-1-negN/A
sinh-undefN/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-sinh.f6481.1
Applied rewrites81.1%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))
(t_1 (* (+ J J) (sinh l))))
(if (<= t_0 (- INFINITY)) t_1 (if (<= t_0 1e+304) (fma (+ J J) l U) t_1))))
double code(double J, double l, double K, double U) {
double t_0 = ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U;
double t_1 = (J + J) * sinh(l);
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_0 <= 1e+304) {
tmp = fma((J + J), l, U);
} else {
tmp = t_1;
}
return tmp;
}
function code(J, l, K, U) t_0 = Float64(Float64(Float64(J * Float64(exp(l) - exp(Float64(-l)))) * cos(Float64(K / 2.0))) + U) t_1 = Float64(Float64(J + J) * sinh(l)) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = t_1; elseif (t_0 <= 1e+304) tmp = fma(Float64(J + J), l, U); else tmp = t_1; end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = 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]}, Block[{t$95$1 = N[(N[(J + J), $MachinePrecision] * N[Sinh[l], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], t$95$1, If[LessEqual[t$95$0, 1e+304], N[(N[(J + J), $MachinePrecision] * l + U), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U\\
t_1 := \left(J + J\right) \cdot \sinh \ell\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 10^{+304}:\\
\;\;\;\;\mathsf{fma}\left(J + J, \ell, U\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 (*.f64 (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) (cos.f64 (/.f64 K #s(literal 2 binary64)))) U) < -inf.0 or 9.9999999999999994e303 < (+.f64 (*.f64 (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) (cos.f64 (/.f64 K #s(literal 2 binary64)))) U) Initial program 86.1%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
mul-1-negN/A
*-commutativeN/A
mul-1-negN/A
sinh-undefN/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-sinh.f6481.1
Applied rewrites81.1%
Taylor expanded in J around inf
rec-expN/A
mul-1-negN/A
mul-1-negN/A
sinh-undefN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
count-2-revN/A
lift-+.f64N/A
lift-sinh.f6446.7
Applied rewrites46.7%
if -inf.0 < (+.f64 (*.f64 (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) (cos.f64 (/.f64 K #s(literal 2 binary64)))) U) < 9.9999999999999994e303Initial program 86.1%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
mul-1-negN/A
*-commutativeN/A
mul-1-negN/A
sinh-undefN/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-sinh.f6481.1
Applied rewrites81.1%
Taylor expanded in l around 0
Applied rewrites54.1%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (fma (* (/ (+ J J) U) l) U U)))
(if (<= l -3.4e+106)
t_0
(if (<= l -850.0)
(* (* l (fma -0.25 (* K K) 2.0)) J)
(if (<= l 5e+33) (fma (+ J J) l U) t_0)))))
double code(double J, double l, double K, double U) {
double t_0 = fma((((J + J) / U) * l), U, U);
double tmp;
if (l <= -3.4e+106) {
tmp = t_0;
} else if (l <= -850.0) {
tmp = (l * fma(-0.25, (K * K), 2.0)) * J;
} else if (l <= 5e+33) {
tmp = fma((J + J), l, U);
} else {
tmp = t_0;
}
return tmp;
}
function code(J, l, K, U) t_0 = fma(Float64(Float64(Float64(J + J) / U) * l), U, U) tmp = 0.0 if (l <= -3.4e+106) tmp = t_0; elseif (l <= -850.0) tmp = Float64(Float64(l * fma(-0.25, Float64(K * K), 2.0)) * J); elseif (l <= 5e+33) tmp = fma(Float64(J + J), l, U); else tmp = t_0; end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[(N[(N[(J + J), $MachinePrecision] / U), $MachinePrecision] * l), $MachinePrecision] * U + U), $MachinePrecision]}, If[LessEqual[l, -3.4e+106], t$95$0, If[LessEqual[l, -850.0], N[(N[(l * N[(-0.25 * N[(K * K), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision], If[LessEqual[l, 5e+33], N[(N[(J + J), $MachinePrecision] * l + U), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(\frac{J + J}{U} \cdot \ell, U, U\right)\\
\mathbf{if}\;\ell \leq -3.4 \cdot 10^{+106}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq -850:\\
\;\;\;\;\left(\ell \cdot \mathsf{fma}\left(-0.25, K \cdot K, 2\right)\right) \cdot J\\
\mathbf{elif}\;\ell \leq 5 \cdot 10^{+33}:\\
\;\;\;\;\mathsf{fma}\left(J + J, \ell, U\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if l < -3.39999999999999994e106 or 4.99999999999999973e33 < l Initial program 86.1%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
mul-1-negN/A
*-commutativeN/A
mul-1-negN/A
sinh-undefN/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-sinh.f6481.1
Applied rewrites81.1%
Taylor expanded in U around inf
+-commutativeN/A
distribute-rgt-inN/A
*-lft-identityN/A
lower-fma.f64N/A
associate-/l*N/A
rec-expN/A
associate-/l*N/A
lower-/.f64N/A
sinh-undefN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
count-2-revN/A
lift-+.f64N/A
lift-sinh.f6479.9
Applied rewrites79.9%
Taylor expanded in l around 0
associate-*r/N/A
associate-*r*N/A
associate-*l/N/A
associate-*r/N/A
lower-*.f64N/A
associate-*r/N/A
lower-/.f64N/A
count-2-revN/A
lift-+.f6455.1
Applied rewrites55.1%
if -3.39999999999999994e106 < l < -850Initial program 86.1%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-fma.f64N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
count-2-revN/A
lower-+.f64N/A
cos-neg-revN/A
*-commutativeN/A
metadata-evalN/A
mult-flipN/A
lower-cos.f64N/A
mult-flipN/A
metadata-evalN/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-eval63.9
Applied rewrites63.9%
Taylor expanded in K around 0
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
+-commutativeN/A
*-commutativeN/A
associate-*l*N/A
lower-fma.f64N/A
count-2-revN/A
lift-+.f6444.3
Applied rewrites44.3%
Taylor expanded in J around inf
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
distribute-rgt-outN/A
lower-*.f64N/A
lower-fma.f64N/A
pow2N/A
lift-*.f6425.2
Applied rewrites25.2%
if -850 < l < 4.99999999999999973e33Initial program 86.1%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
mul-1-negN/A
*-commutativeN/A
mul-1-negN/A
sinh-undefN/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-sinh.f6481.1
Applied rewrites81.1%
Taylor expanded in l around 0
Applied rewrites54.1%
(FPCore (J l K U) :precision binary64 (let* ((t_0 (* (* l (fma -0.25 (* K K) 2.0)) J))) (if (<= l -850.0) t_0 (if (<= l 1.1e+22) (fma (+ J J) l U) t_0))))
double code(double J, double l, double K, double U) {
double t_0 = (l * fma(-0.25, (K * K), 2.0)) * J;
double tmp;
if (l <= -850.0) {
tmp = t_0;
} else if (l <= 1.1e+22) {
tmp = fma((J + J), l, U);
} else {
tmp = t_0;
}
return tmp;
}
function code(J, l, K, U) t_0 = Float64(Float64(l * fma(-0.25, Float64(K * K), 2.0)) * J) tmp = 0.0 if (l <= -850.0) tmp = t_0; elseif (l <= 1.1e+22) tmp = fma(Float64(J + J), l, U); else tmp = t_0; end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[(l * N[(-0.25 * N[(K * K), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]}, If[LessEqual[l, -850.0], t$95$0, If[LessEqual[l, 1.1e+22], N[(N[(J + J), $MachinePrecision] * l + U), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\ell \cdot \mathsf{fma}\left(-0.25, K \cdot K, 2\right)\right) \cdot J\\
\mathbf{if}\;\ell \leq -850:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq 1.1 \cdot 10^{+22}:\\
\;\;\;\;\mathsf{fma}\left(J + J, \ell, U\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if l < -850 or 1.1e22 < l Initial program 86.1%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-fma.f64N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
count-2-revN/A
lower-+.f64N/A
cos-neg-revN/A
*-commutativeN/A
metadata-evalN/A
mult-flipN/A
lower-cos.f64N/A
mult-flipN/A
metadata-evalN/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-eval63.9
Applied rewrites63.9%
Taylor expanded in K around 0
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
+-commutativeN/A
*-commutativeN/A
associate-*l*N/A
lower-fma.f64N/A
count-2-revN/A
lift-+.f6444.3
Applied rewrites44.3%
Taylor expanded in J around inf
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
distribute-rgt-outN/A
lower-*.f64N/A
lower-fma.f64N/A
pow2N/A
lift-*.f6425.2
Applied rewrites25.2%
if -850 < l < 1.1e22Initial program 86.1%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
mul-1-negN/A
*-commutativeN/A
mul-1-negN/A
sinh-undefN/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-sinh.f6481.1
Applied rewrites81.1%
Taylor expanded in l around 0
Applied rewrites54.1%
(FPCore (J l K U) :precision binary64 (fma (+ J J) l U))
double code(double J, double l, double K, double U) {
return fma((J + J), l, U);
}
function code(J, l, K, U) return fma(Float64(J + J), l, U) end
code[J_, l_, K_, U_] := N[(N[(J + J), $MachinePrecision] * l + U), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(J + J, \ell, U\right)
\end{array}
Initial program 86.1%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
mul-1-negN/A
*-commutativeN/A
mul-1-negN/A
sinh-undefN/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-sinh.f6481.1
Applied rewrites81.1%
Taylor expanded in l around 0
Applied rewrites54.1%
(FPCore (J l K U) :precision binary64 U)
double code(double J, double l, double K, double U) {
return U;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(j, l, k, u)
use fmin_fmax_functions
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = u
end function
public static double code(double J, double l, double K, double U) {
return U;
}
def code(J, l, K, U): return U
function code(J, l, K, U) return U end
function tmp = code(J, l, K, U) tmp = U; end
code[J_, l_, K_, U_] := U
\begin{array}{l}
\\
U
\end{array}
Initial program 86.1%
Taylor expanded in J around 0
Applied rewrites37.0%
herbie shell --seed 2025129
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))