
(FPCore (x c s) :precision binary64 (/ (cos (* 2.0 x)) (* (pow c 2.0) (* (* x (pow s 2.0)) x))))
double code(double x, double c, double s) {
return cos((2.0 * x)) / (pow(c, 2.0) * ((x * pow(s, 2.0)) * x));
}
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(x, c, s)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
code = cos((2.0d0 * x)) / ((c ** 2.0d0) * ((x * (s ** 2.0d0)) * x))
end function
public static double code(double x, double c, double s) {
return Math.cos((2.0 * x)) / (Math.pow(c, 2.0) * ((x * Math.pow(s, 2.0)) * x));
}
def code(x, c, s): return math.cos((2.0 * x)) / (math.pow(c, 2.0) * ((x * math.pow(s, 2.0)) * x))
function code(x, c, s) return Float64(cos(Float64(2.0 * x)) / Float64((c ^ 2.0) * Float64(Float64(x * (s ^ 2.0)) * x))) end
function tmp = code(x, c, s) tmp = cos((2.0 * x)) / ((c ^ 2.0) * ((x * (s ^ 2.0)) * x)); end
code[x_, c_, s_] := N[(N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision] / N[(N[Power[c, 2.0], $MachinePrecision] * N[(N[(x * N[Power[s, 2.0], $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)}
\end{array}
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x c s) :precision binary64 (/ (cos (* 2.0 x)) (* (pow c 2.0) (* (* x (pow s 2.0)) x))))
double code(double x, double c, double s) {
return cos((2.0 * x)) / (pow(c, 2.0) * ((x * pow(s, 2.0)) * x));
}
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(x, c, s)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
code = cos((2.0d0 * x)) / ((c ** 2.0d0) * ((x * (s ** 2.0d0)) * x))
end function
public static double code(double x, double c, double s) {
return Math.cos((2.0 * x)) / (Math.pow(c, 2.0) * ((x * Math.pow(s, 2.0)) * x));
}
def code(x, c, s): return math.cos((2.0 * x)) / (math.pow(c, 2.0) * ((x * math.pow(s, 2.0)) * x))
function code(x, c, s) return Float64(cos(Float64(2.0 * x)) / Float64((c ^ 2.0) * Float64(Float64(x * (s ^ 2.0)) * x))) end
function tmp = code(x, c, s) tmp = cos((2.0 * x)) / ((c ^ 2.0) * ((x * (s ^ 2.0)) * x)); end
code[x_, c_, s_] := N[(N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision] / N[(N[Power[c, 2.0], $MachinePrecision] * N[(N[(x * N[Power[s, 2.0], $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)}
\end{array}
(FPCore (x c s) :precision binary64 (/ (cos (* 2.0 x)) (pow (* (* s c) x) 2.0)))
double code(double x, double c, double s) {
return cos((2.0 * x)) / pow(((s * c) * x), 2.0);
}
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(x, c, s)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
code = cos((2.0d0 * x)) / (((s * c) * x) ** 2.0d0)
end function
public static double code(double x, double c, double s) {
return Math.cos((2.0 * x)) / Math.pow(((s * c) * x), 2.0);
}
def code(x, c, s): return math.cos((2.0 * x)) / math.pow(((s * c) * x), 2.0)
function code(x, c, s) return Float64(cos(Float64(2.0 * x)) / (Float64(Float64(s * c) * x) ^ 2.0)) end
function tmp = code(x, c, s) tmp = cos((2.0 * x)) / (((s * c) * x) ^ 2.0); end
code[x_, c_, s_] := N[(N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision] / N[Power[N[(N[(s * c), $MachinePrecision] * x), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\cos \left(2 \cdot x\right)}{{\left(\left(s \cdot c\right) \cdot x\right)}^{2}}
\end{array}
Initial program 66.5%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lift-pow.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6477.8
Applied rewrites77.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
pow2N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-*.f64N/A
associate-*l*N/A
Applied rewrites96.7%
(FPCore (x c s)
:precision binary64
(let* ((t_0 (cos (+ x x))))
(if (<= x 4.8)
(/ t_0 (* (* c (* c (* s x))) (* s x)))
(/ (/ t_0 (* (* (* c s) s) (* c x))) x))))
double code(double x, double c, double s) {
double t_0 = cos((x + x));
double tmp;
if (x <= 4.8) {
tmp = t_0 / ((c * (c * (s * x))) * (s * x));
} else {
tmp = (t_0 / (((c * s) * s) * (c * x))) / x;
}
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(x, c, s)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
real(8) :: t_0
real(8) :: tmp
t_0 = cos((x + x))
if (x <= 4.8d0) then
tmp = t_0 / ((c * (c * (s * x))) * (s * x))
else
tmp = (t_0 / (((c * s) * s) * (c * x))) / x
end if
code = tmp
end function
public static double code(double x, double c, double s) {
double t_0 = Math.cos((x + x));
double tmp;
if (x <= 4.8) {
tmp = t_0 / ((c * (c * (s * x))) * (s * x));
} else {
tmp = (t_0 / (((c * s) * s) * (c * x))) / x;
}
return tmp;
}
def code(x, c, s): t_0 = math.cos((x + x)) tmp = 0 if x <= 4.8: tmp = t_0 / ((c * (c * (s * x))) * (s * x)) else: tmp = (t_0 / (((c * s) * s) * (c * x))) / x return tmp
function code(x, c, s) t_0 = cos(Float64(x + x)) tmp = 0.0 if (x <= 4.8) tmp = Float64(t_0 / Float64(Float64(c * Float64(c * Float64(s * x))) * Float64(s * x))); else tmp = Float64(Float64(t_0 / Float64(Float64(Float64(c * s) * s) * Float64(c * x))) / x); end return tmp end
function tmp_2 = code(x, c, s) t_0 = cos((x + x)); tmp = 0.0; if (x <= 4.8) tmp = t_0 / ((c * (c * (s * x))) * (s * x)); else tmp = (t_0 / (((c * s) * s) * (c * x))) / x; end tmp_2 = tmp; end
code[x_, c_, s_] := Block[{t$95$0 = N[Cos[N[(x + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, 4.8], N[(t$95$0 / N[(N[(c * N[(c * N[(s * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(s * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 / N[(N[(N[(c * s), $MachinePrecision] * s), $MachinePrecision] * N[(c * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(x + x\right)\\
\mathbf{if}\;x \leq 4.8:\\
\;\;\;\;\frac{t\_0}{\left(c \cdot \left(c \cdot \left(s \cdot x\right)\right)\right) \cdot \left(s \cdot x\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{t\_0}{\left(\left(c \cdot s\right) \cdot s\right) \cdot \left(c \cdot x\right)}}{x}\\
\end{array}
\end{array}
if x < 4.79999999999999982Initial program 66.5%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lift-pow.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6477.8
Applied rewrites77.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6492.5
Applied rewrites92.5%
lift-*.f64N/A
count-2-revN/A
lower-+.f6492.5
Applied rewrites92.5%
if 4.79999999999999982 < x Initial program 66.5%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lift-pow.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6477.8
Applied rewrites77.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
pow2N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-*.f64N/A
associate-*l*N/A
Applied rewrites96.7%
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
pow-prod-downN/A
pow2N/A
pow2N/A
lift-*.f64N/A
associate-*r*N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites85.7%
(FPCore (x c s)
:precision binary64
(let* ((t_0 (cos (+ x x))))
(if (<= c 2.5e-195)
(/ t_0 (* (* (* (* s c) x) x) (* s c)))
(/ t_0 (* (* c (* c (* s x))) (* s x))))))
double code(double x, double c, double s) {
double t_0 = cos((x + x));
double tmp;
if (c <= 2.5e-195) {
tmp = t_0 / ((((s * c) * x) * x) * (s * c));
} else {
tmp = t_0 / ((c * (c * (s * x))) * (s * x));
}
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(x, c, s)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
real(8) :: t_0
real(8) :: tmp
t_0 = cos((x + x))
if (c <= 2.5d-195) then
tmp = t_0 / ((((s * c) * x) * x) * (s * c))
else
tmp = t_0 / ((c * (c * (s * x))) * (s * x))
end if
code = tmp
end function
public static double code(double x, double c, double s) {
double t_0 = Math.cos((x + x));
double tmp;
if (c <= 2.5e-195) {
tmp = t_0 / ((((s * c) * x) * x) * (s * c));
} else {
tmp = t_0 / ((c * (c * (s * x))) * (s * x));
}
return tmp;
}
def code(x, c, s): t_0 = math.cos((x + x)) tmp = 0 if c <= 2.5e-195: tmp = t_0 / ((((s * c) * x) * x) * (s * c)) else: tmp = t_0 / ((c * (c * (s * x))) * (s * x)) return tmp
function code(x, c, s) t_0 = cos(Float64(x + x)) tmp = 0.0 if (c <= 2.5e-195) tmp = Float64(t_0 / Float64(Float64(Float64(Float64(s * c) * x) * x) * Float64(s * c))); else tmp = Float64(t_0 / Float64(Float64(c * Float64(c * Float64(s * x))) * Float64(s * x))); end return tmp end
function tmp_2 = code(x, c, s) t_0 = cos((x + x)); tmp = 0.0; if (c <= 2.5e-195) tmp = t_0 / ((((s * c) * x) * x) * (s * c)); else tmp = t_0 / ((c * (c * (s * x))) * (s * x)); end tmp_2 = tmp; end
code[x_, c_, s_] := Block[{t$95$0 = N[Cos[N[(x + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[c, 2.5e-195], N[(t$95$0 / N[(N[(N[(N[(s * c), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision] * N[(s * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 / N[(N[(c * N[(c * N[(s * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(s * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(x + x\right)\\
\mathbf{if}\;c \leq 2.5 \cdot 10^{-195}:\\
\;\;\;\;\frac{t\_0}{\left(\left(\left(s \cdot c\right) \cdot x\right) \cdot x\right) \cdot \left(s \cdot c\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0}{\left(c \cdot \left(c \cdot \left(s \cdot x\right)\right)\right) \cdot \left(s \cdot x\right)}\\
\end{array}
\end{array}
if c < 2.50000000000000004e-195Initial program 66.5%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lift-pow.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6477.8
Applied rewrites77.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6492.5
Applied rewrites92.5%
lift-*.f64N/A
count-2-revN/A
lower-+.f6492.5
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6492.8
Applied rewrites92.8%
if 2.50000000000000004e-195 < c Initial program 66.5%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lift-pow.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6477.8
Applied rewrites77.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6492.5
Applied rewrites92.5%
lift-*.f64N/A
count-2-revN/A
lower-+.f6492.5
Applied rewrites92.5%
(FPCore (x c s) :precision binary64 (/ (cos (+ x x)) (* (* c (* c (* s x))) (* s x))))
double code(double x, double c, double s) {
return cos((x + x)) / ((c * (c * (s * x))) * (s * x));
}
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(x, c, s)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
code = cos((x + x)) / ((c * (c * (s * x))) * (s * x))
end function
public static double code(double x, double c, double s) {
return Math.cos((x + x)) / ((c * (c * (s * x))) * (s * x));
}
def code(x, c, s): return math.cos((x + x)) / ((c * (c * (s * x))) * (s * x))
function code(x, c, s) return Float64(cos(Float64(x + x)) / Float64(Float64(c * Float64(c * Float64(s * x))) * Float64(s * x))) end
function tmp = code(x, c, s) tmp = cos((x + x)) / ((c * (c * (s * x))) * (s * x)); end
code[x_, c_, s_] := N[(N[Cos[N[(x + x), $MachinePrecision]], $MachinePrecision] / N[(N[(c * N[(c * N[(s * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(s * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\cos \left(x + x\right)}{\left(c \cdot \left(c \cdot \left(s \cdot x\right)\right)\right) \cdot \left(s \cdot x\right)}
\end{array}
Initial program 66.5%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lift-pow.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6477.8
Applied rewrites77.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6492.5
Applied rewrites92.5%
lift-*.f64N/A
count-2-revN/A
lower-+.f6492.5
Applied rewrites92.5%
(FPCore (x c s) :precision binary64 (if (<= x 8.2e-150) (/ (+ 1.0 (* -2.0 (pow x 2.0))) (* (* c (* c (* s x))) (* s x))) (/ (/ (* (- 1.0) 1.0) (* (* (* s c) x) (* s c))) (- x))))
double code(double x, double c, double s) {
double tmp;
if (x <= 8.2e-150) {
tmp = (1.0 + (-2.0 * pow(x, 2.0))) / ((c * (c * (s * x))) * (s * x));
} else {
tmp = ((-1.0 * 1.0) / (((s * c) * x) * (s * c))) / -x;
}
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(x, c, s)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
real(8) :: tmp
if (x <= 8.2d-150) then
tmp = (1.0d0 + ((-2.0d0) * (x ** 2.0d0))) / ((c * (c * (s * x))) * (s * x))
else
tmp = ((-1.0d0 * 1.0d0) / (((s * c) * x) * (s * c))) / -x
end if
code = tmp
end function
public static double code(double x, double c, double s) {
double tmp;
if (x <= 8.2e-150) {
tmp = (1.0 + (-2.0 * Math.pow(x, 2.0))) / ((c * (c * (s * x))) * (s * x));
} else {
tmp = ((-1.0 * 1.0) / (((s * c) * x) * (s * c))) / -x;
}
return tmp;
}
def code(x, c, s): tmp = 0 if x <= 8.2e-150: tmp = (1.0 + (-2.0 * math.pow(x, 2.0))) / ((c * (c * (s * x))) * (s * x)) else: tmp = ((-1.0 * 1.0) / (((s * c) * x) * (s * c))) / -x return tmp
function code(x, c, s) tmp = 0.0 if (x <= 8.2e-150) tmp = Float64(Float64(1.0 + Float64(-2.0 * (x ^ 2.0))) / Float64(Float64(c * Float64(c * Float64(s * x))) * Float64(s * x))); else tmp = Float64(Float64(Float64(Float64(-1.0) * 1.0) / Float64(Float64(Float64(s * c) * x) * Float64(s * c))) / Float64(-x)); end return tmp end
function tmp_2 = code(x, c, s) tmp = 0.0; if (x <= 8.2e-150) tmp = (1.0 + (-2.0 * (x ^ 2.0))) / ((c * (c * (s * x))) * (s * x)); else tmp = ((-1.0 * 1.0) / (((s * c) * x) * (s * c))) / -x; end tmp_2 = tmp; end
code[x_, c_, s_] := If[LessEqual[x, 8.2e-150], N[(N[(1.0 + N[(-2.0 * N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(c * N[(c * N[(s * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(s * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[((-1.0) * 1.0), $MachinePrecision] / N[(N[(N[(s * c), $MachinePrecision] * x), $MachinePrecision] * N[(s * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / (-x)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 8.2 \cdot 10^{-150}:\\
\;\;\;\;\frac{1 + -2 \cdot {x}^{2}}{\left(c \cdot \left(c \cdot \left(s \cdot x\right)\right)\right) \cdot \left(s \cdot x\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\left(-1\right) \cdot 1}{\left(\left(s \cdot c\right) \cdot x\right) \cdot \left(s \cdot c\right)}}{-x}\\
\end{array}
\end{array}
if x < 8.1999999999999997e-150Initial program 66.5%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lift-pow.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6477.8
Applied rewrites77.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6492.5
Applied rewrites92.5%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6459.4
Applied rewrites59.4%
if 8.1999999999999997e-150 < x Initial program 66.5%
Taylor expanded in x around 0
Applied rewrites58.5%
lift-*.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6458.6
Applied rewrites58.6%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6459.8
Applied rewrites59.8%
Applied rewrites76.1%
(FPCore (x c s)
:precision binary64
(let* ((t_0 (* (* s c) x)))
(if (<= x 1200000000.0)
(/ (/ (fma -2.0 (* x x) 1.0) t_0) t_0)
(/ (* (/ (* 1.0 1.0) (* c x)) (/ 1.0 s)) t_0))))
double code(double x, double c, double s) {
double t_0 = (s * c) * x;
double tmp;
if (x <= 1200000000.0) {
tmp = (fma(-2.0, (x * x), 1.0) / t_0) / t_0;
} else {
tmp = (((1.0 * 1.0) / (c * x)) * (1.0 / s)) / t_0;
}
return tmp;
}
function code(x, c, s) t_0 = Float64(Float64(s * c) * x) tmp = 0.0 if (x <= 1200000000.0) tmp = Float64(Float64(fma(-2.0, Float64(x * x), 1.0) / t_0) / t_0); else tmp = Float64(Float64(Float64(Float64(1.0 * 1.0) / Float64(c * x)) * Float64(1.0 / s)) / t_0); end return tmp end
code[x_, c_, s_] := Block[{t$95$0 = N[(N[(s * c), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, 1200000000.0], N[(N[(N[(-2.0 * N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision] / t$95$0), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[(N[(N[(1.0 * 1.0), $MachinePrecision] / N[(c * x), $MachinePrecision]), $MachinePrecision] * N[(1.0 / s), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(s \cdot c\right) \cdot x\\
\mathbf{if}\;x \leq 1200000000:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(-2, x \cdot x, 1\right)}{t\_0}}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 \cdot 1}{c \cdot x} \cdot \frac{1}{s}}{t\_0}\\
\end{array}
\end{array}
if x < 1.2e9Initial program 66.5%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lift-pow.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6477.8
Applied rewrites77.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
pow2N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-*.f64N/A
associate-*l*N/A
Applied rewrites96.7%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6461.4
Applied rewrites61.4%
lift-/.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6459.0
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
lower-fma.f6459.0
Applied rewrites59.0%
if 1.2e9 < x Initial program 66.5%
Taylor expanded in x around 0
Applied rewrites58.5%
lift-*.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6458.6
Applied rewrites58.6%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6459.8
Applied rewrites59.8%
Applied rewrites76.7%
(FPCore (x c s) :precision binary64 (if (<= c 4e-90) (/ (/ (* (- 1.0) 1.0) (* (* (* s c) x) (* s c))) (- x)) (/ (* (/ 1.0 (- c)) 1.0) (* (- c) (* (* s x) (* s x))))))
double code(double x, double c, double s) {
double tmp;
if (c <= 4e-90) {
tmp = ((-1.0 * 1.0) / (((s * c) * x) * (s * c))) / -x;
} else {
tmp = ((1.0 / -c) * 1.0) / (-c * ((s * x) * (s * x)));
}
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(x, c, s)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
real(8) :: tmp
if (c <= 4d-90) then
tmp = ((-1.0d0 * 1.0d0) / (((s * c) * x) * (s * c))) / -x
else
tmp = ((1.0d0 / -c) * 1.0d0) / (-c * ((s * x) * (s * x)))
end if
code = tmp
end function
public static double code(double x, double c, double s) {
double tmp;
if (c <= 4e-90) {
tmp = ((-1.0 * 1.0) / (((s * c) * x) * (s * c))) / -x;
} else {
tmp = ((1.0 / -c) * 1.0) / (-c * ((s * x) * (s * x)));
}
return tmp;
}
def code(x, c, s): tmp = 0 if c <= 4e-90: tmp = ((-1.0 * 1.0) / (((s * c) * x) * (s * c))) / -x else: tmp = ((1.0 / -c) * 1.0) / (-c * ((s * x) * (s * x))) return tmp
function code(x, c, s) tmp = 0.0 if (c <= 4e-90) tmp = Float64(Float64(Float64(Float64(-1.0) * 1.0) / Float64(Float64(Float64(s * c) * x) * Float64(s * c))) / Float64(-x)); else tmp = Float64(Float64(Float64(1.0 / Float64(-c)) * 1.0) / Float64(Float64(-c) * Float64(Float64(s * x) * Float64(s * x)))); end return tmp end
function tmp_2 = code(x, c, s) tmp = 0.0; if (c <= 4e-90) tmp = ((-1.0 * 1.0) / (((s * c) * x) * (s * c))) / -x; else tmp = ((1.0 / -c) * 1.0) / (-c * ((s * x) * (s * x))); end tmp_2 = tmp; end
code[x_, c_, s_] := If[LessEqual[c, 4e-90], N[(N[(N[((-1.0) * 1.0), $MachinePrecision] / N[(N[(N[(s * c), $MachinePrecision] * x), $MachinePrecision] * N[(s * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / (-x)), $MachinePrecision], N[(N[(N[(1.0 / (-c)), $MachinePrecision] * 1.0), $MachinePrecision] / N[((-c) * N[(N[(s * x), $MachinePrecision] * N[(s * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \leq 4 \cdot 10^{-90}:\\
\;\;\;\;\frac{\frac{\left(-1\right) \cdot 1}{\left(\left(s \cdot c\right) \cdot x\right) \cdot \left(s \cdot c\right)}}{-x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{-c} \cdot 1}{\left(-c\right) \cdot \left(\left(s \cdot x\right) \cdot \left(s \cdot x\right)\right)}\\
\end{array}
\end{array}
if c < 3.99999999999999998e-90Initial program 66.5%
Taylor expanded in x around 0
Applied rewrites58.5%
lift-*.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6458.6
Applied rewrites58.6%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6459.8
Applied rewrites59.8%
Applied rewrites76.1%
if 3.99999999999999998e-90 < c Initial program 66.5%
Taylor expanded in x around 0
Applied rewrites58.5%
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
associate-/r*N/A
mult-flipN/A
lift-*.f64N/A
sqr-neg-revN/A
associate-/r*N/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
Applied rewrites64.5%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
unswap-sqrN/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6472.5
Applied rewrites72.5%
(FPCore (x c s) :precision binary64 (if (<= c 4e-90) (/ (* 1.0 (/ 1.0 x)) (* (* (* s c) x) (* s c))) (/ (* (/ 1.0 (- c)) 1.0) (* (- c) (* (* s x) (* s x))))))
double code(double x, double c, double s) {
double tmp;
if (c <= 4e-90) {
tmp = (1.0 * (1.0 / x)) / (((s * c) * x) * (s * c));
} else {
tmp = ((1.0 / -c) * 1.0) / (-c * ((s * x) * (s * x)));
}
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(x, c, s)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
real(8) :: tmp
if (c <= 4d-90) then
tmp = (1.0d0 * (1.0d0 / x)) / (((s * c) * x) * (s * c))
else
tmp = ((1.0d0 / -c) * 1.0d0) / (-c * ((s * x) * (s * x)))
end if
code = tmp
end function
public static double code(double x, double c, double s) {
double tmp;
if (c <= 4e-90) {
tmp = (1.0 * (1.0 / x)) / (((s * c) * x) * (s * c));
} else {
tmp = ((1.0 / -c) * 1.0) / (-c * ((s * x) * (s * x)));
}
return tmp;
}
def code(x, c, s): tmp = 0 if c <= 4e-90: tmp = (1.0 * (1.0 / x)) / (((s * c) * x) * (s * c)) else: tmp = ((1.0 / -c) * 1.0) / (-c * ((s * x) * (s * x))) return tmp
function code(x, c, s) tmp = 0.0 if (c <= 4e-90) tmp = Float64(Float64(1.0 * Float64(1.0 / x)) / Float64(Float64(Float64(s * c) * x) * Float64(s * c))); else tmp = Float64(Float64(Float64(1.0 / Float64(-c)) * 1.0) / Float64(Float64(-c) * Float64(Float64(s * x) * Float64(s * x)))); end return tmp end
function tmp_2 = code(x, c, s) tmp = 0.0; if (c <= 4e-90) tmp = (1.0 * (1.0 / x)) / (((s * c) * x) * (s * c)); else tmp = ((1.0 / -c) * 1.0) / (-c * ((s * x) * (s * x))); end tmp_2 = tmp; end
code[x_, c_, s_] := If[LessEqual[c, 4e-90], N[(N[(1.0 * N[(1.0 / x), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(s * c), $MachinePrecision] * x), $MachinePrecision] * N[(s * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / (-c)), $MachinePrecision] * 1.0), $MachinePrecision] / N[((-c) * N[(N[(s * x), $MachinePrecision] * N[(s * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \leq 4 \cdot 10^{-90}:\\
\;\;\;\;\frac{1 \cdot \frac{1}{x}}{\left(\left(s \cdot c\right) \cdot x\right) \cdot \left(s \cdot c\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{-c} \cdot 1}{\left(-c\right) \cdot \left(\left(s \cdot x\right) \cdot \left(s \cdot x\right)\right)}\\
\end{array}
\end{array}
if c < 3.99999999999999998e-90Initial program 66.5%
Taylor expanded in x around 0
Applied rewrites58.5%
lift-*.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6458.6
Applied rewrites58.6%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6459.8
Applied rewrites59.8%
Applied rewrites76.2%
if 3.99999999999999998e-90 < c Initial program 66.5%
Taylor expanded in x around 0
Applied rewrites58.5%
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
associate-/r*N/A
mult-flipN/A
lift-*.f64N/A
sqr-neg-revN/A
associate-/r*N/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
Applied rewrites64.5%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
unswap-sqrN/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6472.5
Applied rewrites72.5%
(FPCore (x c s) :precision binary64 (if (<= c 7.2e-53) (/ (* 1.0 (/ 1.0 x)) (* (* (* s c) x) (* s c))) (/ (/ (/ 1.0 (* c c)) x) (* (* s x) s))))
double code(double x, double c, double s) {
double tmp;
if (c <= 7.2e-53) {
tmp = (1.0 * (1.0 / x)) / (((s * c) * x) * (s * c));
} else {
tmp = ((1.0 / (c * c)) / x) / ((s * x) * s);
}
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(x, c, s)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
real(8) :: tmp
if (c <= 7.2d-53) then
tmp = (1.0d0 * (1.0d0 / x)) / (((s * c) * x) * (s * c))
else
tmp = ((1.0d0 / (c * c)) / x) / ((s * x) * s)
end if
code = tmp
end function
public static double code(double x, double c, double s) {
double tmp;
if (c <= 7.2e-53) {
tmp = (1.0 * (1.0 / x)) / (((s * c) * x) * (s * c));
} else {
tmp = ((1.0 / (c * c)) / x) / ((s * x) * s);
}
return tmp;
}
def code(x, c, s): tmp = 0 if c <= 7.2e-53: tmp = (1.0 * (1.0 / x)) / (((s * c) * x) * (s * c)) else: tmp = ((1.0 / (c * c)) / x) / ((s * x) * s) return tmp
function code(x, c, s) tmp = 0.0 if (c <= 7.2e-53) tmp = Float64(Float64(1.0 * Float64(1.0 / x)) / Float64(Float64(Float64(s * c) * x) * Float64(s * c))); else tmp = Float64(Float64(Float64(1.0 / Float64(c * c)) / x) / Float64(Float64(s * x) * s)); end return tmp end
function tmp_2 = code(x, c, s) tmp = 0.0; if (c <= 7.2e-53) tmp = (1.0 * (1.0 / x)) / (((s * c) * x) * (s * c)); else tmp = ((1.0 / (c * c)) / x) / ((s * x) * s); end tmp_2 = tmp; end
code[x_, c_, s_] := If[LessEqual[c, 7.2e-53], N[(N[(1.0 * N[(1.0 / x), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(s * c), $MachinePrecision] * x), $MachinePrecision] * N[(s * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / N[(c * c), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / N[(N[(s * x), $MachinePrecision] * s), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \leq 7.2 \cdot 10^{-53}:\\
\;\;\;\;\frac{1 \cdot \frac{1}{x}}{\left(\left(s \cdot c\right) \cdot x\right) \cdot \left(s \cdot c\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{1}{c \cdot c}}{x}}{\left(s \cdot x\right) \cdot s}\\
\end{array}
\end{array}
if c < 7.1999999999999998e-53Initial program 66.5%
Taylor expanded in x around 0
Applied rewrites58.5%
lift-*.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6458.6
Applied rewrites58.6%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6459.8
Applied rewrites59.8%
Applied rewrites76.2%
if 7.1999999999999998e-53 < c Initial program 66.5%
Taylor expanded in x around 0
Applied rewrites58.5%
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
associate-/r*N/A
lift-*.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower-/.f6459.0
Applied rewrites59.0%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f6463.9
Applied rewrites63.9%
(FPCore (x c s) :precision binary64 (if (<= c 3e-19) (/ 1.0 (* (* (* (* s c) x) x) (* s c))) (/ (/ (/ 1.0 (* c c)) x) (* (* s x) s))))
double code(double x, double c, double s) {
double tmp;
if (c <= 3e-19) {
tmp = 1.0 / ((((s * c) * x) * x) * (s * c));
} else {
tmp = ((1.0 / (c * c)) / x) / ((s * x) * s);
}
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(x, c, s)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
real(8) :: tmp
if (c <= 3d-19) then
tmp = 1.0d0 / ((((s * c) * x) * x) * (s * c))
else
tmp = ((1.0d0 / (c * c)) / x) / ((s * x) * s)
end if
code = tmp
end function
public static double code(double x, double c, double s) {
double tmp;
if (c <= 3e-19) {
tmp = 1.0 / ((((s * c) * x) * x) * (s * c));
} else {
tmp = ((1.0 / (c * c)) / x) / ((s * x) * s);
}
return tmp;
}
def code(x, c, s): tmp = 0 if c <= 3e-19: tmp = 1.0 / ((((s * c) * x) * x) * (s * c)) else: tmp = ((1.0 / (c * c)) / x) / ((s * x) * s) return tmp
function code(x, c, s) tmp = 0.0 if (c <= 3e-19) tmp = Float64(1.0 / Float64(Float64(Float64(Float64(s * c) * x) * x) * Float64(s * c))); else tmp = Float64(Float64(Float64(1.0 / Float64(c * c)) / x) / Float64(Float64(s * x) * s)); end return tmp end
function tmp_2 = code(x, c, s) tmp = 0.0; if (c <= 3e-19) tmp = 1.0 / ((((s * c) * x) * x) * (s * c)); else tmp = ((1.0 / (c * c)) / x) / ((s * x) * s); end tmp_2 = tmp; end
code[x_, c_, s_] := If[LessEqual[c, 3e-19], N[(1.0 / N[(N[(N[(N[(s * c), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision] * N[(s * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / N[(c * c), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / N[(N[(s * x), $MachinePrecision] * s), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \leq 3 \cdot 10^{-19}:\\
\;\;\;\;\frac{1}{\left(\left(\left(s \cdot c\right) \cdot x\right) \cdot x\right) \cdot \left(s \cdot c\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{1}{c \cdot c}}{x}}{\left(s \cdot x\right) \cdot s}\\
\end{array}
\end{array}
if c < 2.99999999999999993e-19Initial program 66.5%
Taylor expanded in x around 0
Applied rewrites58.5%
lift-*.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6458.6
Applied rewrites58.6%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6459.8
Applied rewrites59.8%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
unswap-sqrN/A
swap-sqrN/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6476.1
Applied rewrites76.1%
if 2.99999999999999993e-19 < c Initial program 66.5%
Taylor expanded in x around 0
Applied rewrites58.5%
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
associate-/r*N/A
lift-*.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower-/.f6459.0
Applied rewrites59.0%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f6463.9
Applied rewrites63.9%
(FPCore (x c s) :precision binary64 (if (<= c 4.8e-16) (/ 1.0 (* (* (* (* s c) x) x) (* s c))) (/ (/ 1.0 (* x (* (* c c) (* s x)))) s)))
double code(double x, double c, double s) {
double tmp;
if (c <= 4.8e-16) {
tmp = 1.0 / ((((s * c) * x) * x) * (s * c));
} else {
tmp = (1.0 / (x * ((c * c) * (s * x)))) / s;
}
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(x, c, s)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
real(8) :: tmp
if (c <= 4.8d-16) then
tmp = 1.0d0 / ((((s * c) * x) * x) * (s * c))
else
tmp = (1.0d0 / (x * ((c * c) * (s * x)))) / s
end if
code = tmp
end function
public static double code(double x, double c, double s) {
double tmp;
if (c <= 4.8e-16) {
tmp = 1.0 / ((((s * c) * x) * x) * (s * c));
} else {
tmp = (1.0 / (x * ((c * c) * (s * x)))) / s;
}
return tmp;
}
def code(x, c, s): tmp = 0 if c <= 4.8e-16: tmp = 1.0 / ((((s * c) * x) * x) * (s * c)) else: tmp = (1.0 / (x * ((c * c) * (s * x)))) / s return tmp
function code(x, c, s) tmp = 0.0 if (c <= 4.8e-16) tmp = Float64(1.0 / Float64(Float64(Float64(Float64(s * c) * x) * x) * Float64(s * c))); else tmp = Float64(Float64(1.0 / Float64(x * Float64(Float64(c * c) * Float64(s * x)))) / s); end return tmp end
function tmp_2 = code(x, c, s) tmp = 0.0; if (c <= 4.8e-16) tmp = 1.0 / ((((s * c) * x) * x) * (s * c)); else tmp = (1.0 / (x * ((c * c) * (s * x)))) / s; end tmp_2 = tmp; end
code[x_, c_, s_] := If[LessEqual[c, 4.8e-16], N[(1.0 / N[(N[(N[(N[(s * c), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision] * N[(s * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(x * N[(N[(c * c), $MachinePrecision] * N[(s * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / s), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \leq 4.8 \cdot 10^{-16}:\\
\;\;\;\;\frac{1}{\left(\left(\left(s \cdot c\right) \cdot x\right) \cdot x\right) \cdot \left(s \cdot c\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x \cdot \left(\left(c \cdot c\right) \cdot \left(s \cdot x\right)\right)}}{s}\\
\end{array}
\end{array}
if c < 4.8000000000000001e-16Initial program 66.5%
Taylor expanded in x around 0
Applied rewrites58.5%
lift-*.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6458.6
Applied rewrites58.6%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6459.8
Applied rewrites59.8%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
unswap-sqrN/A
swap-sqrN/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6476.1
Applied rewrites76.1%
if 4.8000000000000001e-16 < c Initial program 66.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites77.0%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lower-pow.f6460.3
Applied rewrites60.3%
lift-*.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6466.2
Applied rewrites66.2%
(FPCore (x c s) :precision binary64 (/ 1.0 (* (* (* (* s c) x) x) (* s c))))
double code(double x, double c, double s) {
return 1.0 / ((((s * c) * x) * x) * (s * c));
}
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(x, c, s)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
code = 1.0d0 / ((((s * c) * x) * x) * (s * c))
end function
public static double code(double x, double c, double s) {
return 1.0 / ((((s * c) * x) * x) * (s * c));
}
def code(x, c, s): return 1.0 / ((((s * c) * x) * x) * (s * c))
function code(x, c, s) return Float64(1.0 / Float64(Float64(Float64(Float64(s * c) * x) * x) * Float64(s * c))) end
function tmp = code(x, c, s) tmp = 1.0 / ((((s * c) * x) * x) * (s * c)); end
code[x_, c_, s_] := N[(1.0 / N[(N[(N[(N[(s * c), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision] * N[(s * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\left(\left(\left(s \cdot c\right) \cdot x\right) \cdot x\right) \cdot \left(s \cdot c\right)}
\end{array}
Initial program 66.5%
Taylor expanded in x around 0
Applied rewrites58.5%
lift-*.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6458.6
Applied rewrites58.6%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6459.8
Applied rewrites59.8%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
unswap-sqrN/A
swap-sqrN/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6476.1
Applied rewrites76.1%
(FPCore (x c s) :precision binary64 (/ 1.0 (* (* (* c x) (* c x)) (* s s))))
double code(double x, double c, double s) {
return 1.0 / (((c * x) * (c * x)) * (s * s));
}
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(x, c, s)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
code = 1.0d0 / (((c * x) * (c * x)) * (s * s))
end function
public static double code(double x, double c, double s) {
return 1.0 / (((c * x) * (c * x)) * (s * s));
}
def code(x, c, s): return 1.0 / (((c * x) * (c * x)) * (s * s))
function code(x, c, s) return Float64(1.0 / Float64(Float64(Float64(c * x) * Float64(c * x)) * Float64(s * s))) end
function tmp = code(x, c, s) tmp = 1.0 / (((c * x) * (c * x)) * (s * s)); end
code[x_, c_, s_] := N[(1.0 / N[(N[(N[(c * x), $MachinePrecision] * N[(c * x), $MachinePrecision]), $MachinePrecision] * N[(s * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\left(\left(c \cdot x\right) \cdot \left(c \cdot x\right)\right) \cdot \left(s \cdot s\right)}
\end{array}
Initial program 66.5%
Taylor expanded in x around 0
Applied rewrites58.5%
lift-*.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6458.6
Applied rewrites58.6%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
unswap-sqrN/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6466.2
Applied rewrites66.2%
(FPCore (x c s) :precision binary64 (/ 1.0 (* (* c (* c (* x x))) (* s s))))
double code(double x, double c, double s) {
return 1.0 / ((c * (c * (x * x))) * (s * s));
}
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(x, c, s)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
code = 1.0d0 / ((c * (c * (x * x))) * (s * s))
end function
public static double code(double x, double c, double s) {
return 1.0 / ((c * (c * (x * x))) * (s * s));
}
def code(x, c, s): return 1.0 / ((c * (c * (x * x))) * (s * s))
function code(x, c, s) return Float64(1.0 / Float64(Float64(c * Float64(c * Float64(x * x))) * Float64(s * s))) end
function tmp = code(x, c, s) tmp = 1.0 / ((c * (c * (x * x))) * (s * s)); end
code[x_, c_, s_] := N[(1.0 / N[(N[(c * N[(c * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(s * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\left(c \cdot \left(c \cdot \left(x \cdot x\right)\right)\right) \cdot \left(s \cdot s\right)}
\end{array}
Initial program 66.5%
Taylor expanded in x around 0
Applied rewrites58.5%
lift-*.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6458.6
Applied rewrites58.6%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6459.8
Applied rewrites59.8%
herbie shell --seed 2025162
(FPCore (x c s)
:name "mixedcos"
:precision binary64
(/ (cos (* 2.0 x)) (* (pow c 2.0) (* (* x (pow s 2.0)) x))))