
(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}
Sampling outcomes in binary64 precision:
Herbie found 17 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 (+ (* (* (cos (* 0.5 K)) J) (* 2.0 (sinh l))) U))
double code(double J, double l, double K, double U) {
return ((cos((0.5 * K)) * J) * (2.0 * sinh(l))) + 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 = ((cos((0.5d0 * k)) * j) * (2.0d0 * sinh(l))) + u
end function
public static double code(double J, double l, double K, double U) {
return ((Math.cos((0.5 * K)) * J) * (2.0 * Math.sinh(l))) + U;
}
def code(J, l, K, U): return ((math.cos((0.5 * K)) * J) * (2.0 * math.sinh(l))) + U
function code(J, l, K, U) return Float64(Float64(Float64(cos(Float64(0.5 * K)) * J) * Float64(2.0 * sinh(l))) + U) end
function tmp = code(J, l, K, U) tmp = ((cos((0.5 * K)) * J) * (2.0 * sinh(l))) + U; end
code[J_, l_, K_, U_] := N[(N[(N[(N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision] * J), $MachinePrecision] * N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\left(\cos \left(0.5 \cdot K\right) \cdot J\right) \cdot \left(2 \cdot \sinh \ell\right) + U
\end{array}
Initial program 89.7%
Taylor expanded in J around 0
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
sinh-undefN/A
lower-*.f64N/A
lower-sinh.f64100.0
Applied rewrites100.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U)))
(if (or (<= t_0 (- INFINITY)) (not (<= t_0 4e+33)))
(+ (* (* (* (* l l) 0.3333333333333333) l) J) U)
(+ (* (* l J) 2.0) U))))
double code(double J, double l, double K, double U) {
double t_0 = ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U;
double tmp;
if ((t_0 <= -((double) INFINITY)) || !(t_0 <= 4e+33)) {
tmp = ((((l * l) * 0.3333333333333333) * l) * J) + U;
} else {
tmp = ((l * J) * 2.0) + U;
}
return tmp;
}
public static double code(double J, double l, double K, double U) {
double t_0 = ((J * (Math.exp(l) - Math.exp(-l))) * Math.cos((K / 2.0))) + U;
double tmp;
if ((t_0 <= -Double.POSITIVE_INFINITY) || !(t_0 <= 4e+33)) {
tmp = ((((l * l) * 0.3333333333333333) * l) * J) + U;
} else {
tmp = ((l * J) * 2.0) + U;
}
return tmp;
}
def code(J, l, K, U): t_0 = ((J * (math.exp(l) - math.exp(-l))) * math.cos((K / 2.0))) + U tmp = 0 if (t_0 <= -math.inf) or not (t_0 <= 4e+33): tmp = ((((l * l) * 0.3333333333333333) * l) * J) + U else: tmp = ((l * J) * 2.0) + U 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) tmp = 0.0 if ((t_0 <= Float64(-Inf)) || !(t_0 <= 4e+33)) tmp = Float64(Float64(Float64(Float64(Float64(l * l) * 0.3333333333333333) * l) * J) + U); else tmp = Float64(Float64(Float64(l * J) * 2.0) + U); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U; tmp = 0.0; if ((t_0 <= -Inf) || ~((t_0 <= 4e+33))) tmp = ((((l * l) * 0.3333333333333333) * l) * J) + U; else tmp = ((l * J) * 2.0) + U; end tmp_2 = 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]}, If[Or[LessEqual[t$95$0, (-Infinity)], N[Not[LessEqual[t$95$0, 4e+33]], $MachinePrecision]], N[(N[(N[(N[(N[(l * l), $MachinePrecision] * 0.3333333333333333), $MachinePrecision] * l), $MachinePrecision] * J), $MachinePrecision] + U), $MachinePrecision], N[(N[(N[(l * J), $MachinePrecision] * 2.0), $MachinePrecision] + U), $MachinePrecision]]]
\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\\
\mathbf{if}\;t\_0 \leq -\infty \lor \neg \left(t\_0 \leq 4 \cdot 10^{+33}\right):\\
\;\;\;\;\left(\left(\left(\ell \cdot \ell\right) \cdot 0.3333333333333333\right) \cdot \ell\right) \cdot J + U\\
\mathbf{else}:\\
\;\;\;\;\left(\ell \cdot J\right) \cdot 2 + U\\
\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 3.9999999999999998e33 < (+.f64 (*.f64 (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) (cos.f64 (/.f64 K #s(literal 2 binary64)))) U) Initial program 99.9%
Taylor expanded in J around 0
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
sinh-undefN/A
lower-*.f64N/A
lower-sinh.f64100.0
Applied rewrites100.0%
Taylor expanded in K around 0
sinh-undef-revN/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-sinh.f6480.6
Applied rewrites80.6%
Taylor expanded in l around 0
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6469.6
Applied rewrites69.6%
Taylor expanded in l around inf
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6469.6
Applied rewrites69.6%
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) < 3.9999999999999998e33Initial program 73.9%
Taylor expanded in l around 0
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f6498.5
Applied rewrites98.5%
Taylor expanded in K around 0
*-commutativeN/A
lift-*.f6486.4
Applied rewrites86.4%
Final simplification76.2%
(FPCore (J l K U)
:precision binary64
(if (<= (* J (- (exp l) (exp (- l)))) -5e-39)
(* (* (cos (* 0.5 K)) J) (* 2.0 (sinh l)))
(+
(*
(*
J
(*
(+
(*
(+
(*
(+ (* 0.0003968253968253968 (* l l)) 0.016666666666666666)
(* l l))
0.3333333333333333)
(* l l))
2.0)
l))
(cos (/ K 2.0)))
U)))
double code(double J, double l, double K, double U) {
double tmp;
if ((J * (exp(l) - exp(-l))) <= -5e-39) {
tmp = (cos((0.5 * K)) * J) * (2.0 * sinh(l));
} else {
tmp = ((J * (((((((0.0003968253968253968 * (l * l)) + 0.016666666666666666) * (l * l)) + 0.3333333333333333) * (l * l)) + 2.0) * l)) * cos((K / 2.0))) + U;
}
return tmp;
}
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
real(8) :: tmp
if ((j * (exp(l) - exp(-l))) <= (-5d-39)) then
tmp = (cos((0.5d0 * k)) * j) * (2.0d0 * sinh(l))
else
tmp = ((j * (((((((0.0003968253968253968d0 * (l * l)) + 0.016666666666666666d0) * (l * l)) + 0.3333333333333333d0) * (l * l)) + 2.0d0) * l)) * cos((k / 2.0d0))) + u
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((J * (Math.exp(l) - Math.exp(-l))) <= -5e-39) {
tmp = (Math.cos((0.5 * K)) * J) * (2.0 * Math.sinh(l));
} else {
tmp = ((J * (((((((0.0003968253968253968 * (l * l)) + 0.016666666666666666) * (l * l)) + 0.3333333333333333) * (l * l)) + 2.0) * l)) * Math.cos((K / 2.0))) + U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (J * (math.exp(l) - math.exp(-l))) <= -5e-39: tmp = (math.cos((0.5 * K)) * J) * (2.0 * math.sinh(l)) else: tmp = ((J * (((((((0.0003968253968253968 * (l * l)) + 0.016666666666666666) * (l * l)) + 0.3333333333333333) * (l * l)) + 2.0) * l)) * math.cos((K / 2.0))) + U return tmp
function code(J, l, K, U) tmp = 0.0 if (Float64(J * Float64(exp(l) - exp(Float64(-l)))) <= -5e-39) tmp = Float64(Float64(cos(Float64(0.5 * K)) * J) * Float64(2.0 * sinh(l))); else tmp = Float64(Float64(Float64(J * Float64(Float64(Float64(Float64(Float64(Float64(Float64(0.0003968253968253968 * Float64(l * l)) + 0.016666666666666666) * Float64(l * l)) + 0.3333333333333333) * Float64(l * l)) + 2.0) * l)) * cos(Float64(K / 2.0))) + U); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((J * (exp(l) - exp(-l))) <= -5e-39) tmp = (cos((0.5 * K)) * J) * (2.0 * sinh(l)); else tmp = ((J * (((((((0.0003968253968253968 * (l * l)) + 0.016666666666666666) * (l * l)) + 0.3333333333333333) * (l * l)) + 2.0) * l)) * cos((K / 2.0))) + U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -5e-39], N[(N[(N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision] * J), $MachinePrecision] * N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(J * N[(N[(N[(N[(N[(N[(N[(0.0003968253968253968 * N[(l * l), $MachinePrecision]), $MachinePrecision] + 0.016666666666666666), $MachinePrecision] * N[(l * l), $MachinePrecision]), $MachinePrecision] + 0.3333333333333333), $MachinePrecision] * N[(l * l), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;J \cdot \left(e^{\ell} - e^{-\ell}\right) \leq -5 \cdot 10^{-39}:\\
\;\;\;\;\left(\cos \left(0.5 \cdot K\right) \cdot J\right) \cdot \left(2 \cdot \sinh \ell\right)\\
\mathbf{else}:\\
\;\;\;\;\left(J \cdot \left(\left(\left(\left(0.0003968253968253968 \cdot \left(\ell \cdot \ell\right) + 0.016666666666666666\right) \cdot \left(\ell \cdot \ell\right) + 0.3333333333333333\right) \cdot \left(\ell \cdot \ell\right) + 2\right) \cdot \ell\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U\\
\end{array}
\end{array}
if (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) < -4.9999999999999998e-39Initial program 98.8%
Taylor expanded in J around inf
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
sinh-undefN/A
lower-*.f64N/A
lower-sinh.f64100.0
Applied rewrites100.0%
if -4.9999999999999998e-39 < (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) Initial program 86.4%
Taylor expanded in l around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites98.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 -0.22)
(+ (* (* (cos (* 0.5 K)) J) (* 2.0 l)) U)
(if (<= t_0 -0.005)
(+
(*
(*
(- (* (* 0.016666666666666666 (* (* l l) J)) (* l l)) (* -2.0 J))
l)
(+ (* -0.125 (* K K)) 1.0))
U)
(+ (* (* 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.22) {
tmp = ((cos((0.5 * K)) * J) * (2.0 * l)) + U;
} else if (t_0 <= -0.005) {
tmp = (((((0.016666666666666666 * ((l * l) * J)) * (l * l)) - (-2.0 * J)) * l) * ((-0.125 * (K * K)) + 1.0)) + U;
} else {
tmp = ((2.0 * sinh(l)) * J) + U;
}
return tmp;
}
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
real(8) :: t_0
real(8) :: tmp
t_0 = cos((k / 2.0d0))
if (t_0 <= (-0.22d0)) then
tmp = ((cos((0.5d0 * k)) * j) * (2.0d0 * l)) + u
else if (t_0 <= (-0.005d0)) then
tmp = (((((0.016666666666666666d0 * ((l * l) * j)) * (l * l)) - ((-2.0d0) * j)) * l) * (((-0.125d0) * (k * k)) + 1.0d0)) + u
else
tmp = ((2.0d0 * sinh(l)) * j) + u
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = Math.cos((K / 2.0));
double tmp;
if (t_0 <= -0.22) {
tmp = ((Math.cos((0.5 * K)) * J) * (2.0 * l)) + U;
} else if (t_0 <= -0.005) {
tmp = (((((0.016666666666666666 * ((l * l) * J)) * (l * l)) - (-2.0 * J)) * l) * ((-0.125 * (K * K)) + 1.0)) + U;
} else {
tmp = ((2.0 * Math.sinh(l)) * J) + U;
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) tmp = 0 if t_0 <= -0.22: tmp = ((math.cos((0.5 * K)) * J) * (2.0 * l)) + U elif t_0 <= -0.005: tmp = (((((0.016666666666666666 * ((l * l) * J)) * (l * l)) - (-2.0 * J)) * l) * ((-0.125 * (K * K)) + 1.0)) + U else: tmp = ((2.0 * math.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.22) tmp = Float64(Float64(Float64(cos(Float64(0.5 * K)) * J) * Float64(2.0 * l)) + U); elseif (t_0 <= -0.005) tmp = Float64(Float64(Float64(Float64(Float64(Float64(0.016666666666666666 * Float64(Float64(l * l) * J)) * Float64(l * l)) - Float64(-2.0 * J)) * l) * Float64(Float64(-0.125 * Float64(K * K)) + 1.0)) + U); else tmp = Float64(Float64(Float64(2.0 * sinh(l)) * J) + U); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K / 2.0)); tmp = 0.0; if (t_0 <= -0.22) tmp = ((cos((0.5 * K)) * J) * (2.0 * l)) + U; elseif (t_0 <= -0.005) tmp = (((((0.016666666666666666 * ((l * l) * J)) * (l * l)) - (-2.0 * J)) * l) * ((-0.125 * (K * K)) + 1.0)) + U; else tmp = ((2.0 * sinh(l)) * J) + U; end tmp_2 = 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.22], N[(N[(N[(N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision] * J), $MachinePrecision] * N[(2.0 * l), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], If[LessEqual[t$95$0, -0.005], N[(N[(N[(N[(N[(N[(0.016666666666666666 * N[(N[(l * l), $MachinePrecision] * J), $MachinePrecision]), $MachinePrecision] * N[(l * l), $MachinePrecision]), $MachinePrecision] - N[(-2.0 * J), $MachinePrecision]), $MachinePrecision] * l), $MachinePrecision] * N[(N[(-0.125 * N[(K * K), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(N[(N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision] + U), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t\_0 \leq -0.22:\\
\;\;\;\;\left(\cos \left(0.5 \cdot K\right) \cdot J\right) \cdot \left(2 \cdot \ell\right) + U\\
\mathbf{elif}\;t\_0 \leq -0.005:\\
\;\;\;\;\left(\left(\left(0.016666666666666666 \cdot \left(\left(\ell \cdot \ell\right) \cdot J\right)\right) \cdot \left(\ell \cdot \ell\right) - -2 \cdot J\right) \cdot \ell\right) \cdot \left(-0.125 \cdot \left(K \cdot K\right) + 1\right) + U\\
\mathbf{else}:\\
\;\;\;\;\left(2 \cdot \sinh \ell\right) \cdot J + U\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.220000000000000001Initial program 89.2%
Taylor expanded in J around 0
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
sinh-undefN/A
lower-*.f64N/A
lower-sinh.f64100.0
Applied rewrites100.0%
Taylor expanded in l around 0
Applied rewrites70.8%
if -0.220000000000000001 < (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0050000000000000001Initial program 91.7%
Taylor expanded in l around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites82.7%
Taylor expanded in K around 0
+-commutativeN/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6491.1
Applied rewrites91.1%
Taylor expanded in l around inf
lower-*.f64N/A
*-commutativeN/A
pow2N/A
lift-*.f64N/A
lift-*.f6491.1
Applied rewrites91.1%
Taylor expanded in K around 0
Applied rewrites91.1%
if -0.0050000000000000001 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 89.7%
Taylor expanded in K around 0
*-commutativeN/A
lower-*.f64N/A
sinh-undefN/A
lower-*.f64N/A
lower-sinh.f6497.2
Applied rewrites97.2%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 0.8)
(+ (* (* J (* (+ (* (* l l) 0.3333333333333333) 2.0) l)) t_0) U)
(+ (* (* 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.8) {
tmp = ((J * ((((l * l) * 0.3333333333333333) + 2.0) * l)) * t_0) + U;
} else {
tmp = ((2.0 * sinh(l)) * J) + U;
}
return tmp;
}
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
real(8) :: t_0
real(8) :: tmp
t_0 = cos((k / 2.0d0))
if (t_0 <= 0.8d0) then
tmp = ((j * ((((l * l) * 0.3333333333333333d0) + 2.0d0) * l)) * t_0) + u
else
tmp = ((2.0d0 * sinh(l)) * j) + u
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = Math.cos((K / 2.0));
double tmp;
if (t_0 <= 0.8) {
tmp = ((J * ((((l * l) * 0.3333333333333333) + 2.0) * l)) * t_0) + U;
} else {
tmp = ((2.0 * Math.sinh(l)) * J) + U;
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) tmp = 0 if t_0 <= 0.8: tmp = ((J * ((((l * l) * 0.3333333333333333) + 2.0) * l)) * t_0) + U else: tmp = ((2.0 * math.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.8) tmp = Float64(Float64(Float64(J * Float64(Float64(Float64(Float64(l * l) * 0.3333333333333333) + 2.0) * l)) * t_0) + U); else tmp = Float64(Float64(Float64(2.0 * sinh(l)) * J) + U); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K / 2.0)); tmp = 0.0; if (t_0 <= 0.8) tmp = ((J * ((((l * l) * 0.3333333333333333) + 2.0) * l)) * t_0) + U; else tmp = ((2.0 * sinh(l)) * J) + U; end tmp_2 = 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.8], N[(N[(N[(J * N[(N[(N[(N[(l * l), $MachinePrecision] * 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] + U), $MachinePrecision], N[(N[(N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision] + U), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t\_0 \leq 0.8:\\
\;\;\;\;\left(J \cdot \left(\left(\left(\ell \cdot \ell\right) \cdot 0.3333333333333333 + 2\right) \cdot \ell\right)\right) \cdot t\_0 + U\\
\mathbf{else}:\\
\;\;\;\;\left(2 \cdot \sinh \ell\right) \cdot J + U\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.80000000000000004Initial program 87.6%
Taylor expanded in l around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6487.1
Applied rewrites87.1%
if 0.80000000000000004 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 90.8%
Taylor expanded in K around 0
*-commutativeN/A
lower-*.f64N/A
sinh-undefN/A
lower-*.f64N/A
lower-sinh.f6499.1
Applied rewrites99.1%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.005)
(+
(*
(* (- (* (* 0.016666666666666666 (* (* l l) J)) (* l l)) (* -2.0 J)) l)
(+ (* -0.125 (* K K)) 1.0))
U)
(+ (* (* 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 = (((((0.016666666666666666 * ((l * l) * J)) * (l * l)) - (-2.0 * J)) * l) * ((-0.125 * (K * K)) + 1.0)) + U;
} else {
tmp = ((2.0 * sinh(l)) * J) + U;
}
return tmp;
}
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
real(8) :: tmp
if (cos((k / 2.0d0)) <= (-0.005d0)) then
tmp = (((((0.016666666666666666d0 * ((l * l) * j)) * (l * l)) - ((-2.0d0) * j)) * l) * (((-0.125d0) * (k * k)) + 1.0d0)) + u
else
tmp = ((2.0d0 * sinh(l)) * j) + u
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (Math.cos((K / 2.0)) <= -0.005) {
tmp = (((((0.016666666666666666 * ((l * l) * J)) * (l * l)) - (-2.0 * J)) * l) * ((-0.125 * (K * K)) + 1.0)) + U;
} else {
tmp = ((2.0 * Math.sinh(l)) * J) + U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if math.cos((K / 2.0)) <= -0.005: tmp = (((((0.016666666666666666 * ((l * l) * J)) * (l * l)) - (-2.0 * J)) * l) * ((-0.125 * (K * K)) + 1.0)) + U else: tmp = ((2.0 * math.sinh(l)) * J) + U return tmp
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.005) tmp = Float64(Float64(Float64(Float64(Float64(Float64(0.016666666666666666 * Float64(Float64(l * l) * J)) * Float64(l * l)) - Float64(-2.0 * J)) * l) * Float64(Float64(-0.125 * Float64(K * K)) + 1.0)) + U); else tmp = Float64(Float64(Float64(2.0 * sinh(l)) * J) + U); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (cos((K / 2.0)) <= -0.005) tmp = (((((0.016666666666666666 * ((l * l) * J)) * (l * l)) - (-2.0 * J)) * l) * ((-0.125 * (K * K)) + 1.0)) + U; else tmp = ((2.0 * sinh(l)) * J) + U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.005], N[(N[(N[(N[(N[(N[(0.016666666666666666 * N[(N[(l * l), $MachinePrecision] * J), $MachinePrecision]), $MachinePrecision] * N[(l * l), $MachinePrecision]), $MachinePrecision] - N[(-2.0 * J), $MachinePrecision]), $MachinePrecision] * l), $MachinePrecision] * N[(N[(-0.125 * N[(K * K), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(N[(N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision] + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.005:\\
\;\;\;\;\left(\left(\left(0.016666666666666666 \cdot \left(\left(\ell \cdot \ell\right) \cdot J\right)\right) \cdot \left(\ell \cdot \ell\right) - -2 \cdot J\right) \cdot \ell\right) \cdot \left(-0.125 \cdot \left(K \cdot K\right) + 1\right) + U\\
\mathbf{else}:\\
\;\;\;\;\left(2 \cdot \sinh \ell\right) \cdot J + U\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0050000000000000001Initial program 89.6%
Taylor expanded in l around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites92.0%
Taylor expanded in K around 0
+-commutativeN/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6451.0
Applied rewrites51.0%
Taylor expanded in l around inf
lower-*.f64N/A
*-commutativeN/A
pow2N/A
lift-*.f64N/A
lift-*.f6451.0
Applied rewrites51.0%
Taylor expanded in K around 0
Applied rewrites60.2%
if -0.0050000000000000001 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 89.7%
Taylor expanded in K around 0
*-commutativeN/A
lower-*.f64N/A
sinh-undefN/A
lower-*.f64N/A
lower-sinh.f6497.2
Applied rewrites97.2%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.005)
(+
(*
(* (- (* (* 0.016666666666666666 (* (* l l) J)) (* l l)) (* -2.0 J)) l)
(+ (* -0.125 (* K K)) 1.0))
U)
(+
(*
(*
(+
(*
(+
(* (+ (* 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.005) {
tmp = (((((0.016666666666666666 * ((l * l) * J)) * (l * l)) - (-2.0 * J)) * l) * ((-0.125 * (K * K)) + 1.0)) + U;
} else {
tmp = ((((((((0.0003968253968253968 * (l * l)) + 0.016666666666666666) * (l * l)) + 0.3333333333333333) * (l * l)) + 2.0) * l) * J) + U;
}
return tmp;
}
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
real(8) :: tmp
if (cos((k / 2.0d0)) <= (-0.005d0)) then
tmp = (((((0.016666666666666666d0 * ((l * l) * j)) * (l * l)) - ((-2.0d0) * j)) * l) * (((-0.125d0) * (k * k)) + 1.0d0)) + u
else
tmp = ((((((((0.0003968253968253968d0 * (l * l)) + 0.016666666666666666d0) * (l * l)) + 0.3333333333333333d0) * (l * l)) + 2.0d0) * l) * j) + u
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (Math.cos((K / 2.0)) <= -0.005) {
tmp = (((((0.016666666666666666 * ((l * l) * J)) * (l * l)) - (-2.0 * J)) * l) * ((-0.125 * (K * K)) + 1.0)) + U;
} else {
tmp = ((((((((0.0003968253968253968 * (l * l)) + 0.016666666666666666) * (l * l)) + 0.3333333333333333) * (l * l)) + 2.0) * l) * J) + U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if math.cos((K / 2.0)) <= -0.005: tmp = (((((0.016666666666666666 * ((l * l) * J)) * (l * l)) - (-2.0 * J)) * l) * ((-0.125 * (K * K)) + 1.0)) + U else: tmp = ((((((((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.005) tmp = Float64(Float64(Float64(Float64(Float64(Float64(0.016666666666666666 * Float64(Float64(l * l) * J)) * Float64(l * l)) - Float64(-2.0 * J)) * l) * Float64(Float64(-0.125 * Float64(K * K)) + 1.0)) + U); else tmp = Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(0.0003968253968253968 * Float64(l * l)) + 0.016666666666666666) * Float64(l * l)) + 0.3333333333333333) * Float64(l * l)) + 2.0) * l) * J) + U); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (cos((K / 2.0)) <= -0.005) tmp = (((((0.016666666666666666 * ((l * l) * J)) * (l * l)) - (-2.0 * J)) * l) * ((-0.125 * (K * K)) + 1.0)) + U; else tmp = ((((((((0.0003968253968253968 * (l * l)) + 0.016666666666666666) * (l * l)) + 0.3333333333333333) * (l * l)) + 2.0) * l) * J) + U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.005], N[(N[(N[(N[(N[(N[(0.016666666666666666 * N[(N[(l * l), $MachinePrecision] * J), $MachinePrecision]), $MachinePrecision] * N[(l * l), $MachinePrecision]), $MachinePrecision] - N[(-2.0 * J), $MachinePrecision]), $MachinePrecision] * l), $MachinePrecision] * N[(N[(-0.125 * N[(K * K), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(N[(N[(N[(N[(N[(N[(N[(N[(0.0003968253968253968 * N[(l * l), $MachinePrecision]), $MachinePrecision] + 0.016666666666666666), $MachinePrecision] * N[(l * l), $MachinePrecision]), $MachinePrecision] + 0.3333333333333333), $MachinePrecision] * N[(l * l), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision] * l), $MachinePrecision] * J), $MachinePrecision] + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.005:\\
\;\;\;\;\left(\left(\left(0.016666666666666666 \cdot \left(\left(\ell \cdot \ell\right) \cdot J\right)\right) \cdot \left(\ell \cdot \ell\right) - -2 \cdot J\right) \cdot \ell\right) \cdot \left(-0.125 \cdot \left(K \cdot K\right) + 1\right) + U\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\left(\left(0.0003968253968253968 \cdot \left(\ell \cdot \ell\right) + 0.016666666666666666\right) \cdot \left(\ell \cdot \ell\right) + 0.3333333333333333\right) \cdot \left(\ell \cdot \ell\right) + 2\right) \cdot \ell\right) \cdot J + U\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0050000000000000001Initial program 89.6%
Taylor expanded in l around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites92.0%
Taylor expanded in K around 0
+-commutativeN/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6451.0
Applied rewrites51.0%
Taylor expanded in l around inf
lower-*.f64N/A
*-commutativeN/A
pow2N/A
lift-*.f64N/A
lift-*.f6451.0
Applied rewrites51.0%
Taylor expanded in K around 0
Applied rewrites60.2%
if -0.0050000000000000001 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 89.7%
Taylor expanded in J around 0
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
sinh-undefN/A
lower-*.f64N/A
lower-sinh.f64100.0
Applied rewrites100.0%
Taylor expanded in K around 0
sinh-undef-revN/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-sinh.f6497.2
Applied rewrites97.2%
Taylor expanded in l around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites93.5%
Final simplification85.7%
(FPCore (J l K U)
:precision binary64
(if (<= K 1e-79)
(+ (* (* 2.0 (sinh l)) J) U)
(+
(*
(*
J
(*
(+
(*
(+
(*
(+ (* 0.0003968253968253968 (* l l)) 0.016666666666666666)
(* l l))
0.3333333333333333)
(* l l))
2.0)
l))
(cos (/ K 2.0)))
U)))
double code(double J, double l, double K, double U) {
double tmp;
if (K <= 1e-79) {
tmp = ((2.0 * sinh(l)) * J) + U;
} else {
tmp = ((J * (((((((0.0003968253968253968 * (l * l)) + 0.016666666666666666) * (l * l)) + 0.3333333333333333) * (l * l)) + 2.0) * l)) * cos((K / 2.0))) + U;
}
return tmp;
}
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
real(8) :: tmp
if (k <= 1d-79) then
tmp = ((2.0d0 * sinh(l)) * j) + u
else
tmp = ((j * (((((((0.0003968253968253968d0 * (l * l)) + 0.016666666666666666d0) * (l * l)) + 0.3333333333333333d0) * (l * l)) + 2.0d0) * l)) * cos((k / 2.0d0))) + u
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (K <= 1e-79) {
tmp = ((2.0 * Math.sinh(l)) * J) + U;
} else {
tmp = ((J * (((((((0.0003968253968253968 * (l * l)) + 0.016666666666666666) * (l * l)) + 0.3333333333333333) * (l * l)) + 2.0) * l)) * Math.cos((K / 2.0))) + U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if K <= 1e-79: tmp = ((2.0 * math.sinh(l)) * J) + U else: tmp = ((J * (((((((0.0003968253968253968 * (l * l)) + 0.016666666666666666) * (l * l)) + 0.3333333333333333) * (l * l)) + 2.0) * l)) * math.cos((K / 2.0))) + U return tmp
function code(J, l, K, U) tmp = 0.0 if (K <= 1e-79) tmp = Float64(Float64(Float64(2.0 * sinh(l)) * J) + U); else tmp = Float64(Float64(Float64(J * Float64(Float64(Float64(Float64(Float64(Float64(Float64(0.0003968253968253968 * Float64(l * l)) + 0.016666666666666666) * Float64(l * l)) + 0.3333333333333333) * Float64(l * l)) + 2.0) * l)) * cos(Float64(K / 2.0))) + U); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (K <= 1e-79) tmp = ((2.0 * sinh(l)) * J) + U; else tmp = ((J * (((((((0.0003968253968253968 * (l * l)) + 0.016666666666666666) * (l * l)) + 0.3333333333333333) * (l * l)) + 2.0) * l)) * cos((K / 2.0))) + U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[K, 1e-79], N[(N[(N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision] + U), $MachinePrecision], N[(N[(N[(J * N[(N[(N[(N[(N[(N[(N[(0.0003968253968253968 * N[(l * l), $MachinePrecision]), $MachinePrecision] + 0.016666666666666666), $MachinePrecision] * N[(l * l), $MachinePrecision]), $MachinePrecision] + 0.3333333333333333), $MachinePrecision] * N[(l * l), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;K \leq 10^{-79}:\\
\;\;\;\;\left(2 \cdot \sinh \ell\right) \cdot J + U\\
\mathbf{else}:\\
\;\;\;\;\left(J \cdot \left(\left(\left(\left(0.0003968253968253968 \cdot \left(\ell \cdot \ell\right) + 0.016666666666666666\right) \cdot \left(\ell \cdot \ell\right) + 0.3333333333333333\right) \cdot \left(\ell \cdot \ell\right) + 2\right) \cdot \ell\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U\\
\end{array}
\end{array}
if K < 1e-79Initial program 89.3%
Taylor expanded in K around 0
*-commutativeN/A
lower-*.f64N/A
sinh-undefN/A
lower-*.f64N/A
lower-sinh.f6488.5
Applied rewrites88.5%
if 1e-79 < K Initial program 90.5%
Taylor expanded in l around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites96.7%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.005)
(+
(*
(* (- (* 2.0 J) (* -0.3333333333333333 (* (* l l) J))) l)
(+ (* (* K K) -0.125) 1.0))
U)
(+
(*
(*
(+
(*
(+
(* (+ (* 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.005) {
tmp = ((((2.0 * J) - (-0.3333333333333333 * ((l * l) * J))) * l) * (((K * K) * -0.125) + 1.0)) + U;
} else {
tmp = ((((((((0.0003968253968253968 * (l * l)) + 0.016666666666666666) * (l * l)) + 0.3333333333333333) * (l * l)) + 2.0) * l) * J) + U;
}
return tmp;
}
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
real(8) :: tmp
if (cos((k / 2.0d0)) <= (-0.005d0)) then
tmp = ((((2.0d0 * j) - ((-0.3333333333333333d0) * ((l * l) * j))) * l) * (((k * k) * (-0.125d0)) + 1.0d0)) + u
else
tmp = ((((((((0.0003968253968253968d0 * (l * l)) + 0.016666666666666666d0) * (l * l)) + 0.3333333333333333d0) * (l * l)) + 2.0d0) * l) * j) + u
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (Math.cos((K / 2.0)) <= -0.005) {
tmp = ((((2.0 * J) - (-0.3333333333333333 * ((l * l) * J))) * l) * (((K * K) * -0.125) + 1.0)) + U;
} else {
tmp = ((((((((0.0003968253968253968 * (l * l)) + 0.016666666666666666) * (l * l)) + 0.3333333333333333) * (l * l)) + 2.0) * l) * J) + U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if math.cos((K / 2.0)) <= -0.005: tmp = ((((2.0 * J) - (-0.3333333333333333 * ((l * l) * J))) * l) * (((K * K) * -0.125) + 1.0)) + U else: tmp = ((((((((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.005) tmp = Float64(Float64(Float64(Float64(Float64(2.0 * J) - Float64(-0.3333333333333333 * Float64(Float64(l * l) * J))) * l) * Float64(Float64(Float64(K * K) * -0.125) + 1.0)) + U); else tmp = Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(0.0003968253968253968 * Float64(l * l)) + 0.016666666666666666) * Float64(l * l)) + 0.3333333333333333) * Float64(l * l)) + 2.0) * l) * J) + U); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (cos((K / 2.0)) <= -0.005) tmp = ((((2.0 * J) - (-0.3333333333333333 * ((l * l) * J))) * l) * (((K * K) * -0.125) + 1.0)) + U; else tmp = ((((((((0.0003968253968253968 * (l * l)) + 0.016666666666666666) * (l * l)) + 0.3333333333333333) * (l * l)) + 2.0) * l) * J) + U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.005], N[(N[(N[(N[(N[(2.0 * J), $MachinePrecision] - N[(-0.3333333333333333 * N[(N[(l * l), $MachinePrecision] * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * l), $MachinePrecision] * N[(N[(N[(K * K), $MachinePrecision] * -0.125), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(N[(N[(N[(N[(N[(N[(N[(N[(0.0003968253968253968 * N[(l * l), $MachinePrecision]), $MachinePrecision] + 0.016666666666666666), $MachinePrecision] * N[(l * l), $MachinePrecision]), $MachinePrecision] + 0.3333333333333333), $MachinePrecision] * N[(l * l), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision] * l), $MachinePrecision] * J), $MachinePrecision] + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.005:\\
\;\;\;\;\left(\left(2 \cdot J - -0.3333333333333333 \cdot \left(\left(\ell \cdot \ell\right) \cdot J\right)\right) \cdot \ell\right) \cdot \left(\left(K \cdot K\right) \cdot -0.125 + 1\right) + U\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\left(\left(0.0003968253968253968 \cdot \left(\ell \cdot \ell\right) + 0.016666666666666666\right) \cdot \left(\ell \cdot \ell\right) + 0.3333333333333333\right) \cdot \left(\ell \cdot \ell\right) + 2\right) \cdot \ell\right) \cdot J + U\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0050000000000000001Initial program 89.6%
Taylor expanded in l around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f64N/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6481.0
Applied rewrites81.0%
Taylor expanded in K around 0
+-commutativeN/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6457.2
Applied rewrites57.2%
if -0.0050000000000000001 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 89.7%
Taylor expanded in J around 0
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
sinh-undefN/A
lower-*.f64N/A
lower-sinh.f64100.0
Applied rewrites100.0%
Taylor expanded in K around 0
sinh-undef-revN/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-sinh.f6497.2
Applied rewrites97.2%
Taylor expanded in l around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites93.5%
Final simplification85.0%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.005)
(+
(*
(* (- (* 2.0 J) (* -0.3333333333333333 (* (* l l) J))) l)
(+ (* (* K K) -0.125) 1.0))
U)
(+
(*
(*
(+
(*
(+ (* (* (* l l) 0.0003968253968253968) (* 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.005) {
tmp = ((((2.0 * J) - (-0.3333333333333333 * ((l * l) * J))) * l) * (((K * K) * -0.125) + 1.0)) + U;
} else {
tmp = ((((((((l * l) * 0.0003968253968253968) * (l * l)) + 0.3333333333333333) * (l * l)) + 2.0) * l) * J) + U;
}
return tmp;
}
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
real(8) :: tmp
if (cos((k / 2.0d0)) <= (-0.005d0)) then
tmp = ((((2.0d0 * j) - ((-0.3333333333333333d0) * ((l * l) * j))) * l) * (((k * k) * (-0.125d0)) + 1.0d0)) + u
else
tmp = ((((((((l * l) * 0.0003968253968253968d0) * (l * l)) + 0.3333333333333333d0) * (l * l)) + 2.0d0) * l) * j) + u
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (Math.cos((K / 2.0)) <= -0.005) {
tmp = ((((2.0 * J) - (-0.3333333333333333 * ((l * l) * J))) * l) * (((K * K) * -0.125) + 1.0)) + U;
} else {
tmp = ((((((((l * l) * 0.0003968253968253968) * (l * l)) + 0.3333333333333333) * (l * l)) + 2.0) * l) * J) + U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if math.cos((K / 2.0)) <= -0.005: tmp = ((((2.0 * J) - (-0.3333333333333333 * ((l * l) * J))) * l) * (((K * K) * -0.125) + 1.0)) + U else: tmp = ((((((((l * l) * 0.0003968253968253968) * (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.005) tmp = Float64(Float64(Float64(Float64(Float64(2.0 * J) - Float64(-0.3333333333333333 * Float64(Float64(l * l) * J))) * l) * Float64(Float64(Float64(K * K) * -0.125) + 1.0)) + U); else tmp = Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(l * l) * 0.0003968253968253968) * Float64(l * l)) + 0.3333333333333333) * Float64(l * l)) + 2.0) * l) * J) + U); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (cos((K / 2.0)) <= -0.005) tmp = ((((2.0 * J) - (-0.3333333333333333 * ((l * l) * J))) * l) * (((K * K) * -0.125) + 1.0)) + U; else tmp = ((((((((l * l) * 0.0003968253968253968) * (l * l)) + 0.3333333333333333) * (l * l)) + 2.0) * l) * J) + U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.005], N[(N[(N[(N[(N[(2.0 * J), $MachinePrecision] - N[(-0.3333333333333333 * N[(N[(l * l), $MachinePrecision] * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * l), $MachinePrecision] * N[(N[(N[(K * K), $MachinePrecision] * -0.125), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(N[(N[(N[(N[(N[(N[(N[(N[(l * l), $MachinePrecision] * 0.0003968253968253968), $MachinePrecision] * N[(l * l), $MachinePrecision]), $MachinePrecision] + 0.3333333333333333), $MachinePrecision] * N[(l * l), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision] * l), $MachinePrecision] * J), $MachinePrecision] + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.005:\\
\;\;\;\;\left(\left(2 \cdot J - -0.3333333333333333 \cdot \left(\left(\ell \cdot \ell\right) \cdot J\right)\right) \cdot \ell\right) \cdot \left(\left(K \cdot K\right) \cdot -0.125 + 1\right) + U\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\left(\left(\left(\ell \cdot \ell\right) \cdot 0.0003968253968253968\right) \cdot \left(\ell \cdot \ell\right) + 0.3333333333333333\right) \cdot \left(\ell \cdot \ell\right) + 2\right) \cdot \ell\right) \cdot J + U\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0050000000000000001Initial program 89.6%
Taylor expanded in l around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f64N/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6481.0
Applied rewrites81.0%
Taylor expanded in K around 0
+-commutativeN/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6457.2
Applied rewrites57.2%
if -0.0050000000000000001 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 89.7%
Taylor expanded in J around 0
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
sinh-undefN/A
lower-*.f64N/A
lower-sinh.f64100.0
Applied rewrites100.0%
Taylor expanded in K around 0
sinh-undef-revN/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-sinh.f6497.2
Applied rewrites97.2%
Taylor expanded in l around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites93.5%
Taylor expanded in l around inf
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6493.2
Applied rewrites93.2%
Final simplification84.8%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.746)
(+ (* (* (* l J) (+ (* (* K K) -0.125) 1.0)) 2.0) U)
(+
(*
(*
(+
(*
(+ (* (* (* l l) 0.0003968253968253968) (* 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.746) {
tmp = (((l * J) * (((K * K) * -0.125) + 1.0)) * 2.0) + U;
} else {
tmp = ((((((((l * l) * 0.0003968253968253968) * (l * l)) + 0.3333333333333333) * (l * l)) + 2.0) * l) * J) + U;
}
return tmp;
}
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
real(8) :: tmp
if (cos((k / 2.0d0)) <= (-0.746d0)) then
tmp = (((l * j) * (((k * k) * (-0.125d0)) + 1.0d0)) * 2.0d0) + u
else
tmp = ((((((((l * l) * 0.0003968253968253968d0) * (l * l)) + 0.3333333333333333d0) * (l * l)) + 2.0d0) * l) * j) + u
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (Math.cos((K / 2.0)) <= -0.746) {
tmp = (((l * J) * (((K * K) * -0.125) + 1.0)) * 2.0) + U;
} else {
tmp = ((((((((l * l) * 0.0003968253968253968) * (l * l)) + 0.3333333333333333) * (l * l)) + 2.0) * l) * J) + U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if math.cos((K / 2.0)) <= -0.746: tmp = (((l * J) * (((K * K) * -0.125) + 1.0)) * 2.0) + U else: tmp = ((((((((l * l) * 0.0003968253968253968) * (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.746) tmp = Float64(Float64(Float64(Float64(l * J) * Float64(Float64(Float64(K * K) * -0.125) + 1.0)) * 2.0) + U); else tmp = Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(l * l) * 0.0003968253968253968) * Float64(l * l)) + 0.3333333333333333) * Float64(l * l)) + 2.0) * l) * J) + U); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (cos((K / 2.0)) <= -0.746) tmp = (((l * J) * (((K * K) * -0.125) + 1.0)) * 2.0) + U; else tmp = ((((((((l * l) * 0.0003968253968253968) * (l * l)) + 0.3333333333333333) * (l * l)) + 2.0) * l) * J) + U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.746], N[(N[(N[(N[(l * J), $MachinePrecision] * N[(N[(N[(K * K), $MachinePrecision] * -0.125), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision] + U), $MachinePrecision], N[(N[(N[(N[(N[(N[(N[(N[(N[(l * l), $MachinePrecision] * 0.0003968253968253968), $MachinePrecision] * N[(l * l), $MachinePrecision]), $MachinePrecision] + 0.3333333333333333), $MachinePrecision] * N[(l * l), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision] * l), $MachinePrecision] * J), $MachinePrecision] + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.746:\\
\;\;\;\;\left(\left(\ell \cdot J\right) \cdot \left(\left(K \cdot K\right) \cdot -0.125 + 1\right)\right) \cdot 2 + U\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\left(\left(\left(\ell \cdot \ell\right) \cdot 0.0003968253968253968\right) \cdot \left(\ell \cdot \ell\right) + 0.3333333333333333\right) \cdot \left(\ell \cdot \ell\right) + 2\right) \cdot \ell\right) \cdot J + U\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.746Initial program 88.5%
Taylor expanded in l around 0
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f6467.3
Applied rewrites67.3%
Taylor expanded in K around 0
+-commutativeN/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6455.2
Applied rewrites55.2%
if -0.746 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 89.8%
Taylor expanded in J around 0
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
sinh-undefN/A
lower-*.f64N/A
lower-sinh.f64100.0
Applied rewrites100.0%
Taylor expanded in K around 0
sinh-undef-revN/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-sinh.f6489.2
Applied rewrites89.2%
Taylor expanded in l around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites86.0%
Taylor expanded in l around inf
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6485.8
Applied rewrites85.8%
Final simplification82.3%
(FPCore (J l K U)
:precision binary64
(if (<= K 2e+20)
(+ (* (* (+ (* (* K K) -0.125) 1.0) J) (* 2.0 (sinh l))) U)
(+
(*
(*
J
(*
(+
(* (+ (* 0.016666666666666666 (* l l)) 0.3333333333333333) (* l l))
2.0)
l))
(cos (/ K 2.0)))
U)))
double code(double J, double l, double K, double U) {
double tmp;
if (K <= 2e+20) {
tmp = (((((K * K) * -0.125) + 1.0) * J) * (2.0 * sinh(l))) + U;
} else {
tmp = ((J * (((((0.016666666666666666 * (l * l)) + 0.3333333333333333) * (l * l)) + 2.0) * l)) * cos((K / 2.0))) + U;
}
return tmp;
}
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
real(8) :: tmp
if (k <= 2d+20) then
tmp = (((((k * k) * (-0.125d0)) + 1.0d0) * j) * (2.0d0 * sinh(l))) + u
else
tmp = ((j * (((((0.016666666666666666d0 * (l * l)) + 0.3333333333333333d0) * (l * l)) + 2.0d0) * l)) * cos((k / 2.0d0))) + u
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (K <= 2e+20) {
tmp = (((((K * K) * -0.125) + 1.0) * J) * (2.0 * Math.sinh(l))) + U;
} else {
tmp = ((J * (((((0.016666666666666666 * (l * l)) + 0.3333333333333333) * (l * l)) + 2.0) * l)) * Math.cos((K / 2.0))) + U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if K <= 2e+20: tmp = (((((K * K) * -0.125) + 1.0) * J) * (2.0 * math.sinh(l))) + U else: tmp = ((J * (((((0.016666666666666666 * (l * l)) + 0.3333333333333333) * (l * l)) + 2.0) * l)) * math.cos((K / 2.0))) + U return tmp
function code(J, l, K, U) tmp = 0.0 if (K <= 2e+20) tmp = Float64(Float64(Float64(Float64(Float64(Float64(K * K) * -0.125) + 1.0) * J) * Float64(2.0 * sinh(l))) + U); else tmp = Float64(Float64(Float64(J * Float64(Float64(Float64(Float64(Float64(0.016666666666666666 * Float64(l * l)) + 0.3333333333333333) * Float64(l * l)) + 2.0) * l)) * cos(Float64(K / 2.0))) + U); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (K <= 2e+20) tmp = (((((K * K) * -0.125) + 1.0) * J) * (2.0 * sinh(l))) + U; else tmp = ((J * (((((0.016666666666666666 * (l * l)) + 0.3333333333333333) * (l * l)) + 2.0) * l)) * cos((K / 2.0))) + U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[K, 2e+20], N[(N[(N[(N[(N[(N[(K * K), $MachinePrecision] * -0.125), $MachinePrecision] + 1.0), $MachinePrecision] * J), $MachinePrecision] * N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(N[(N[(J * N[(N[(N[(N[(N[(0.016666666666666666 * N[(l * l), $MachinePrecision]), $MachinePrecision] + 0.3333333333333333), $MachinePrecision] * N[(l * l), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;K \leq 2 \cdot 10^{+20}:\\
\;\;\;\;\left(\left(\left(K \cdot K\right) \cdot -0.125 + 1\right) \cdot J\right) \cdot \left(2 \cdot \sinh \ell\right) + U\\
\mathbf{else}:\\
\;\;\;\;\left(J \cdot \left(\left(\left(0.016666666666666666 \cdot \left(\ell \cdot \ell\right) + 0.3333333333333333\right) \cdot \left(\ell \cdot \ell\right) + 2\right) \cdot \ell\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U\\
\end{array}
\end{array}
if K < 2e20Initial program 90.7%
Taylor expanded in J around 0
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
sinh-undefN/A
lower-*.f64N/A
lower-sinh.f64100.0
Applied rewrites100.0%
Taylor expanded in K around 0
+-commutativeN/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6487.6
Applied rewrites87.6%
if 2e20 < K Initial program 86.4%
Taylor expanded in l around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6492.2
Applied rewrites92.2%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.746)
(+ (* (* (* l J) (+ (* (* K K) -0.125) 1.0)) 2.0) U)
(+
(*
(*
(+
(* (- 0.3333333333333333 (* (* l l) -0.016666666666666666)) (* 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.746) {
tmp = (((l * J) * (((K * K) * -0.125) + 1.0)) * 2.0) + U;
} else {
tmp = (((((0.3333333333333333 - ((l * l) * -0.016666666666666666)) * (l * l)) + 2.0) * l) * J) + U;
}
return tmp;
}
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
real(8) :: tmp
if (cos((k / 2.0d0)) <= (-0.746d0)) then
tmp = (((l * j) * (((k * k) * (-0.125d0)) + 1.0d0)) * 2.0d0) + u
else
tmp = (((((0.3333333333333333d0 - ((l * l) * (-0.016666666666666666d0))) * (l * l)) + 2.0d0) * l) * j) + u
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (Math.cos((K / 2.0)) <= -0.746) {
tmp = (((l * J) * (((K * K) * -0.125) + 1.0)) * 2.0) + U;
} else {
tmp = (((((0.3333333333333333 - ((l * l) * -0.016666666666666666)) * (l * l)) + 2.0) * l) * J) + U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if math.cos((K / 2.0)) <= -0.746: tmp = (((l * J) * (((K * K) * -0.125) + 1.0)) * 2.0) + U else: tmp = (((((0.3333333333333333 - ((l * l) * -0.016666666666666666)) * (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.746) tmp = Float64(Float64(Float64(Float64(l * J) * Float64(Float64(Float64(K * K) * -0.125) + 1.0)) * 2.0) + U); else tmp = Float64(Float64(Float64(Float64(Float64(Float64(0.3333333333333333 - Float64(Float64(l * l) * -0.016666666666666666)) * Float64(l * l)) + 2.0) * l) * J) + U); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (cos((K / 2.0)) <= -0.746) tmp = (((l * J) * (((K * K) * -0.125) + 1.0)) * 2.0) + U; else tmp = (((((0.3333333333333333 - ((l * l) * -0.016666666666666666)) * (l * l)) + 2.0) * l) * J) + U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.746], N[(N[(N[(N[(l * J), $MachinePrecision] * N[(N[(N[(K * K), $MachinePrecision] * -0.125), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision] + U), $MachinePrecision], N[(N[(N[(N[(N[(N[(0.3333333333333333 - N[(N[(l * l), $MachinePrecision] * -0.016666666666666666), $MachinePrecision]), $MachinePrecision] * N[(l * l), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision] * l), $MachinePrecision] * J), $MachinePrecision] + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.746:\\
\;\;\;\;\left(\left(\ell \cdot J\right) \cdot \left(\left(K \cdot K\right) \cdot -0.125 + 1\right)\right) \cdot 2 + U\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\left(0.3333333333333333 - \left(\ell \cdot \ell\right) \cdot -0.016666666666666666\right) \cdot \left(\ell \cdot \ell\right) + 2\right) \cdot \ell\right) \cdot J + U\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.746Initial program 88.5%
Taylor expanded in l around 0
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f6467.3
Applied rewrites67.3%
Taylor expanded in K around 0
+-commutativeN/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6455.2
Applied rewrites55.2%
if -0.746 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 89.8%
Taylor expanded in J around 0
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
sinh-undefN/A
lower-*.f64N/A
lower-sinh.f64100.0
Applied rewrites100.0%
Taylor expanded in K around 0
sinh-undef-revN/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-sinh.f6489.2
Applied rewrites89.2%
Taylor expanded in l around 0
*-commutativeN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
lower-*.f64N/A
Applied rewrites84.7%
Final simplification81.3%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.746) (+ (* (* (* l J) (+ (* (* K K) -0.125) 1.0)) 2.0) U) (+ (* (* (- 2.0 (* l (* l -0.3333333333333333))) l) J) U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.746) {
tmp = (((l * J) * (((K * K) * -0.125) + 1.0)) * 2.0) + U;
} else {
tmp = (((2.0 - (l * (l * -0.3333333333333333))) * l) * J) + U;
}
return tmp;
}
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
real(8) :: tmp
if (cos((k / 2.0d0)) <= (-0.746d0)) then
tmp = (((l * j) * (((k * k) * (-0.125d0)) + 1.0d0)) * 2.0d0) + u
else
tmp = (((2.0d0 - (l * (l * (-0.3333333333333333d0)))) * l) * j) + u
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (Math.cos((K / 2.0)) <= -0.746) {
tmp = (((l * J) * (((K * K) * -0.125) + 1.0)) * 2.0) + U;
} else {
tmp = (((2.0 - (l * (l * -0.3333333333333333))) * l) * J) + U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if math.cos((K / 2.0)) <= -0.746: tmp = (((l * J) * (((K * K) * -0.125) + 1.0)) * 2.0) + U else: tmp = (((2.0 - (l * (l * -0.3333333333333333))) * l) * J) + U return tmp
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.746) tmp = Float64(Float64(Float64(Float64(l * J) * Float64(Float64(Float64(K * K) * -0.125) + 1.0)) * 2.0) + U); else tmp = Float64(Float64(Float64(Float64(2.0 - Float64(l * Float64(l * -0.3333333333333333))) * l) * J) + U); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (cos((K / 2.0)) <= -0.746) tmp = (((l * J) * (((K * K) * -0.125) + 1.0)) * 2.0) + U; else tmp = (((2.0 - (l * (l * -0.3333333333333333))) * l) * J) + U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.746], N[(N[(N[(N[(l * J), $MachinePrecision] * N[(N[(N[(K * K), $MachinePrecision] * -0.125), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision] + U), $MachinePrecision], N[(N[(N[(N[(2.0 - N[(l * N[(l * -0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * l), $MachinePrecision] * J), $MachinePrecision] + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.746:\\
\;\;\;\;\left(\left(\ell \cdot J\right) \cdot \left(\left(K \cdot K\right) \cdot -0.125 + 1\right)\right) \cdot 2 + U\\
\mathbf{else}:\\
\;\;\;\;\left(\left(2 - \ell \cdot \left(\ell \cdot -0.3333333333333333\right)\right) \cdot \ell\right) \cdot J + U\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.746Initial program 88.5%
Taylor expanded in l around 0
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f6467.3
Applied rewrites67.3%
Taylor expanded in K around 0
+-commutativeN/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6455.2
Applied rewrites55.2%
if -0.746 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 89.8%
Taylor expanded in J around 0
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
sinh-undefN/A
lower-*.f64N/A
lower-sinh.f64100.0
Applied rewrites100.0%
Taylor expanded in K around 0
sinh-undef-revN/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-sinh.f6489.2
Applied rewrites89.2%
Taylor expanded in l around 0
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6481.2
Applied rewrites81.2%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6481.2
Applied rewrites81.2%
Final simplification78.2%
(FPCore (J l K U) :precision binary64 (+ (* (* (- 2.0 (* l (* l -0.3333333333333333))) l) J) U))
double code(double J, double l, double K, double U) {
return (((2.0 - (l * (l * -0.3333333333333333))) * l) * J) + 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 = (((2.0d0 - (l * (l * (-0.3333333333333333d0)))) * l) * j) + u
end function
public static double code(double J, double l, double K, double U) {
return (((2.0 - (l * (l * -0.3333333333333333))) * l) * J) + U;
}
def code(J, l, K, U): return (((2.0 - (l * (l * -0.3333333333333333))) * l) * J) + U
function code(J, l, K, U) return Float64(Float64(Float64(Float64(2.0 - Float64(l * Float64(l * -0.3333333333333333))) * l) * J) + U) end
function tmp = code(J, l, K, U) tmp = (((2.0 - (l * (l * -0.3333333333333333))) * l) * J) + U; end
code[J_, l_, K_, U_] := N[(N[(N[(N[(2.0 - N[(l * N[(l * -0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * l), $MachinePrecision] * J), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(2 - \ell \cdot \left(\ell \cdot -0.3333333333333333\right)\right) \cdot \ell\right) \cdot J + U
\end{array}
Initial program 89.7%
Taylor expanded in J around 0
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
sinh-undefN/A
lower-*.f64N/A
lower-sinh.f64100.0
Applied rewrites100.0%
Taylor expanded in K around 0
sinh-undef-revN/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-sinh.f6483.4
Applied rewrites83.4%
Taylor expanded in l around 0
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6476.3
Applied rewrites76.3%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6476.3
Applied rewrites76.3%
Final simplification76.3%
(FPCore (J l K U) :precision binary64 (+ (* (* l J) 2.0) U))
double code(double J, double l, double K, double U) {
return ((l * J) * 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 = ((l * j) * 2.0d0) + u
end function
public static double code(double J, double l, double K, double U) {
return ((l * J) * 2.0) + U;
}
def code(J, l, K, U): return ((l * J) * 2.0) + U
function code(J, l, K, U) return Float64(Float64(Float64(l * J) * 2.0) + U) end
function tmp = code(J, l, K, U) tmp = ((l * J) * 2.0) + U; end
code[J_, l_, K_, U_] := N[(N[(N[(l * J), $MachinePrecision] * 2.0), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\left(\ell \cdot J\right) \cdot 2 + U
\end{array}
Initial program 89.7%
Taylor expanded in l around 0
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f6465.0
Applied rewrites65.0%
Taylor expanded in K around 0
*-commutativeN/A
lift-*.f6457.1
Applied rewrites57.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 89.7%
Taylor expanded in J around 0
Applied rewrites41.2%
herbie shell --seed 2025065
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))