
(FPCore (F B x) :precision binary64 (+ (- (* x (/ 1.0 (tan B)))) (* (/ F (sin B)) (pow (+ (+ (* F F) 2.0) (* 2.0 x)) (- (/ 1.0 2.0))))))
double code(double F, double B, double x) {
return -(x * (1.0 / tan(B))) + ((F / sin(B)) * pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 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(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
code = -(x * (1.0d0 / tan(b))) + ((f / sin(b)) * ((((f * f) + 2.0d0) + (2.0d0 * x)) ** -(1.0d0 / 2.0d0)))
end function
public static double code(double F, double B, double x) {
return -(x * (1.0 / Math.tan(B))) + ((F / Math.sin(B)) * Math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
}
def code(F, B, x): return -(x * (1.0 / math.tan(B))) + ((F / math.sin(B)) * math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)))
function code(F, B, x) return Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(Float64(F / sin(B)) * (Float64(Float64(Float64(F * F) + 2.0) + Float64(2.0 * x)) ^ Float64(-Float64(1.0 / 2.0))))) end
function tmp = code(F, B, x) tmp = -(x * (1.0 / tan(B))) + ((F / sin(B)) * ((((F * F) + 2.0) + (2.0 * x)) ^ -(1.0 / 2.0))); end
code[F_, B_, x_] := N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(N[(F * F), $MachinePrecision] + 2.0), $MachinePrecision] + N[(2.0 * x), $MachinePrecision]), $MachinePrecision], (-N[(1.0 / 2.0), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}
\end{array}
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (F B x) :precision binary64 (+ (- (* x (/ 1.0 (tan B)))) (* (/ F (sin B)) (pow (+ (+ (* F F) 2.0) (* 2.0 x)) (- (/ 1.0 2.0))))))
double code(double F, double B, double x) {
return -(x * (1.0 / tan(B))) + ((F / sin(B)) * pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 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(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
code = -(x * (1.0d0 / tan(b))) + ((f / sin(b)) * ((((f * f) + 2.0d0) + (2.0d0 * x)) ** -(1.0d0 / 2.0d0)))
end function
public static double code(double F, double B, double x) {
return -(x * (1.0 / Math.tan(B))) + ((F / Math.sin(B)) * Math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
}
def code(F, B, x): return -(x * (1.0 / math.tan(B))) + ((F / math.sin(B)) * math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)))
function code(F, B, x) return Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(Float64(F / sin(B)) * (Float64(Float64(Float64(F * F) + 2.0) + Float64(2.0 * x)) ^ Float64(-Float64(1.0 / 2.0))))) end
function tmp = code(F, B, x) tmp = -(x * (1.0 / tan(B))) + ((F / sin(B)) * ((((F * F) + 2.0) + (2.0 * x)) ^ -(1.0 / 2.0))); end
code[F_, B_, x_] := N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(N[(F * F), $MachinePrecision] + 2.0), $MachinePrecision] + N[(2.0 * x), $MachinePrecision]), $MachinePrecision], (-N[(1.0 / 2.0), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}
\end{array}
(FPCore (F B x)
:precision binary64
(let* ((t_0 (- (/ (* x 1.0) (tan B)))))
(if (<= F -4e+54)
(- (/ (+ 1.0 (* (cos B) x)) (sin B)))
(if (<= F 102000000.0)
(+
t_0
(* (/ F (sin B)) (pow (+ (+ (* F F) 2.0) (* 2.0 x)) (- (/ 1.0 2.0)))))
(+ t_0 (pow (sin B) -1.0))))))
double code(double F, double B, double x) {
double t_0 = -((x * 1.0) / tan(B));
double tmp;
if (F <= -4e+54) {
tmp = -((1.0 + (cos(B) * x)) / sin(B));
} else if (F <= 102000000.0) {
tmp = t_0 + ((F / sin(B)) * pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
} else {
tmp = t_0 + pow(sin(B), -1.0);
}
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(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: tmp
t_0 = -((x * 1.0d0) / tan(b))
if (f <= (-4d+54)) then
tmp = -((1.0d0 + (cos(b) * x)) / sin(b))
else if (f <= 102000000.0d0) then
tmp = t_0 + ((f / sin(b)) * ((((f * f) + 2.0d0) + (2.0d0 * x)) ** -(1.0d0 / 2.0d0)))
else
tmp = t_0 + (sin(b) ** (-1.0d0))
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double t_0 = -((x * 1.0) / Math.tan(B));
double tmp;
if (F <= -4e+54) {
tmp = -((1.0 + (Math.cos(B) * x)) / Math.sin(B));
} else if (F <= 102000000.0) {
tmp = t_0 + ((F / Math.sin(B)) * Math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
} else {
tmp = t_0 + Math.pow(Math.sin(B), -1.0);
}
return tmp;
}
def code(F, B, x): t_0 = -((x * 1.0) / math.tan(B)) tmp = 0 if F <= -4e+54: tmp = -((1.0 + (math.cos(B) * x)) / math.sin(B)) elif F <= 102000000.0: tmp = t_0 + ((F / math.sin(B)) * math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0))) else: tmp = t_0 + math.pow(math.sin(B), -1.0) return tmp
function code(F, B, x) t_0 = Float64(-Float64(Float64(x * 1.0) / tan(B))) tmp = 0.0 if (F <= -4e+54) tmp = Float64(-Float64(Float64(1.0 + Float64(cos(B) * x)) / sin(B))); elseif (F <= 102000000.0) tmp = Float64(t_0 + Float64(Float64(F / sin(B)) * (Float64(Float64(Float64(F * F) + 2.0) + Float64(2.0 * x)) ^ Float64(-Float64(1.0 / 2.0))))); else tmp = Float64(t_0 + (sin(B) ^ -1.0)); end return tmp end
function tmp_2 = code(F, B, x) t_0 = -((x * 1.0) / tan(B)); tmp = 0.0; if (F <= -4e+54) tmp = -((1.0 + (cos(B) * x)) / sin(B)); elseif (F <= 102000000.0) tmp = t_0 + ((F / sin(B)) * ((((F * F) + 2.0) + (2.0 * x)) ^ -(1.0 / 2.0))); else tmp = t_0 + (sin(B) ^ -1.0); end tmp_2 = tmp; end
code[F_, B_, x_] := Block[{t$95$0 = (-N[(N[(x * 1.0), $MachinePrecision] / N[Tan[B], $MachinePrecision]), $MachinePrecision])}, If[LessEqual[F, -4e+54], (-N[(N[(1.0 + N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), If[LessEqual[F, 102000000.0], N[(t$95$0 + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(N[(F * F), $MachinePrecision] + 2.0), $MachinePrecision] + N[(2.0 * x), $MachinePrecision]), $MachinePrecision], (-N[(1.0 / 2.0), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[Power[N[Sin[B], $MachinePrecision], -1.0], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -\frac{x \cdot 1}{\tan B}\\
\mathbf{if}\;F \leq -4 \cdot 10^{+54}:\\
\;\;\;\;-\frac{1 + \cos B \cdot x}{\sin B}\\
\mathbf{elif}\;F \leq 102000000:\\
\;\;\;\;t\_0 + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0 + {\sin B}^{-1}\\
\end{array}
\end{array}
if F < -4.0000000000000003e54Initial program 53.2%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
if -4.0000000000000003e54 < F < 1.02e8Initial program 99.3%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6499.4
Applied rewrites99.4%
if 1.02e8 < F Initial program 56.8%
Taylor expanded in F around inf
inv-powN/A
lower-pow.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6499.8
Applied rewrites99.8%
(FPCore (F B x)
:precision binary64
(if (<= F -6.5e+50)
(- (/ (+ 1.0 (* (cos B) x)) (sin B)))
(if (<= F 102000000.0)
(+
(- (* x (/ 1.0 (tan B))))
(* (/ F (sin B)) (sqrt (pow (fma F F 2.0) -1.0))))
(+ (- (/ (* x 1.0) (tan B))) (pow (sin B) -1.0)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -6.5e+50) {
tmp = -((1.0 + (cos(B) * x)) / sin(B));
} else if (F <= 102000000.0) {
tmp = -(x * (1.0 / tan(B))) + ((F / sin(B)) * sqrt(pow(fma(F, F, 2.0), -1.0)));
} else {
tmp = -((x * 1.0) / tan(B)) + pow(sin(B), -1.0);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -6.5e+50) tmp = Float64(-Float64(Float64(1.0 + Float64(cos(B) * x)) / sin(B))); elseif (F <= 102000000.0) tmp = Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(Float64(F / sin(B)) * sqrt((fma(F, F, 2.0) ^ -1.0)))); else tmp = Float64(Float64(-Float64(Float64(x * 1.0) / tan(B))) + (sin(B) ^ -1.0)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -6.5e+50], (-N[(N[(1.0 + N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), If[LessEqual[F, 102000000.0], N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[Power[N[(F * F + 2.0), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-N[(N[(x * 1.0), $MachinePrecision] / N[Tan[B], $MachinePrecision]), $MachinePrecision]) + N[Power[N[Sin[B], $MachinePrecision], -1.0], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -6.5 \cdot 10^{+50}:\\
\;\;\;\;-\frac{1 + \cos B \cdot x}{\sin B}\\
\mathbf{elif}\;F \leq 102000000:\\
\;\;\;\;\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot \sqrt{{\left(\mathsf{fma}\left(F, F, 2\right)\right)}^{-1}}\\
\mathbf{else}:\\
\;\;\;\;\left(-\frac{x \cdot 1}{\tan B}\right) + {\sin B}^{-1}\\
\end{array}
\end{array}
if F < -6.5000000000000003e50Initial program 53.6%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
if -6.5000000000000003e50 < F < 1.02e8Initial program 99.3%
Taylor expanded in x around 0
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
+-commutativeN/A
pow2N/A
lower-fma.f6499.2
Applied rewrites99.2%
if 1.02e8 < F Initial program 56.8%
Taylor expanded in F around inf
inv-powN/A
lower-pow.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6499.8
Applied rewrites99.8%
(FPCore (F B x)
:precision binary64
(if (<= F -1.95)
(- (/ (+ 1.0 (* (cos B) x)) (sin B)))
(if (<= F 1.4)
(fma (- x) (pow (tan B) -1.0) (* (sqrt 0.5) (/ F (sin B))))
(+ (- (/ (* x 1.0) (tan B))) (pow (sin B) -1.0)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1.95) {
tmp = -((1.0 + (cos(B) * x)) / sin(B));
} else if (F <= 1.4) {
tmp = fma(-x, pow(tan(B), -1.0), (sqrt(0.5) * (F / sin(B))));
} else {
tmp = -((x * 1.0) / tan(B)) + pow(sin(B), -1.0);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -1.95) tmp = Float64(-Float64(Float64(1.0 + Float64(cos(B) * x)) / sin(B))); elseif (F <= 1.4) tmp = fma(Float64(-x), (tan(B) ^ -1.0), Float64(sqrt(0.5) * Float64(F / sin(B)))); else tmp = Float64(Float64(-Float64(Float64(x * 1.0) / tan(B))) + (sin(B) ^ -1.0)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -1.95], (-N[(N[(1.0 + N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), If[LessEqual[F, 1.4], N[((-x) * N[Power[N[Tan[B], $MachinePrecision], -1.0], $MachinePrecision] + N[(N[Sqrt[0.5], $MachinePrecision] * N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-N[(N[(x * 1.0), $MachinePrecision] / N[Tan[B], $MachinePrecision]), $MachinePrecision]) + N[Power[N[Sin[B], $MachinePrecision], -1.0], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.95:\\
\;\;\;\;-\frac{1 + \cos B \cdot x}{\sin B}\\
\mathbf{elif}\;F \leq 1.4:\\
\;\;\;\;\mathsf{fma}\left(-x, {\tan B}^{-1}, \sqrt{0.5} \cdot \frac{F}{\sin B}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-\frac{x \cdot 1}{\tan B}\right) + {\sin B}^{-1}\\
\end{array}
\end{array}
if F < -1.94999999999999996Initial program 60.0%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6499.2
Applied rewrites99.2%
if -1.94999999999999996 < F < 1.3999999999999999Initial program 99.4%
Taylor expanded in x around 0
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
+-commutativeN/A
pow2N/A
lower-fma.f6499.4
Applied rewrites99.4%
Taylor expanded in F around 0
Applied rewrites98.8%
metadata-evalN/A
lift-+.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
distribute-lft-neg-inN/A
Applied rewrites98.8%
if 1.3999999999999999 < F Initial program 57.7%
Taylor expanded in F around inf
inv-powN/A
lower-pow.f64N/A
lift-sin.f6499.1
Applied rewrites99.1%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6499.2
Applied rewrites99.2%
(FPCore (F B x)
:precision binary64
(if (<= F -0.125)
(- (/ (+ 1.0 (* (cos B) x)) (sin B)))
(if (<= F -5.8e-253)
(+ (- (/ x B)) (* (/ F (sin B)) (sqrt 0.5)))
(if (<= F 1.4e-20)
(- (* (cos B) (/ x (sin B))))
(+ (- (/ (* x 1.0) (tan B))) (pow (sin B) -1.0))))))
double code(double F, double B, double x) {
double tmp;
if (F <= -0.125) {
tmp = -((1.0 + (cos(B) * x)) / sin(B));
} else if (F <= -5.8e-253) {
tmp = -(x / B) + ((F / sin(B)) * sqrt(0.5));
} else if (F <= 1.4e-20) {
tmp = -(cos(B) * (x / sin(B)));
} else {
tmp = -((x * 1.0) / tan(B)) + pow(sin(B), -1.0);
}
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(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: tmp
if (f <= (-0.125d0)) then
tmp = -((1.0d0 + (cos(b) * x)) / sin(b))
else if (f <= (-5.8d-253)) then
tmp = -(x / b) + ((f / sin(b)) * sqrt(0.5d0))
else if (f <= 1.4d-20) then
tmp = -(cos(b) * (x / sin(b)))
else
tmp = -((x * 1.0d0) / tan(b)) + (sin(b) ** (-1.0d0))
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -0.125) {
tmp = -((1.0 + (Math.cos(B) * x)) / Math.sin(B));
} else if (F <= -5.8e-253) {
tmp = -(x / B) + ((F / Math.sin(B)) * Math.sqrt(0.5));
} else if (F <= 1.4e-20) {
tmp = -(Math.cos(B) * (x / Math.sin(B)));
} else {
tmp = -((x * 1.0) / Math.tan(B)) + Math.pow(Math.sin(B), -1.0);
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -0.125: tmp = -((1.0 + (math.cos(B) * x)) / math.sin(B)) elif F <= -5.8e-253: tmp = -(x / B) + ((F / math.sin(B)) * math.sqrt(0.5)) elif F <= 1.4e-20: tmp = -(math.cos(B) * (x / math.sin(B))) else: tmp = -((x * 1.0) / math.tan(B)) + math.pow(math.sin(B), -1.0) return tmp
function code(F, B, x) tmp = 0.0 if (F <= -0.125) tmp = Float64(-Float64(Float64(1.0 + Float64(cos(B) * x)) / sin(B))); elseif (F <= -5.8e-253) tmp = Float64(Float64(-Float64(x / B)) + Float64(Float64(F / sin(B)) * sqrt(0.5))); elseif (F <= 1.4e-20) tmp = Float64(-Float64(cos(B) * Float64(x / sin(B)))); else tmp = Float64(Float64(-Float64(Float64(x * 1.0) / tan(B))) + (sin(B) ^ -1.0)); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -0.125) tmp = -((1.0 + (cos(B) * x)) / sin(B)); elseif (F <= -5.8e-253) tmp = -(x / B) + ((F / sin(B)) * sqrt(0.5)); elseif (F <= 1.4e-20) tmp = -(cos(B) * (x / sin(B))); else tmp = -((x * 1.0) / tan(B)) + (sin(B) ^ -1.0); end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -0.125], (-N[(N[(1.0 + N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), If[LessEqual[F, -5.8e-253], N[((-N[(x / B), $MachinePrecision]) + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.4e-20], (-N[(N[Cos[B], $MachinePrecision] * N[(x / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), N[((-N[(N[(x * 1.0), $MachinePrecision] / N[Tan[B], $MachinePrecision]), $MachinePrecision]) + N[Power[N[Sin[B], $MachinePrecision], -1.0], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -0.125:\\
\;\;\;\;-\frac{1 + \cos B \cdot x}{\sin B}\\
\mathbf{elif}\;F \leq -5.8 \cdot 10^{-253}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{F}{\sin B} \cdot \sqrt{0.5}\\
\mathbf{elif}\;F \leq 1.4 \cdot 10^{-20}:\\
\;\;\;\;-\cos B \cdot \frac{x}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;\left(-\frac{x \cdot 1}{\tan B}\right) + {\sin B}^{-1}\\
\end{array}
\end{array}
if F < -0.125Initial program 60.0%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6499.2
Applied rewrites99.2%
if -0.125 < F < -5.7999999999999996e-253Initial program 99.5%
Taylor expanded in x around 0
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
+-commutativeN/A
pow2N/A
lower-fma.f6499.3
Applied rewrites99.3%
Taylor expanded in F around 0
Applied rewrites98.9%
Taylor expanded in B around 0
lift-/.f6469.9
Applied rewrites69.9%
if -5.7999999999999996e-253 < F < 1.4000000000000001e-20Initial program 99.4%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6472.4
Applied rewrites72.4%
lift-/.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-sin.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift-cos.f64N/A
lower-/.f64N/A
lift-sin.f6472.4
Applied rewrites72.4%
if 1.4000000000000001e-20 < F Initial program 59.5%
Taylor expanded in F around inf
inv-powN/A
lower-pow.f64N/A
lift-sin.f6496.3
Applied rewrites96.3%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6496.3
Applied rewrites96.3%
(FPCore (F B x)
:precision binary64
(if (<= F -0.125)
(- (/ (+ 1.0 (* (cos B) x)) (sin B)))
(if (<= F -5.8e-253)
(+ (- (/ x B)) (* (/ F (sin B)) (sqrt 0.5)))
(if (<= F 1.5e-21)
(- (* (cos B) (/ x (sin B))))
(+ (- (* x (/ 1.0 (tan B)))) (pow (sin B) -1.0))))))
double code(double F, double B, double x) {
double tmp;
if (F <= -0.125) {
tmp = -((1.0 + (cos(B) * x)) / sin(B));
} else if (F <= -5.8e-253) {
tmp = -(x / B) + ((F / sin(B)) * sqrt(0.5));
} else if (F <= 1.5e-21) {
tmp = -(cos(B) * (x / sin(B)));
} else {
tmp = -(x * (1.0 / tan(B))) + pow(sin(B), -1.0);
}
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(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: tmp
if (f <= (-0.125d0)) then
tmp = -((1.0d0 + (cos(b) * x)) / sin(b))
else if (f <= (-5.8d-253)) then
tmp = -(x / b) + ((f / sin(b)) * sqrt(0.5d0))
else if (f <= 1.5d-21) then
tmp = -(cos(b) * (x / sin(b)))
else
tmp = -(x * (1.0d0 / tan(b))) + (sin(b) ** (-1.0d0))
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -0.125) {
tmp = -((1.0 + (Math.cos(B) * x)) / Math.sin(B));
} else if (F <= -5.8e-253) {
tmp = -(x / B) + ((F / Math.sin(B)) * Math.sqrt(0.5));
} else if (F <= 1.5e-21) {
tmp = -(Math.cos(B) * (x / Math.sin(B)));
} else {
tmp = -(x * (1.0 / Math.tan(B))) + Math.pow(Math.sin(B), -1.0);
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -0.125: tmp = -((1.0 + (math.cos(B) * x)) / math.sin(B)) elif F <= -5.8e-253: tmp = -(x / B) + ((F / math.sin(B)) * math.sqrt(0.5)) elif F <= 1.5e-21: tmp = -(math.cos(B) * (x / math.sin(B))) else: tmp = -(x * (1.0 / math.tan(B))) + math.pow(math.sin(B), -1.0) return tmp
function code(F, B, x) tmp = 0.0 if (F <= -0.125) tmp = Float64(-Float64(Float64(1.0 + Float64(cos(B) * x)) / sin(B))); elseif (F <= -5.8e-253) tmp = Float64(Float64(-Float64(x / B)) + Float64(Float64(F / sin(B)) * sqrt(0.5))); elseif (F <= 1.5e-21) tmp = Float64(-Float64(cos(B) * Float64(x / sin(B)))); else tmp = Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + (sin(B) ^ -1.0)); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -0.125) tmp = -((1.0 + (cos(B) * x)) / sin(B)); elseif (F <= -5.8e-253) tmp = -(x / B) + ((F / sin(B)) * sqrt(0.5)); elseif (F <= 1.5e-21) tmp = -(cos(B) * (x / sin(B))); else tmp = -(x * (1.0 / tan(B))) + (sin(B) ^ -1.0); end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -0.125], (-N[(N[(1.0 + N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), If[LessEqual[F, -5.8e-253], N[((-N[(x / B), $MachinePrecision]) + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.5e-21], (-N[(N[Cos[B], $MachinePrecision] * N[(x / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[Power[N[Sin[B], $MachinePrecision], -1.0], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -0.125:\\
\;\;\;\;-\frac{1 + \cos B \cdot x}{\sin B}\\
\mathbf{elif}\;F \leq -5.8 \cdot 10^{-253}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{F}{\sin B} \cdot \sqrt{0.5}\\
\mathbf{elif}\;F \leq 1.5 \cdot 10^{-21}:\\
\;\;\;\;-\cos B \cdot \frac{x}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;\left(-x \cdot \frac{1}{\tan B}\right) + {\sin B}^{-1}\\
\end{array}
\end{array}
if F < -0.125Initial program 60.0%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6499.2
Applied rewrites99.2%
if -0.125 < F < -5.7999999999999996e-253Initial program 99.5%
Taylor expanded in x around 0
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
+-commutativeN/A
pow2N/A
lower-fma.f6499.3
Applied rewrites99.3%
Taylor expanded in F around 0
Applied rewrites98.9%
Taylor expanded in B around 0
lift-/.f6469.9
Applied rewrites69.9%
if -5.7999999999999996e-253 < F < 1.49999999999999996e-21Initial program 99.4%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6472.4
Applied rewrites72.4%
lift-/.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-sin.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift-cos.f64N/A
lower-/.f64N/A
lift-sin.f6472.4
Applied rewrites72.4%
if 1.49999999999999996e-21 < F Initial program 59.5%
Taylor expanded in F around inf
inv-powN/A
lower-pow.f64N/A
lift-sin.f6496.3
Applied rewrites96.3%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (* (cos B) x)))
(if (<= F -0.125)
(- (/ (+ 1.0 t_0) (sin B)))
(if (<= F -5.8e-253)
(+ (- (/ x B)) (* (/ F (sin B)) (sqrt 0.5)))
(if (<= F 2e-14)
(- (* (cos B) (/ x (sin B))))
(/ (- 1.0 t_0) (sin B)))))))
double code(double F, double B, double x) {
double t_0 = cos(B) * x;
double tmp;
if (F <= -0.125) {
tmp = -((1.0 + t_0) / sin(B));
} else if (F <= -5.8e-253) {
tmp = -(x / B) + ((F / sin(B)) * sqrt(0.5));
} else if (F <= 2e-14) {
tmp = -(cos(B) * (x / sin(B)));
} else {
tmp = (1.0 - t_0) / sin(B);
}
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(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: tmp
t_0 = cos(b) * x
if (f <= (-0.125d0)) then
tmp = -((1.0d0 + t_0) / sin(b))
else if (f <= (-5.8d-253)) then
tmp = -(x / b) + ((f / sin(b)) * sqrt(0.5d0))
else if (f <= 2d-14) then
tmp = -(cos(b) * (x / sin(b)))
else
tmp = (1.0d0 - t_0) / sin(b)
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double t_0 = Math.cos(B) * x;
double tmp;
if (F <= -0.125) {
tmp = -((1.0 + t_0) / Math.sin(B));
} else if (F <= -5.8e-253) {
tmp = -(x / B) + ((F / Math.sin(B)) * Math.sqrt(0.5));
} else if (F <= 2e-14) {
tmp = -(Math.cos(B) * (x / Math.sin(B)));
} else {
tmp = (1.0 - t_0) / Math.sin(B);
}
return tmp;
}
def code(F, B, x): t_0 = math.cos(B) * x tmp = 0 if F <= -0.125: tmp = -((1.0 + t_0) / math.sin(B)) elif F <= -5.8e-253: tmp = -(x / B) + ((F / math.sin(B)) * math.sqrt(0.5)) elif F <= 2e-14: tmp = -(math.cos(B) * (x / math.sin(B))) else: tmp = (1.0 - t_0) / math.sin(B) return tmp
function code(F, B, x) t_0 = Float64(cos(B) * x) tmp = 0.0 if (F <= -0.125) tmp = Float64(-Float64(Float64(1.0 + t_0) / sin(B))); elseif (F <= -5.8e-253) tmp = Float64(Float64(-Float64(x / B)) + Float64(Float64(F / sin(B)) * sqrt(0.5))); elseif (F <= 2e-14) tmp = Float64(-Float64(cos(B) * Float64(x / sin(B)))); else tmp = Float64(Float64(1.0 - t_0) / sin(B)); end return tmp end
function tmp_2 = code(F, B, x) t_0 = cos(B) * x; tmp = 0.0; if (F <= -0.125) tmp = -((1.0 + t_0) / sin(B)); elseif (F <= -5.8e-253) tmp = -(x / B) + ((F / sin(B)) * sqrt(0.5)); elseif (F <= 2e-14) tmp = -(cos(B) * (x / sin(B))); else tmp = (1.0 - t_0) / sin(B); end tmp_2 = tmp; end
code[F_, B_, x_] := Block[{t$95$0 = N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[F, -0.125], (-N[(N[(1.0 + t$95$0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), If[LessEqual[F, -5.8e-253], N[((-N[(x / B), $MachinePrecision]) + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 2e-14], (-N[(N[Cos[B], $MachinePrecision] * N[(x / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), N[(N[(1.0 - t$95$0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos B \cdot x\\
\mathbf{if}\;F \leq -0.125:\\
\;\;\;\;-\frac{1 + t\_0}{\sin B}\\
\mathbf{elif}\;F \leq -5.8 \cdot 10^{-253}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{F}{\sin B} \cdot \sqrt{0.5}\\
\mathbf{elif}\;F \leq 2 \cdot 10^{-14}:\\
\;\;\;\;-\cos B \cdot \frac{x}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - t\_0}{\sin B}\\
\end{array}
\end{array}
if F < -0.125Initial program 60.0%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6499.2
Applied rewrites99.2%
if -0.125 < F < -5.7999999999999996e-253Initial program 99.5%
Taylor expanded in x around 0
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
+-commutativeN/A
pow2N/A
lower-fma.f6499.3
Applied rewrites99.3%
Taylor expanded in F around 0
Applied rewrites98.9%
Taylor expanded in B around 0
lift-/.f6469.9
Applied rewrites69.9%
if -5.7999999999999996e-253 < F < 2e-14Initial program 99.4%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6471.9
Applied rewrites71.9%
lift-/.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-sin.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift-cos.f64N/A
lower-/.f64N/A
lift-sin.f6471.9
Applied rewrites71.9%
if 2e-14 < F Initial program 59.1%
Taylor expanded in F around inf
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6497.0
Applied rewrites97.0%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (* (cos B) x)))
(if (<= F -2.6e-29)
(- (/ (+ 1.0 t_0) (sin B)))
(if (<= F 2e-14) (- (* (cos B) (/ x (sin B)))) (/ (- 1.0 t_0) (sin B))))))
double code(double F, double B, double x) {
double t_0 = cos(B) * x;
double tmp;
if (F <= -2.6e-29) {
tmp = -((1.0 + t_0) / sin(B));
} else if (F <= 2e-14) {
tmp = -(cos(B) * (x / sin(B)));
} else {
tmp = (1.0 - t_0) / sin(B);
}
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(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: tmp
t_0 = cos(b) * x
if (f <= (-2.6d-29)) then
tmp = -((1.0d0 + t_0) / sin(b))
else if (f <= 2d-14) then
tmp = -(cos(b) * (x / sin(b)))
else
tmp = (1.0d0 - t_0) / sin(b)
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double t_0 = Math.cos(B) * x;
double tmp;
if (F <= -2.6e-29) {
tmp = -((1.0 + t_0) / Math.sin(B));
} else if (F <= 2e-14) {
tmp = -(Math.cos(B) * (x / Math.sin(B)));
} else {
tmp = (1.0 - t_0) / Math.sin(B);
}
return tmp;
}
def code(F, B, x): t_0 = math.cos(B) * x tmp = 0 if F <= -2.6e-29: tmp = -((1.0 + t_0) / math.sin(B)) elif F <= 2e-14: tmp = -(math.cos(B) * (x / math.sin(B))) else: tmp = (1.0 - t_0) / math.sin(B) return tmp
function code(F, B, x) t_0 = Float64(cos(B) * x) tmp = 0.0 if (F <= -2.6e-29) tmp = Float64(-Float64(Float64(1.0 + t_0) / sin(B))); elseif (F <= 2e-14) tmp = Float64(-Float64(cos(B) * Float64(x / sin(B)))); else tmp = Float64(Float64(1.0 - t_0) / sin(B)); end return tmp end
function tmp_2 = code(F, B, x) t_0 = cos(B) * x; tmp = 0.0; if (F <= -2.6e-29) tmp = -((1.0 + t_0) / sin(B)); elseif (F <= 2e-14) tmp = -(cos(B) * (x / sin(B))); else tmp = (1.0 - t_0) / sin(B); end tmp_2 = tmp; end
code[F_, B_, x_] := Block[{t$95$0 = N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[F, -2.6e-29], (-N[(N[(1.0 + t$95$0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), If[LessEqual[F, 2e-14], (-N[(N[Cos[B], $MachinePrecision] * N[(x / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), N[(N[(1.0 - t$95$0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos B \cdot x\\
\mathbf{if}\;F \leq -2.6 \cdot 10^{-29}:\\
\;\;\;\;-\frac{1 + t\_0}{\sin B}\\
\mathbf{elif}\;F \leq 2 \cdot 10^{-14}:\\
\;\;\;\;-\cos B \cdot \frac{x}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - t\_0}{\sin B}\\
\end{array}
\end{array}
if F < -2.6000000000000002e-29Initial program 62.7%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6495.1
Applied rewrites95.1%
if -2.6000000000000002e-29 < F < 2e-14Initial program 99.5%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6468.9
Applied rewrites68.9%
lift-/.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-sin.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift-cos.f64N/A
lower-/.f64N/A
lift-sin.f6468.9
Applied rewrites68.9%
if 2e-14 < F Initial program 59.1%
Taylor expanded in F around inf
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6497.0
Applied rewrites97.0%
(FPCore (F B x) :precision binary64 (if (<= F 2e-14) (- (* (cos B) (/ x (sin B)))) (/ (- 1.0 (* (cos B) x)) (sin B))))
double code(double F, double B, double x) {
double tmp;
if (F <= 2e-14) {
tmp = -(cos(B) * (x / sin(B)));
} else {
tmp = (1.0 - (cos(B) * x)) / sin(B);
}
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(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: tmp
if (f <= 2d-14) then
tmp = -(cos(b) * (x / sin(b)))
else
tmp = (1.0d0 - (cos(b) * x)) / sin(b)
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= 2e-14) {
tmp = -(Math.cos(B) * (x / Math.sin(B)));
} else {
tmp = (1.0 - (Math.cos(B) * x)) / Math.sin(B);
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= 2e-14: tmp = -(math.cos(B) * (x / math.sin(B))) else: tmp = (1.0 - (math.cos(B) * x)) / math.sin(B) return tmp
function code(F, B, x) tmp = 0.0 if (F <= 2e-14) tmp = Float64(-Float64(cos(B) * Float64(x / sin(B)))); else tmp = Float64(Float64(1.0 - Float64(cos(B) * x)) / sin(B)); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= 2e-14) tmp = -(cos(B) * (x / sin(B))); else tmp = (1.0 - (cos(B) * x)) / sin(B); end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, 2e-14], (-N[(N[Cos[B], $MachinePrecision] * N[(x / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), N[(N[(1.0 - N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq 2 \cdot 10^{-14}:\\
\;\;\;\;-\cos B \cdot \frac{x}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - \cos B \cdot x}{\sin B}\\
\end{array}
\end{array}
if F < 2e-14Initial program 84.1%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6459.3
Applied rewrites59.3%
lift-/.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-sin.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift-cos.f64N/A
lower-/.f64N/A
lift-sin.f6459.3
Applied rewrites59.3%
if 2e-14 < F Initial program 59.1%
Taylor expanded in F around inf
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6497.0
Applied rewrites97.0%
(FPCore (F B x)
:precision binary64
(if (<= x -8.5e-103)
(- (* x (/ (cos B) (sin B))))
(if (<= x 7.6e-224)
(/ (* (sqrt 0.5) F) (sin B))
(if (<= x 1.55e-97) (pow (sin B) -1.0) (- (* (cos B) (/ x (sin B))))))))
double code(double F, double B, double x) {
double tmp;
if (x <= -8.5e-103) {
tmp = -(x * (cos(B) / sin(B)));
} else if (x <= 7.6e-224) {
tmp = (sqrt(0.5) * F) / sin(B);
} else if (x <= 1.55e-97) {
tmp = pow(sin(B), -1.0);
} else {
tmp = -(cos(B) * (x / sin(B)));
}
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(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: tmp
if (x <= (-8.5d-103)) then
tmp = -(x * (cos(b) / sin(b)))
else if (x <= 7.6d-224) then
tmp = (sqrt(0.5d0) * f) / sin(b)
else if (x <= 1.55d-97) then
tmp = sin(b) ** (-1.0d0)
else
tmp = -(cos(b) * (x / sin(b)))
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (x <= -8.5e-103) {
tmp = -(x * (Math.cos(B) / Math.sin(B)));
} else if (x <= 7.6e-224) {
tmp = (Math.sqrt(0.5) * F) / Math.sin(B);
} else if (x <= 1.55e-97) {
tmp = Math.pow(Math.sin(B), -1.0);
} else {
tmp = -(Math.cos(B) * (x / Math.sin(B)));
}
return tmp;
}
def code(F, B, x): tmp = 0 if x <= -8.5e-103: tmp = -(x * (math.cos(B) / math.sin(B))) elif x <= 7.6e-224: tmp = (math.sqrt(0.5) * F) / math.sin(B) elif x <= 1.55e-97: tmp = math.pow(math.sin(B), -1.0) else: tmp = -(math.cos(B) * (x / math.sin(B))) return tmp
function code(F, B, x) tmp = 0.0 if (x <= -8.5e-103) tmp = Float64(-Float64(x * Float64(cos(B) / sin(B)))); elseif (x <= 7.6e-224) tmp = Float64(Float64(sqrt(0.5) * F) / sin(B)); elseif (x <= 1.55e-97) tmp = sin(B) ^ -1.0; else tmp = Float64(-Float64(cos(B) * Float64(x / sin(B)))); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (x <= -8.5e-103) tmp = -(x * (cos(B) / sin(B))); elseif (x <= 7.6e-224) tmp = (sqrt(0.5) * F) / sin(B); elseif (x <= 1.55e-97) tmp = sin(B) ^ -1.0; else tmp = -(cos(B) * (x / sin(B))); end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[x, -8.5e-103], (-N[(x * N[(N[Cos[B], $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), If[LessEqual[x, 7.6e-224], N[(N[(N[Sqrt[0.5], $MachinePrecision] * F), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.55e-97], N[Power[N[Sin[B], $MachinePrecision], -1.0], $MachinePrecision], (-N[(N[Cos[B], $MachinePrecision] * N[(x / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision])]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -8.5 \cdot 10^{-103}:\\
\;\;\;\;-x \cdot \frac{\cos B}{\sin B}\\
\mathbf{elif}\;x \leq 7.6 \cdot 10^{-224}:\\
\;\;\;\;\frac{\sqrt{0.5} \cdot F}{\sin B}\\
\mathbf{elif}\;x \leq 1.55 \cdot 10^{-97}:\\
\;\;\;\;{\sin B}^{-1}\\
\mathbf{else}:\\
\;\;\;\;-\cos B \cdot \frac{x}{\sin B}\\
\end{array}
\end{array}
if x < -8.50000000000000032e-103Initial program 72.6%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6472.0
Applied rewrites72.0%
lift-/.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-sin.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift-cos.f64N/A
lift-sin.f6471.9
Applied rewrites71.9%
if -8.50000000000000032e-103 < x < 7.60000000000000005e-224Initial program 71.6%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites75.3%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
pow2N/A
unpow-1N/A
sqrt-pow1N/A
pow2N/A
+-commutativeN/A
metadata-evalN/A
lower-pow.f64N/A
+-commutativeN/A
pow2N/A
lift-fma.f64N/A
lift-sin.f64N/A
lift-/.f6457.4
Applied rewrites57.4%
Taylor expanded in F around 0
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
sqrt-unprodN/A
sqrt-unprodN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
metadata-evalN/A
lift-sin.f6437.8
Applied rewrites37.8%
if 7.60000000000000005e-224 < x < 1.55000000000000001e-97Initial program 71.6%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites74.2%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
pow2N/A
unpow-1N/A
sqrt-pow1N/A
pow2N/A
+-commutativeN/A
metadata-evalN/A
lower-pow.f64N/A
+-commutativeN/A
pow2N/A
lift-fma.f64N/A
lift-sin.f64N/A
lift-/.f6450.5
Applied rewrites50.5%
Taylor expanded in F around inf
inv-powN/A
lower-pow.f64N/A
lift-sin.f6428.3
Applied rewrites28.3%
if 1.55000000000000001e-97 < x Initial program 84.6%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6485.7
Applied rewrites85.7%
lift-/.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-sin.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift-cos.f64N/A
lower-/.f64N/A
lift-sin.f6485.7
Applied rewrites85.7%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (- (* x (/ (cos B) (sin B))))))
(if (<= x -8.5e-103)
t_0
(if (<= x 7.6e-224)
(/ (* (sqrt 0.5) F) (sin B))
(if (<= x 1.55e-97) (pow (sin B) -1.0) t_0)))))
double code(double F, double B, double x) {
double t_0 = -(x * (cos(B) / sin(B)));
double tmp;
if (x <= -8.5e-103) {
tmp = t_0;
} else if (x <= 7.6e-224) {
tmp = (sqrt(0.5) * F) / sin(B);
} else if (x <= 1.55e-97) {
tmp = pow(sin(B), -1.0);
} else {
tmp = t_0;
}
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(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: tmp
t_0 = -(x * (cos(b) / sin(b)))
if (x <= (-8.5d-103)) then
tmp = t_0
else if (x <= 7.6d-224) then
tmp = (sqrt(0.5d0) * f) / sin(b)
else if (x <= 1.55d-97) then
tmp = sin(b) ** (-1.0d0)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double t_0 = -(x * (Math.cos(B) / Math.sin(B)));
double tmp;
if (x <= -8.5e-103) {
tmp = t_0;
} else if (x <= 7.6e-224) {
tmp = (Math.sqrt(0.5) * F) / Math.sin(B);
} else if (x <= 1.55e-97) {
tmp = Math.pow(Math.sin(B), -1.0);
} else {
tmp = t_0;
}
return tmp;
}
def code(F, B, x): t_0 = -(x * (math.cos(B) / math.sin(B))) tmp = 0 if x <= -8.5e-103: tmp = t_0 elif x <= 7.6e-224: tmp = (math.sqrt(0.5) * F) / math.sin(B) elif x <= 1.55e-97: tmp = math.pow(math.sin(B), -1.0) else: tmp = t_0 return tmp
function code(F, B, x) t_0 = Float64(-Float64(x * Float64(cos(B) / sin(B)))) tmp = 0.0 if (x <= -8.5e-103) tmp = t_0; elseif (x <= 7.6e-224) tmp = Float64(Float64(sqrt(0.5) * F) / sin(B)); elseif (x <= 1.55e-97) tmp = sin(B) ^ -1.0; else tmp = t_0; end return tmp end
function tmp_2 = code(F, B, x) t_0 = -(x * (cos(B) / sin(B))); tmp = 0.0; if (x <= -8.5e-103) tmp = t_0; elseif (x <= 7.6e-224) tmp = (sqrt(0.5) * F) / sin(B); elseif (x <= 1.55e-97) tmp = sin(B) ^ -1.0; else tmp = t_0; end tmp_2 = tmp; end
code[F_, B_, x_] := Block[{t$95$0 = (-N[(x * N[(N[Cos[B], $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision])}, If[LessEqual[x, -8.5e-103], t$95$0, If[LessEqual[x, 7.6e-224], N[(N[(N[Sqrt[0.5], $MachinePrecision] * F), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.55e-97], N[Power[N[Sin[B], $MachinePrecision], -1.0], $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -x \cdot \frac{\cos B}{\sin B}\\
\mathbf{if}\;x \leq -8.5 \cdot 10^{-103}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 7.6 \cdot 10^{-224}:\\
\;\;\;\;\frac{\sqrt{0.5} \cdot F}{\sin B}\\
\mathbf{elif}\;x \leq 1.55 \cdot 10^{-97}:\\
\;\;\;\;{\sin B}^{-1}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -8.50000000000000032e-103 or 1.55000000000000001e-97 < x Initial program 80.4%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6480.9
Applied rewrites80.9%
lift-/.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-sin.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift-cos.f64N/A
lift-sin.f6480.8
Applied rewrites80.8%
if -8.50000000000000032e-103 < x < 7.60000000000000005e-224Initial program 71.6%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites75.3%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
pow2N/A
unpow-1N/A
sqrt-pow1N/A
pow2N/A
+-commutativeN/A
metadata-evalN/A
lower-pow.f64N/A
+-commutativeN/A
pow2N/A
lift-fma.f64N/A
lift-sin.f64N/A
lift-/.f6457.4
Applied rewrites57.4%
Taylor expanded in F around 0
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
sqrt-unprodN/A
sqrt-unprodN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
metadata-evalN/A
lift-sin.f6437.8
Applied rewrites37.8%
if 7.60000000000000005e-224 < x < 1.55000000000000001e-97Initial program 71.6%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites74.2%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
pow2N/A
unpow-1N/A
sqrt-pow1N/A
pow2N/A
+-commutativeN/A
metadata-evalN/A
lower-pow.f64N/A
+-commutativeN/A
pow2N/A
lift-fma.f64N/A
lift-sin.f64N/A
lift-/.f6450.5
Applied rewrites50.5%
Taylor expanded in F around inf
inv-powN/A
lower-pow.f64N/A
lift-sin.f6428.3
Applied rewrites28.3%
(FPCore (F B x) :precision binary64 (if (<= F -52000.0) (/ -1.0 (sin B)) (if (<= F 0.0027) (- (/ x (sin B))) (pow (sin B) -1.0))))
double code(double F, double B, double x) {
double tmp;
if (F <= -52000.0) {
tmp = -1.0 / sin(B);
} else if (F <= 0.0027) {
tmp = -(x / sin(B));
} else {
tmp = pow(sin(B), -1.0);
}
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(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: tmp
if (f <= (-52000.0d0)) then
tmp = (-1.0d0) / sin(b)
else if (f <= 0.0027d0) then
tmp = -(x / sin(b))
else
tmp = sin(b) ** (-1.0d0)
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -52000.0) {
tmp = -1.0 / Math.sin(B);
} else if (F <= 0.0027) {
tmp = -(x / Math.sin(B));
} else {
tmp = Math.pow(Math.sin(B), -1.0);
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -52000.0: tmp = -1.0 / math.sin(B) elif F <= 0.0027: tmp = -(x / math.sin(B)) else: tmp = math.pow(math.sin(B), -1.0) return tmp
function code(F, B, x) tmp = 0.0 if (F <= -52000.0) tmp = Float64(-1.0 / sin(B)); elseif (F <= 0.0027) tmp = Float64(-Float64(x / sin(B))); else tmp = sin(B) ^ -1.0; end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -52000.0) tmp = -1.0 / sin(B); elseif (F <= 0.0027) tmp = -(x / sin(B)); else tmp = sin(B) ^ -1.0; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -52000.0], N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 0.0027], (-N[(x / N[Sin[B], $MachinePrecision]), $MachinePrecision]), N[Power[N[Sin[B], $MachinePrecision], -1.0], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -52000:\\
\;\;\;\;\frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 0.0027:\\
\;\;\;\;-\frac{x}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;{\sin B}^{-1}\\
\end{array}
\end{array}
if F < -52000Initial program 59.5%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites73.5%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
pow2N/A
unpow-1N/A
sqrt-pow1N/A
pow2N/A
+-commutativeN/A
metadata-evalN/A
lower-pow.f64N/A
+-commutativeN/A
pow2N/A
lift-fma.f64N/A
lift-sin.f64N/A
lift-/.f6426.2
Applied rewrites26.2%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6454.3
Applied rewrites54.3%
if -52000 < F < 0.0027000000000000001Initial program 99.4%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6466.6
Applied rewrites66.6%
Taylor expanded in B around 0
Applied rewrites37.3%
if 0.0027000000000000001 < F Initial program 58.0%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites73.4%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
pow2N/A
unpow-1N/A
sqrt-pow1N/A
pow2N/A
+-commutativeN/A
metadata-evalN/A
lower-pow.f64N/A
+-commutativeN/A
pow2N/A
lift-fma.f64N/A
lift-sin.f64N/A
lift-/.f6425.8
Applied rewrites25.8%
Taylor expanded in F around inf
inv-powN/A
lower-pow.f64N/A
lift-sin.f6452.8
Applied rewrites52.8%
(FPCore (F B x) :precision binary64 (if (<= F -52000.0) (/ -1.0 (sin B)) (if (<= F 0.0027) (- (/ x B)) (pow (sin B) -1.0))))
double code(double F, double B, double x) {
double tmp;
if (F <= -52000.0) {
tmp = -1.0 / sin(B);
} else if (F <= 0.0027) {
tmp = -(x / B);
} else {
tmp = pow(sin(B), -1.0);
}
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(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: tmp
if (f <= (-52000.0d0)) then
tmp = (-1.0d0) / sin(b)
else if (f <= 0.0027d0) then
tmp = -(x / b)
else
tmp = sin(b) ** (-1.0d0)
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -52000.0) {
tmp = -1.0 / Math.sin(B);
} else if (F <= 0.0027) {
tmp = -(x / B);
} else {
tmp = Math.pow(Math.sin(B), -1.0);
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -52000.0: tmp = -1.0 / math.sin(B) elif F <= 0.0027: tmp = -(x / B) else: tmp = math.pow(math.sin(B), -1.0) return tmp
function code(F, B, x) tmp = 0.0 if (F <= -52000.0) tmp = Float64(-1.0 / sin(B)); elseif (F <= 0.0027) tmp = Float64(-Float64(x / B)); else tmp = sin(B) ^ -1.0; end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -52000.0) tmp = -1.0 / sin(B); elseif (F <= 0.0027) tmp = -(x / B); else tmp = sin(B) ^ -1.0; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -52000.0], N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 0.0027], (-N[(x / B), $MachinePrecision]), N[Power[N[Sin[B], $MachinePrecision], -1.0], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -52000:\\
\;\;\;\;\frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 0.0027:\\
\;\;\;\;-\frac{x}{B}\\
\mathbf{else}:\\
\;\;\;\;{\sin B}^{-1}\\
\end{array}
\end{array}
if F < -52000Initial program 59.5%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites73.5%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
pow2N/A
unpow-1N/A
sqrt-pow1N/A
pow2N/A
+-commutativeN/A
metadata-evalN/A
lower-pow.f64N/A
+-commutativeN/A
pow2N/A
lift-fma.f64N/A
lift-sin.f64N/A
lift-/.f6426.2
Applied rewrites26.2%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6454.3
Applied rewrites54.3%
if -52000 < F < 0.0027000000000000001Initial program 99.4%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6466.6
Applied rewrites66.6%
Taylor expanded in B around 0
lower-/.f6434.6
Applied rewrites34.6%
if 0.0027000000000000001 < F Initial program 58.0%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites73.4%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
pow2N/A
unpow-1N/A
sqrt-pow1N/A
pow2N/A
+-commutativeN/A
metadata-evalN/A
lower-pow.f64N/A
+-commutativeN/A
pow2N/A
lift-fma.f64N/A
lift-sin.f64N/A
lift-/.f6425.8
Applied rewrites25.8%
Taylor expanded in F around inf
inv-powN/A
lower-pow.f64N/A
lift-sin.f6452.8
Applied rewrites52.8%
(FPCore (F B x) :precision binary64 (if (<= B 1.36e-8) (- (/ x B)) (/ -1.0 (sin B))))
double code(double F, double B, double x) {
double tmp;
if (B <= 1.36e-8) {
tmp = -(x / B);
} else {
tmp = -1.0 / sin(B);
}
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(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: tmp
if (b <= 1.36d-8) then
tmp = -(x / b)
else
tmp = (-1.0d0) / sin(b)
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (B <= 1.36e-8) {
tmp = -(x / B);
} else {
tmp = -1.0 / Math.sin(B);
}
return tmp;
}
def code(F, B, x): tmp = 0 if B <= 1.36e-8: tmp = -(x / B) else: tmp = -1.0 / math.sin(B) return tmp
function code(F, B, x) tmp = 0.0 if (B <= 1.36e-8) tmp = Float64(-Float64(x / B)); else tmp = Float64(-1.0 / sin(B)); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (B <= 1.36e-8) tmp = -(x / B); else tmp = -1.0 / sin(B); end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[B, 1.36e-8], (-N[(x / B), $MachinePrecision]), N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq 1.36 \cdot 10^{-8}:\\
\;\;\;\;-\frac{x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{-1}{\sin B}\\
\end{array}
\end{array}
if B < 1.3599999999999999e-8Initial program 73.4%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6455.9
Applied rewrites55.9%
Taylor expanded in B around 0
lower-/.f6437.4
Applied rewrites37.4%
if 1.3599999999999999e-8 < B Initial program 86.9%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites87.0%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
pow2N/A
unpow-1N/A
sqrt-pow1N/A
pow2N/A
+-commutativeN/A
metadata-evalN/A
lower-pow.f64N/A
+-commutativeN/A
pow2N/A
lift-fma.f64N/A
lift-sin.f64N/A
lift-/.f6433.1
Applied rewrites33.1%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6417.2
Applied rewrites17.2%
(FPCore (F B x) :precision binary64 (- (/ x B)))
double code(double F, double B, double x) {
return -(x / B);
}
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(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
code = -(x / b)
end function
public static double code(double F, double B, double x) {
return -(x / B);
}
def code(F, B, x): return -(x / B)
function code(F, B, x) return Float64(-Float64(x / B)) end
function tmp = code(F, B, x) tmp = -(x / B); end
code[F_, B_, x_] := (-N[(x / B), $MachinePrecision])
\begin{array}{l}
\\
-\frac{x}{B}
\end{array}
Initial program 76.9%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6455.8
Applied rewrites55.8%
Taylor expanded in B around 0
lower-/.f6428.9
Applied rewrites28.9%
herbie shell --seed 2025101
(FPCore (F B x)
:name "VandenBroeck and Keller, Equation (23)"
:precision binary64
(+ (- (* x (/ 1.0 (tan B)))) (* (/ F (sin B)) (pow (+ (+ (* F F) 2.0) (* 2.0 x)) (- (/ 1.0 2.0))))))