
(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 29 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
(if (<= F -5e+25)
(fma (- x) (/ 1.0 (tan B)) (/ -1.0 (sin B)))
(if (<= F 2e+15)
(+
(- (/ (* x 1.0) (tan B)))
(* (/ F (sin B)) (pow (+ (+ (* F F) 2.0) (* 2.0 x)) (- (/ 1.0 2.0)))))
(+ (/ (- x) (tan B)) (/ 1.0 (sin B))))))
double code(double F, double B, double x) {
double tmp;
if (F <= -5e+25) {
tmp = fma(-x, (1.0 / tan(B)), (-1.0 / sin(B)));
} else if (F <= 2e+15) {
tmp = -((x * 1.0) / tan(B)) + ((F / sin(B)) * pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
} else {
tmp = (-x / tan(B)) + (1.0 / sin(B));
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -5e+25) tmp = fma(Float64(-x), Float64(1.0 / tan(B)), Float64(-1.0 / sin(B))); elseif (F <= 2e+15) tmp = Float64(Float64(-Float64(Float64(x * 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))))); else tmp = Float64(Float64(Float64(-x) / tan(B)) + Float64(1.0 / sin(B))); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -5e+25], N[((-x) * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision] + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 2e+15], N[((-N[(N[(x * 1.0), $MachinePrecision] / N[Tan[B], $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], N[(N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -5 \cdot 10^{+25}:\\
\;\;\;\;\mathsf{fma}\left(-x, \frac{1}{\tan B}, \frac{-1}{\sin B}\right)\\
\mathbf{elif}\;F \leq 2 \cdot 10^{+15}:\\
\;\;\;\;\left(-\frac{x \cdot 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)}\\
\mathbf{else}:\\
\;\;\;\;\frac{-x}{\tan B} + \frac{1}{\sin B}\\
\end{array}
\end{array}
if F < -5.00000000000000024e25Initial program 55.6%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
lift-+.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
lift-tan.f64N/A
lift-/.f6499.7
Applied rewrites99.7%
if -5.00000000000000024e25 < F < 2e15Initial program 99.4%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6499.5
Applied rewrites99.5%
if 2e15 < F Initial program 56.9%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6457.0
Applied rewrites57.0%
Taylor expanded in F around inf
lower-/.f64N/A
lift-sin.f6499.8
Applied rewrites99.8%
lift-neg.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
distribute-neg-fracN/A
*-rgt-identityN/A
lower-/.f64N/A
lower-neg.f64N/A
lift-tan.f6499.8
Applied rewrites99.8%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ 1.0 (tan B))))
(if (<= F -5.5e+25)
(fma (- x) t_0 (/ -1.0 (sin B)))
(if (<= F 2.85e-6)
(+ (- (* x t_0)) (* (/ F (sin B)) (pow (fma F F 2.0) -0.5)))
(+ (/ (- x) (tan B)) (/ 1.0 (sin B)))))))
double code(double F, double B, double x) {
double t_0 = 1.0 / tan(B);
double tmp;
if (F <= -5.5e+25) {
tmp = fma(-x, t_0, (-1.0 / sin(B)));
} else if (F <= 2.85e-6) {
tmp = -(x * t_0) + ((F / sin(B)) * pow(fma(F, F, 2.0), -0.5));
} else {
tmp = (-x / tan(B)) + (1.0 / sin(B));
}
return tmp;
}
function code(F, B, x) t_0 = Float64(1.0 / tan(B)) tmp = 0.0 if (F <= -5.5e+25) tmp = fma(Float64(-x), t_0, Float64(-1.0 / sin(B))); elseif (F <= 2.85e-6) tmp = Float64(Float64(-Float64(x * t_0)) + Float64(Float64(F / sin(B)) * (fma(F, F, 2.0) ^ -0.5))); else tmp = Float64(Float64(Float64(-x) / tan(B)) + Float64(1.0 / sin(B))); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -5.5e+25], N[((-x) * t$95$0 + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 2.85e-6], N[((-N[(x * t$95$0), $MachinePrecision]) + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Power[N[(F * F + 2.0), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{\tan B}\\
\mathbf{if}\;F \leq -5.5 \cdot 10^{+25}:\\
\;\;\;\;\mathsf{fma}\left(-x, t\_0, \frac{-1}{\sin B}\right)\\
\mathbf{elif}\;F \leq 2.85 \cdot 10^{-6}:\\
\;\;\;\;\left(-x \cdot t\_0\right) + \frac{F}{\sin B} \cdot {\left(\mathsf{fma}\left(F, F, 2\right)\right)}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;\frac{-x}{\tan B} + \frac{1}{\sin B}\\
\end{array}
\end{array}
if F < -5.50000000000000018e25Initial program 55.6%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
lift-+.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
lift-tan.f64N/A
lift-/.f6499.7
Applied rewrites99.7%
if -5.50000000000000018e25 < F < 2.8499999999999998e-6Initial program 99.4%
Taylor expanded in x around 0
metadata-evalN/A
metadata-evalN/A
lower-pow.f64N/A
+-commutativeN/A
pow2N/A
lower-fma.f64N/A
metadata-evalN/A
metadata-eval99.4
Applied rewrites99.4%
if 2.8499999999999998e-6 < F Initial program 58.8%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6458.9
Applied rewrites58.9%
Taylor expanded in F around inf
lower-/.f64N/A
lift-sin.f6498.3
Applied rewrites98.3%
lift-neg.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
distribute-neg-fracN/A
*-rgt-identityN/A
lower-/.f64N/A
lower-neg.f64N/A
lift-tan.f6498.3
Applied rewrites98.3%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ 1.0 (tan B))))
(if (<= F -5.5e+25)
(fma (- x) t_0 (/ -1.0 (sin B)))
(if (<= F 2.85e-6)
(fma (- x) t_0 (* (pow (fma 2.0 x (fma F F 2.0)) -0.5) (/ F (sin B))))
(+ (/ (- x) (tan B)) (/ 1.0 (sin B)))))))
double code(double F, double B, double x) {
double t_0 = 1.0 / tan(B);
double tmp;
if (F <= -5.5e+25) {
tmp = fma(-x, t_0, (-1.0 / sin(B)));
} else if (F <= 2.85e-6) {
tmp = fma(-x, t_0, (pow(fma(2.0, x, fma(F, F, 2.0)), -0.5) * (F / sin(B))));
} else {
tmp = (-x / tan(B)) + (1.0 / sin(B));
}
return tmp;
}
function code(F, B, x) t_0 = Float64(1.0 / tan(B)) tmp = 0.0 if (F <= -5.5e+25) tmp = fma(Float64(-x), t_0, Float64(-1.0 / sin(B))); elseif (F <= 2.85e-6) tmp = fma(Float64(-x), t_0, Float64((fma(2.0, x, fma(F, F, 2.0)) ^ -0.5) * Float64(F / sin(B)))); else tmp = Float64(Float64(Float64(-x) / tan(B)) + Float64(1.0 / sin(B))); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -5.5e+25], N[((-x) * t$95$0 + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 2.85e-6], N[((-x) * t$95$0 + N[(N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{\tan B}\\
\mathbf{if}\;F \leq -5.5 \cdot 10^{+25}:\\
\;\;\;\;\mathsf{fma}\left(-x, t\_0, \frac{-1}{\sin B}\right)\\
\mathbf{elif}\;F \leq 2.85 \cdot 10^{-6}:\\
\;\;\;\;\mathsf{fma}\left(-x, t\_0, {\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5} \cdot \frac{F}{\sin B}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{-x}{\tan B} + \frac{1}{\sin B}\\
\end{array}
\end{array}
if F < -5.50000000000000018e25Initial program 55.6%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
lift-+.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
lift-tan.f64N/A
lift-/.f6499.7
Applied rewrites99.7%
if -5.50000000000000018e25 < F < 2.8499999999999998e-6Initial program 99.4%
Applied rewrites99.4%
if 2.8499999999999998e-6 < F Initial program 58.8%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6458.9
Applied rewrites58.9%
Taylor expanded in F around inf
lower-/.f64N/A
lift-sin.f6498.3
Applied rewrites98.3%
lift-neg.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
distribute-neg-fracN/A
*-rgt-identityN/A
lower-/.f64N/A
lower-neg.f64N/A
lift-tan.f6498.3
Applied rewrites98.3%
(FPCore (F B x)
:precision binary64
(if (<= F -1.45)
(fma (- x) (/ 1.0 (tan B)) (/ -1.0 (sin B)))
(if (<= F 2.85e-6)
(/ (- (* (pow (fma 2.0 x 2.0) -0.5) F) (* (cos B) x)) (sin B))
(+ (/ (- x) (tan B)) (/ 1.0 (sin B))))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1.45) {
tmp = fma(-x, (1.0 / tan(B)), (-1.0 / sin(B)));
} else if (F <= 2.85e-6) {
tmp = ((pow(fma(2.0, x, 2.0), -0.5) * F) - (cos(B) * x)) / sin(B);
} else {
tmp = (-x / tan(B)) + (1.0 / sin(B));
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -1.45) tmp = fma(Float64(-x), Float64(1.0 / tan(B)), Float64(-1.0 / sin(B))); elseif (F <= 2.85e-6) tmp = Float64(Float64(Float64((fma(2.0, x, 2.0) ^ -0.5) * F) - Float64(cos(B) * x)) / sin(B)); else tmp = Float64(Float64(Float64(-x) / tan(B)) + Float64(1.0 / sin(B))); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -1.45], N[((-x) * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision] + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 2.85e-6], N[(N[(N[(N[Power[N[(2.0 * x + 2.0), $MachinePrecision], -0.5], $MachinePrecision] * F), $MachinePrecision] - N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], N[(N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.45:\\
\;\;\;\;\mathsf{fma}\left(-x, \frac{1}{\tan B}, \frac{-1}{\sin B}\right)\\
\mathbf{elif}\;F \leq 2.85 \cdot 10^{-6}:\\
\;\;\;\;\frac{{\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{-0.5} \cdot F - \cos B \cdot x}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;\frac{-x}{\tan B} + \frac{1}{\sin B}\\
\end{array}
\end{array}
if F < -1.44999999999999996Initial program 58.8%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6499.2
Applied rewrites99.2%
lift-+.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
lift-tan.f64N/A
lift-/.f6499.3
Applied rewrites99.3%
if -1.44999999999999996 < F < 2.8499999999999998e-6Initial program 99.5%
Taylor expanded in F around 0
metadata-evalN/A
metadata-evalN/A
sub-divN/A
lower-/.f64N/A
Applied rewrites99.3%
if 2.8499999999999998e-6 < F Initial program 58.8%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6458.9
Applied rewrites58.9%
Taylor expanded in F around inf
lower-/.f64N/A
lift-sin.f6498.3
Applied rewrites98.3%
lift-neg.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
distribute-neg-fracN/A
*-rgt-identityN/A
lower-/.f64N/A
lower-neg.f64N/A
lift-tan.f6498.3
Applied rewrites98.3%
(FPCore (F B x)
:precision binary64
(let* ((t_0
(+
(- (/ x B))
(*
(/ F (sin B))
(pow (+ (+ (* F F) 2.0) (* 2.0 x)) (- (/ 1.0 2.0))))))
(t_1 (/ (- x) (tan B))))
(if (<= F -0.000216)
(+ t_1 (/ -1.0 (sin B)))
(if (<= F -4.5e-130)
t_0
(if (<= F 4.2e-140)
(- (* (cos B) (/ x (sin B))))
(if (<= F 6.6e-7) t_0 (+ t_1 (/ 1.0 (sin B)))))))))
double code(double F, double B, double x) {
double t_0 = -(x / B) + ((F / sin(B)) * pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
double t_1 = -x / tan(B);
double tmp;
if (F <= -0.000216) {
tmp = t_1 + (-1.0 / sin(B));
} else if (F <= -4.5e-130) {
tmp = t_0;
} else if (F <= 4.2e-140) {
tmp = -(cos(B) * (x / sin(B)));
} else if (F <= 6.6e-7) {
tmp = t_0;
} else {
tmp = t_1 + (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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = -(x / b) + ((f / sin(b)) * ((((f * f) + 2.0d0) + (2.0d0 * x)) ** -(1.0d0 / 2.0d0)))
t_1 = -x / tan(b)
if (f <= (-0.000216d0)) then
tmp = t_1 + ((-1.0d0) / sin(b))
else if (f <= (-4.5d-130)) then
tmp = t_0
else if (f <= 4.2d-140) then
tmp = -(cos(b) * (x / sin(b)))
else if (f <= 6.6d-7) then
tmp = t_0
else
tmp = t_1 + (1.0d0 / sin(b))
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double t_0 = -(x / B) + ((F / Math.sin(B)) * Math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
double t_1 = -x / Math.tan(B);
double tmp;
if (F <= -0.000216) {
tmp = t_1 + (-1.0 / Math.sin(B));
} else if (F <= -4.5e-130) {
tmp = t_0;
} else if (F <= 4.2e-140) {
tmp = -(Math.cos(B) * (x / Math.sin(B)));
} else if (F <= 6.6e-7) {
tmp = t_0;
} else {
tmp = t_1 + (1.0 / Math.sin(B));
}
return tmp;
}
def code(F, B, x): t_0 = -(x / B) + ((F / math.sin(B)) * math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0))) t_1 = -x / math.tan(B) tmp = 0 if F <= -0.000216: tmp = t_1 + (-1.0 / math.sin(B)) elif F <= -4.5e-130: tmp = t_0 elif F <= 4.2e-140: tmp = -(math.cos(B) * (x / math.sin(B))) elif F <= 6.6e-7: tmp = t_0 else: tmp = t_1 + (1.0 / math.sin(B)) return tmp
function code(F, B, x) t_0 = Float64(Float64(-Float64(x / B)) + Float64(Float64(F / sin(B)) * (Float64(Float64(Float64(F * F) + 2.0) + Float64(2.0 * x)) ^ Float64(-Float64(1.0 / 2.0))))) t_1 = Float64(Float64(-x) / tan(B)) tmp = 0.0 if (F <= -0.000216) tmp = Float64(t_1 + Float64(-1.0 / sin(B))); elseif (F <= -4.5e-130) tmp = t_0; elseif (F <= 4.2e-140) tmp = Float64(-Float64(cos(B) * Float64(x / sin(B)))); elseif (F <= 6.6e-7) tmp = t_0; else tmp = Float64(t_1 + Float64(1.0 / sin(B))); end return tmp end
function tmp_2 = code(F, B, x) t_0 = -(x / B) + ((F / sin(B)) * ((((F * F) + 2.0) + (2.0 * x)) ^ -(1.0 / 2.0))); t_1 = -x / tan(B); tmp = 0.0; if (F <= -0.000216) tmp = t_1 + (-1.0 / sin(B)); elseif (F <= -4.5e-130) tmp = t_0; elseif (F <= 4.2e-140) tmp = -(cos(B) * (x / sin(B))); elseif (F <= 6.6e-7) tmp = t_0; else tmp = t_1 + (1.0 / sin(B)); end tmp_2 = tmp; end
code[F_, B_, x_] := Block[{t$95$0 = N[((-N[(x / B), $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]}, Block[{t$95$1 = N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -0.000216], N[(t$95$1 + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, -4.5e-130], t$95$0, If[LessEqual[F, 4.2e-140], (-N[(N[Cos[B], $MachinePrecision] * N[(x / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), If[LessEqual[F, 6.6e-7], t$95$0, N[(t$95$1 + N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(-\frac{x}{B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}\\
t_1 := \frac{-x}{\tan B}\\
\mathbf{if}\;F \leq -0.000216:\\
\;\;\;\;t\_1 + \frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq -4.5 \cdot 10^{-130}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;F \leq 4.2 \cdot 10^{-140}:\\
\;\;\;\;-\cos B \cdot \frac{x}{\sin B}\\
\mathbf{elif}\;F \leq 6.6 \cdot 10^{-7}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1 + \frac{1}{\sin B}\\
\end{array}
\end{array}
if F < -2.1599999999999999e-4Initial program 59.1%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6498.8
Applied rewrites98.8%
lift-neg.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-/l*N/A
distribute-neg-fracN/A
*-rgt-identityN/A
lower-/.f64N/A
lower-neg.f64N/A
lift-tan.f6498.9
Applied rewrites98.9%
if -2.1599999999999999e-4 < F < -4.5e-130 or 4.20000000000000035e-140 < F < 6.6000000000000003e-7Initial program 99.4%
Taylor expanded in B around 0
lower-/.f6476.6
Applied rewrites76.6%
if -4.5e-130 < F < 4.20000000000000035e-140Initial 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.f6482.2
Applied rewrites82.2%
associate-/l*82.2
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.f6482.2
Applied rewrites82.2%
if 6.6000000000000003e-7 < F Initial program 99.4%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6499.5
Applied rewrites99.5%
Taylor expanded in F around inf
lower-/.f64N/A
lift-sin.f6435.9
Applied rewrites35.9%
lift-neg.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
distribute-neg-fracN/A
*-rgt-identityN/A
lower-/.f64N/A
lower-neg.f64N/A
lift-tan.f6435.9
Applied rewrites35.9%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ 1.0 (tan B))))
(if (<= F -1.4)
(fma (- x) t_0 (/ -1.0 (sin B)))
(if (<= F 1.15e-38)
(+ (- (* x t_0)) (/ (* (pow (+ (fma F F (+ x x)) 2.0) -0.5) F) B))
(+ (/ (- x) (tan B)) (/ 1.0 (sin B)))))))
double code(double F, double B, double x) {
double t_0 = 1.0 / tan(B);
double tmp;
if (F <= -1.4) {
tmp = fma(-x, t_0, (-1.0 / sin(B)));
} else if (F <= 1.15e-38) {
tmp = -(x * t_0) + ((pow((fma(F, F, (x + x)) + 2.0), -0.5) * F) / B);
} else {
tmp = (-x / tan(B)) + (1.0 / sin(B));
}
return tmp;
}
function code(F, B, x) t_0 = Float64(1.0 / tan(B)) tmp = 0.0 if (F <= -1.4) tmp = fma(Float64(-x), t_0, Float64(-1.0 / sin(B))); elseif (F <= 1.15e-38) tmp = Float64(Float64(-Float64(x * t_0)) + Float64(Float64((Float64(fma(F, F, Float64(x + x)) + 2.0) ^ -0.5) * F) / B)); else tmp = Float64(Float64(Float64(-x) / tan(B)) + Float64(1.0 / sin(B))); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -1.4], N[((-x) * t$95$0 + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.15e-38], N[((-N[(x * t$95$0), $MachinePrecision]) + N[(N[(N[Power[N[(N[(F * F + N[(x + x), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision], -0.5], $MachinePrecision] * F), $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision], N[(N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{\tan B}\\
\mathbf{if}\;F \leq -1.4:\\
\;\;\;\;\mathsf{fma}\left(-x, t\_0, \frac{-1}{\sin B}\right)\\
\mathbf{elif}\;F \leq 1.15 \cdot 10^{-38}:\\
\;\;\;\;\left(-x \cdot t\_0\right) + \frac{{\left(\mathsf{fma}\left(F, F, x + x\right) + 2\right)}^{-0.5} \cdot F}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{-x}{\tan B} + \frac{1}{\sin B}\\
\end{array}
\end{array}
if F < -1.3999999999999999Initial program 58.8%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6499.2
Applied rewrites99.2%
lift-+.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
lift-tan.f64N/A
lift-/.f6499.3
Applied rewrites99.3%
if -1.3999999999999999 < F < 1.15000000000000001e-38Initial program 99.5%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites84.0%
if 1.15000000000000001e-38 < F Initial program 61.9%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6462.0
Applied rewrites62.0%
Taylor expanded in F around inf
lower-/.f64N/A
lift-sin.f6494.0
Applied rewrites94.0%
lift-neg.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
distribute-neg-fracN/A
*-rgt-identityN/A
lower-/.f64N/A
lower-neg.f64N/A
lift-tan.f6494.0
Applied rewrites94.0%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ (- x) (tan B))))
(if (<= F -0.000216)
(+ t_0 (/ -1.0 (sin B)))
(if (<= F 1.15e-38)
(+
(- (* x (/ 1.0 (tan B))))
(/ (* (pow (+ (fma F F (+ x x)) 2.0) -0.5) F) B))
(+ t_0 (/ 1.0 (sin B)))))))
double code(double F, double B, double x) {
double t_0 = -x / tan(B);
double tmp;
if (F <= -0.000216) {
tmp = t_0 + (-1.0 / sin(B));
} else if (F <= 1.15e-38) {
tmp = -(x * (1.0 / tan(B))) + ((pow((fma(F, F, (x + x)) + 2.0), -0.5) * F) / B);
} else {
tmp = t_0 + (1.0 / sin(B));
}
return tmp;
}
function code(F, B, x) t_0 = Float64(Float64(-x) / tan(B)) tmp = 0.0 if (F <= -0.000216) tmp = Float64(t_0 + Float64(-1.0 / sin(B))); elseif (F <= 1.15e-38) tmp = Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(Float64((Float64(fma(F, F, Float64(x + x)) + 2.0) ^ -0.5) * F) / B)); else tmp = Float64(t_0 + Float64(1.0 / sin(B))); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -0.000216], N[(t$95$0 + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.15e-38], N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(N[(N[Power[N[(N[(F * F + N[(x + x), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision], -0.5], $MachinePrecision] * F), $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-x}{\tan B}\\
\mathbf{if}\;F \leq -0.000216:\\
\;\;\;\;t\_0 + \frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 1.15 \cdot 10^{-38}:\\
\;\;\;\;\left(-x \cdot \frac{1}{\tan B}\right) + \frac{{\left(\mathsf{fma}\left(F, F, x + x\right) + 2\right)}^{-0.5} \cdot F}{B}\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \frac{1}{\sin B}\\
\end{array}
\end{array}
if F < -2.1599999999999999e-4Initial program 59.1%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6498.8
Applied rewrites98.8%
lift-neg.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-/l*N/A
distribute-neg-fracN/A
*-rgt-identityN/A
lower-/.f64N/A
lower-neg.f64N/A
lift-tan.f6498.9
Applied rewrites98.9%
if -2.1599999999999999e-4 < F < 1.15000000000000001e-38Initial program 99.5%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites84.1%
if 1.15000000000000001e-38 < F Initial program 61.9%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6462.0
Applied rewrites62.0%
Taylor expanded in F around inf
lower-/.f64N/A
lift-sin.f6494.0
Applied rewrites94.0%
lift-neg.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
distribute-neg-fracN/A
*-rgt-identityN/A
lower-/.f64N/A
lower-neg.f64N/A
lift-tan.f6494.0
Applied rewrites94.0%
(FPCore (F B x)
:precision binary64
(let* ((t_0
(+
(- (/ x B))
(*
(/ F (sin B))
(pow (+ (+ (* F F) 2.0) (* 2.0 x)) (- (/ 1.0 2.0)))))))
(if (<= F -0.000216)
(+ (/ (- x) (tan B)) (/ -1.0 (sin B)))
(if (<= F -4.5e-130)
t_0
(if (<= F 4.2e-140)
(- (* (cos B) (/ x (sin B))))
(if (<= F 4.3e+139)
t_0
(+
(- (/ (* x 1.0) (tan B)))
(/
1.0
(*
(+
1.0
(*
(- (* 0.008333333333333333 (* B B)) 0.16666666666666666)
(* B B)))
B)))))))))
double code(double F, double B, double x) {
double t_0 = -(x / B) + ((F / sin(B)) * pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
double tmp;
if (F <= -0.000216) {
tmp = (-x / tan(B)) + (-1.0 / sin(B));
} else if (F <= -4.5e-130) {
tmp = t_0;
} else if (F <= 4.2e-140) {
tmp = -(cos(B) * (x / sin(B)));
} else if (F <= 4.3e+139) {
tmp = t_0;
} else {
tmp = -((x * 1.0) / tan(B)) + (1.0 / ((1.0 + (((0.008333333333333333 * (B * B)) - 0.16666666666666666) * (B * B))) * 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 = -(x / b) + ((f / sin(b)) * ((((f * f) + 2.0d0) + (2.0d0 * x)) ** -(1.0d0 / 2.0d0)))
if (f <= (-0.000216d0)) then
tmp = (-x / tan(b)) + ((-1.0d0) / sin(b))
else if (f <= (-4.5d-130)) then
tmp = t_0
else if (f <= 4.2d-140) then
tmp = -(cos(b) * (x / sin(b)))
else if (f <= 4.3d+139) then
tmp = t_0
else
tmp = -((x * 1.0d0) / tan(b)) + (1.0d0 / ((1.0d0 + (((0.008333333333333333d0 * (b * b)) - 0.16666666666666666d0) * (b * b))) * b))
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double t_0 = -(x / B) + ((F / Math.sin(B)) * Math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
double tmp;
if (F <= -0.000216) {
tmp = (-x / Math.tan(B)) + (-1.0 / Math.sin(B));
} else if (F <= -4.5e-130) {
tmp = t_0;
} else if (F <= 4.2e-140) {
tmp = -(Math.cos(B) * (x / Math.sin(B)));
} else if (F <= 4.3e+139) {
tmp = t_0;
} else {
tmp = -((x * 1.0) / Math.tan(B)) + (1.0 / ((1.0 + (((0.008333333333333333 * (B * B)) - 0.16666666666666666) * (B * B))) * B));
}
return tmp;
}
def code(F, B, x): t_0 = -(x / B) + ((F / math.sin(B)) * math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0))) tmp = 0 if F <= -0.000216: tmp = (-x / math.tan(B)) + (-1.0 / math.sin(B)) elif F <= -4.5e-130: tmp = t_0 elif F <= 4.2e-140: tmp = -(math.cos(B) * (x / math.sin(B))) elif F <= 4.3e+139: tmp = t_0 else: tmp = -((x * 1.0) / math.tan(B)) + (1.0 / ((1.0 + (((0.008333333333333333 * (B * B)) - 0.16666666666666666) * (B * B))) * B)) return tmp
function code(F, B, x) t_0 = Float64(Float64(-Float64(x / B)) + Float64(Float64(F / sin(B)) * (Float64(Float64(Float64(F * F) + 2.0) + Float64(2.0 * x)) ^ Float64(-Float64(1.0 / 2.0))))) tmp = 0.0 if (F <= -0.000216) tmp = Float64(Float64(Float64(-x) / tan(B)) + Float64(-1.0 / sin(B))); elseif (F <= -4.5e-130) tmp = t_0; elseif (F <= 4.2e-140) tmp = Float64(-Float64(cos(B) * Float64(x / sin(B)))); elseif (F <= 4.3e+139) tmp = t_0; else tmp = Float64(Float64(-Float64(Float64(x * 1.0) / tan(B))) + Float64(1.0 / Float64(Float64(1.0 + Float64(Float64(Float64(0.008333333333333333 * Float64(B * B)) - 0.16666666666666666) * Float64(B * B))) * B))); end return tmp end
function tmp_2 = code(F, B, x) t_0 = -(x / B) + ((F / sin(B)) * ((((F * F) + 2.0) + (2.0 * x)) ^ -(1.0 / 2.0))); tmp = 0.0; if (F <= -0.000216) tmp = (-x / tan(B)) + (-1.0 / sin(B)); elseif (F <= -4.5e-130) tmp = t_0; elseif (F <= 4.2e-140) tmp = -(cos(B) * (x / sin(B))); elseif (F <= 4.3e+139) tmp = t_0; else tmp = -((x * 1.0) / tan(B)) + (1.0 / ((1.0 + (((0.008333333333333333 * (B * B)) - 0.16666666666666666) * (B * B))) * B)); end tmp_2 = tmp; end
code[F_, B_, x_] := Block[{t$95$0 = N[((-N[(x / B), $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]}, If[LessEqual[F, -0.000216], N[(N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision] + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, -4.5e-130], t$95$0, If[LessEqual[F, 4.2e-140], (-N[(N[Cos[B], $MachinePrecision] * N[(x / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), If[LessEqual[F, 4.3e+139], t$95$0, N[((-N[(N[(x * 1.0), $MachinePrecision] / N[Tan[B], $MachinePrecision]), $MachinePrecision]) + N[(1.0 / N[(N[(1.0 + N[(N[(N[(0.008333333333333333 * N[(B * B), $MachinePrecision]), $MachinePrecision] - 0.16666666666666666), $MachinePrecision] * N[(B * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(-\frac{x}{B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}\\
\mathbf{if}\;F \leq -0.000216:\\
\;\;\;\;\frac{-x}{\tan B} + \frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq -4.5 \cdot 10^{-130}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;F \leq 4.2 \cdot 10^{-140}:\\
\;\;\;\;-\cos B \cdot \frac{x}{\sin B}\\
\mathbf{elif}\;F \leq 4.3 \cdot 10^{+139}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\left(-\frac{x \cdot 1}{\tan B}\right) + \frac{1}{\left(1 + \left(0.008333333333333333 \cdot \left(B \cdot B\right) - 0.16666666666666666\right) \cdot \left(B \cdot B\right)\right) \cdot B}\\
\end{array}
\end{array}
if F < -2.1599999999999999e-4Initial program 59.1%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6498.8
Applied rewrites98.8%
lift-neg.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-/l*N/A
distribute-neg-fracN/A
*-rgt-identityN/A
lower-/.f64N/A
lower-neg.f64N/A
lift-tan.f6498.9
Applied rewrites98.9%
if -2.1599999999999999e-4 < F < -4.5e-130 or 4.20000000000000035e-140 < F < 4.2999999999999998e139Initial program 95.9%
Taylor expanded in B around 0
lower-/.f6474.1
Applied rewrites74.1%
if -4.5e-130 < F < 4.20000000000000035e-140Initial 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.f6482.2
Applied rewrites82.2%
associate-/l*82.2
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.f6482.2
Applied rewrites82.2%
if 4.2999999999999998e139 < F Initial program 95.9%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6496.0
Applied rewrites96.0%
Taylor expanded in F around inf
lower-/.f64N/A
lift-sin.f6458.1
Applied rewrites58.1%
Taylor expanded in B around 0
*-commutativeN/A
lower-*.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6452.0
Applied rewrites52.0%
(FPCore (F B x)
:precision binary64
(if (<= x -6.8e-8)
(+ (- (* x (/ 1.0 (tan B)))) (/ -1.0 B))
(if (<= x 5.7e-18)
(+
(- (/ x B))
(* (/ F (sin B)) (pow (+ (+ (* F F) 2.0) (* 2.0 x)) (- (/ 1.0 2.0)))))
(- (* (cos B) (/ x (sin B)))))))
double code(double F, double B, double x) {
double tmp;
if (x <= -6.8e-8) {
tmp = -(x * (1.0 / tan(B))) + (-1.0 / B);
} else if (x <= 5.7e-18) {
tmp = -(x / B) + ((F / sin(B)) * pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.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 <= (-6.8d-8)) then
tmp = -(x * (1.0d0 / tan(b))) + ((-1.0d0) / b)
else if (x <= 5.7d-18) then
tmp = -(x / b) + ((f / sin(b)) * ((((f * f) + 2.0d0) + (2.0d0 * x)) ** -(1.0d0 / 2.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 <= -6.8e-8) {
tmp = -(x * (1.0 / Math.tan(B))) + (-1.0 / B);
} else if (x <= 5.7e-18) {
tmp = -(x / B) + ((F / Math.sin(B)) * Math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
} else {
tmp = -(Math.cos(B) * (x / Math.sin(B)));
}
return tmp;
}
def code(F, B, x): tmp = 0 if x <= -6.8e-8: tmp = -(x * (1.0 / math.tan(B))) + (-1.0 / B) elif x <= 5.7e-18: tmp = -(x / B) + ((F / math.sin(B)) * math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0))) else: tmp = -(math.cos(B) * (x / math.sin(B))) return tmp
function code(F, B, x) tmp = 0.0 if (x <= -6.8e-8) tmp = Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(-1.0 / B)); elseif (x <= 5.7e-18) tmp = Float64(Float64(-Float64(x / B)) + 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(-Float64(cos(B) * Float64(x / sin(B)))); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (x <= -6.8e-8) tmp = -(x * (1.0 / tan(B))) + (-1.0 / B); elseif (x <= 5.7e-18) tmp = -(x / B) + ((F / sin(B)) * ((((F * F) + 2.0) + (2.0 * x)) ^ -(1.0 / 2.0))); else tmp = -(cos(B) * (x / sin(B))); end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[x, -6.8e-8], N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(-1.0 / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 5.7e-18], N[((-N[(x / B), $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], (-N[(N[Cos[B], $MachinePrecision] * N[(x / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision])]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.8 \cdot 10^{-8}:\\
\;\;\;\;\left(-x \cdot \frac{1}{\tan B}\right) + \frac{-1}{B}\\
\mathbf{elif}\;x \leq 5.7 \cdot 10^{-18}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}\\
\mathbf{else}:\\
\;\;\;\;-\cos B \cdot \frac{x}{\sin B}\\
\end{array}
\end{array}
if x < -6.8e-8Initial program 70.8%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6494.6
Applied rewrites94.6%
Taylor expanded in B around 0
Applied rewrites94.4%
if -6.8e-8 < x < 5.69999999999999971e-18Initial program 72.1%
Taylor expanded in B around 0
lower-/.f6460.6
Applied rewrites60.6%
if 5.69999999999999971e-18 < x Initial program 87.7%
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.f6496.1
Applied rewrites96.1%
associate-/l*96.1
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.f6496.1
Applied rewrites96.1%
(FPCore (F B x)
:precision binary64
(if (<= x -6.8e-8)
(+ (- (* x (/ 1.0 (tan B)))) (/ -1.0 B))
(if (<= x 5.7e-18)
(+ (- (* x (/ 1.0 B))) (* (/ F (sin B)) (pow (fma F F 2.0) -0.5)))
(- (* (cos B) (/ x (sin B)))))))
double code(double F, double B, double x) {
double tmp;
if (x <= -6.8e-8) {
tmp = -(x * (1.0 / tan(B))) + (-1.0 / B);
} else if (x <= 5.7e-18) {
tmp = -(x * (1.0 / B)) + ((F / sin(B)) * pow(fma(F, F, 2.0), -0.5));
} else {
tmp = -(cos(B) * (x / sin(B)));
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (x <= -6.8e-8) tmp = Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(-1.0 / B)); elseif (x <= 5.7e-18) tmp = Float64(Float64(-Float64(x * Float64(1.0 / B))) + Float64(Float64(F / sin(B)) * (fma(F, F, 2.0) ^ -0.5))); else tmp = Float64(-Float64(cos(B) * Float64(x / sin(B)))); end return tmp end
code[F_, B_, x_] := If[LessEqual[x, -6.8e-8], N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(-1.0 / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 5.7e-18], N[((-N[(x * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]) + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Power[N[(F * F + 2.0), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], (-N[(N[Cos[B], $MachinePrecision] * N[(x / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision])]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.8 \cdot 10^{-8}:\\
\;\;\;\;\left(-x \cdot \frac{1}{\tan B}\right) + \frac{-1}{B}\\
\mathbf{elif}\;x \leq 5.7 \cdot 10^{-18}:\\
\;\;\;\;\left(-x \cdot \frac{1}{B}\right) + \frac{F}{\sin B} \cdot {\left(\mathsf{fma}\left(F, F, 2\right)\right)}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;-\cos B \cdot \frac{x}{\sin B}\\
\end{array}
\end{array}
if x < -6.8e-8Initial program 70.8%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6494.6
Applied rewrites94.6%
Taylor expanded in B around 0
Applied rewrites94.4%
if -6.8e-8 < x < 5.69999999999999971e-18Initial program 72.1%
Taylor expanded in x around 0
metadata-evalN/A
metadata-evalN/A
lower-pow.f64N/A
+-commutativeN/A
pow2N/A
lower-fma.f64N/A
metadata-evalN/A
metadata-eval72.1
Applied rewrites72.1%
Taylor expanded in B around 0
Applied rewrites60.6%
if 5.69999999999999971e-18 < x Initial program 87.7%
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.f6496.1
Applied rewrites96.1%
associate-/l*96.1
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.f6496.1
Applied rewrites96.1%
(FPCore (F B x)
:precision binary64
(if (<= x -6.8e-8)
(+ (- (* x (/ 1.0 (tan B)))) (/ -1.0 B))
(if (<= x 5.7e-18)
(+ (- (* x (/ 1.0 B))) (* (/ F (sin B)) (pow (fma F F 2.0) -0.5)))
(- (/ (* (cos B) x) (sin B))))))
double code(double F, double B, double x) {
double tmp;
if (x <= -6.8e-8) {
tmp = -(x * (1.0 / tan(B))) + (-1.0 / B);
} else if (x <= 5.7e-18) {
tmp = -(x * (1.0 / B)) + ((F / sin(B)) * pow(fma(F, F, 2.0), -0.5));
} else {
tmp = -((cos(B) * x) / sin(B));
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (x <= -6.8e-8) tmp = Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(-1.0 / B)); elseif (x <= 5.7e-18) tmp = Float64(Float64(-Float64(x * Float64(1.0 / B))) + Float64(Float64(F / sin(B)) * (fma(F, F, 2.0) ^ -0.5))); else tmp = Float64(-Float64(Float64(cos(B) * x) / sin(B))); end return tmp end
code[F_, B_, x_] := If[LessEqual[x, -6.8e-8], N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(-1.0 / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 5.7e-18], N[((-N[(x * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]) + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Power[N[(F * F + 2.0), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], (-N[(N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision])]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.8 \cdot 10^{-8}:\\
\;\;\;\;\left(-x \cdot \frac{1}{\tan B}\right) + \frac{-1}{B}\\
\mathbf{elif}\;x \leq 5.7 \cdot 10^{-18}:\\
\;\;\;\;\left(-x \cdot \frac{1}{B}\right) + \frac{F}{\sin B} \cdot {\left(\mathsf{fma}\left(F, F, 2\right)\right)}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;-\frac{\cos B \cdot x}{\sin B}\\
\end{array}
\end{array}
if x < -6.8e-8Initial program 70.8%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6494.6
Applied rewrites94.6%
Taylor expanded in B around 0
Applied rewrites94.4%
if -6.8e-8 < x < 5.69999999999999971e-18Initial program 72.1%
Taylor expanded in x around 0
metadata-evalN/A
metadata-evalN/A
lower-pow.f64N/A
+-commutativeN/A
pow2N/A
lower-fma.f64N/A
metadata-evalN/A
metadata-eval72.1
Applied rewrites72.1%
Taylor expanded in B around 0
Applied rewrites60.6%
if 5.69999999999999971e-18 < x Initial program 87.7%
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.f6496.1
Applied rewrites96.1%
(FPCore (F B x)
:precision binary64
(if (<= x -6.8e-8)
(+ (- (* x (/ 1.0 (tan B)))) (/ -1.0 B))
(if (<= x 0.015)
(+ (- (* x (/ 1.0 B))) (* (/ F (sin B)) (pow (fma F F 2.0) -0.5)))
(+ (- (/ (* x 1.0) (tan B))) (/ 1.0 B)))))
double code(double F, double B, double x) {
double tmp;
if (x <= -6.8e-8) {
tmp = -(x * (1.0 / tan(B))) + (-1.0 / B);
} else if (x <= 0.015) {
tmp = -(x * (1.0 / B)) + ((F / sin(B)) * pow(fma(F, F, 2.0), -0.5));
} else {
tmp = -((x * 1.0) / tan(B)) + (1.0 / B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (x <= -6.8e-8) tmp = Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(-1.0 / B)); elseif (x <= 0.015) tmp = Float64(Float64(-Float64(x * Float64(1.0 / B))) + Float64(Float64(F / sin(B)) * (fma(F, F, 2.0) ^ -0.5))); else tmp = Float64(Float64(-Float64(Float64(x * 1.0) / tan(B))) + Float64(1.0 / B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[x, -6.8e-8], N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(-1.0 / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.015], N[((-N[(x * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]) + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Power[N[(F * F + 2.0), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-N[(N[(x * 1.0), $MachinePrecision] / N[Tan[B], $MachinePrecision]), $MachinePrecision]) + N[(1.0 / B), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.8 \cdot 10^{-8}:\\
\;\;\;\;\left(-x \cdot \frac{1}{\tan B}\right) + \frac{-1}{B}\\
\mathbf{elif}\;x \leq 0.015:\\
\;\;\;\;\left(-x \cdot \frac{1}{B}\right) + \frac{F}{\sin B} \cdot {\left(\mathsf{fma}\left(F, F, 2\right)\right)}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;\left(-\frac{x \cdot 1}{\tan B}\right) + \frac{1}{B}\\
\end{array}
\end{array}
if x < -6.8e-8Initial program 70.8%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6494.6
Applied rewrites94.6%
Taylor expanded in B around 0
Applied rewrites94.4%
if -6.8e-8 < x < 0.014999999999999999Initial program 72.0%
Taylor expanded in x around 0
metadata-evalN/A
metadata-evalN/A
lower-pow.f64N/A
+-commutativeN/A
pow2N/A
lower-fma.f64N/A
metadata-evalN/A
metadata-eval71.9
Applied rewrites71.9%
Taylor expanded in B around 0
Applied rewrites60.0%
if 0.014999999999999999 < x Initial program 88.6%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6488.8
Applied rewrites88.8%
Taylor expanded in F around inf
lower-/.f64N/A
lift-sin.f6497.7
Applied rewrites97.7%
Taylor expanded in B around 0
lower-/.f6498.4
Applied rewrites98.4%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (- (* x (/ 1.0 (tan B))))))
(if (<= x -3.1e-109)
(+ t_0 (/ -1.0 (* (fma (* B B) -0.16666666666666666 1.0) B)))
(if (<= x 7.5e-119)
(/ (* (pow (fma F F 2.0) -0.5) F) (sin B))
(+
t_0
(/
-1.0
(*
(fma
(- (* 0.008333333333333333 (* B B)) 0.16666666666666666)
(* B B)
1.0)
B)))))))
double code(double F, double B, double x) {
double t_0 = -(x * (1.0 / tan(B)));
double tmp;
if (x <= -3.1e-109) {
tmp = t_0 + (-1.0 / (fma((B * B), -0.16666666666666666, 1.0) * B));
} else if (x <= 7.5e-119) {
tmp = (pow(fma(F, F, 2.0), -0.5) * F) / sin(B);
} else {
tmp = t_0 + (-1.0 / (fma(((0.008333333333333333 * (B * B)) - 0.16666666666666666), (B * B), 1.0) * B));
}
return tmp;
}
function code(F, B, x) t_0 = Float64(-Float64(x * Float64(1.0 / tan(B)))) tmp = 0.0 if (x <= -3.1e-109) tmp = Float64(t_0 + Float64(-1.0 / Float64(fma(Float64(B * B), -0.16666666666666666, 1.0) * B))); elseif (x <= 7.5e-119) tmp = Float64(Float64((fma(F, F, 2.0) ^ -0.5) * F) / sin(B)); else tmp = Float64(t_0 + Float64(-1.0 / Float64(fma(Float64(Float64(0.008333333333333333 * Float64(B * B)) - 0.16666666666666666), Float64(B * B), 1.0) * B))); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = (-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision])}, If[LessEqual[x, -3.1e-109], N[(t$95$0 + N[(-1.0 / N[(N[(N[(B * B), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 7.5e-119], N[(N[(N[Power[N[(F * F + 2.0), $MachinePrecision], -0.5], $MachinePrecision] * F), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(-1.0 / N[(N[(N[(N[(0.008333333333333333 * N[(B * B), $MachinePrecision]), $MachinePrecision] - 0.16666666666666666), $MachinePrecision] * N[(B * B), $MachinePrecision] + 1.0), $MachinePrecision] * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -x \cdot \frac{1}{\tan B}\\
\mathbf{if}\;x \leq -3.1 \cdot 10^{-109}:\\
\;\;\;\;t\_0 + \frac{-1}{\mathsf{fma}\left(B \cdot B, -0.16666666666666666, 1\right) \cdot B}\\
\mathbf{elif}\;x \leq 7.5 \cdot 10^{-119}:\\
\;\;\;\;\frac{{\left(\mathsf{fma}\left(F, F, 2\right)\right)}^{-0.5} \cdot F}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \frac{-1}{\mathsf{fma}\left(0.008333333333333333 \cdot \left(B \cdot B\right) - 0.16666666666666666, B \cdot B, 1\right) \cdot B}\\
\end{array}
\end{array}
if x < -3.1e-109Initial program 71.4%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6463.8
Applied rewrites63.8%
Taylor expanded in B around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6465.7
Applied rewrites65.7%
if -3.1e-109 < x < 7.50000000000000044e-119Initial program 72.3%
Taylor expanded in x around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
+-commutativeN/A
pow2N/A
lower-fma.f64N/A
metadata-evalN/A
metadata-evalN/A
lift-sin.f6460.2
Applied rewrites60.2%
if 7.50000000000000044e-119 < x Initial program 83.6%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6477.4
Applied rewrites77.4%
Taylor expanded in B around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6479.7
Applied rewrites79.7%
(FPCore (F B x)
:precision binary64
(let* ((t_0
(+
(- (* x (/ 1.0 (tan B))))
(/ -1.0 (* (fma (* B B) -0.16666666666666666 1.0) B)))))
(if (<= x -3.1e-109)
t_0
(if (<= x 7.5e-119) (/ (* (pow (fma F F 2.0) -0.5) F) (sin B)) t_0))))
double code(double F, double B, double x) {
double t_0 = -(x * (1.0 / tan(B))) + (-1.0 / (fma((B * B), -0.16666666666666666, 1.0) * B));
double tmp;
if (x <= -3.1e-109) {
tmp = t_0;
} else if (x <= 7.5e-119) {
tmp = (pow(fma(F, F, 2.0), -0.5) * F) / sin(B);
} else {
tmp = t_0;
}
return tmp;
}
function code(F, B, x) t_0 = Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(-1.0 / Float64(fma(Float64(B * B), -0.16666666666666666, 1.0) * B))) tmp = 0.0 if (x <= -3.1e-109) tmp = t_0; elseif (x <= 7.5e-119) tmp = Float64(Float64((fma(F, F, 2.0) ^ -0.5) * F) / sin(B)); else tmp = t_0; end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(-1.0 / N[(N[(N[(B * B), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -3.1e-109], t$95$0, If[LessEqual[x, 7.5e-119], N[(N[(N[Power[N[(F * F + 2.0), $MachinePrecision], -0.5], $MachinePrecision] * F), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(-x \cdot \frac{1}{\tan B}\right) + \frac{-1}{\mathsf{fma}\left(B \cdot B, -0.16666666666666666, 1\right) \cdot B}\\
\mathbf{if}\;x \leq -3.1 \cdot 10^{-109}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 7.5 \cdot 10^{-119}:\\
\;\;\;\;\frac{{\left(\mathsf{fma}\left(F, F, 2\right)\right)}^{-0.5} \cdot F}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -3.1e-109 or 7.50000000000000044e-119 < x Initial program 79.4%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6472.7
Applied rewrites72.7%
Taylor expanded in B around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6474.8
Applied rewrites74.8%
if -3.1e-109 < x < 7.50000000000000044e-119Initial program 72.3%
Taylor expanded in x around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
+-commutativeN/A
pow2N/A
lower-fma.f64N/A
metadata-evalN/A
metadata-evalN/A
lift-sin.f6460.2
Applied rewrites60.2%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (+ (- (* x (/ 1.0 (tan B)))) (/ -1.0 B))))
(if (<= x -1.85e-73)
t_0
(if (<= x 8.2e-119) (/ (* (pow (fma F F 2.0) -0.5) F) (sin B)) t_0))))
double code(double F, double B, double x) {
double t_0 = -(x * (1.0 / tan(B))) + (-1.0 / B);
double tmp;
if (x <= -1.85e-73) {
tmp = t_0;
} else if (x <= 8.2e-119) {
tmp = (pow(fma(F, F, 2.0), -0.5) * F) / sin(B);
} else {
tmp = t_0;
}
return tmp;
}
function code(F, B, x) t_0 = Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(-1.0 / B)) tmp = 0.0 if (x <= -1.85e-73) tmp = t_0; elseif (x <= 8.2e-119) tmp = Float64(Float64((fma(F, F, 2.0) ^ -0.5) * F) / sin(B)); else tmp = t_0; end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(-1.0 / B), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.85e-73], t$95$0, If[LessEqual[x, 8.2e-119], N[(N[(N[Power[N[(F * F + 2.0), $MachinePrecision], -0.5], $MachinePrecision] * F), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(-x \cdot \frac{1}{\tan B}\right) + \frac{-1}{B}\\
\mathbf{if}\;x \leq -1.85 \cdot 10^{-73}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 8.2 \cdot 10^{-119}:\\
\;\;\;\;\frac{{\left(\mathsf{fma}\left(F, F, 2\right)\right)}^{-0.5} \cdot F}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -1.85e-73 or 8.20000000000000041e-119 < x Initial program 79.8%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6475.1
Applied rewrites75.1%
Taylor expanded in B around 0
Applied rewrites76.9%
if -1.85e-73 < x < 8.20000000000000041e-119Initial program 72.3%
Taylor expanded in x around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
+-commutativeN/A
pow2N/A
lower-fma.f64N/A
metadata-evalN/A
metadata-evalN/A
lift-sin.f6458.7
Applied rewrites58.7%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (- (* x (/ 1.0 B))))
(t_1 (+ (- (/ (* x 1.0) (tan B))) (/ 1.0 B))))
(if (<= F -2.55e+119)
(+ (- (* x (/ 1.0 (tan B)))) (/ -1.0 B))
(if (<= F -0.000216)
(+ t_0 (/ -1.0 (sin B)))
(if (<= F 7.5e-107)
(+
t_0
(*
(/
F
(*
B
(+
1.0
(*
(* B B)
(- (* 0.008333333333333333 (* B B)) 0.16666666666666666)))))
(pow (fma F F 2.0) -0.5)))
(if (<= F 1.15e+36)
t_1
(if (<= F 4.3e+139) (+ t_0 (* (/ F (sin B)) (/ 1.0 F))) t_1)))))))
double code(double F, double B, double x) {
double t_0 = -(x * (1.0 / B));
double t_1 = -((x * 1.0) / tan(B)) + (1.0 / B);
double tmp;
if (F <= -2.55e+119) {
tmp = -(x * (1.0 / tan(B))) + (-1.0 / B);
} else if (F <= -0.000216) {
tmp = t_0 + (-1.0 / sin(B));
} else if (F <= 7.5e-107) {
tmp = t_0 + ((F / (B * (1.0 + ((B * B) * ((0.008333333333333333 * (B * B)) - 0.16666666666666666))))) * pow(fma(F, F, 2.0), -0.5));
} else if (F <= 1.15e+36) {
tmp = t_1;
} else if (F <= 4.3e+139) {
tmp = t_0 + ((F / sin(B)) * (1.0 / F));
} else {
tmp = t_1;
}
return tmp;
}
function code(F, B, x) t_0 = Float64(-Float64(x * Float64(1.0 / B))) t_1 = Float64(Float64(-Float64(Float64(x * 1.0) / tan(B))) + Float64(1.0 / B)) tmp = 0.0 if (F <= -2.55e+119) tmp = Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(-1.0 / B)); elseif (F <= -0.000216) tmp = Float64(t_0 + Float64(-1.0 / sin(B))); elseif (F <= 7.5e-107) tmp = Float64(t_0 + Float64(Float64(F / Float64(B * Float64(1.0 + Float64(Float64(B * B) * Float64(Float64(0.008333333333333333 * Float64(B * B)) - 0.16666666666666666))))) * (fma(F, F, 2.0) ^ -0.5))); elseif (F <= 1.15e+36) tmp = t_1; elseif (F <= 4.3e+139) tmp = Float64(t_0 + Float64(Float64(F / sin(B)) * Float64(1.0 / F))); else tmp = t_1; end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = (-N[(x * N[(1.0 / B), $MachinePrecision]), $MachinePrecision])}, Block[{t$95$1 = N[((-N[(N[(x * 1.0), $MachinePrecision] / N[Tan[B], $MachinePrecision]), $MachinePrecision]) + N[(1.0 / B), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -2.55e+119], N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(-1.0 / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, -0.000216], N[(t$95$0 + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 7.5e-107], N[(t$95$0 + N[(N[(F / N[(B * N[(1.0 + N[(N[(B * B), $MachinePrecision] * N[(N[(0.008333333333333333 * N[(B * B), $MachinePrecision]), $MachinePrecision] - 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Power[N[(F * F + 2.0), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.15e+36], t$95$1, If[LessEqual[F, 4.3e+139], N[(t$95$0 + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[(1.0 / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -x \cdot \frac{1}{B}\\
t_1 := \left(-\frac{x \cdot 1}{\tan B}\right) + \frac{1}{B}\\
\mathbf{if}\;F \leq -2.55 \cdot 10^{+119}:\\
\;\;\;\;\left(-x \cdot \frac{1}{\tan B}\right) + \frac{-1}{B}\\
\mathbf{elif}\;F \leq -0.000216:\\
\;\;\;\;t\_0 + \frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 7.5 \cdot 10^{-107}:\\
\;\;\;\;t\_0 + \frac{F}{B \cdot \left(1 + \left(B \cdot B\right) \cdot \left(0.008333333333333333 \cdot \left(B \cdot B\right) - 0.16666666666666666\right)\right)} \cdot {\left(\mathsf{fma}\left(F, F, 2\right)\right)}^{-0.5}\\
\mathbf{elif}\;F \leq 1.15 \cdot 10^{+36}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;F \leq 4.3 \cdot 10^{+139}:\\
\;\;\;\;t\_0 + \frac{F}{\sin B} \cdot \frac{1}{F}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if F < -2.54999999999999992e119Initial program 39.4%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
Taylor expanded in B around 0
Applied rewrites74.5%
if -2.54999999999999992e119 < F < -2.1599999999999999e-4Initial program 93.3%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6497.3
Applied rewrites97.3%
Taylor expanded in B around 0
Applied rewrites77.7%
if -2.1599999999999999e-4 < F < 7.50000000000000047e-107Initial program 99.5%
Taylor expanded in x around 0
metadata-evalN/A
metadata-evalN/A
lower-pow.f64N/A
+-commutativeN/A
pow2N/A
lower-fma.f64N/A
metadata-evalN/A
metadata-eval99.4
Applied rewrites99.4%
Taylor expanded in B around 0
Applied rewrites64.7%
Taylor expanded in B around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f6452.0
Applied rewrites52.0%
if 7.50000000000000047e-107 < F < 1.14999999999999998e36 or 4.2999999999999998e139 < F Initial program 61.0%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6461.0
Applied rewrites61.0%
Taylor expanded in F around inf
lower-/.f64N/A
lift-sin.f6481.3
Applied rewrites81.3%
Taylor expanded in B around 0
lower-/.f6464.6
Applied rewrites64.6%
if 1.14999999999999998e36 < F < 4.2999999999999998e139Initial program 87.0%
Taylor expanded in x around 0
metadata-evalN/A
metadata-evalN/A
lower-pow.f64N/A
+-commutativeN/A
pow2N/A
lower-fma.f64N/A
metadata-evalN/A
metadata-eval87.0
Applied rewrites87.0%
Taylor expanded in B around 0
Applied rewrites67.3%
Taylor expanded in F around inf
metadata-evalN/A
metadata-evalN/A
sqr-powN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
pow-prod-upN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
pow-prod-upN/A
unpow2N/A
lower-/.f6467.3
Applied rewrites67.3%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (- (* x (/ 1.0 B))))
(t_1 (+ (- (/ (* x 1.0) (tan B))) (/ 1.0 B))))
(if (<= F -2.55e+119)
(+ (- (* x (/ 1.0 (tan B)))) (/ -1.0 B))
(if (<= F -0.000216)
(+ t_0 (/ -1.0 (sin B)))
(if (<= F 7.5e-107)
(+
t_0
(*
(/ F (* B (- 1.0 (* 0.16666666666666666 (* B B)))))
(pow (fma F F 2.0) -0.5)))
(if (<= F 1.15e+36)
t_1
(if (<= F 4.3e+139) (+ t_0 (* (/ F (sin B)) (/ 1.0 F))) t_1)))))))
double code(double F, double B, double x) {
double t_0 = -(x * (1.0 / B));
double t_1 = -((x * 1.0) / tan(B)) + (1.0 / B);
double tmp;
if (F <= -2.55e+119) {
tmp = -(x * (1.0 / tan(B))) + (-1.0 / B);
} else if (F <= -0.000216) {
tmp = t_0 + (-1.0 / sin(B));
} else if (F <= 7.5e-107) {
tmp = t_0 + ((F / (B * (1.0 - (0.16666666666666666 * (B * B))))) * pow(fma(F, F, 2.0), -0.5));
} else if (F <= 1.15e+36) {
tmp = t_1;
} else if (F <= 4.3e+139) {
tmp = t_0 + ((F / sin(B)) * (1.0 / F));
} else {
tmp = t_1;
}
return tmp;
}
function code(F, B, x) t_0 = Float64(-Float64(x * Float64(1.0 / B))) t_1 = Float64(Float64(-Float64(Float64(x * 1.0) / tan(B))) + Float64(1.0 / B)) tmp = 0.0 if (F <= -2.55e+119) tmp = Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(-1.0 / B)); elseif (F <= -0.000216) tmp = Float64(t_0 + Float64(-1.0 / sin(B))); elseif (F <= 7.5e-107) tmp = Float64(t_0 + Float64(Float64(F / Float64(B * Float64(1.0 - Float64(0.16666666666666666 * Float64(B * B))))) * (fma(F, F, 2.0) ^ -0.5))); elseif (F <= 1.15e+36) tmp = t_1; elseif (F <= 4.3e+139) tmp = Float64(t_0 + Float64(Float64(F / sin(B)) * Float64(1.0 / F))); else tmp = t_1; end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = (-N[(x * N[(1.0 / B), $MachinePrecision]), $MachinePrecision])}, Block[{t$95$1 = N[((-N[(N[(x * 1.0), $MachinePrecision] / N[Tan[B], $MachinePrecision]), $MachinePrecision]) + N[(1.0 / B), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -2.55e+119], N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(-1.0 / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, -0.000216], N[(t$95$0 + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 7.5e-107], N[(t$95$0 + N[(N[(F / N[(B * N[(1.0 - N[(0.16666666666666666 * N[(B * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Power[N[(F * F + 2.0), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.15e+36], t$95$1, If[LessEqual[F, 4.3e+139], N[(t$95$0 + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[(1.0 / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -x \cdot \frac{1}{B}\\
t_1 := \left(-\frac{x \cdot 1}{\tan B}\right) + \frac{1}{B}\\
\mathbf{if}\;F \leq -2.55 \cdot 10^{+119}:\\
\;\;\;\;\left(-x \cdot \frac{1}{\tan B}\right) + \frac{-1}{B}\\
\mathbf{elif}\;F \leq -0.000216:\\
\;\;\;\;t\_0 + \frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 7.5 \cdot 10^{-107}:\\
\;\;\;\;t\_0 + \frac{F}{B \cdot \left(1 - 0.16666666666666666 \cdot \left(B \cdot B\right)\right)} \cdot {\left(\mathsf{fma}\left(F, F, 2\right)\right)}^{-0.5}\\
\mathbf{elif}\;F \leq 1.15 \cdot 10^{+36}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;F \leq 4.3 \cdot 10^{+139}:\\
\;\;\;\;t\_0 + \frac{F}{\sin B} \cdot \frac{1}{F}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if F < -2.54999999999999992e119Initial program 39.4%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
Taylor expanded in B around 0
Applied rewrites74.5%
if -2.54999999999999992e119 < F < -2.1599999999999999e-4Initial program 93.3%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6497.3
Applied rewrites97.3%
Taylor expanded in B around 0
Applied rewrites77.7%
if -2.1599999999999999e-4 < F < 7.50000000000000047e-107Initial program 99.5%
Taylor expanded in x around 0
metadata-evalN/A
metadata-evalN/A
lower-pow.f64N/A
+-commutativeN/A
pow2N/A
lower-fma.f64N/A
metadata-evalN/A
metadata-eval99.4
Applied rewrites99.4%
Taylor expanded in B around 0
Applied rewrites64.7%
Taylor expanded in B around 0
lower-*.f64N/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
metadata-evalN/A
lower-*.f64N/A
pow2N/A
lift-*.f6452.0
Applied rewrites52.0%
if 7.50000000000000047e-107 < F < 1.14999999999999998e36 or 4.2999999999999998e139 < F Initial program 61.0%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6461.0
Applied rewrites61.0%
Taylor expanded in F around inf
lower-/.f64N/A
lift-sin.f6481.3
Applied rewrites81.3%
Taylor expanded in B around 0
lower-/.f6464.6
Applied rewrites64.6%
if 1.14999999999999998e36 < F < 4.2999999999999998e139Initial program 87.0%
Taylor expanded in x around 0
metadata-evalN/A
metadata-evalN/A
lower-pow.f64N/A
+-commutativeN/A
pow2N/A
lower-fma.f64N/A
metadata-evalN/A
metadata-eval87.0
Applied rewrites87.0%
Taylor expanded in B around 0
Applied rewrites67.3%
Taylor expanded in F around inf
metadata-evalN/A
metadata-evalN/A
sqr-powN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
pow-prod-upN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
pow-prod-upN/A
unpow2N/A
lower-/.f6467.3
Applied rewrites67.3%
(FPCore (F B x) :precision binary64 (if (<= B 0.002) (/ (- (* (pow (+ (fma F F (+ x x)) 2.0) -0.5) F) x) B) (+ (- (/ (* x 1.0) (tan B))) (/ 1.0 B))))
double code(double F, double B, double x) {
double tmp;
if (B <= 0.002) {
tmp = ((pow((fma(F, F, (x + x)) + 2.0), -0.5) * F) - x) / B;
} else {
tmp = -((x * 1.0) / tan(B)) + (1.0 / B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (B <= 0.002) tmp = Float64(Float64(Float64((Float64(fma(F, F, Float64(x + x)) + 2.0) ^ -0.5) * F) - x) / B); else tmp = Float64(Float64(-Float64(Float64(x * 1.0) / tan(B))) + Float64(1.0 / B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[B, 0.002], N[(N[(N[(N[Power[N[(N[(F * F + N[(x + x), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision], -0.5], $MachinePrecision] * F), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[((-N[(N[(x * 1.0), $MachinePrecision] / N[Tan[B], $MachinePrecision]), $MachinePrecision]) + N[(1.0 / B), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq 0.002:\\
\;\;\;\;\frac{{\left(\mathsf{fma}\left(F, F, x + x\right) + 2\right)}^{-0.5} \cdot F - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\left(-\frac{x \cdot 1}{\tan B}\right) + \frac{1}{B}\\
\end{array}
\end{array}
if B < 2e-3Initial program 74.0%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites57.7%
if 2e-3 < B Initial program 85.0%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6485.1
Applied rewrites85.1%
Taylor expanded in F around inf
lower-/.f64N/A
lift-sin.f6457.3
Applied rewrites57.3%
Taylor expanded in B around 0
lower-/.f6452.3
Applied rewrites52.3%
(FPCore (F B x) :precision binary64 (if (<= B 0.0024) (/ (- (* (pow (+ (fma F F (+ x x)) 2.0) -0.5) F) x) B) (+ (- (* x (/ 1.0 (tan B)))) (/ -1.0 B))))
double code(double F, double B, double x) {
double tmp;
if (B <= 0.0024) {
tmp = ((pow((fma(F, F, (x + x)) + 2.0), -0.5) * F) - x) / B;
} else {
tmp = -(x * (1.0 / tan(B))) + (-1.0 / B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (B <= 0.0024) tmp = Float64(Float64(Float64((Float64(fma(F, F, Float64(x + x)) + 2.0) ^ -0.5) * F) - x) / B); else tmp = Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(-1.0 / B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[B, 0.0024], N[(N[(N[(N[Power[N[(N[(F * F + N[(x + x), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision], -0.5], $MachinePrecision] * F), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(-1.0 / B), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq 0.0024:\\
\;\;\;\;\frac{{\left(\mathsf{fma}\left(F, F, x + x\right) + 2\right)}^{-0.5} \cdot F - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\left(-x \cdot \frac{1}{\tan B}\right) + \frac{-1}{B}\\
\end{array}
\end{array}
if B < 0.00239999999999999979Initial program 74.0%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites57.7%
if 0.00239999999999999979 < B Initial program 85.0%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6456.9
Applied rewrites56.9%
Taylor expanded in B around 0
Applied rewrites52.2%
(FPCore (F B x)
:precision binary64
(if (<= F -1.4)
(+ (- (* x (/ 1.0 B))) (/ -1.0 (sin B)))
(if (<= F 7.7e+40)
(/ (- (* (pow (+ (fma F F (+ x x)) 2.0) -0.5) F) x) B)
(if (<= F 5.6e+159) (/ 1.0 (sin B)) (/ (- 1.0 x) B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1.4) {
tmp = -(x * (1.0 / B)) + (-1.0 / sin(B));
} else if (F <= 7.7e+40) {
tmp = ((pow((fma(F, F, (x + x)) + 2.0), -0.5) * F) - x) / B;
} else if (F <= 5.6e+159) {
tmp = 1.0 / sin(B);
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -1.4) tmp = Float64(Float64(-Float64(x * Float64(1.0 / B))) + Float64(-1.0 / sin(B))); elseif (F <= 7.7e+40) tmp = Float64(Float64(Float64((Float64(fma(F, F, Float64(x + x)) + 2.0) ^ -0.5) * F) - x) / B); elseif (F <= 5.6e+159) tmp = Float64(1.0 / sin(B)); else tmp = Float64(Float64(1.0 - x) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -1.4], N[((-N[(x * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]) + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 7.7e+40], N[(N[(N[(N[Power[N[(N[(F * F + N[(x + x), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision], -0.5], $MachinePrecision] * F), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 5.6e+159], N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.4:\\
\;\;\;\;\left(-x \cdot \frac{1}{B}\right) + \frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 7.7 \cdot 10^{+40}:\\
\;\;\;\;\frac{{\left(\mathsf{fma}\left(F, F, x + x\right) + 2\right)}^{-0.5} \cdot F - x}{B}\\
\mathbf{elif}\;F \leq 5.6 \cdot 10^{+159}:\\
\;\;\;\;\frac{1}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < -1.3999999999999999Initial program 58.8%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6499.2
Applied rewrites99.2%
Taylor expanded in B around 0
Applied rewrites76.8%
if -1.3999999999999999 < F < 7.69999999999999964e40Initial program 99.3%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites51.5%
if 7.69999999999999964e40 < F < 5.6000000000000002e159Initial program 84.0%
Taylor expanded in F around inf
lower-/.f64N/A
lift-sin.f6454.8
Applied rewrites54.8%
if 5.6000000000000002e159 < F Initial program 32.2%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6432.2
Applied rewrites32.2%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites25.1%
Taylor expanded in F around inf
Applied rewrites51.1%
(FPCore (F B x)
:precision binary64
(if (<= F -4e+120)
(/ (- -1.0 x) B)
(if (<= F -210000.0)
(/ -1.0 (sin B))
(if (<= F 1300000000000.0)
(/ (- (* (pow (+ (+ x x) 2.0) -0.5) F) x) B)
(if (<= F 5.6e+159) (/ 1.0 (sin B)) (/ (- 1.0 x) B))))))
double code(double F, double B, double x) {
double tmp;
if (F <= -4e+120) {
tmp = (-1.0 - x) / B;
} else if (F <= -210000.0) {
tmp = -1.0 / sin(B);
} else if (F <= 1300000000000.0) {
tmp = ((pow(((x + x) + 2.0), -0.5) * F) - x) / B;
} else if (F <= 5.6e+159) {
tmp = 1.0 / sin(B);
} else {
tmp = (1.0 - x) / 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 <= (-4d+120)) then
tmp = ((-1.0d0) - x) / b
else if (f <= (-210000.0d0)) then
tmp = (-1.0d0) / sin(b)
else if (f <= 1300000000000.0d0) then
tmp = (((((x + x) + 2.0d0) ** (-0.5d0)) * f) - x) / b
else if (f <= 5.6d+159) then
tmp = 1.0d0 / sin(b)
else
tmp = (1.0d0 - x) / b
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -4e+120) {
tmp = (-1.0 - x) / B;
} else if (F <= -210000.0) {
tmp = -1.0 / Math.sin(B);
} else if (F <= 1300000000000.0) {
tmp = ((Math.pow(((x + x) + 2.0), -0.5) * F) - x) / B;
} else if (F <= 5.6e+159) {
tmp = 1.0 / Math.sin(B);
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -4e+120: tmp = (-1.0 - x) / B elif F <= -210000.0: tmp = -1.0 / math.sin(B) elif F <= 1300000000000.0: tmp = ((math.pow(((x + x) + 2.0), -0.5) * F) - x) / B elif F <= 5.6e+159: tmp = 1.0 / math.sin(B) else: tmp = (1.0 - x) / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= -4e+120) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= -210000.0) tmp = Float64(-1.0 / sin(B)); elseif (F <= 1300000000000.0) tmp = Float64(Float64(Float64((Float64(Float64(x + x) + 2.0) ^ -0.5) * F) - x) / B); elseif (F <= 5.6e+159) tmp = Float64(1.0 / sin(B)); else tmp = Float64(Float64(1.0 - x) / B); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -4e+120) tmp = (-1.0 - x) / B; elseif (F <= -210000.0) tmp = -1.0 / sin(B); elseif (F <= 1300000000000.0) tmp = (((((x + x) + 2.0) ^ -0.5) * F) - x) / B; elseif (F <= 5.6e+159) tmp = 1.0 / sin(B); else tmp = (1.0 - x) / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -4e+120], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, -210000.0], N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1300000000000.0], N[(N[(N[(N[Power[N[(N[(x + x), $MachinePrecision] + 2.0), $MachinePrecision], -0.5], $MachinePrecision] * F), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 5.6e+159], N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -4 \cdot 10^{+120}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq -210000:\\
\;\;\;\;\frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 1300000000000:\\
\;\;\;\;\frac{{\left(\left(x + x\right) + 2\right)}^{-0.5} \cdot F - x}{B}\\
\mathbf{elif}\;F \leq 5.6 \cdot 10^{+159}:\\
\;\;\;\;\frac{1}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < -3.9999999999999999e120Initial program 39.1%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6439.2
Applied rewrites39.2%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites30.8%
Taylor expanded in F around -inf
Applied rewrites52.1%
if -3.9999999999999999e120 < F < -2.1e5Initial program 92.8%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6459.7
Applied rewrites59.7%
if -2.1e5 < F < 1.3e12Initial program 99.4%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6499.6
Applied rewrites99.6%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites51.8%
Taylor expanded in F around 0
count-2-revN/A
lift-+.f6451.1
Applied rewrites51.1%
if 1.3e12 < F < 5.6000000000000002e159Initial program 86.4%
Taylor expanded in F around inf
lower-/.f64N/A
lift-sin.f6456.1
Applied rewrites56.1%
if 5.6000000000000002e159 < F Initial program 32.2%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6432.2
Applied rewrites32.2%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites25.1%
Taylor expanded in F around inf
Applied rewrites51.1%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ 1.0 (sin B))))
(if (<= B 0.92)
(/ (- (* (pow (+ (fma F F (+ x x)) 2.0) -0.5) F) x) B)
(if (<= B 6.1e+29) t_0 (if (<= B 5e+105) (/ -1.0 (sin B)) t_0)))))
double code(double F, double B, double x) {
double t_0 = 1.0 / sin(B);
double tmp;
if (B <= 0.92) {
tmp = ((pow((fma(F, F, (x + x)) + 2.0), -0.5) * F) - x) / B;
} else if (B <= 6.1e+29) {
tmp = t_0;
} else if (B <= 5e+105) {
tmp = -1.0 / sin(B);
} else {
tmp = t_0;
}
return tmp;
}
function code(F, B, x) t_0 = Float64(1.0 / sin(B)) tmp = 0.0 if (B <= 0.92) tmp = Float64(Float64(Float64((Float64(fma(F, F, Float64(x + x)) + 2.0) ^ -0.5) * F) - x) / B); elseif (B <= 6.1e+29) tmp = t_0; elseif (B <= 5e+105) tmp = Float64(-1.0 / sin(B)); else tmp = t_0; end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, 0.92], N[(N[(N[(N[Power[N[(N[(F * F + N[(x + x), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision], -0.5], $MachinePrecision] * F), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[B, 6.1e+29], t$95$0, If[LessEqual[B, 5e+105], N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{\sin B}\\
\mathbf{if}\;B \leq 0.92:\\
\;\;\;\;\frac{{\left(\mathsf{fma}\left(F, F, x + x\right) + 2\right)}^{-0.5} \cdot F - x}{B}\\
\mathbf{elif}\;B \leq 6.1 \cdot 10^{+29}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;B \leq 5 \cdot 10^{+105}:\\
\;\;\;\;\frac{-1}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if B < 0.92000000000000004Initial program 74.0%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites57.6%
if 0.92000000000000004 < B < 6.0999999999999998e29 or 5.00000000000000046e105 < B Initial program 84.8%
Taylor expanded in F around inf
lower-/.f64N/A
lift-sin.f6417.8
Applied rewrites17.8%
if 6.0999999999999998e29 < B < 5.00000000000000046e105Initial program 85.9%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6417.2
Applied rewrites17.2%
(FPCore (F B x)
:precision binary64
(if (<= F -4e+120)
(/ (- -1.0 x) B)
(if (<= F -210000.0)
(/ -1.0 (sin B))
(if (<= F 1.15e-38)
(/ (- (* (pow (+ (+ x x) 2.0) -0.5) F) x) B)
(/ (- 1.0 x) B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -4e+120) {
tmp = (-1.0 - x) / B;
} else if (F <= -210000.0) {
tmp = -1.0 / sin(B);
} else if (F <= 1.15e-38) {
tmp = ((pow(((x + x) + 2.0), -0.5) * F) - x) / B;
} else {
tmp = (1.0 - x) / 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 <= (-4d+120)) then
tmp = ((-1.0d0) - x) / b
else if (f <= (-210000.0d0)) then
tmp = (-1.0d0) / sin(b)
else if (f <= 1.15d-38) then
tmp = (((((x + x) + 2.0d0) ** (-0.5d0)) * f) - x) / b
else
tmp = (1.0d0 - x) / b
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -4e+120) {
tmp = (-1.0 - x) / B;
} else if (F <= -210000.0) {
tmp = -1.0 / Math.sin(B);
} else if (F <= 1.15e-38) {
tmp = ((Math.pow(((x + x) + 2.0), -0.5) * F) - x) / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -4e+120: tmp = (-1.0 - x) / B elif F <= -210000.0: tmp = -1.0 / math.sin(B) elif F <= 1.15e-38: tmp = ((math.pow(((x + x) + 2.0), -0.5) * F) - x) / B else: tmp = (1.0 - x) / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= -4e+120) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= -210000.0) tmp = Float64(-1.0 / sin(B)); elseif (F <= 1.15e-38) tmp = Float64(Float64(Float64((Float64(Float64(x + x) + 2.0) ^ -0.5) * F) - x) / B); else tmp = Float64(Float64(1.0 - x) / B); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -4e+120) tmp = (-1.0 - x) / B; elseif (F <= -210000.0) tmp = -1.0 / sin(B); elseif (F <= 1.15e-38) tmp = (((((x + x) + 2.0) ^ -0.5) * F) - x) / B; else tmp = (1.0 - x) / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -4e+120], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, -210000.0], N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.15e-38], N[(N[(N[(N[Power[N[(N[(x + x), $MachinePrecision] + 2.0), $MachinePrecision], -0.5], $MachinePrecision] * F), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -4 \cdot 10^{+120}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq -210000:\\
\;\;\;\;\frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 1.15 \cdot 10^{-38}:\\
\;\;\;\;\frac{{\left(\left(x + x\right) + 2\right)}^{-0.5} \cdot F - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < -3.9999999999999999e120Initial program 39.1%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6439.2
Applied rewrites39.2%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites30.8%
Taylor expanded in F around -inf
Applied rewrites52.1%
if -3.9999999999999999e120 < F < -2.1e5Initial program 92.8%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6459.7
Applied rewrites59.7%
if -2.1e5 < F < 1.15000000000000001e-38Initial program 99.5%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6499.6
Applied rewrites99.6%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites52.2%
Taylor expanded in F around 0
count-2-revN/A
lift-+.f6451.9
Applied rewrites51.9%
if 1.15000000000000001e-38 < F Initial program 61.9%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6462.0
Applied rewrites62.0%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites37.5%
Taylor expanded in F around inf
Applied rewrites47.8%
(FPCore (F B x)
:precision binary64
(if (<= F -210000.0)
(/ (- -1.0 x) B)
(if (<= F 1.15e-38)
(/ (- (* (pow (+ (+ x x) 2.0) -0.5) F) x) B)
(/ (- 1.0 x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -210000.0) {
tmp = (-1.0 - x) / B;
} else if (F <= 1.15e-38) {
tmp = ((pow(((x + x) + 2.0), -0.5) * F) - x) / B;
} else {
tmp = (1.0 - x) / 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 <= (-210000.0d0)) then
tmp = ((-1.0d0) - x) / b
else if (f <= 1.15d-38) then
tmp = (((((x + x) + 2.0d0) ** (-0.5d0)) * f) - x) / b
else
tmp = (1.0d0 - x) / b
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -210000.0) {
tmp = (-1.0 - x) / B;
} else if (F <= 1.15e-38) {
tmp = ((Math.pow(((x + x) + 2.0), -0.5) * F) - x) / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -210000.0: tmp = (-1.0 - x) / B elif F <= 1.15e-38: tmp = ((math.pow(((x + x) + 2.0), -0.5) * F) - x) / B else: tmp = (1.0 - x) / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= -210000.0) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 1.15e-38) tmp = Float64(Float64(Float64((Float64(Float64(x + x) + 2.0) ^ -0.5) * F) - x) / B); else tmp = Float64(Float64(1.0 - x) / B); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -210000.0) tmp = (-1.0 - x) / B; elseif (F <= 1.15e-38) tmp = (((((x + x) + 2.0) ^ -0.5) * F) - x) / B; else tmp = (1.0 - x) / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -210000.0], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 1.15e-38], N[(N[(N[(N[Power[N[(N[(x + x), $MachinePrecision] + 2.0), $MachinePrecision], -0.5], $MachinePrecision] * F), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -210000:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 1.15 \cdot 10^{-38}:\\
\;\;\;\;\frac{{\left(\left(x + x\right) + 2\right)}^{-0.5} \cdot F - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < -2.1e5Initial program 58.2%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6458.2
Applied rewrites58.2%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites37.8%
Taylor expanded in F around -inf
Applied rewrites51.5%
if -2.1e5 < F < 1.15000000000000001e-38Initial program 99.5%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6499.6
Applied rewrites99.6%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites52.2%
Taylor expanded in F around 0
count-2-revN/A
lift-+.f6451.9
Applied rewrites51.9%
if 1.15000000000000001e-38 < F Initial program 61.9%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6462.0
Applied rewrites62.0%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites37.5%
Taylor expanded in F around inf
Applied rewrites47.8%
(FPCore (F B x) :precision binary64 (if (<= F -3e-54) (/ (- -1.0 x) B) (if (<= F 1.5e-59) (- (/ x B)) (/ (- 1.0 x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -3e-54) {
tmp = (-1.0 - x) / B;
} else if (F <= 1.5e-59) {
tmp = -(x / B);
} else {
tmp = (1.0 - x) / 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 <= (-3d-54)) then
tmp = ((-1.0d0) - x) / b
else if (f <= 1.5d-59) then
tmp = -(x / b)
else
tmp = (1.0d0 - x) / b
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -3e-54) {
tmp = (-1.0 - x) / B;
} else if (F <= 1.5e-59) {
tmp = -(x / B);
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -3e-54: tmp = (-1.0 - x) / B elif F <= 1.5e-59: tmp = -(x / B) else: tmp = (1.0 - x) / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= -3e-54) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 1.5e-59) tmp = Float64(-Float64(x / B)); else tmp = Float64(Float64(1.0 - x) / B); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -3e-54) tmp = (-1.0 - x) / B; elseif (F <= 1.5e-59) tmp = -(x / B); else tmp = (1.0 - x) / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -3e-54], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 1.5e-59], (-N[(x / B), $MachinePrecision]), N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -3 \cdot 10^{-54}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 1.5 \cdot 10^{-59}:\\
\;\;\;\;-\frac{x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < -3.00000000000000009e-54Initial program 64.0%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6464.0
Applied rewrites64.0%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites39.8%
Taylor expanded in F around -inf
Applied rewrites47.6%
if -3.00000000000000009e-54 < F < 1.5e-59Initial 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.f6472.2
Applied rewrites72.2%
Taylor expanded in B around 0
lower-/.f6438.1
Applied rewrites38.1%
if 1.5e-59 < F Initial program 63.8%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6463.8
Applied rewrites63.8%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites38.2%
Taylor expanded in F around inf
Applied rewrites46.5%
(FPCore (F B x) :precision binary64 (if (<= F -3e-54) (/ (- -1.0 x) B) (- (/ x B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -3e-54) {
tmp = (-1.0 - x) / B;
} else {
tmp = -(x / 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 <= (-3d-54)) then
tmp = ((-1.0d0) - x) / b
else
tmp = -(x / b)
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -3e-54) {
tmp = (-1.0 - x) / B;
} else {
tmp = -(x / B);
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -3e-54: tmp = (-1.0 - x) / B else: tmp = -(x / B) return tmp
function code(F, B, x) tmp = 0.0 if (F <= -3e-54) tmp = Float64(Float64(-1.0 - x) / B); else tmp = Float64(-Float64(x / B)); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -3e-54) tmp = (-1.0 - x) / B; else tmp = -(x / B); end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -3e-54], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], (-N[(x / B), $MachinePrecision])]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -3 \cdot 10^{-54}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{else}:\\
\;\;\;\;-\frac{x}{B}\\
\end{array}
\end{array}
if F < -3.00000000000000009e-54Initial program 64.0%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6464.0
Applied rewrites64.0%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites39.8%
Taylor expanded in F around -inf
Applied rewrites47.6%
if -3.00000000000000009e-54 < F Initial program 82.7%
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.f6460.2
Applied rewrites60.2%
Taylor expanded in B around 0
lower-/.f6431.6
Applied rewrites31.6%
(FPCore (F B x) :precision binary64 (if (<= F -5e+155) (/ -1.0 B) (- (/ x B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -5e+155) {
tmp = -1.0 / B;
} else {
tmp = -(x / 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 <= (-5d+155)) then
tmp = (-1.0d0) / b
else
tmp = -(x / b)
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -5e+155) {
tmp = -1.0 / B;
} else {
tmp = -(x / B);
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -5e+155: tmp = -1.0 / B else: tmp = -(x / B) return tmp
function code(F, B, x) tmp = 0.0 if (F <= -5e+155) tmp = Float64(-1.0 / B); else tmp = Float64(-Float64(x / B)); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -5e+155) tmp = -1.0 / B; else tmp = -(x / B); end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -5e+155], N[(-1.0 / B), $MachinePrecision], (-N[(x / B), $MachinePrecision])]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -5 \cdot 10^{+155}:\\
\;\;\;\;\frac{-1}{B}\\
\mathbf{else}:\\
\;\;\;\;-\frac{x}{B}\\
\end{array}
\end{array}
if F < -4.9999999999999999e155Initial program 30.1%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6451.0
Applied rewrites51.0%
Taylor expanded in B around 0
Applied rewrites27.7%
if -4.9999999999999999e155 < F 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.f6456.7
Applied rewrites56.7%
Taylor expanded in B around 0
lower-/.f6430.0
Applied rewrites30.0%
(FPCore (F B x) :precision binary64 (if (<= F 1300000000000.0) (/ -1.0 B) (/ 1.0 B)))
double code(double F, double B, double x) {
double tmp;
if (F <= 1300000000000.0) {
tmp = -1.0 / B;
} else {
tmp = 1.0 / 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 <= 1300000000000.0d0) then
tmp = (-1.0d0) / b
else
tmp = 1.0d0 / b
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= 1300000000000.0) {
tmp = -1.0 / B;
} else {
tmp = 1.0 / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= 1300000000000.0: tmp = -1.0 / B else: tmp = 1.0 / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= 1300000000000.0) tmp = Float64(-1.0 / B); else tmp = Float64(1.0 / B); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= 1300000000000.0) tmp = -1.0 / B; else tmp = 1.0 / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, 1300000000000.0], N[(-1.0 / B), $MachinePrecision], N[(1.0 / B), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq 1300000000000:\\
\;\;\;\;\frac{-1}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{B}\\
\end{array}
\end{array}
if F < 1.3e12Initial program 84.2%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6422.9
Applied rewrites22.9%
Taylor expanded in B around 0
Applied rewrites13.3%
if 1.3e12 < F Initial program 57.1%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6457.2
Applied rewrites57.2%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites36.3%
Taylor expanded in F around inf
Applied rewrites28.3%
(FPCore (F B x) :precision binary64 (/ -1.0 B))
double code(double F, double B, double x) {
return -1.0 / 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 = (-1.0d0) / b
end function
public static double code(double F, double B, double x) {
return -1.0 / B;
}
def code(F, B, x): return -1.0 / B
function code(F, B, x) return Float64(-1.0 / B) end
function tmp = code(F, B, x) tmp = -1.0 / B; end
code[F_, B_, x_] := N[(-1.0 / B), $MachinePrecision]
\begin{array}{l}
\\
\frac{-1}{B}
\end{array}
Initial program 76.8%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6417.2
Applied rewrites17.2%
Taylor expanded in B around 0
Applied rewrites10.4%
herbie shell --seed 2025133
(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))))))