
(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 22 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (F B x) :precision binary64 (+ (- (* x (/ 1.0 (tan B)))) (* (/ F (sin B)) (pow (+ (+ (* F F) 2.0) (* 2.0 x)) (- (/ 1.0 2.0))))))
double code(double F, double B, double x) {
return -(x * (1.0 / tan(B))) + ((F / sin(B)) * pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
code = -(x * (1.0d0 / tan(b))) + ((f / sin(b)) * ((((f * f) + 2.0d0) + (2.0d0 * x)) ** -(1.0d0 / 2.0d0)))
end function
public static double code(double F, double B, double x) {
return -(x * (1.0 / Math.tan(B))) + ((F / Math.sin(B)) * Math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
}
def code(F, B, x): return -(x * (1.0 / math.tan(B))) + ((F / math.sin(B)) * math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)))
function code(F, B, x) return Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(Float64(F / sin(B)) * (Float64(Float64(Float64(F * F) + 2.0) + Float64(2.0 * x)) ^ Float64(-Float64(1.0 / 2.0))))) end
function tmp = code(F, B, x) tmp = -(x * (1.0 / tan(B))) + ((F / sin(B)) * ((((F * F) + 2.0) + (2.0 * x)) ^ -(1.0 / 2.0))); end
code[F_, B_, x_] := N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(N[(F * F), $MachinePrecision] + 2.0), $MachinePrecision] + N[(2.0 * x), $MachinePrecision]), $MachinePrecision], (-N[(1.0 / 2.0), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}
\end{array}
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ (- x) (tan B))))
(if (<= F -2e+19)
(fma -1.0 (/ 1.0 (sin B)) t_0)
(if (<= F 5000.0)
(fma F (/ (pow (fma 2.0 x (fma F F 2.0)) -0.5) (sin B)) t_0)
(fma F (/ (/ 1.0 F) (sin B)) (/ -1.0 (/ (tan B) x)))))))
double code(double F, double B, double x) {
double t_0 = -x / tan(B);
double tmp;
if (F <= -2e+19) {
tmp = fma(-1.0, (1.0 / sin(B)), t_0);
} else if (F <= 5000.0) {
tmp = fma(F, (pow(fma(2.0, x, fma(F, F, 2.0)), -0.5) / sin(B)), t_0);
} else {
tmp = fma(F, ((1.0 / F) / sin(B)), (-1.0 / (tan(B) / x)));
}
return tmp;
}
function code(F, B, x) t_0 = Float64(Float64(-x) / tan(B)) tmp = 0.0 if (F <= -2e+19) tmp = fma(-1.0, Float64(1.0 / sin(B)), t_0); elseif (F <= 5000.0) tmp = fma(F, Float64((fma(2.0, x, fma(F, F, 2.0)) ^ -0.5) / sin(B)), t_0); else tmp = fma(F, Float64(Float64(1.0 / F) / sin(B)), Float64(-1.0 / Float64(tan(B) / x))); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -2e+19], N[(-1.0 * N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision], If[LessEqual[F, 5000.0], N[(F * N[(N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision], N[(F * N[(N[(1.0 / F), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] + N[(-1.0 / N[(N[Tan[B], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-x}{\tan B}\\
\mathbf{if}\;F \leq -2 \cdot 10^{+19}:\\
\;\;\;\;\mathsf{fma}\left(-1, \frac{1}{\sin B}, t\_0\right)\\
\mathbf{elif}\;F \leq 5000:\\
\;\;\;\;\mathsf{fma}\left(F, \frac{{\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{\sin B}, t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(F, \frac{\frac{1}{F}}{\sin B}, \frac{-1}{\frac{\tan B}{x}}\right)\\
\end{array}
\end{array}
if F < -2e19Initial program 76.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites84.8%
lift-fma.f64N/A
lift-/.f64N/A
associate-*r/N/A
mult-flipN/A
lift-/.f64N/A
lift-neg.f64N/A
distribute-frac-negN/A
mult-flip-revN/A
lift-/.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6484.7
Applied rewrites84.8%
Taylor expanded in F around -inf
Applied rewrites56.6%
if -2e19 < F < 5e3Initial program 76.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites84.8%
if 5e3 < F Initial program 76.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites84.8%
lift-/.f64N/A
div-flipN/A
lift-neg.f64N/A
distribute-frac-neg2N/A
lift-tan.f64N/A
tan-quotN/A
lift-sin.f64N/A
lift-cos.f64N/A
associate-/r*N/A
*-commutativeN/A
lift-*.f64N/A
distribute-neg-frac2N/A
distribute-neg-fracN/A
metadata-evalN/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lift-sin.f64N/A
lift-cos.f64N/A
tan-quotN/A
lift-tan.f64N/A
lower-/.f6484.7
Applied rewrites84.7%
Taylor expanded in F around inf
lower-/.f6452.3
Applied rewrites52.3%
(FPCore (F B x)
:precision binary64
(if (<= F -200000000.0)
(fma -1.0 (/ 1.0 (sin B)) (/ (- x) (tan B)))
(if (<= F 80000000000000.0)
(- (* (pow (fma 2.0 x (fma F F 2.0)) -0.5) (/ F (sin B))) (/ x (tan B)))
(fma F (/ (/ 1.0 F) (sin B)) (/ -1.0 (/ (tan B) x))))))
double code(double F, double B, double x) {
double tmp;
if (F <= -200000000.0) {
tmp = fma(-1.0, (1.0 / sin(B)), (-x / tan(B)));
} else if (F <= 80000000000000.0) {
tmp = (pow(fma(2.0, x, fma(F, F, 2.0)), -0.5) * (F / sin(B))) - (x / tan(B));
} else {
tmp = fma(F, ((1.0 / F) / sin(B)), (-1.0 / (tan(B) / x)));
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -200000000.0) tmp = fma(-1.0, Float64(1.0 / sin(B)), Float64(Float64(-x) / tan(B))); elseif (F <= 80000000000000.0) tmp = Float64(Float64((fma(2.0, x, fma(F, F, 2.0)) ^ -0.5) * Float64(F / sin(B))) - Float64(x / tan(B))); else tmp = fma(F, Float64(Float64(1.0 / F) / sin(B)), Float64(-1.0 / Float64(tan(B) / x))); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -200000000.0], N[(-1.0 * N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] + N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 80000000000000.0], N[(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] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(F * N[(N[(1.0 / F), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] + N[(-1.0 / N[(N[Tan[B], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -200000000:\\
\;\;\;\;\mathsf{fma}\left(-1, \frac{1}{\sin B}, \frac{-x}{\tan B}\right)\\
\mathbf{elif}\;F \leq 80000000000000:\\
\;\;\;\;{\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5} \cdot \frac{F}{\sin B} - \frac{x}{\tan B}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(F, \frac{\frac{1}{F}}{\sin B}, \frac{-1}{\frac{\tan B}{x}}\right)\\
\end{array}
\end{array}
if F < -2e8Initial program 76.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites84.8%
lift-fma.f64N/A
lift-/.f64N/A
associate-*r/N/A
mult-flipN/A
lift-/.f64N/A
lift-neg.f64N/A
distribute-frac-negN/A
mult-flip-revN/A
lift-/.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6484.7
Applied rewrites84.8%
Taylor expanded in F around -inf
Applied rewrites56.6%
if -2e8 < F < 8e13Initial program 76.2%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6476.2
Applied rewrites76.3%
if 8e13 < F Initial program 76.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites84.8%
lift-/.f64N/A
div-flipN/A
lift-neg.f64N/A
distribute-frac-neg2N/A
lift-tan.f64N/A
tan-quotN/A
lift-sin.f64N/A
lift-cos.f64N/A
associate-/r*N/A
*-commutativeN/A
lift-*.f64N/A
distribute-neg-frac2N/A
distribute-neg-fracN/A
metadata-evalN/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lift-sin.f64N/A
lift-cos.f64N/A
tan-quotN/A
lift-tan.f64N/A
lower-/.f6484.7
Applied rewrites84.7%
Taylor expanded in F around inf
lower-/.f6452.3
Applied rewrites52.3%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ (- x) (tan B))))
(if (<= F -1.42)
(fma -1.0 (/ 1.0 (sin B)) t_0)
(if (<= F 2.6)
(fma F (/ (pow (fma 2.0 x 2.0) -0.5) (sin B)) t_0)
(fma F (/ (/ 1.0 F) (sin B)) (/ -1.0 (/ (tan B) x)))))))
double code(double F, double B, double x) {
double t_0 = -x / tan(B);
double tmp;
if (F <= -1.42) {
tmp = fma(-1.0, (1.0 / sin(B)), t_0);
} else if (F <= 2.6) {
tmp = fma(F, (pow(fma(2.0, x, 2.0), -0.5) / sin(B)), t_0);
} else {
tmp = fma(F, ((1.0 / F) / sin(B)), (-1.0 / (tan(B) / x)));
}
return tmp;
}
function code(F, B, x) t_0 = Float64(Float64(-x) / tan(B)) tmp = 0.0 if (F <= -1.42) tmp = fma(-1.0, Float64(1.0 / sin(B)), t_0); elseif (F <= 2.6) tmp = fma(F, Float64((fma(2.0, x, 2.0) ^ -0.5) / sin(B)), t_0); else tmp = fma(F, Float64(Float64(1.0 / F) / sin(B)), Float64(-1.0 / Float64(tan(B) / x))); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -1.42], N[(-1.0 * N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision], If[LessEqual[F, 2.6], N[(F * N[(N[Power[N[(2.0 * x + 2.0), $MachinePrecision], -0.5], $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision], N[(F * N[(N[(1.0 / F), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] + N[(-1.0 / N[(N[Tan[B], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-x}{\tan B}\\
\mathbf{if}\;F \leq -1.42:\\
\;\;\;\;\mathsf{fma}\left(-1, \frac{1}{\sin B}, t\_0\right)\\
\mathbf{elif}\;F \leq 2.6:\\
\;\;\;\;\mathsf{fma}\left(F, \frac{{\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{-0.5}}{\sin B}, t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(F, \frac{\frac{1}{F}}{\sin B}, \frac{-1}{\frac{\tan B}{x}}\right)\\
\end{array}
\end{array}
if F < -1.4199999999999999Initial program 76.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites84.8%
lift-fma.f64N/A
lift-/.f64N/A
associate-*r/N/A
mult-flipN/A
lift-/.f64N/A
lift-neg.f64N/A
distribute-frac-negN/A
mult-flip-revN/A
lift-/.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6484.7
Applied rewrites84.8%
Taylor expanded in F around -inf
Applied rewrites56.6%
if -1.4199999999999999 < F < 2.60000000000000009Initial program 76.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites84.8%
Taylor expanded in F around 0
Applied rewrites55.5%
if 2.60000000000000009 < F Initial program 76.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites84.8%
lift-/.f64N/A
div-flipN/A
lift-neg.f64N/A
distribute-frac-neg2N/A
lift-tan.f64N/A
tan-quotN/A
lift-sin.f64N/A
lift-cos.f64N/A
associate-/r*N/A
*-commutativeN/A
lift-*.f64N/A
distribute-neg-frac2N/A
distribute-neg-fracN/A
metadata-evalN/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lift-sin.f64N/A
lift-cos.f64N/A
tan-quotN/A
lift-tan.f64N/A
lower-/.f6484.7
Applied rewrites84.7%
Taylor expanded in F around inf
lower-/.f6452.3
Applied rewrites52.3%
(FPCore (F B x)
:precision binary64
(if (<= F -1.42)
(fma -1.0 (/ 1.0 (sin B)) (/ (- x) (tan B)))
(if (<= F 2.6)
(- (* (pow (fma 2.0 x 2.0) -0.5) (/ F (sin B))) (/ x (tan B)))
(fma F (/ (/ 1.0 F) (sin B)) (/ -1.0 (/ (tan B) x))))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1.42) {
tmp = fma(-1.0, (1.0 / sin(B)), (-x / tan(B)));
} else if (F <= 2.6) {
tmp = (pow(fma(2.0, x, 2.0), -0.5) * (F / sin(B))) - (x / tan(B));
} else {
tmp = fma(F, ((1.0 / F) / sin(B)), (-1.0 / (tan(B) / x)));
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -1.42) tmp = fma(-1.0, Float64(1.0 / sin(B)), Float64(Float64(-x) / tan(B))); elseif (F <= 2.6) tmp = Float64(Float64((fma(2.0, x, 2.0) ^ -0.5) * Float64(F / sin(B))) - Float64(x / tan(B))); else tmp = fma(F, Float64(Float64(1.0 / F) / sin(B)), Float64(-1.0 / Float64(tan(B) / x))); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -1.42], N[(-1.0 * N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] + N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 2.6], N[(N[(N[Power[N[(2.0 * x + 2.0), $MachinePrecision], -0.5], $MachinePrecision] * N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(F * N[(N[(1.0 / F), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] + N[(-1.0 / N[(N[Tan[B], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.42:\\
\;\;\;\;\mathsf{fma}\left(-1, \frac{1}{\sin B}, \frac{-x}{\tan B}\right)\\
\mathbf{elif}\;F \leq 2.6:\\
\;\;\;\;{\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{-0.5} \cdot \frac{F}{\sin B} - \frac{x}{\tan B}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(F, \frac{\frac{1}{F}}{\sin B}, \frac{-1}{\frac{\tan B}{x}}\right)\\
\end{array}
\end{array}
if F < -1.4199999999999999Initial program 76.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites84.8%
lift-fma.f64N/A
lift-/.f64N/A
associate-*r/N/A
mult-flipN/A
lift-/.f64N/A
lift-neg.f64N/A
distribute-frac-negN/A
mult-flip-revN/A
lift-/.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6484.7
Applied rewrites84.8%
Taylor expanded in F around -inf
Applied rewrites56.6%
if -1.4199999999999999 < F < 2.60000000000000009Initial program 76.2%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
div-flipN/A
mult-flip-revN/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-evalN/A
lower-/.f6476.9
Applied rewrites76.9%
Taylor expanded in F around 0
Applied rewrites54.2%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
sub-flip-reverseN/A
lower--.f6454.2
Applied rewrites54.1%
if 2.60000000000000009 < F Initial program 76.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites84.8%
lift-/.f64N/A
div-flipN/A
lift-neg.f64N/A
distribute-frac-neg2N/A
lift-tan.f64N/A
tan-quotN/A
lift-sin.f64N/A
lift-cos.f64N/A
associate-/r*N/A
*-commutativeN/A
lift-*.f64N/A
distribute-neg-frac2N/A
distribute-neg-fracN/A
metadata-evalN/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lift-sin.f64N/A
lift-cos.f64N/A
tan-quotN/A
lift-tan.f64N/A
lower-/.f6484.7
Applied rewrites84.7%
Taylor expanded in F around inf
lower-/.f6452.3
Applied rewrites52.3%
(FPCore (F B x)
:precision binary64
(if (<= F -0.182)
(fma -1.0 (/ 1.0 (sin B)) (/ (- x) (tan B)))
(if (<= F 440.0)
(+
(- (* x (/ 1.0 (tan B))))
(* (/ F B) (pow (+ (+ (* F F) 2.0) (* 2.0 x)) (- (/ 1.0 2.0)))))
(fma F (/ (/ 1.0 F) (sin B)) (/ -1.0 (/ (tan B) x))))))
double code(double F, double B, double x) {
double tmp;
if (F <= -0.182) {
tmp = fma(-1.0, (1.0 / sin(B)), (-x / tan(B)));
} else if (F <= 440.0) {
tmp = -(x * (1.0 / tan(B))) + ((F / B) * pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
} else {
tmp = fma(F, ((1.0 / F) / sin(B)), (-1.0 / (tan(B) / x)));
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -0.182) tmp = fma(-1.0, Float64(1.0 / sin(B)), Float64(Float64(-x) / tan(B))); elseif (F <= 440.0) tmp = Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(Float64(F / B) * (Float64(Float64(Float64(F * F) + 2.0) + Float64(2.0 * x)) ^ Float64(-Float64(1.0 / 2.0))))); else tmp = fma(F, Float64(Float64(1.0 / F) / sin(B)), Float64(-1.0 / Float64(tan(B) / x))); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -0.182], N[(-1.0 * N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] + N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 440.0], N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(N[(F / B), $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[(F * N[(N[(1.0 / F), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] + N[(-1.0 / N[(N[Tan[B], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -0.182:\\
\;\;\;\;\mathsf{fma}\left(-1, \frac{1}{\sin B}, \frac{-x}{\tan B}\right)\\
\mathbf{elif}\;F \leq 440:\\
\;\;\;\;\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(F, \frac{\frac{1}{F}}{\sin B}, \frac{-1}{\frac{\tan B}{x}}\right)\\
\end{array}
\end{array}
if F < -0.182Initial program 76.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites84.8%
lift-fma.f64N/A
lift-/.f64N/A
associate-*r/N/A
mult-flipN/A
lift-/.f64N/A
lift-neg.f64N/A
distribute-frac-negN/A
mult-flip-revN/A
lift-/.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6484.7
Applied rewrites84.8%
Taylor expanded in F around -inf
Applied rewrites56.6%
if -0.182 < F < 440Initial program 76.2%
Taylor expanded in B around 0
lower-/.f6461.4
Applied rewrites61.4%
if 440 < F Initial program 76.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites84.8%
lift-/.f64N/A
div-flipN/A
lift-neg.f64N/A
distribute-frac-neg2N/A
lift-tan.f64N/A
tan-quotN/A
lift-sin.f64N/A
lift-cos.f64N/A
associate-/r*N/A
*-commutativeN/A
lift-*.f64N/A
distribute-neg-frac2N/A
distribute-neg-fracN/A
metadata-evalN/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lift-sin.f64N/A
lift-cos.f64N/A
tan-quotN/A
lift-tan.f64N/A
lower-/.f6484.7
Applied rewrites84.7%
Taylor expanded in F around inf
lower-/.f6452.3
Applied rewrites52.3%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ 1.0 (sin B))) (t_1 (/ (- x) (tan B))))
(if (<= F -0.182)
(fma -1.0 t_0 t_1)
(if (<= F 440.0)
(+
(- (* x (/ 1.0 (tan B))))
(* (/ F B) (pow (+ (+ (* F F) 2.0) (* 2.0 x)) (- (/ 1.0 2.0)))))
(fma 1.0 t_0 t_1)))))
double code(double F, double B, double x) {
double t_0 = 1.0 / sin(B);
double t_1 = -x / tan(B);
double tmp;
if (F <= -0.182) {
tmp = fma(-1.0, t_0, t_1);
} else if (F <= 440.0) {
tmp = -(x * (1.0 / tan(B))) + ((F / B) * pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
} else {
tmp = fma(1.0, t_0, t_1);
}
return tmp;
}
function code(F, B, x) t_0 = Float64(1.0 / sin(B)) t_1 = Float64(Float64(-x) / tan(B)) tmp = 0.0 if (F <= -0.182) tmp = fma(-1.0, t_0, t_1); elseif (F <= 440.0) tmp = Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(Float64(F / B) * (Float64(Float64(Float64(F * F) + 2.0) + Float64(2.0 * x)) ^ Float64(-Float64(1.0 / 2.0))))); else tmp = fma(1.0, t_0, t_1); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -0.182], N[(-1.0 * t$95$0 + t$95$1), $MachinePrecision], If[LessEqual[F, 440.0], N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(N[(F / B), $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[(1.0 * t$95$0 + t$95$1), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{\sin B}\\
t_1 := \frac{-x}{\tan B}\\
\mathbf{if}\;F \leq -0.182:\\
\;\;\;\;\mathsf{fma}\left(-1, t\_0, t\_1\right)\\
\mathbf{elif}\;F \leq 440:\\
\;\;\;\;\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1, t\_0, t\_1\right)\\
\end{array}
\end{array}
if F < -0.182Initial program 76.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites84.8%
lift-fma.f64N/A
lift-/.f64N/A
associate-*r/N/A
mult-flipN/A
lift-/.f64N/A
lift-neg.f64N/A
distribute-frac-negN/A
mult-flip-revN/A
lift-/.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6484.7
Applied rewrites84.8%
Taylor expanded in F around -inf
Applied rewrites56.6%
if -0.182 < F < 440Initial program 76.2%
Taylor expanded in B around 0
lower-/.f6461.4
Applied rewrites61.4%
if 440 < F Initial program 76.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites84.8%
lift-fma.f64N/A
lift-/.f64N/A
associate-*r/N/A
mult-flipN/A
lift-/.f64N/A
lift-neg.f64N/A
distribute-frac-negN/A
mult-flip-revN/A
lift-/.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6484.7
Applied rewrites84.8%
Taylor expanded in F around inf
Applied rewrites56.4%
(FPCore (F B x)
:precision binary64
(let* ((t_0
(fma
F
(/ (pow (fma 2.0 x (fma F F 2.0)) -0.5) (sin B))
(* -1.0 (/ x B))))
(t_1 (/ 1.0 (sin B)))
(t_2 (/ (- x) (tan B))))
(if (<= F -1.55e+19)
(fma -1.0 t_1 t_2)
(if (<= F -3.3e-227)
t_0
(if (<= F 5.1e-138)
t_2
(if (<= F 10800000.0) t_0 (fma 1.0 t_1 t_2)))))))
double code(double F, double B, double x) {
double t_0 = fma(F, (pow(fma(2.0, x, fma(F, F, 2.0)), -0.5) / sin(B)), (-1.0 * (x / B)));
double t_1 = 1.0 / sin(B);
double t_2 = -x / tan(B);
double tmp;
if (F <= -1.55e+19) {
tmp = fma(-1.0, t_1, t_2);
} else if (F <= -3.3e-227) {
tmp = t_0;
} else if (F <= 5.1e-138) {
tmp = t_2;
} else if (F <= 10800000.0) {
tmp = t_0;
} else {
tmp = fma(1.0, t_1, t_2);
}
return tmp;
}
function code(F, B, x) t_0 = fma(F, Float64((fma(2.0, x, fma(F, F, 2.0)) ^ -0.5) / sin(B)), Float64(-1.0 * Float64(x / B))) t_1 = Float64(1.0 / sin(B)) t_2 = Float64(Float64(-x) / tan(B)) tmp = 0.0 if (F <= -1.55e+19) tmp = fma(-1.0, t_1, t_2); elseif (F <= -3.3e-227) tmp = t_0; elseif (F <= 5.1e-138) tmp = t_2; elseif (F <= 10800000.0) tmp = t_0; else tmp = fma(1.0, t_1, t_2); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(F * N[(N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] + N[(-1.0 * N[(x / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -1.55e+19], N[(-1.0 * t$95$1 + t$95$2), $MachinePrecision], If[LessEqual[F, -3.3e-227], t$95$0, If[LessEqual[F, 5.1e-138], t$95$2, If[LessEqual[F, 10800000.0], t$95$0, N[(1.0 * t$95$1 + t$95$2), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(F, \frac{{\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{\sin B}, -1 \cdot \frac{x}{B}\right)\\
t_1 := \frac{1}{\sin B}\\
t_2 := \frac{-x}{\tan B}\\
\mathbf{if}\;F \leq -1.55 \cdot 10^{+19}:\\
\;\;\;\;\mathsf{fma}\left(-1, t\_1, t\_2\right)\\
\mathbf{elif}\;F \leq -3.3 \cdot 10^{-227}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;F \leq 5.1 \cdot 10^{-138}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;F \leq 10800000:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1, t\_1, t\_2\right)\\
\end{array}
\end{array}
if F < -1.55e19Initial program 76.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites84.8%
lift-fma.f64N/A
lift-/.f64N/A
associate-*r/N/A
mult-flipN/A
lift-/.f64N/A
lift-neg.f64N/A
distribute-frac-negN/A
mult-flip-revN/A
lift-/.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6484.7
Applied rewrites84.8%
Taylor expanded in F around -inf
Applied rewrites56.6%
if -1.55e19 < F < -3.2999999999999999e-227 or 5.1000000000000002e-138 < F < 1.08e7Initial program 76.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites84.8%
Taylor expanded in B around 0
lower-*.f64N/A
lower-/.f6457.3
Applied rewrites57.3%
if -3.2999999999999999e-227 < F < 5.1000000000000002e-138Initial program 76.2%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6455.4
Applied rewrites55.4%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
div-flipN/A
mul-1-negN/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lift-neg.f64N/A
associate-/l/N/A
lift-sin.f64N/A
lift-cos.f64N/A
tan-quotN/A
lift-tan.f64N/A
div-flipN/A
lift-/.f6455.5
Applied rewrites55.5%
if 1.08e7 < F Initial program 76.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites84.8%
lift-fma.f64N/A
lift-/.f64N/A
associate-*r/N/A
mult-flipN/A
lift-/.f64N/A
lift-neg.f64N/A
distribute-frac-negN/A
mult-flip-revN/A
lift-/.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6484.7
Applied rewrites84.8%
Taylor expanded in F around inf
Applied rewrites56.4%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ 1.0 (sin B))) (t_1 (/ (- x) (tan B))))
(if (<= x -2.9e-52)
(fma -1.0 t_0 t_1)
(if (<= x 1.85e-34)
(fma (* (pow (fma x 2.0 (fma F F 2.0)) -0.5) F) t_0 (* -1.0 (/ x B)))
t_1))))
double code(double F, double B, double x) {
double t_0 = 1.0 / sin(B);
double t_1 = -x / tan(B);
double tmp;
if (x <= -2.9e-52) {
tmp = fma(-1.0, t_0, t_1);
} else if (x <= 1.85e-34) {
tmp = fma((pow(fma(x, 2.0, fma(F, F, 2.0)), -0.5) * F), t_0, (-1.0 * (x / B)));
} else {
tmp = t_1;
}
return tmp;
}
function code(F, B, x) t_0 = Float64(1.0 / sin(B)) t_1 = Float64(Float64(-x) / tan(B)) tmp = 0.0 if (x <= -2.9e-52) tmp = fma(-1.0, t_0, t_1); elseif (x <= 1.85e-34) tmp = fma(Float64((fma(x, 2.0, fma(F, F, 2.0)) ^ -0.5) * F), t_0, Float64(-1.0 * Float64(x / B))); else tmp = t_1; end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.9e-52], N[(-1.0 * t$95$0 + t$95$1), $MachinePrecision], If[LessEqual[x, 1.85e-34], N[(N[(N[Power[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * F), $MachinePrecision] * t$95$0 + N[(-1.0 * N[(x / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{\sin B}\\
t_1 := \frac{-x}{\tan B}\\
\mathbf{if}\;x \leq -2.9 \cdot 10^{-52}:\\
\;\;\;\;\mathsf{fma}\left(-1, t\_0, t\_1\right)\\
\mathbf{elif}\;x \leq 1.85 \cdot 10^{-34}:\\
\;\;\;\;\mathsf{fma}\left({\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5} \cdot F, t\_0, -1 \cdot \frac{x}{B}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -2.9000000000000002e-52Initial program 76.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites84.8%
lift-fma.f64N/A
lift-/.f64N/A
associate-*r/N/A
mult-flipN/A
lift-/.f64N/A
lift-neg.f64N/A
distribute-frac-negN/A
mult-flip-revN/A
lift-/.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6484.7
Applied rewrites84.8%
Taylor expanded in F around -inf
Applied rewrites56.6%
if -2.9000000000000002e-52 < x < 1.84999999999999994e-34Initial program 76.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites84.8%
lift-fma.f64N/A
lift-/.f64N/A
associate-*r/N/A
mult-flipN/A
lift-/.f64N/A
lift-neg.f64N/A
distribute-frac-negN/A
mult-flip-revN/A
lift-/.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6484.7
Applied rewrites84.8%
Taylor expanded in B around 0
lower-*.f64N/A
lower-/.f6457.3
Applied rewrites57.3%
if 1.84999999999999994e-34 < x Initial program 76.2%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6455.4
Applied rewrites55.4%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
div-flipN/A
mul-1-negN/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lift-neg.f64N/A
associate-/l/N/A
lift-sin.f64N/A
lift-cos.f64N/A
tan-quotN/A
lift-tan.f64N/A
div-flipN/A
lift-/.f6455.5
Applied rewrites55.5%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ (- x) (tan B))))
(if (<= x -6.3e-12)
(fma F (/ 1.0 (* F B)) t_0)
(if (<= x 1.85e-34)
(fma
(* (pow (fma x 2.0 (fma F F 2.0)) -0.5) F)
(/ 1.0 (sin B))
(* -1.0 (/ x B)))
t_0))))
double code(double F, double B, double x) {
double t_0 = -x / tan(B);
double tmp;
if (x <= -6.3e-12) {
tmp = fma(F, (1.0 / (F * B)), t_0);
} else if (x <= 1.85e-34) {
tmp = fma((pow(fma(x, 2.0, fma(F, F, 2.0)), -0.5) * F), (1.0 / sin(B)), (-1.0 * (x / B)));
} else {
tmp = t_0;
}
return tmp;
}
function code(F, B, x) t_0 = Float64(Float64(-x) / tan(B)) tmp = 0.0 if (x <= -6.3e-12) tmp = fma(F, Float64(1.0 / Float64(F * B)), t_0); elseif (x <= 1.85e-34) tmp = fma(Float64((fma(x, 2.0, fma(F, F, 2.0)) ^ -0.5) * F), Float64(1.0 / sin(B)), Float64(-1.0 * Float64(x / B))); else tmp = t_0; end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -6.3e-12], N[(F * N[(1.0 / N[(F * B), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision], If[LessEqual[x, 1.85e-34], N[(N[(N[Power[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * F), $MachinePrecision] * N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] + N[(-1.0 * N[(x / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-x}{\tan B}\\
\mathbf{if}\;x \leq -6.3 \cdot 10^{-12}:\\
\;\;\;\;\mathsf{fma}\left(F, \frac{1}{F \cdot B}, t\_0\right)\\
\mathbf{elif}\;x \leq 1.85 \cdot 10^{-34}:\\
\;\;\;\;\mathsf{fma}\left({\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5} \cdot F, \frac{1}{\sin B}, -1 \cdot \frac{x}{B}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -6.3000000000000002e-12Initial program 76.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites84.8%
Taylor expanded in F around inf
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f6452.4
Applied rewrites52.4%
Taylor expanded in B around 0
Applied rewrites49.7%
if -6.3000000000000002e-12 < x < 1.84999999999999994e-34Initial program 76.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites84.8%
lift-fma.f64N/A
lift-/.f64N/A
associate-*r/N/A
mult-flipN/A
lift-/.f64N/A
lift-neg.f64N/A
distribute-frac-negN/A
mult-flip-revN/A
lift-/.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6484.7
Applied rewrites84.8%
Taylor expanded in B around 0
lower-*.f64N/A
lower-/.f6457.3
Applied rewrites57.3%
if 1.84999999999999994e-34 < x Initial program 76.2%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6455.4
Applied rewrites55.4%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
div-flipN/A
mul-1-negN/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lift-neg.f64N/A
associate-/l/N/A
lift-sin.f64N/A
lift-cos.f64N/A
tan-quotN/A
lift-tan.f64N/A
div-flipN/A
lift-/.f6455.5
Applied rewrites55.5%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ (- x) (tan B))))
(if (<= x -2.1e+16)
t_0
(if (<= x 1.85e-34)
(fma
F
(/ (pow (fma 2.0 x (fma F F 2.0)) -0.5) (sin B))
(* -1.0 (/ x B)))
t_0))))
double code(double F, double B, double x) {
double t_0 = -x / tan(B);
double tmp;
if (x <= -2.1e+16) {
tmp = t_0;
} else if (x <= 1.85e-34) {
tmp = fma(F, (pow(fma(2.0, x, fma(F, F, 2.0)), -0.5) / sin(B)), (-1.0 * (x / B)));
} else {
tmp = t_0;
}
return tmp;
}
function code(F, B, x) t_0 = Float64(Float64(-x) / tan(B)) tmp = 0.0 if (x <= -2.1e+16) tmp = t_0; elseif (x <= 1.85e-34) tmp = fma(F, Float64((fma(2.0, x, fma(F, F, 2.0)) ^ -0.5) / sin(B)), Float64(-1.0 * Float64(x / B))); else tmp = t_0; end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.1e+16], t$95$0, If[LessEqual[x, 1.85e-34], N[(F * N[(N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] + N[(-1.0 * N[(x / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-x}{\tan B}\\
\mathbf{if}\;x \leq -2.1 \cdot 10^{+16}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 1.85 \cdot 10^{-34}:\\
\;\;\;\;\mathsf{fma}\left(F, \frac{{\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{\sin B}, -1 \cdot \frac{x}{B}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -2.1e16 or 1.84999999999999994e-34 < x Initial program 76.2%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6455.4
Applied rewrites55.4%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
div-flipN/A
mul-1-negN/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lift-neg.f64N/A
associate-/l/N/A
lift-sin.f64N/A
lift-cos.f64N/A
tan-quotN/A
lift-tan.f64N/A
div-flipN/A
lift-/.f6455.5
Applied rewrites55.5%
if -2.1e16 < x < 1.84999999999999994e-34Initial program 76.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites84.8%
Taylor expanded in B around 0
lower-*.f64N/A
lower-/.f6457.3
Applied rewrites57.3%
(FPCore (F B x) :precision binary64 (if (<= B 1.25e-5) (/ (- (* F (pow (+ 2.0 (fma 2.0 x (pow F 2.0))) -0.5)) x) B) (/ (- x) (tan B))))
double code(double F, double B, double x) {
double tmp;
if (B <= 1.25e-5) {
tmp = ((F * pow((2.0 + fma(2.0, x, pow(F, 2.0))), -0.5)) - x) / B;
} else {
tmp = -x / tan(B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (B <= 1.25e-5) tmp = Float64(Float64(Float64(F * (Float64(2.0 + fma(2.0, x, (F ^ 2.0))) ^ -0.5)) - x) / B); else tmp = Float64(Float64(-x) / tan(B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[B, 1.25e-5], N[(N[(N[(F * N[Power[N[(2.0 + N[(2.0 * x + N[Power[F, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq 1.25 \cdot 10^{-5}:\\
\;\;\;\;\frac{F \cdot {\left(2 + \mathsf{fma}\left(2, x, {F}^{2}\right)\right)}^{-0.5} - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{-x}{\tan B}\\
\end{array}
\end{array}
if B < 1.25000000000000006e-5Initial program 76.2%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites43.3%
if 1.25000000000000006e-5 < B Initial program 76.2%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6455.4
Applied rewrites55.4%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
div-flipN/A
mul-1-negN/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lift-neg.f64N/A
associate-/l/N/A
lift-sin.f64N/A
lift-cos.f64N/A
tan-quotN/A
lift-tan.f64N/A
div-flipN/A
lift-/.f6455.5
Applied rewrites55.5%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ (- x) (tan B))))
(if (<= x -2.1e+16)
t_0
(if (<= x 3e-126)
(+ (- (* x (/ 1.0 B))) (/ (pow (fma 2.0 x (fma F F 2.0)) -0.5) (/ B F)))
t_0))))
double code(double F, double B, double x) {
double t_0 = -x / tan(B);
double tmp;
if (x <= -2.1e+16) {
tmp = t_0;
} else if (x <= 3e-126) {
tmp = -(x * (1.0 / B)) + (pow(fma(2.0, x, fma(F, F, 2.0)), -0.5) / (B / F));
} else {
tmp = t_0;
}
return tmp;
}
function code(F, B, x) t_0 = Float64(Float64(-x) / tan(B)) tmp = 0.0 if (x <= -2.1e+16) tmp = t_0; elseif (x <= 3e-126) tmp = Float64(Float64(-Float64(x * Float64(1.0 / B))) + Float64((fma(2.0, x, fma(F, F, 2.0)) ^ -0.5) / Float64(B / F))); else tmp = t_0; end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.1e+16], t$95$0, If[LessEqual[x, 3e-126], N[((-N[(x * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]) + N[(N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] / N[(B / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-x}{\tan B}\\
\mathbf{if}\;x \leq -2.1 \cdot 10^{+16}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 3 \cdot 10^{-126}:\\
\;\;\;\;\left(-x \cdot \frac{1}{B}\right) + \frac{{\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{\frac{B}{F}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -2.1e16 or 3.0000000000000002e-126 < x Initial program 76.2%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6455.4
Applied rewrites55.4%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
div-flipN/A
mul-1-negN/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lift-neg.f64N/A
associate-/l/N/A
lift-sin.f64N/A
lift-cos.f64N/A
tan-quotN/A
lift-tan.f64N/A
div-flipN/A
lift-/.f6455.5
Applied rewrites55.5%
if -2.1e16 < x < 3.0000000000000002e-126Initial program 76.2%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
div-flipN/A
mult-flip-revN/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-evalN/A
lower-/.f6476.9
Applied rewrites76.9%
Taylor expanded in B around 0
lower-/.f6449.5
Applied rewrites49.5%
Taylor expanded in B around 0
lower-/.f6435.5
Applied rewrites35.5%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ (- x) (tan B))))
(if (<= x -1.4e-8)
t_0
(if (<= x 3e-126)
(- (* (pow (fma 2.0 x (fma F F 2.0)) -0.5) (/ F B)) (* (/ 1.0 B) x))
t_0))))
double code(double F, double B, double x) {
double t_0 = -x / tan(B);
double tmp;
if (x <= -1.4e-8) {
tmp = t_0;
} else if (x <= 3e-126) {
tmp = (pow(fma(2.0, x, fma(F, F, 2.0)), -0.5) * (F / B)) - ((1.0 / B) * x);
} else {
tmp = t_0;
}
return tmp;
}
function code(F, B, x) t_0 = Float64(Float64(-x) / tan(B)) tmp = 0.0 if (x <= -1.4e-8) tmp = t_0; elseif (x <= 3e-126) tmp = Float64(Float64((fma(2.0, x, fma(F, F, 2.0)) ^ -0.5) * Float64(F / B)) - Float64(Float64(1.0 / B) * x)); else tmp = t_0; end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.4e-8], t$95$0, If[LessEqual[x, 3e-126], N[(N[(N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * N[(F / B), $MachinePrecision]), $MachinePrecision] - N[(N[(1.0 / B), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-x}{\tan B}\\
\mathbf{if}\;x \leq -1.4 \cdot 10^{-8}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 3 \cdot 10^{-126}:\\
\;\;\;\;{\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5} \cdot \frac{F}{B} - \frac{1}{B} \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -1.4e-8 or 3.0000000000000002e-126 < x Initial program 76.2%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6455.4
Applied rewrites55.4%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
div-flipN/A
mul-1-negN/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lift-neg.f64N/A
associate-/l/N/A
lift-sin.f64N/A
lift-cos.f64N/A
tan-quotN/A
lift-tan.f64N/A
div-flipN/A
lift-/.f6455.5
Applied rewrites55.5%
if -1.4e-8 < x < 3.0000000000000002e-126Initial program 76.2%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
div-flipN/A
mult-flip-revN/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-evalN/A
lower-/.f6476.9
Applied rewrites76.9%
Taylor expanded in B around 0
lower-/.f6449.5
Applied rewrites49.5%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6449.5
lift-/.f64N/A
mult-flipN/A
lift-/.f64N/A
div-flipN/A
lift-sin.f64N/A
lower-*.f64N/A
lift-sin.f64N/A
lower-/.f6448.8
lift-*.f64N/A
*-commutativeN/A
lower-*.f6448.8
Applied rewrites48.8%
Taylor expanded in B around 0
Applied rewrites34.8%
(FPCore (F B x) :precision binary64 (let* ((t_0 (/ (- x) (tan B)))) (if (<= x -1.6e-13) t_0 (if (<= x 4.05e-227) (/ -1.0 (sin B)) t_0))))
double code(double F, double B, double x) {
double t_0 = -x / tan(B);
double tmp;
if (x <= -1.6e-13) {
tmp = t_0;
} else if (x <= 4.05e-227) {
tmp = -1.0 / sin(B);
} else {
tmp = t_0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: tmp
t_0 = -x / tan(b)
if (x <= (-1.6d-13)) then
tmp = t_0
else if (x <= 4.05d-227) then
tmp = (-1.0d0) / sin(b)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double t_0 = -x / Math.tan(B);
double tmp;
if (x <= -1.6e-13) {
tmp = t_0;
} else if (x <= 4.05e-227) {
tmp = -1.0 / Math.sin(B);
} else {
tmp = t_0;
}
return tmp;
}
def code(F, B, x): t_0 = -x / math.tan(B) tmp = 0 if x <= -1.6e-13: tmp = t_0 elif x <= 4.05e-227: tmp = -1.0 / math.sin(B) else: tmp = t_0 return tmp
function code(F, B, x) t_0 = Float64(Float64(-x) / tan(B)) tmp = 0.0 if (x <= -1.6e-13) tmp = t_0; elseif (x <= 4.05e-227) tmp = Float64(-1.0 / sin(B)); else tmp = t_0; end return tmp end
function tmp_2 = code(F, B, x) t_0 = -x / tan(B); tmp = 0.0; if (x <= -1.6e-13) tmp = t_0; elseif (x <= 4.05e-227) tmp = -1.0 / sin(B); else tmp = t_0; end tmp_2 = tmp; end
code[F_, B_, x_] := Block[{t$95$0 = N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.6e-13], t$95$0, If[LessEqual[x, 4.05e-227], N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-x}{\tan B}\\
\mathbf{if}\;x \leq -1.6 \cdot 10^{-13}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 4.05 \cdot 10^{-227}:\\
\;\;\;\;\frac{-1}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -1.6e-13 or 4.04999999999999993e-227 < x Initial program 76.2%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6455.4
Applied rewrites55.4%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
div-flipN/A
mul-1-negN/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lift-neg.f64N/A
associate-/l/N/A
lift-sin.f64N/A
lift-cos.f64N/A
tan-quotN/A
lift-tan.f64N/A
div-flipN/A
lift-/.f6455.5
Applied rewrites55.5%
if -1.6e-13 < x < 4.04999999999999993e-227Initial program 76.2%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6417.7
Applied rewrites17.7%
(FPCore (F B x) :precision binary64 (if (<= F -1.8e-13) (/ -1.0 (sin B)) (if (<= F 0.00145) (* -1.0 (/ x (sin B))) (/ 1.0 (sin B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1.8e-13) {
tmp = -1.0 / sin(B);
} else if (F <= 0.00145) {
tmp = -1.0 * (x / sin(B));
} else {
tmp = 1.0 / sin(B);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: tmp
if (f <= (-1.8d-13)) then
tmp = (-1.0d0) / sin(b)
else if (f <= 0.00145d0) then
tmp = (-1.0d0) * (x / sin(b))
else
tmp = 1.0d0 / sin(b)
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -1.8e-13) {
tmp = -1.0 / Math.sin(B);
} else if (F <= 0.00145) {
tmp = -1.0 * (x / Math.sin(B));
} else {
tmp = 1.0 / Math.sin(B);
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -1.8e-13: tmp = -1.0 / math.sin(B) elif F <= 0.00145: tmp = -1.0 * (x / math.sin(B)) else: tmp = 1.0 / math.sin(B) return tmp
function code(F, B, x) tmp = 0.0 if (F <= -1.8e-13) tmp = Float64(-1.0 / sin(B)); elseif (F <= 0.00145) tmp = Float64(-1.0 * Float64(x / sin(B))); else tmp = Float64(1.0 / sin(B)); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -1.8e-13) tmp = -1.0 / sin(B); elseif (F <= 0.00145) tmp = -1.0 * (x / sin(B)); else tmp = 1.0 / sin(B); end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -1.8e-13], N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 0.00145], N[(-1.0 * N[(x / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.8 \cdot 10^{-13}:\\
\;\;\;\;\frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 0.00145:\\
\;\;\;\;-1 \cdot \frac{x}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B}\\
\end{array}
\end{array}
if F < -1.7999999999999999e-13Initial program 76.2%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6417.7
Applied rewrites17.7%
if -1.7999999999999999e-13 < F < 0.00145Initial program 76.2%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6455.4
Applied rewrites55.4%
Taylor expanded in B around 0
Applied rewrites31.1%
if 0.00145 < F Initial program 76.2%
Taylor expanded in F around inf
lower-/.f64N/A
lower-sin.f6416.9
Applied rewrites16.9%
(FPCore (F B x)
:precision binary64
(if (<= F -1.7e-13)
(/ -1.0 (sin B))
(if (<= F 5.9e-28)
(* -1.0 (/ 1.0 (/ (* B (+ 1.0 (* 0.3333333333333333 (pow B 2.0)))) x)))
(/ 1.0 (sin B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1.7e-13) {
tmp = -1.0 / sin(B);
} else if (F <= 5.9e-28) {
tmp = -1.0 * (1.0 / ((B * (1.0 + (0.3333333333333333 * pow(B, 2.0)))) / x));
} else {
tmp = 1.0 / sin(B);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: tmp
if (f <= (-1.7d-13)) then
tmp = (-1.0d0) / sin(b)
else if (f <= 5.9d-28) then
tmp = (-1.0d0) * (1.0d0 / ((b * (1.0d0 + (0.3333333333333333d0 * (b ** 2.0d0)))) / x))
else
tmp = 1.0d0 / sin(b)
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -1.7e-13) {
tmp = -1.0 / Math.sin(B);
} else if (F <= 5.9e-28) {
tmp = -1.0 * (1.0 / ((B * (1.0 + (0.3333333333333333 * Math.pow(B, 2.0)))) / x));
} else {
tmp = 1.0 / Math.sin(B);
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -1.7e-13: tmp = -1.0 / math.sin(B) elif F <= 5.9e-28: tmp = -1.0 * (1.0 / ((B * (1.0 + (0.3333333333333333 * math.pow(B, 2.0)))) / x)) else: tmp = 1.0 / math.sin(B) return tmp
function code(F, B, x) tmp = 0.0 if (F <= -1.7e-13) tmp = Float64(-1.0 / sin(B)); elseif (F <= 5.9e-28) tmp = Float64(-1.0 * Float64(1.0 / Float64(Float64(B * Float64(1.0 + Float64(0.3333333333333333 * (B ^ 2.0)))) / x))); else tmp = Float64(1.0 / sin(B)); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -1.7e-13) tmp = -1.0 / sin(B); elseif (F <= 5.9e-28) tmp = -1.0 * (1.0 / ((B * (1.0 + (0.3333333333333333 * (B ^ 2.0)))) / x)); else tmp = 1.0 / sin(B); end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -1.7e-13], N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 5.9e-28], N[(-1.0 * N[(1.0 / N[(N[(B * N[(1.0 + N[(0.3333333333333333 * N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.7 \cdot 10^{-13}:\\
\;\;\;\;\frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 5.9 \cdot 10^{-28}:\\
\;\;\;\;-1 \cdot \frac{1}{\frac{B \cdot \left(1 + 0.3333333333333333 \cdot {B}^{2}\right)}{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B}\\
\end{array}
\end{array}
if F < -1.70000000000000008e-13Initial program 76.2%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6417.7
Applied rewrites17.7%
if -1.70000000000000008e-13 < F < 5.9000000000000002e-28Initial program 76.2%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6455.4
Applied rewrites55.4%
lift-/.f64N/A
div-flipN/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lift-sin.f64N/A
lift-cos.f64N/A
tan-quotN/A
lift-tan.f64N/A
lower-/.f6455.4
Applied rewrites55.4%
Taylor expanded in B around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6428.7
Applied rewrites28.7%
if 5.9000000000000002e-28 < F Initial program 76.2%
Taylor expanded in F around inf
lower-/.f64N/A
lower-sin.f6416.9
Applied rewrites16.9%
(FPCore (F B x) :precision binary64 (if (<= F -1.7e-13) (/ -1.0 (sin B)) (* -1.0 (/ 1.0 (/ (* B (+ 1.0 (* 0.3333333333333333 (pow B 2.0)))) x)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1.7e-13) {
tmp = -1.0 / sin(B);
} else {
tmp = -1.0 * (1.0 / ((B * (1.0 + (0.3333333333333333 * pow(B, 2.0)))) / x));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(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 <= (-1.7d-13)) then
tmp = (-1.0d0) / sin(b)
else
tmp = (-1.0d0) * (1.0d0 / ((b * (1.0d0 + (0.3333333333333333d0 * (b ** 2.0d0)))) / x))
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -1.7e-13) {
tmp = -1.0 / Math.sin(B);
} else {
tmp = -1.0 * (1.0 / ((B * (1.0 + (0.3333333333333333 * Math.pow(B, 2.0)))) / x));
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -1.7e-13: tmp = -1.0 / math.sin(B) else: tmp = -1.0 * (1.0 / ((B * (1.0 + (0.3333333333333333 * math.pow(B, 2.0)))) / x)) return tmp
function code(F, B, x) tmp = 0.0 if (F <= -1.7e-13) tmp = Float64(-1.0 / sin(B)); else tmp = Float64(-1.0 * Float64(1.0 / Float64(Float64(B * Float64(1.0 + Float64(0.3333333333333333 * (B ^ 2.0)))) / x))); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -1.7e-13) tmp = -1.0 / sin(B); else tmp = -1.0 * (1.0 / ((B * (1.0 + (0.3333333333333333 * (B ^ 2.0)))) / x)); end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -1.7e-13], N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], N[(-1.0 * N[(1.0 / N[(N[(B * N[(1.0 + N[(0.3333333333333333 * N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.7 \cdot 10^{-13}:\\
\;\;\;\;\frac{-1}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;-1 \cdot \frac{1}{\frac{B \cdot \left(1 + 0.3333333333333333 \cdot {B}^{2}\right)}{x}}\\
\end{array}
\end{array}
if F < -1.70000000000000008e-13Initial program 76.2%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6417.7
Applied rewrites17.7%
if -1.70000000000000008e-13 < F Initial program 76.2%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6455.4
Applied rewrites55.4%
lift-/.f64N/A
div-flipN/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lift-sin.f64N/A
lift-cos.f64N/A
tan-quotN/A
lift-tan.f64N/A
lower-/.f6455.4
Applied rewrites55.4%
Taylor expanded in B around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6428.7
Applied rewrites28.7%
(FPCore (F B x) :precision binary64 (let* ((t_0 (- (/ x B)))) (if (<= x -2.9e-25) t_0 (if (<= x 4.9e-225) (/ -1.0 B) t_0))))
double code(double F, double B, double x) {
double t_0 = -(x / B);
double tmp;
if (x <= -2.9e-25) {
tmp = t_0;
} else if (x <= 4.9e-225) {
tmp = -1.0 / B;
} else {
tmp = t_0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: tmp
t_0 = -(x / b)
if (x <= (-2.9d-25)) then
tmp = t_0
else if (x <= 4.9d-225) then
tmp = (-1.0d0) / b
else
tmp = t_0
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double t_0 = -(x / B);
double tmp;
if (x <= -2.9e-25) {
tmp = t_0;
} else if (x <= 4.9e-225) {
tmp = -1.0 / B;
} else {
tmp = t_0;
}
return tmp;
}
def code(F, B, x): t_0 = -(x / B) tmp = 0 if x <= -2.9e-25: tmp = t_0 elif x <= 4.9e-225: tmp = -1.0 / B else: tmp = t_0 return tmp
function code(F, B, x) t_0 = Float64(-Float64(x / B)) tmp = 0.0 if (x <= -2.9e-25) tmp = t_0; elseif (x <= 4.9e-225) tmp = Float64(-1.0 / B); else tmp = t_0; end return tmp end
function tmp_2 = code(F, B, x) t_0 = -(x / B); tmp = 0.0; if (x <= -2.9e-25) tmp = t_0; elseif (x <= 4.9e-225) tmp = -1.0 / B; else tmp = t_0; end tmp_2 = tmp; end
code[F_, B_, x_] := Block[{t$95$0 = (-N[(x / B), $MachinePrecision])}, If[LessEqual[x, -2.9e-25], t$95$0, If[LessEqual[x, 4.9e-225], N[(-1.0 / B), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -\frac{x}{B}\\
\mathbf{if}\;x \leq -2.9 \cdot 10^{-25}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 4.9 \cdot 10^{-225}:\\
\;\;\;\;\frac{-1}{B}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -2.9000000000000001e-25 or 4.89999999999999971e-225 < x Initial program 76.2%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6455.4
Applied rewrites55.4%
Taylor expanded in B around 0
lower-/.f6428.8
Applied rewrites28.8%
Applied rewrites28.8%
if -2.9000000000000001e-25 < x < 4.89999999999999971e-225Initial program 76.2%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6417.7
Applied rewrites17.7%
Taylor expanded in B around 0
Applied rewrites10.8%
(FPCore (F B x) :precision binary64 (if (<= F -1.8e-13) (/ (- (* -0.16666666666666666 (pow B 2.0)) 1.0) B) (* -1.0 (/ 1.0 (/ (* B (+ 1.0 (* 0.3333333333333333 (pow B 2.0)))) x)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1.8e-13) {
tmp = ((-0.16666666666666666 * pow(B, 2.0)) - 1.0) / B;
} else {
tmp = -1.0 * (1.0 / ((B * (1.0 + (0.3333333333333333 * pow(B, 2.0)))) / x));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(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 <= (-1.8d-13)) then
tmp = (((-0.16666666666666666d0) * (b ** 2.0d0)) - 1.0d0) / b
else
tmp = (-1.0d0) * (1.0d0 / ((b * (1.0d0 + (0.3333333333333333d0 * (b ** 2.0d0)))) / x))
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -1.8e-13) {
tmp = ((-0.16666666666666666 * Math.pow(B, 2.0)) - 1.0) / B;
} else {
tmp = -1.0 * (1.0 / ((B * (1.0 + (0.3333333333333333 * Math.pow(B, 2.0)))) / x));
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -1.8e-13: tmp = ((-0.16666666666666666 * math.pow(B, 2.0)) - 1.0) / B else: tmp = -1.0 * (1.0 / ((B * (1.0 + (0.3333333333333333 * math.pow(B, 2.0)))) / x)) return tmp
function code(F, B, x) tmp = 0.0 if (F <= -1.8e-13) tmp = Float64(Float64(Float64(-0.16666666666666666 * (B ^ 2.0)) - 1.0) / B); else tmp = Float64(-1.0 * Float64(1.0 / Float64(Float64(B * Float64(1.0 + Float64(0.3333333333333333 * (B ^ 2.0)))) / x))); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -1.8e-13) tmp = ((-0.16666666666666666 * (B ^ 2.0)) - 1.0) / B; else tmp = -1.0 * (1.0 / ((B * (1.0 + (0.3333333333333333 * (B ^ 2.0)))) / x)); end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -1.8e-13], N[(N[(N[(-0.16666666666666666 * N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision] / B), $MachinePrecision], N[(-1.0 * N[(1.0 / N[(N[(B * N[(1.0 + N[(0.3333333333333333 * N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.8 \cdot 10^{-13}:\\
\;\;\;\;\frac{-0.16666666666666666 \cdot {B}^{2} - 1}{B}\\
\mathbf{else}:\\
\;\;\;\;-1 \cdot \frac{1}{\frac{B \cdot \left(1 + 0.3333333333333333 \cdot {B}^{2}\right)}{x}}\\
\end{array}
\end{array}
if F < -1.7999999999999999e-13Initial program 76.2%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6417.7
Applied rewrites17.7%
Taylor expanded in B around 0
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-pow.f6410.6
Applied rewrites10.6%
if -1.7999999999999999e-13 < F Initial program 76.2%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6455.4
Applied rewrites55.4%
lift-/.f64N/A
div-flipN/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lift-sin.f64N/A
lift-cos.f64N/A
tan-quotN/A
lift-tan.f64N/A
lower-/.f6455.4
Applied rewrites55.4%
Taylor expanded in B around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6428.7
Applied rewrites28.7%
(FPCore (F B x) :precision binary64 (if (<= F -1.8e-13) (/ (- (* -0.16666666666666666 (pow B 2.0)) 1.0) B) (* -1.0 (/ (+ x (* -0.3333333333333333 (* (pow B 2.0) x))) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1.8e-13) {
tmp = ((-0.16666666666666666 * pow(B, 2.0)) - 1.0) / B;
} else {
tmp = -1.0 * ((x + (-0.3333333333333333 * (pow(B, 2.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 <= (-1.8d-13)) then
tmp = (((-0.16666666666666666d0) * (b ** 2.0d0)) - 1.0d0) / b
else
tmp = (-1.0d0) * ((x + ((-0.3333333333333333d0) * ((b ** 2.0d0) * x))) / b)
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -1.8e-13) {
tmp = ((-0.16666666666666666 * Math.pow(B, 2.0)) - 1.0) / B;
} else {
tmp = -1.0 * ((x + (-0.3333333333333333 * (Math.pow(B, 2.0) * x))) / B);
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -1.8e-13: tmp = ((-0.16666666666666666 * math.pow(B, 2.0)) - 1.0) / B else: tmp = -1.0 * ((x + (-0.3333333333333333 * (math.pow(B, 2.0) * x))) / B) return tmp
function code(F, B, x) tmp = 0.0 if (F <= -1.8e-13) tmp = Float64(Float64(Float64(-0.16666666666666666 * (B ^ 2.0)) - 1.0) / B); else tmp = Float64(-1.0 * Float64(Float64(x + Float64(-0.3333333333333333 * Float64((B ^ 2.0) * x))) / B)); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -1.8e-13) tmp = ((-0.16666666666666666 * (B ^ 2.0)) - 1.0) / B; else tmp = -1.0 * ((x + (-0.3333333333333333 * ((B ^ 2.0) * x))) / B); end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -1.8e-13], N[(N[(N[(-0.16666666666666666 * N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision] / B), $MachinePrecision], N[(-1.0 * N[(N[(x + N[(-0.3333333333333333 * N[(N[Power[B, 2.0], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.8 \cdot 10^{-13}:\\
\;\;\;\;\frac{-0.16666666666666666 \cdot {B}^{2} - 1}{B}\\
\mathbf{else}:\\
\;\;\;\;-1 \cdot \frac{x + -0.3333333333333333 \cdot \left({B}^{2} \cdot x\right)}{B}\\
\end{array}
\end{array}
if F < -1.7999999999999999e-13Initial program 76.2%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6417.7
Applied rewrites17.7%
Taylor expanded in B around 0
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-pow.f6410.6
Applied rewrites10.6%
if -1.7999999999999999e-13 < F Initial program 76.2%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6455.4
Applied rewrites55.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
div-flip-revN/A
lift-sin.f64N/A
lift-cos.f64N/A
tan-quotN/A
lift-tan.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f6455.3
Applied rewrites55.3%
Taylor expanded in B around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-pow.f6428.7
Applied rewrites28.7%
(FPCore (F B x) :precision binary64 (if (<= F -1.8e-13) (/ (- (* -0.16666666666666666 (pow B 2.0)) 1.0) B) (- (/ x B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1.8e-13) {
tmp = ((-0.16666666666666666 * pow(B, 2.0)) - 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 <= (-1.8d-13)) then
tmp = (((-0.16666666666666666d0) * (b ** 2.0d0)) - 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 <= -1.8e-13) {
tmp = ((-0.16666666666666666 * Math.pow(B, 2.0)) - 1.0) / B;
} else {
tmp = -(x / B);
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -1.8e-13: tmp = ((-0.16666666666666666 * math.pow(B, 2.0)) - 1.0) / B else: tmp = -(x / B) return tmp
function code(F, B, x) tmp = 0.0 if (F <= -1.8e-13) tmp = Float64(Float64(Float64(-0.16666666666666666 * (B ^ 2.0)) - 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 <= -1.8e-13) tmp = ((-0.16666666666666666 * (B ^ 2.0)) - 1.0) / B; else tmp = -(x / B); end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -1.8e-13], N[(N[(N[(-0.16666666666666666 * N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision] / B), $MachinePrecision], (-N[(x / B), $MachinePrecision])]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.8 \cdot 10^{-13}:\\
\;\;\;\;\frac{-0.16666666666666666 \cdot {B}^{2} - 1}{B}\\
\mathbf{else}:\\
\;\;\;\;-\frac{x}{B}\\
\end{array}
\end{array}
if F < -1.7999999999999999e-13Initial program 76.2%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6417.7
Applied rewrites17.7%
Taylor expanded in B around 0
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-pow.f6410.6
Applied rewrites10.6%
if -1.7999999999999999e-13 < F Initial program 76.2%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6455.4
Applied rewrites55.4%
Taylor expanded in B around 0
lower-/.f6428.8
Applied rewrites28.8%
Applied rewrites28.8%
(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.2%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6417.7
Applied rewrites17.7%
Taylor expanded in B around 0
Applied rewrites10.8%
herbie shell --seed 2025142
(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))))))