
(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]
\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)}
Herbie found 28 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]
\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)}
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ 1.0 (sin B))) (t_1 (/ (- x) (tan B))))
(if (<= F -4.5e+15)
(fma t_0 -1.0 t_1)
(if (<= F 10500.0)
(fma F (/ (pow (fma 2.0 x (fma F F 2.0)) -0.5) (sin B)) t_1)
(fma t_0 1.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 <= -4.5e+15) {
tmp = fma(t_0, -1.0, t_1);
} else if (F <= 10500.0) {
tmp = fma(F, (pow(fma(2.0, x, fma(F, F, 2.0)), -0.5) / sin(B)), t_1);
} else {
tmp = fma(t_0, 1.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 <= -4.5e+15) tmp = fma(t_0, -1.0, t_1); elseif (F <= 10500.0) tmp = fma(F, Float64((fma(2.0, x, fma(F, F, 2.0)) ^ -0.5) / sin(B)), t_1); else tmp = fma(t_0, 1.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, -4.5e+15], N[(t$95$0 * -1.0 + t$95$1), $MachinePrecision], If[LessEqual[F, 10500.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$1), $MachinePrecision], N[(t$95$0 * 1.0 + t$95$1), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := \frac{1}{\sin B}\\
t_1 := \frac{-x}{\tan B}\\
\mathbf{if}\;F \leq -4.5 \cdot 10^{+15}:\\
\;\;\;\;\mathsf{fma}\left(t\_0, -1, t\_1\right)\\
\mathbf{elif}\;F \leq 10500:\\
\;\;\;\;\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\_1\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_0, 1, t\_1\right)\\
\end{array}
if F < -4.5e15Initial program 77.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
mult-flipN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites85.5%
Taylor expanded in F around -inf
Applied rewrites55.8%
if -4.5e15 < F < 10500Initial program 77.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
mult-flipN/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites85.5%
if 10500 < F Initial program 77.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
mult-flipN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites85.5%
Taylor expanded in F around inf
Applied rewrites56.1%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ 1.0 (sin B))) (t_1 (/ (- x) (tan B))))
(if (<= F -7e+17)
(fma t_0 -1.0 t_1)
(if (<= F 10500.0)
(- (* (pow (fma 2.0 x (fma F F 2.0)) -0.5) (/ F (sin B))) (/ x (tan B)))
(fma t_0 1.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 <= -7e+17) {
tmp = fma(t_0, -1.0, t_1);
} else if (F <= 10500.0) {
tmp = (pow(fma(2.0, x, fma(F, F, 2.0)), -0.5) * (F / sin(B))) - (x / tan(B));
} else {
tmp = fma(t_0, 1.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 <= -7e+17) tmp = fma(t_0, -1.0, t_1); elseif (F <= 10500.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(t_0, 1.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, -7e+17], N[(t$95$0 * -1.0 + t$95$1), $MachinePrecision], If[LessEqual[F, 10500.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[(t$95$0 * 1.0 + t$95$1), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := \frac{1}{\sin B}\\
t_1 := \frac{-x}{\tan B}\\
\mathbf{if}\;F \leq -7 \cdot 10^{+17}:\\
\;\;\;\;\mathsf{fma}\left(t\_0, -1, t\_1\right)\\
\mathbf{elif}\;F \leq 10500:\\
\;\;\;\;{\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(t\_0, 1, t\_1\right)\\
\end{array}
if F < -7e17Initial program 77.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
mult-flipN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites85.5%
Taylor expanded in F around -inf
Applied rewrites55.8%
if -7e17 < F < 10500Initial program 77.5%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6477.5%
Applied rewrites77.6%
if 10500 < F Initial program 77.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
mult-flipN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites85.5%
Taylor expanded in F around inf
Applied rewrites56.1%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ 1.0 (sin B))) (t_1 (/ (- x) (tan B))))
(if (<= F -1.5e-6)
(fma t_0 -1.0 t_1)
(if (<= F 0.25)
(fma t_0 (* (pow (fma 2.0 x 2.0) -0.5) F) t_1)
(fma t_0 1.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 <= -1.5e-6) {
tmp = fma(t_0, -1.0, t_1);
} else if (F <= 0.25) {
tmp = fma(t_0, (pow(fma(2.0, x, 2.0), -0.5) * F), t_1);
} else {
tmp = fma(t_0, 1.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 <= -1.5e-6) tmp = fma(t_0, -1.0, t_1); elseif (F <= 0.25) tmp = fma(t_0, Float64((fma(2.0, x, 2.0) ^ -0.5) * F), t_1); else tmp = fma(t_0, 1.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, -1.5e-6], N[(t$95$0 * -1.0 + t$95$1), $MachinePrecision], If[LessEqual[F, 0.25], N[(t$95$0 * N[(N[Power[N[(2.0 * x + 2.0), $MachinePrecision], -0.5], $MachinePrecision] * F), $MachinePrecision] + t$95$1), $MachinePrecision], N[(t$95$0 * 1.0 + t$95$1), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := \frac{1}{\sin B}\\
t_1 := \frac{-x}{\tan B}\\
\mathbf{if}\;F \leq -1.5 \cdot 10^{-6}:\\
\;\;\;\;\mathsf{fma}\left(t\_0, -1, t\_1\right)\\
\mathbf{elif}\;F \leq 0.25:\\
\;\;\;\;\mathsf{fma}\left(t\_0, {\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{-0.5} \cdot F, t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_0, 1, t\_1\right)\\
\end{array}
if F < -1.5e-6Initial program 77.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
mult-flipN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites85.5%
Taylor expanded in F around -inf
Applied rewrites55.8%
if -1.5e-6 < F < 0.25Initial program 77.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
mult-flipN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites85.5%
Taylor expanded in F around 0
Applied rewrites56.9%
if 0.25 < F Initial program 77.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
mult-flipN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites85.5%
Taylor expanded in F around inf
Applied rewrites56.1%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ 1.0 (sin B))) (t_1 (/ (- x) (tan B))))
(if (<= F -0.000105)
(fma t_0 -1.0 t_1)
(if (<= F 0.27)
(+ (- (* x (/ 1.0 (tan B)))) (* (/ F (sin B)) (pow 2.0 -0.5)))
(fma t_0 1.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.000105) {
tmp = fma(t_0, -1.0, t_1);
} else if (F <= 0.27) {
tmp = -(x * (1.0 / tan(B))) + ((F / sin(B)) * pow(2.0, -0.5));
} else {
tmp = fma(t_0, 1.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.000105) tmp = fma(t_0, -1.0, t_1); elseif (F <= 0.27) tmp = Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(Float64(F / sin(B)) * (2.0 ^ -0.5))); else tmp = fma(t_0, 1.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.000105], N[(t$95$0 * -1.0 + t$95$1), $MachinePrecision], If[LessEqual[F, 0.27], N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Power[2.0, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * 1.0 + t$95$1), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := \frac{1}{\sin B}\\
t_1 := \frac{-x}{\tan B}\\
\mathbf{if}\;F \leq -0.000105:\\
\;\;\;\;\mathsf{fma}\left(t\_0, -1, t\_1\right)\\
\mathbf{elif}\;F \leq 0.27:\\
\;\;\;\;\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {2}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_0, 1, t\_1\right)\\
\end{array}
if F < -1.05e-4Initial program 77.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
mult-flipN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites85.5%
Taylor expanded in F around -inf
Applied rewrites55.8%
if -1.05e-4 < F < 0.27000000000000002Initial program 77.5%
Taylor expanded in F around 0
metadata-evalN/A
metadata-evalN/A
lower-pow.f64N/A
lower-+.f64N/A
lower-*.f64N/A
metadata-evalN/A
metadata-eval55.6%
Applied rewrites55.6%
Taylor expanded in x around 0
metadata-evalN/A
metadata-evalN/A
lower-pow.f64N/A
metadata-evalN/A
metadata-eval57.6%
Applied rewrites57.6%
if 0.27000000000000002 < F Initial program 77.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
mult-flipN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites85.5%
Taylor expanded in F around inf
Applied rewrites56.1%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ 1.0 (sin B))) (t_1 (/ (- x) (tan B))))
(if (<= F -1e+16)
(fma t_0 -1.0 t_1)
(if (<= F 4.5e-116)
(fma (/ 1.0 B) (* (pow (fma 2.0 x (fma F F 2.0)) -0.5) F) t_1)
(if (<= F 10500.0)
(fma F (/ (pow (fma x 2.0 (fma F F 2.0)) -0.5) (sin B)) (- (/ x B)))
(fma t_0 1.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 <= -1e+16) {
tmp = fma(t_0, -1.0, t_1);
} else if (F <= 4.5e-116) {
tmp = fma((1.0 / B), (pow(fma(2.0, x, fma(F, F, 2.0)), -0.5) * F), t_1);
} else if (F <= 10500.0) {
tmp = fma(F, (pow(fma(x, 2.0, fma(F, F, 2.0)), -0.5) / sin(B)), -(x / B));
} else {
tmp = fma(t_0, 1.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 <= -1e+16) tmp = fma(t_0, -1.0, t_1); elseif (F <= 4.5e-116) tmp = fma(Float64(1.0 / B), Float64((fma(2.0, x, fma(F, F, 2.0)) ^ -0.5) * F), t_1); elseif (F <= 10500.0) tmp = fma(F, Float64((fma(x, 2.0, fma(F, F, 2.0)) ^ -0.5) / sin(B)), Float64(-Float64(x / B))); else tmp = fma(t_0, 1.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, -1e+16], N[(t$95$0 * -1.0 + t$95$1), $MachinePrecision], If[LessEqual[F, 4.5e-116], N[(N[(1.0 / B), $MachinePrecision] * N[(N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * F), $MachinePrecision] + t$95$1), $MachinePrecision], If[LessEqual[F, 10500.0], N[(F * N[(N[Power[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] + (-N[(x / B), $MachinePrecision])), $MachinePrecision], N[(t$95$0 * 1.0 + t$95$1), $MachinePrecision]]]]]]
\begin{array}{l}
t_0 := \frac{1}{\sin B}\\
t_1 := \frac{-x}{\tan B}\\
\mathbf{if}\;F \leq -1 \cdot 10^{+16}:\\
\;\;\;\;\mathsf{fma}\left(t\_0, -1, t\_1\right)\\
\mathbf{elif}\;F \leq 4.5 \cdot 10^{-116}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{B}, {\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5} \cdot F, t\_1\right)\\
\mathbf{elif}\;F \leq 10500:\\
\;\;\;\;\mathsf{fma}\left(F, \frac{{\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{\sin B}, -\frac{x}{B}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_0, 1, t\_1\right)\\
\end{array}
if F < -1e16Initial program 77.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
mult-flipN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites85.5%
Taylor expanded in F around -inf
Applied rewrites55.8%
if -1e16 < F < 4.5000000000000001e-116Initial program 77.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
mult-flipN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites85.5%
Taylor expanded in B around 0
Applied rewrites70.6%
if 4.5000000000000001e-116 < F < 10500Initial program 77.5%
Taylor expanded in B around 0
lower-/.f6449.4%
Applied rewrites49.4%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites57.2%
if 10500 < F Initial program 77.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
mult-flipN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites85.5%
Taylor expanded in F around inf
Applied rewrites56.1%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ 1.0 (sin B))) (t_1 (/ (- x) (tan B))))
(if (<= F -1e+16)
(fma t_0 -1.0 t_1)
(if (<= F 4.5e-116)
(fma (/ 1.0 B) (* (pow (fma 2.0 x (fma F F 2.0)) -0.5) F) t_1)
(if (<= F 1.45e+138)
(fma t_0 (* (pow (fma x 2.0 (fma F F 2.0)) -0.5) F) (- (/ x B)))
(fma (/ 1.0 B) 1.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 <= -1e+16) {
tmp = fma(t_0, -1.0, t_1);
} else if (F <= 4.5e-116) {
tmp = fma((1.0 / B), (pow(fma(2.0, x, fma(F, F, 2.0)), -0.5) * F), t_1);
} else if (F <= 1.45e+138) {
tmp = fma(t_0, (pow(fma(x, 2.0, fma(F, F, 2.0)), -0.5) * F), -(x / B));
} else {
tmp = fma((1.0 / B), 1.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 <= -1e+16) tmp = fma(t_0, -1.0, t_1); elseif (F <= 4.5e-116) tmp = fma(Float64(1.0 / B), Float64((fma(2.0, x, fma(F, F, 2.0)) ^ -0.5) * F), t_1); elseif (F <= 1.45e+138) tmp = fma(t_0, Float64((fma(x, 2.0, fma(F, F, 2.0)) ^ -0.5) * F), Float64(-Float64(x / B))); else tmp = fma(Float64(1.0 / B), 1.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, -1e+16], N[(t$95$0 * -1.0 + t$95$1), $MachinePrecision], If[LessEqual[F, 4.5e-116], N[(N[(1.0 / B), $MachinePrecision] * N[(N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * F), $MachinePrecision] + t$95$1), $MachinePrecision], If[LessEqual[F, 1.45e+138], N[(t$95$0 * N[(N[Power[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * F), $MachinePrecision] + (-N[(x / B), $MachinePrecision])), $MachinePrecision], N[(N[(1.0 / B), $MachinePrecision] * 1.0 + t$95$1), $MachinePrecision]]]]]]
\begin{array}{l}
t_0 := \frac{1}{\sin B}\\
t_1 := \frac{-x}{\tan B}\\
\mathbf{if}\;F \leq -1 \cdot 10^{+16}:\\
\;\;\;\;\mathsf{fma}\left(t\_0, -1, t\_1\right)\\
\mathbf{elif}\;F \leq 4.5 \cdot 10^{-116}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{B}, {\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5} \cdot F, t\_1\right)\\
\mathbf{elif}\;F \leq 1.45 \cdot 10^{+138}:\\
\;\;\;\;\mathsf{fma}\left(t\_0, {\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5} \cdot F, -\frac{x}{B}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{B}, 1, t\_1\right)\\
\end{array}
if F < -1e16Initial program 77.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
mult-flipN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites85.5%
Taylor expanded in F around -inf
Applied rewrites55.8%
if -1e16 < F < 4.5000000000000001e-116Initial program 77.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
mult-flipN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites85.5%
Taylor expanded in B around 0
Applied rewrites70.6%
if 4.5000000000000001e-116 < F < 1.45e138Initial program 77.5%
Taylor expanded in B around 0
lower-/.f6449.4%
Applied rewrites49.4%
lift-+.f64N/A
+-commutativeN/A
Applied rewrites57.2%
if 1.45e138 < F Initial program 77.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
mult-flipN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites85.5%
Taylor expanded in B around 0
Applied rewrites70.6%
Taylor expanded in F around inf
Applied rewrites53.7%
(FPCore (F B x)
:precision binary64
(let* ((t_0
(fma
(/ 1.0 B)
(* (pow (fma 2.0 x (fma F F 2.0)) -0.5) F)
(/ (- x) (tan B)))))
(if (<= x -1.76e-79)
t_0
(if (<= x 7.5e-105)
(fma
(/ 1.0 (sin B))
(* (pow (fma x 2.0 (fma F F 2.0)) -0.5) F)
(- (/ x B)))
t_0))))double code(double F, double B, double x) {
double t_0 = fma((1.0 / B), (pow(fma(2.0, x, fma(F, F, 2.0)), -0.5) * F), (-x / tan(B)));
double tmp;
if (x <= -1.76e-79) {
tmp = t_0;
} else if (x <= 7.5e-105) {
tmp = fma((1.0 / sin(B)), (pow(fma(x, 2.0, fma(F, F, 2.0)), -0.5) * F), -(x / B));
} else {
tmp = t_0;
}
return tmp;
}
function code(F, B, x) t_0 = fma(Float64(1.0 / B), Float64((fma(2.0, x, fma(F, F, 2.0)) ^ -0.5) * F), Float64(Float64(-x) / tan(B))) tmp = 0.0 if (x <= -1.76e-79) tmp = t_0; elseif (x <= 7.5e-105) tmp = fma(Float64(1.0 / sin(B)), Float64((fma(x, 2.0, fma(F, F, 2.0)) ^ -0.5) * F), Float64(-Float64(x / B))); else tmp = t_0; end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(N[(1.0 / B), $MachinePrecision] * N[(N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * F), $MachinePrecision] + N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.76e-79], t$95$0, If[LessEqual[x, 7.5e-105], N[(N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * F), $MachinePrecision] + (-N[(x / B), $MachinePrecision])), $MachinePrecision], t$95$0]]]
\begin{array}{l}
t_0 := \mathsf{fma}\left(\frac{1}{B}, {\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5} \cdot F, \frac{-x}{\tan B}\right)\\
\mathbf{if}\;x \leq -1.76 \cdot 10^{-79}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 7.5 \cdot 10^{-105}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{\sin B}, {\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5} \cdot F, -\frac{x}{B}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if x < -1.7600000000000001e-79 or 7.5000000000000006e-105 < x Initial program 77.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
mult-flipN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites85.5%
Taylor expanded in B around 0
Applied rewrites70.6%
if -1.7600000000000001e-79 < x < 7.5000000000000006e-105Initial program 77.5%
Taylor expanded in B around 0
lower-/.f6449.4%
Applied rewrites49.4%
lift-+.f64N/A
+-commutativeN/A
Applied rewrites57.2%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ (- x) (tan B))))
(if (<= F -1.5e-6)
(fma (/ 1.0 B) -1.0 t_0)
(if (<= F 4.5e-116)
(fma (/ 1.0 B) (* (pow (+ 2.0 (* 2.0 x)) -0.5) F) t_0)
(if (<= F 1.45e+138)
(fma F (/ (pow (fma x 2.0 (fma F F 2.0)) -0.5) (sin B)) (- (/ x B)))
(fma (/ 1.0 B) 1.0 t_0))))))double code(double F, double B, double x) {
double t_0 = -x / tan(B);
double tmp;
if (F <= -1.5e-6) {
tmp = fma((1.0 / B), -1.0, t_0);
} else if (F <= 4.5e-116) {
tmp = fma((1.0 / B), (pow((2.0 + (2.0 * x)), -0.5) * F), t_0);
} else if (F <= 1.45e+138) {
tmp = fma(F, (pow(fma(x, 2.0, fma(F, F, 2.0)), -0.5) / sin(B)), -(x / B));
} else {
tmp = fma((1.0 / B), 1.0, t_0);
}
return tmp;
}
function code(F, B, x) t_0 = Float64(Float64(-x) / tan(B)) tmp = 0.0 if (F <= -1.5e-6) tmp = fma(Float64(1.0 / B), -1.0, t_0); elseif (F <= 4.5e-116) tmp = fma(Float64(1.0 / B), Float64((Float64(2.0 + Float64(2.0 * x)) ^ -0.5) * F), t_0); elseif (F <= 1.45e+138) tmp = fma(F, Float64((fma(x, 2.0, fma(F, F, 2.0)) ^ -0.5) / sin(B)), Float64(-Float64(x / B))); else tmp = fma(Float64(1.0 / B), 1.0, t_0); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -1.5e-6], N[(N[(1.0 / B), $MachinePrecision] * -1.0 + t$95$0), $MachinePrecision], If[LessEqual[F, 4.5e-116], N[(N[(1.0 / B), $MachinePrecision] * N[(N[Power[N[(2.0 + N[(2.0 * x), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * F), $MachinePrecision] + t$95$0), $MachinePrecision], If[LessEqual[F, 1.45e+138], N[(F * N[(N[Power[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] + (-N[(x / B), $MachinePrecision])), $MachinePrecision], N[(N[(1.0 / B), $MachinePrecision] * 1.0 + t$95$0), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := \frac{-x}{\tan B}\\
\mathbf{if}\;F \leq -1.5 \cdot 10^{-6}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{B}, -1, t\_0\right)\\
\mathbf{elif}\;F \leq 4.5 \cdot 10^{-116}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{B}, {\left(2 + 2 \cdot x\right)}^{-0.5} \cdot F, t\_0\right)\\
\mathbf{elif}\;F \leq 1.45 \cdot 10^{+138}:\\
\;\;\;\;\mathsf{fma}\left(F, \frac{{\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{\sin B}, -\frac{x}{B}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{B}, 1, t\_0\right)\\
\end{array}
if F < -1.5e-6Initial program 77.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
mult-flipN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites85.5%
Taylor expanded in B around 0
Applied rewrites70.6%
Taylor expanded in F around -inf
Applied rewrites53.8%
if -1.5e-6 < F < 4.5000000000000001e-116Initial program 77.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
mult-flipN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites85.5%
Taylor expanded in B around 0
Applied rewrites70.6%
Taylor expanded in F around 0
lower-+.f64N/A
lower-*.f6450.9%
Applied rewrites50.9%
if 4.5000000000000001e-116 < F < 1.45e138Initial program 77.5%
Taylor expanded in B around 0
lower-/.f6449.4%
Applied rewrites49.4%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites57.2%
if 1.45e138 < F Initial program 77.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
mult-flipN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites85.5%
Taylor expanded in B around 0
Applied rewrites70.6%
Taylor expanded in F around inf
Applied rewrites53.7%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (* -1.0 (/ (* x (cos B)) (sin B)))))
(if (<= x -3.2e-50)
t_0
(if (<= x 8.5e-105)
(fma
(/ 1.0 (sin B))
(* (pow (fma x 2.0 (fma F F 2.0)) -0.5) F)
(- (/ x B)))
t_0))))double code(double F, double B, double x) {
double t_0 = -1.0 * ((x * cos(B)) / sin(B));
double tmp;
if (x <= -3.2e-50) {
tmp = t_0;
} else if (x <= 8.5e-105) {
tmp = fma((1.0 / sin(B)), (pow(fma(x, 2.0, fma(F, F, 2.0)), -0.5) * F), -(x / B));
} else {
tmp = t_0;
}
return tmp;
}
function code(F, B, x) t_0 = Float64(-1.0 * Float64(Float64(x * cos(B)) / sin(B))) tmp = 0.0 if (x <= -3.2e-50) tmp = t_0; elseif (x <= 8.5e-105) tmp = fma(Float64(1.0 / sin(B)), Float64((fma(x, 2.0, fma(F, F, 2.0)) ^ -0.5) * F), Float64(-Float64(x / B))); else tmp = t_0; end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(-1.0 * N[(N[(x * N[Cos[B], $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -3.2e-50], t$95$0, If[LessEqual[x, 8.5e-105], N[(N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * F), $MachinePrecision] + (-N[(x / B), $MachinePrecision])), $MachinePrecision], t$95$0]]]
\begin{array}{l}
t_0 := -1 \cdot \frac{x \cdot \cos B}{\sin B}\\
\mathbf{if}\;x \leq -3.2 \cdot 10^{-50}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 8.5 \cdot 10^{-105}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{\sin B}, {\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5} \cdot F, -\frac{x}{B}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if x < -3.2e-50 or 8.5000000000000004e-105 < x Initial program 77.5%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6456.4%
Applied rewrites56.4%
if -3.2e-50 < x < 8.5000000000000004e-105Initial program 77.5%
Taylor expanded in B around 0
lower-/.f6449.4%
Applied rewrites49.4%
lift-+.f64N/A
+-commutativeN/A
Applied rewrites57.2%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (* -1.0 (/ (* x (cos B)) (sin B)))))
(if (<= x -3.2e-50)
t_0
(if (<= x 1.6e-100)
(fma F (/ (pow (fma x 2.0 (fma F F 2.0)) -0.5) (sin B)) (- (/ x B)))
t_0))))double code(double F, double B, double x) {
double t_0 = -1.0 * ((x * cos(B)) / sin(B));
double tmp;
if (x <= -3.2e-50) {
tmp = t_0;
} else if (x <= 1.6e-100) {
tmp = fma(F, (pow(fma(x, 2.0, fma(F, F, 2.0)), -0.5) / sin(B)), -(x / B));
} else {
tmp = t_0;
}
return tmp;
}
function code(F, B, x) t_0 = Float64(-1.0 * Float64(Float64(x * cos(B)) / sin(B))) tmp = 0.0 if (x <= -3.2e-50) tmp = t_0; elseif (x <= 1.6e-100) tmp = fma(F, Float64((fma(x, 2.0, fma(F, F, 2.0)) ^ -0.5) / sin(B)), Float64(-Float64(x / B))); else tmp = t_0; end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(-1.0 * N[(N[(x * N[Cos[B], $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -3.2e-50], t$95$0, If[LessEqual[x, 1.6e-100], N[(F * N[(N[Power[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] + (-N[(x / B), $MachinePrecision])), $MachinePrecision], t$95$0]]]
\begin{array}{l}
t_0 := -1 \cdot \frac{x \cdot \cos B}{\sin B}\\
\mathbf{if}\;x \leq -3.2 \cdot 10^{-50}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 1.6 \cdot 10^{-100}:\\
\;\;\;\;\mathsf{fma}\left(F, \frac{{\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{\sin B}, -\frac{x}{B}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if x < -3.2e-50 or 1.6000000000000001e-100 < x Initial program 77.5%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6456.4%
Applied rewrites56.4%
if -3.2e-50 < x < 1.6000000000000001e-100Initial program 77.5%
Taylor expanded in B around 0
lower-/.f6449.4%
Applied rewrites49.4%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites57.2%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ (- x) (tan B))))
(if (<= x -2.15e-89)
(fma (/ 1.0 B) -1.0 t_0)
(if (<= x 0.31)
(fma F (/ (pow (fma x 2.0 (fma F F 2.0)) -0.5) (sin B)) (- (/ x B)))
(fma (/ 1.0 B) 1.0 t_0)))))double code(double F, double B, double x) {
double t_0 = -x / tan(B);
double tmp;
if (x <= -2.15e-89) {
tmp = fma((1.0 / B), -1.0, t_0);
} else if (x <= 0.31) {
tmp = fma(F, (pow(fma(x, 2.0, fma(F, F, 2.0)), -0.5) / sin(B)), -(x / B));
} else {
tmp = fma((1.0 / B), 1.0, t_0);
}
return tmp;
}
function code(F, B, x) t_0 = Float64(Float64(-x) / tan(B)) tmp = 0.0 if (x <= -2.15e-89) tmp = fma(Float64(1.0 / B), -1.0, t_0); elseif (x <= 0.31) tmp = fma(F, Float64((fma(x, 2.0, fma(F, F, 2.0)) ^ -0.5) / sin(B)), Float64(-Float64(x / B))); else tmp = fma(Float64(1.0 / B), 1.0, 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.15e-89], N[(N[(1.0 / B), $MachinePrecision] * -1.0 + t$95$0), $MachinePrecision], If[LessEqual[x, 0.31], N[(F * N[(N[Power[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] + (-N[(x / B), $MachinePrecision])), $MachinePrecision], N[(N[(1.0 / B), $MachinePrecision] * 1.0 + t$95$0), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \frac{-x}{\tan B}\\
\mathbf{if}\;x \leq -2.15 \cdot 10^{-89}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{B}, -1, t\_0\right)\\
\mathbf{elif}\;x \leq 0.31:\\
\;\;\;\;\mathsf{fma}\left(F, \frac{{\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{\sin B}, -\frac{x}{B}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{B}, 1, t\_0\right)\\
\end{array}
if x < -2.1499999999999999e-89Initial program 77.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
mult-flipN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites85.5%
Taylor expanded in B around 0
Applied rewrites70.6%
Taylor expanded in F around -inf
Applied rewrites53.8%
if -2.1499999999999999e-89 < x < 0.31Initial program 77.5%
Taylor expanded in B around 0
lower-/.f6449.4%
Applied rewrites49.4%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites57.2%
if 0.31 < x Initial program 77.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
mult-flipN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites85.5%
Taylor expanded in B around 0
Applied rewrites70.6%
Taylor expanded in F around inf
Applied rewrites53.7%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ (- x) (tan B))))
(if (<= x -1.1e-92)
(fma (/ 1.0 B) -1.0 t_0)
(if (<= x 5e-80)
(- (* (pow (fma x 2.0 (fma F F 2.0)) -0.5) (/ F (sin B))) (/ x B))
(fma (/ 1.0 B) 1.0 t_0)))))double code(double F, double B, double x) {
double t_0 = -x / tan(B);
double tmp;
if (x <= -1.1e-92) {
tmp = fma((1.0 / B), -1.0, t_0);
} else if (x <= 5e-80) {
tmp = (pow(fma(x, 2.0, fma(F, F, 2.0)), -0.5) * (F / sin(B))) - (x / B);
} else {
tmp = fma((1.0 / B), 1.0, t_0);
}
return tmp;
}
function code(F, B, x) t_0 = Float64(Float64(-x) / tan(B)) tmp = 0.0 if (x <= -1.1e-92) tmp = fma(Float64(1.0 / B), -1.0, t_0); elseif (x <= 5e-80) tmp = Float64(Float64((fma(x, 2.0, fma(F, F, 2.0)) ^ -0.5) * Float64(F / sin(B))) - Float64(x / B)); else tmp = fma(Float64(1.0 / B), 1.0, 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.1e-92], N[(N[(1.0 / B), $MachinePrecision] * -1.0 + t$95$0), $MachinePrecision], If[LessEqual[x, 5e-80], N[(N[(N[Power[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / B), $MachinePrecision] * 1.0 + t$95$0), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \frac{-x}{\tan B}\\
\mathbf{if}\;x \leq -1.1 \cdot 10^{-92}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{B}, -1, t\_0\right)\\
\mathbf{elif}\;x \leq 5 \cdot 10^{-80}:\\
\;\;\;\;{\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5} \cdot \frac{F}{\sin B} - \frac{x}{B}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{B}, 1, t\_0\right)\\
\end{array}
if x < -1.0999999999999999e-92Initial program 77.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
mult-flipN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites85.5%
Taylor expanded in B around 0
Applied rewrites70.6%
Taylor expanded in F around -inf
Applied rewrites53.8%
if -1.0999999999999999e-92 < x < 5e-80Initial program 77.5%
Taylor expanded in B around 0
lower-/.f6449.4%
Applied rewrites49.4%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6449.4%
Applied rewrites49.4%
if 5e-80 < x Initial program 77.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
mult-flipN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites85.5%
Taylor expanded in B around 0
Applied rewrites70.6%
Taylor expanded in F around inf
Applied rewrites53.7%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (- (/ x B)))
(t_1 (fma (/ (pow (fma x 2.0 2.0) -0.5) (sin B)) F t_0)))
(if (<= F -4.4e-27)
(fma (/ 1.0 B) -1.0 (/ (- x) (tan B)))
(if (<= F -4.6e-277)
t_1
(if (<= F 1.65e-149)
(+ (- (* x (/ 1.0 (tan B)))) (* (/ F B) (/ 1.0 F)))
(if (<= F 0.25) t_1 (fma (/ 1.0 (* F (sin B))) F t_0)))))))double code(double F, double B, double x) {
double t_0 = -(x / B);
double t_1 = fma((pow(fma(x, 2.0, 2.0), -0.5) / sin(B)), F, t_0);
double tmp;
if (F <= -4.4e-27) {
tmp = fma((1.0 / B), -1.0, (-x / tan(B)));
} else if (F <= -4.6e-277) {
tmp = t_1;
} else if (F <= 1.65e-149) {
tmp = -(x * (1.0 / tan(B))) + ((F / B) * (1.0 / F));
} else if (F <= 0.25) {
tmp = t_1;
} else {
tmp = fma((1.0 / (F * sin(B))), F, t_0);
}
return tmp;
}
function code(F, B, x) t_0 = Float64(-Float64(x / B)) t_1 = fma(Float64((fma(x, 2.0, 2.0) ^ -0.5) / sin(B)), F, t_0) tmp = 0.0 if (F <= -4.4e-27) tmp = fma(Float64(1.0 / B), -1.0, Float64(Float64(-x) / tan(B))); elseif (F <= -4.6e-277) tmp = t_1; elseif (F <= 1.65e-149) tmp = Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(Float64(F / B) * Float64(1.0 / F))); elseif (F <= 0.25) tmp = t_1; else tmp = fma(Float64(1.0 / Float64(F * sin(B))), F, t_0); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = (-N[(x / B), $MachinePrecision])}, Block[{t$95$1 = N[(N[(N[Power[N[(x * 2.0 + 2.0), $MachinePrecision], -0.5], $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] * F + t$95$0), $MachinePrecision]}, If[LessEqual[F, -4.4e-27], N[(N[(1.0 / B), $MachinePrecision] * -1.0 + N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, -4.6e-277], t$95$1, If[LessEqual[F, 1.65e-149], N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(N[(F / B), $MachinePrecision] * N[(1.0 / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 0.25], t$95$1, N[(N[(1.0 / N[(F * N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * F + t$95$0), $MachinePrecision]]]]]]]
\begin{array}{l}
t_0 := -\frac{x}{B}\\
t_1 := \mathsf{fma}\left(\frac{{\left(\mathsf{fma}\left(x, 2, 2\right)\right)}^{-0.5}}{\sin B}, F, t\_0\right)\\
\mathbf{if}\;F \leq -4.4 \cdot 10^{-27}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{B}, -1, \frac{-x}{\tan B}\right)\\
\mathbf{elif}\;F \leq -4.6 \cdot 10^{-277}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;F \leq 1.65 \cdot 10^{-149}:\\
\;\;\;\;\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{B} \cdot \frac{1}{F}\\
\mathbf{elif}\;F \leq 0.25:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{F \cdot \sin B}, F, t\_0\right)\\
\end{array}
if F < -4.3999999999999997e-27Initial program 77.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
mult-flipN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites85.5%
Taylor expanded in B around 0
Applied rewrites70.6%
Taylor expanded in F around -inf
Applied rewrites53.8%
if -4.3999999999999997e-27 < F < -4.6000000000000004e-277 or 1.6500000000000001e-149 < F < 0.25Initial program 77.5%
Taylor expanded in B around 0
lower-/.f6449.4%
Applied rewrites49.4%
Applied rewrites57.2%
Taylor expanded in F around 0
Applied rewrites36.9%
lift-*.f64N/A
lift-sin.f64N/A
lift-/.f64N/A
mult-flip-revN/A
lower-/.f64N/A
lift-sin.f6436.9%
Applied rewrites36.9%
if -4.6000000000000004e-277 < F < 1.6500000000000001e-149Initial program 77.5%
Taylor expanded in F around inf
lower-/.f6447.8%
Applied rewrites47.8%
Taylor expanded in B around 0
lower-/.f6446.4%
Applied rewrites46.4%
if 0.25 < F Initial program 77.5%
Taylor expanded in B around 0
lower-/.f6449.4%
Applied rewrites49.4%
Applied rewrites57.2%
Taylor expanded in F around inf
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f6432.4%
Applied rewrites32.4%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (- (* (pow (fma x 2.0 2.0) -0.5) (/ F (sin B))) (/ x B))))
(if (<= F -4.4e-27)
(fma (/ 1.0 B) -1.0 (/ (- x) (tan B)))
(if (<= F -4.6e-277)
t_0
(if (<= F 1.65e-149)
(+ (- (* x (/ 1.0 (tan B)))) (* (/ F B) (/ 1.0 F)))
(if (<= F 0.25) t_0 (fma (/ 1.0 (* F (sin B))) F (- (/ x B)))))))))double code(double F, double B, double x) {
double t_0 = (pow(fma(x, 2.0, 2.0), -0.5) * (F / sin(B))) - (x / B);
double tmp;
if (F <= -4.4e-27) {
tmp = fma((1.0 / B), -1.0, (-x / tan(B)));
} else if (F <= -4.6e-277) {
tmp = t_0;
} else if (F <= 1.65e-149) {
tmp = -(x * (1.0 / tan(B))) + ((F / B) * (1.0 / F));
} else if (F <= 0.25) {
tmp = t_0;
} else {
tmp = fma((1.0 / (F * sin(B))), F, -(x / B));
}
return tmp;
}
function code(F, B, x) t_0 = Float64(Float64((fma(x, 2.0, 2.0) ^ -0.5) * Float64(F / sin(B))) - Float64(x / B)) tmp = 0.0 if (F <= -4.4e-27) tmp = fma(Float64(1.0 / B), -1.0, Float64(Float64(-x) / tan(B))); elseif (F <= -4.6e-277) tmp = t_0; elseif (F <= 1.65e-149) tmp = Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(Float64(F / B) * Float64(1.0 / F))); elseif (F <= 0.25) tmp = t_0; else tmp = fma(Float64(1.0 / Float64(F * sin(B))), F, Float64(-Float64(x / B))); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(N[(N[Power[N[(x * 2.0 + 2.0), $MachinePrecision], -0.5], $MachinePrecision] * N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -4.4e-27], N[(N[(1.0 / B), $MachinePrecision] * -1.0 + N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, -4.6e-277], t$95$0, If[LessEqual[F, 1.65e-149], N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(N[(F / B), $MachinePrecision] * N[(1.0 / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 0.25], t$95$0, N[(N[(1.0 / N[(F * N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * F + (-N[(x / B), $MachinePrecision])), $MachinePrecision]]]]]]
\begin{array}{l}
t_0 := {\left(\mathsf{fma}\left(x, 2, 2\right)\right)}^{-0.5} \cdot \frac{F}{\sin B} - \frac{x}{B}\\
\mathbf{if}\;F \leq -4.4 \cdot 10^{-27}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{B}, -1, \frac{-x}{\tan B}\right)\\
\mathbf{elif}\;F \leq -4.6 \cdot 10^{-277}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;F \leq 1.65 \cdot 10^{-149}:\\
\;\;\;\;\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{B} \cdot \frac{1}{F}\\
\mathbf{elif}\;F \leq 0.25:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{F \cdot \sin B}, F, -\frac{x}{B}\right)\\
\end{array}
if F < -4.3999999999999997e-27Initial program 77.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
mult-flipN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites85.5%
Taylor expanded in B around 0
Applied rewrites70.6%
Taylor expanded in F around -inf
Applied rewrites53.8%
if -4.3999999999999997e-27 < F < -4.6000000000000004e-277 or 1.6500000000000001e-149 < F < 0.25Initial program 77.5%
Taylor expanded in B around 0
lower-/.f6449.4%
Applied rewrites49.4%
Applied rewrites57.2%
Taylor expanded in F around 0
Applied rewrites36.9%
lift-fma.f64N/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f64N/A
Applied rewrites35.6%
if -4.6000000000000004e-277 < F < 1.6500000000000001e-149Initial program 77.5%
Taylor expanded in F around inf
lower-/.f6447.8%
Applied rewrites47.8%
Taylor expanded in B around 0
lower-/.f6446.4%
Applied rewrites46.4%
if 0.25 < F Initial program 77.5%
Taylor expanded in B around 0
lower-/.f6449.4%
Applied rewrites49.4%
Applied rewrites57.2%
Taylor expanded in F around inf
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f6432.4%
Applied rewrites32.4%
(FPCore (F B x)
:precision binary64
(*
(copysign 1.0 B)
(if (<= (fabs B) 0.00072)
(/ (- (* F (pow (+ 2.0 (fma 2.0 x (pow F 2.0))) -0.5)) x) (fabs B))
(+ (- (* x (/ 1.0 (tan (fabs B))))) (* (/ F (fabs B)) (/ 1.0 F))))))double code(double F, double B, double x) {
double tmp;
if (fabs(B) <= 0.00072) {
tmp = ((F * pow((2.0 + fma(2.0, x, pow(F, 2.0))), -0.5)) - x) / fabs(B);
} else {
tmp = -(x * (1.0 / tan(fabs(B)))) + ((F / fabs(B)) * (1.0 / F));
}
return copysign(1.0, B) * tmp;
}
function code(F, B, x) tmp = 0.0 if (abs(B) <= 0.00072) tmp = Float64(Float64(Float64(F * (Float64(2.0 + fma(2.0, x, (F ^ 2.0))) ^ -0.5)) - x) / abs(B)); else tmp = Float64(Float64(-Float64(x * Float64(1.0 / tan(abs(B))))) + Float64(Float64(F / abs(B)) * Float64(1.0 / F))); end return Float64(copysign(1.0, B) * tmp) end
code[F_, B_, x_] := N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[B]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[B], $MachinePrecision], 0.00072], 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] / N[Abs[B], $MachinePrecision]), $MachinePrecision], N[((-N[(x * N[(1.0 / N[Tan[N[Abs[B], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(N[(F / N[Abs[B], $MachinePrecision]), $MachinePrecision] * N[(1.0 / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\mathsf{copysign}\left(1, B\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|B\right| \leq 0.00072:\\
\;\;\;\;\frac{F \cdot {\left(2 + \mathsf{fma}\left(2, x, {F}^{2}\right)\right)}^{-0.5} - x}{\left|B\right|}\\
\mathbf{else}:\\
\;\;\;\;\left(-x \cdot \frac{1}{\tan \left(\left|B\right|\right)}\right) + \frac{F}{\left|B\right|} \cdot \frac{1}{F}\\
\end{array}
if B < 7.2000000000000005e-4Initial program 77.5%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites43.1%
if 7.2000000000000005e-4 < B Initial program 77.5%
Taylor expanded in F around inf
lower-/.f6447.8%
Applied rewrites47.8%
Taylor expanded in B around 0
lower-/.f6446.4%
Applied rewrites46.4%
(FPCore (F B x)
:precision binary64
(*
(copysign 1.0 B)
(if (<= (fabs B) 1.4e-12)
(/ (- (* F (pow (+ 2.0 (fma 2.0 x (pow F 2.0))) -0.5)) x) (fabs B))
(fma (/ 1.0 (fabs B)) 1.0 (/ (- x) (tan (fabs B)))))))double code(double F, double B, double x) {
double tmp;
if (fabs(B) <= 1.4e-12) {
tmp = ((F * pow((2.0 + fma(2.0, x, pow(F, 2.0))), -0.5)) - x) / fabs(B);
} else {
tmp = fma((1.0 / fabs(B)), 1.0, (-x / tan(fabs(B))));
}
return copysign(1.0, B) * tmp;
}
function code(F, B, x) tmp = 0.0 if (abs(B) <= 1.4e-12) tmp = Float64(Float64(Float64(F * (Float64(2.0 + fma(2.0, x, (F ^ 2.0))) ^ -0.5)) - x) / abs(B)); else tmp = fma(Float64(1.0 / abs(B)), 1.0, Float64(Float64(-x) / tan(abs(B)))); end return Float64(copysign(1.0, B) * tmp) end
code[F_, B_, x_] := N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[B]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[B], $MachinePrecision], 1.4e-12], 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] / N[Abs[B], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[Abs[B], $MachinePrecision]), $MachinePrecision] * 1.0 + N[((-x) / N[Tan[N[Abs[B], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\mathsf{copysign}\left(1, B\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|B\right| \leq 1.4 \cdot 10^{-12}:\\
\;\;\;\;\frac{F \cdot {\left(2 + \mathsf{fma}\left(2, x, {F}^{2}\right)\right)}^{-0.5} - x}{\left|B\right|}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{\left|B\right|}, 1, \frac{-x}{\tan \left(\left|B\right|\right)}\right)\\
\end{array}
if B < 1.4000000000000001e-12Initial program 77.5%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites43.1%
if 1.4000000000000001e-12 < B Initial program 77.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
mult-flipN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites85.5%
Taylor expanded in B around 0
Applied rewrites70.6%
Taylor expanded in F around inf
Applied rewrites53.7%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ 1.0 (fabs B))))
(*
(copysign 1.0 B)
(if (<= (fabs B) 1.4e-12)
(fma
t_0
(* (pow (fma 2.0 x (fma F F 2.0)) -0.5) F)
(* -1.0 (/ x (fabs B))))
(fma t_0 1.0 (/ (- x) (tan (fabs B))))))))double code(double F, double B, double x) {
double t_0 = 1.0 / fabs(B);
double tmp;
if (fabs(B) <= 1.4e-12) {
tmp = fma(t_0, (pow(fma(2.0, x, fma(F, F, 2.0)), -0.5) * F), (-1.0 * (x / fabs(B))));
} else {
tmp = fma(t_0, 1.0, (-x / tan(fabs(B))));
}
return copysign(1.0, B) * tmp;
}
function code(F, B, x) t_0 = Float64(1.0 / abs(B)) tmp = 0.0 if (abs(B) <= 1.4e-12) tmp = fma(t_0, Float64((fma(2.0, x, fma(F, F, 2.0)) ^ -0.5) * F), Float64(-1.0 * Float64(x / abs(B)))); else tmp = fma(t_0, 1.0, Float64(Float64(-x) / tan(abs(B)))); end return Float64(copysign(1.0, B) * tmp) end
code[F_, B_, x_] := Block[{t$95$0 = N[(1.0 / N[Abs[B], $MachinePrecision]), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[B]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[B], $MachinePrecision], 1.4e-12], N[(t$95$0 * N[(N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * F), $MachinePrecision] + N[(-1.0 * N[(x / N[Abs[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * 1.0 + N[((-x) / N[Tan[N[Abs[B], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
t_0 := \frac{1}{\left|B\right|}\\
\mathsf{copysign}\left(1, B\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|B\right| \leq 1.4 \cdot 10^{-12}:\\
\;\;\;\;\mathsf{fma}\left(t\_0, {\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5} \cdot F, -1 \cdot \frac{x}{\left|B\right|}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_0, 1, \frac{-x}{\tan \left(\left|B\right|\right)}\right)\\
\end{array}
\end{array}
if B < 1.4000000000000001e-12Initial program 77.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
mult-flipN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites85.5%
Taylor expanded in B around 0
Applied rewrites70.6%
Taylor expanded in B around 0
lower-*.f64N/A
lower-/.f6443.1%
Applied rewrites43.1%
if 1.4000000000000001e-12 < B Initial program 77.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
mult-flipN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites85.5%
Taylor expanded in B around 0
Applied rewrites70.6%
Taylor expanded in F around inf
Applied rewrites53.7%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ 1.0 (fabs B))))
(*
(copysign 1.0 B)
(if (<= (fabs B) 1.1e-11)
(fma
t_0
(* (pow (fma 2.0 x (fma F F 2.0)) -0.5) F)
(* -1.0 (/ x (fabs B))))
(fma t_0 -1.0 (/ (- x) (tan (fabs B))))))))double code(double F, double B, double x) {
double t_0 = 1.0 / fabs(B);
double tmp;
if (fabs(B) <= 1.1e-11) {
tmp = fma(t_0, (pow(fma(2.0, x, fma(F, F, 2.0)), -0.5) * F), (-1.0 * (x / fabs(B))));
} else {
tmp = fma(t_0, -1.0, (-x / tan(fabs(B))));
}
return copysign(1.0, B) * tmp;
}
function code(F, B, x) t_0 = Float64(1.0 / abs(B)) tmp = 0.0 if (abs(B) <= 1.1e-11) tmp = fma(t_0, Float64((fma(2.0, x, fma(F, F, 2.0)) ^ -0.5) * F), Float64(-1.0 * Float64(x / abs(B)))); else tmp = fma(t_0, -1.0, Float64(Float64(-x) / tan(abs(B)))); end return Float64(copysign(1.0, B) * tmp) end
code[F_, B_, x_] := Block[{t$95$0 = N[(1.0 / N[Abs[B], $MachinePrecision]), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[B]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[B], $MachinePrecision], 1.1e-11], N[(t$95$0 * N[(N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * F), $MachinePrecision] + N[(-1.0 * N[(x / N[Abs[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * -1.0 + N[((-x) / N[Tan[N[Abs[B], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
t_0 := \frac{1}{\left|B\right|}\\
\mathsf{copysign}\left(1, B\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|B\right| \leq 1.1 \cdot 10^{-11}:\\
\;\;\;\;\mathsf{fma}\left(t\_0, {\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5} \cdot F, -1 \cdot \frac{x}{\left|B\right|}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_0, -1, \frac{-x}{\tan \left(\left|B\right|\right)}\right)\\
\end{array}
\end{array}
if B < 1.1000000000000001e-11Initial program 77.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
mult-flipN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites85.5%
Taylor expanded in B around 0
Applied rewrites70.6%
Taylor expanded in B around 0
lower-*.f64N/A
lower-/.f6443.1%
Applied rewrites43.1%
if 1.1000000000000001e-11 < B Initial program 77.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
mult-flipN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites85.5%
Taylor expanded in B around 0
Applied rewrites70.6%
Taylor expanded in F around -inf
Applied rewrites53.8%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (* F (sin B))) (t_1 (- (/ x B))))
(if (<= F -4.5e+15)
(fma (/ -1.0 t_0) F t_1)
(if (<= F 250.0)
(fma
(/ 1.0 B)
(* (pow (fma 2.0 x (fma F F 2.0)) -0.5) F)
(* -1.0 (/ x B)))
(fma (/ 1.0 t_0) F t_1)))))double code(double F, double B, double x) {
double t_0 = F * sin(B);
double t_1 = -(x / B);
double tmp;
if (F <= -4.5e+15) {
tmp = fma((-1.0 / t_0), F, t_1);
} else if (F <= 250.0) {
tmp = fma((1.0 / B), (pow(fma(2.0, x, fma(F, F, 2.0)), -0.5) * F), (-1.0 * (x / B)));
} else {
tmp = fma((1.0 / t_0), F, t_1);
}
return tmp;
}
function code(F, B, x) t_0 = Float64(F * sin(B)) t_1 = Float64(-Float64(x / B)) tmp = 0.0 if (F <= -4.5e+15) tmp = fma(Float64(-1.0 / t_0), F, t_1); elseif (F <= 250.0) tmp = fma(Float64(1.0 / B), Float64((fma(2.0, x, fma(F, F, 2.0)) ^ -0.5) * F), Float64(-1.0 * Float64(x / B))); else tmp = fma(Float64(1.0 / t_0), F, t_1); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(F * N[Sin[B], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = (-N[(x / B), $MachinePrecision])}, If[LessEqual[F, -4.5e+15], N[(N[(-1.0 / t$95$0), $MachinePrecision] * F + t$95$1), $MachinePrecision], If[LessEqual[F, 250.0], N[(N[(1.0 / B), $MachinePrecision] * N[(N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * F), $MachinePrecision] + N[(-1.0 * N[(x / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / t$95$0), $MachinePrecision] * F + t$95$1), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := F \cdot \sin B\\
t_1 := -\frac{x}{B}\\
\mathbf{if}\;F \leq -4.5 \cdot 10^{+15}:\\
\;\;\;\;\mathsf{fma}\left(\frac{-1}{t\_0}, F, t\_1\right)\\
\mathbf{elif}\;F \leq 250:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{B}, {\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5} \cdot F, -1 \cdot \frac{x}{B}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{t\_0}, F, t\_1\right)\\
\end{array}
if F < -4.5e15Initial program 77.5%
Taylor expanded in B around 0
lower-/.f6449.4%
Applied rewrites49.4%
Applied rewrites57.2%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f6434.3%
Applied rewrites34.3%
if -4.5e15 < F < 250Initial program 77.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
mult-flipN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites85.5%
Taylor expanded in B around 0
Applied rewrites70.6%
Taylor expanded in B around 0
lower-*.f64N/A
lower-/.f6443.1%
Applied rewrites43.1%
if 250 < F Initial program 77.5%
Taylor expanded in B around 0
lower-/.f6449.4%
Applied rewrites49.4%
Applied rewrites57.2%
Taylor expanded in F around inf
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f6432.4%
Applied rewrites32.4%
(FPCore (F B x)
:precision binary64
(if (<= F -4.5e+15)
(fma (/ -1.0 (* F (sin B))) F (- (/ x B)))
(if (<= F 460000000000.0)
(fma
(/ 1.0 B)
(* (pow (fma 2.0 x (fma F F 2.0)) -0.5) F)
(* -1.0 (/ x B)))
(/ 1.0 (sin B)))))double code(double F, double B, double x) {
double tmp;
if (F <= -4.5e+15) {
tmp = fma((-1.0 / (F * sin(B))), F, -(x / B));
} else if (F <= 460000000000.0) {
tmp = fma((1.0 / B), (pow(fma(2.0, x, fma(F, F, 2.0)), -0.5) * F), (-1.0 * (x / B)));
} else {
tmp = 1.0 / sin(B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -4.5e+15) tmp = fma(Float64(-1.0 / Float64(F * sin(B))), F, Float64(-Float64(x / B))); elseif (F <= 460000000000.0) tmp = fma(Float64(1.0 / B), Float64((fma(2.0, x, fma(F, F, 2.0)) ^ -0.5) * F), Float64(-1.0 * Float64(x / B))); else tmp = Float64(1.0 / sin(B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -4.5e+15], N[(N[(-1.0 / N[(F * N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * F + (-N[(x / B), $MachinePrecision])), $MachinePrecision], If[LessEqual[F, 460000000000.0], N[(N[(1.0 / B), $MachinePrecision] * N[(N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * F), $MachinePrecision] + N[(-1.0 * N[(x / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;F \leq -4.5 \cdot 10^{+15}:\\
\;\;\;\;\mathsf{fma}\left(\frac{-1}{F \cdot \sin B}, F, -\frac{x}{B}\right)\\
\mathbf{elif}\;F \leq 460000000000:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{B}, {\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5} \cdot F, -1 \cdot \frac{x}{B}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B}\\
\end{array}
if F < -4.5e15Initial program 77.5%
Taylor expanded in B around 0
lower-/.f6449.4%
Applied rewrites49.4%
Applied rewrites57.2%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f6434.3%
Applied rewrites34.3%
if -4.5e15 < F < 4.6e11Initial program 77.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
mult-flipN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites85.5%
Taylor expanded in B around 0
Applied rewrites70.6%
Taylor expanded in B around 0
lower-*.f64N/A
lower-/.f6443.1%
Applied rewrites43.1%
if 4.6e11 < F Initial program 77.5%
Taylor expanded in F around inf
lower-/.f64N/A
lower-sin.f6416.6%
Applied rewrites16.6%
(FPCore (F B x)
:precision binary64
(*
(copysign 1.0 B)
(if (<= (fabs B) 490000.0)
(fma
(/ 1.0 (fabs B))
(* (pow (fma 2.0 x (fma F F 2.0)) -0.5) F)
(* -1.0 (/ x (fabs B))))
(/ 1.0 (sin (fabs B))))))double code(double F, double B, double x) {
double tmp;
if (fabs(B) <= 490000.0) {
tmp = fma((1.0 / fabs(B)), (pow(fma(2.0, x, fma(F, F, 2.0)), -0.5) * F), (-1.0 * (x / fabs(B))));
} else {
tmp = 1.0 / sin(fabs(B));
}
return copysign(1.0, B) * tmp;
}
function code(F, B, x) tmp = 0.0 if (abs(B) <= 490000.0) tmp = fma(Float64(1.0 / abs(B)), Float64((fma(2.0, x, fma(F, F, 2.0)) ^ -0.5) * F), Float64(-1.0 * Float64(x / abs(B)))); else tmp = Float64(1.0 / sin(abs(B))); end return Float64(copysign(1.0, B) * tmp) end
code[F_, B_, x_] := N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[B]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[B], $MachinePrecision], 490000.0], N[(N[(1.0 / N[Abs[B], $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * F), $MachinePrecision] + N[(-1.0 * N[(x / N[Abs[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[Sin[N[Abs[B], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\mathsf{copysign}\left(1, B\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|B\right| \leq 490000:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{\left|B\right|}, {\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5} \cdot F, -1 \cdot \frac{x}{\left|B\right|}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin \left(\left|B\right|\right)}\\
\end{array}
if B < 4.9e5Initial program 77.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
mult-flipN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites85.5%
Taylor expanded in B around 0
Applied rewrites70.6%
Taylor expanded in B around 0
lower-*.f64N/A
lower-/.f6443.1%
Applied rewrites43.1%
if 4.9e5 < B Initial program 77.5%
Taylor expanded in F around inf
lower-/.f64N/A
lower-sin.f6416.6%
Applied rewrites16.6%
(FPCore (F B x)
:precision binary64
(*
(copysign 1.0 B)
(if (<= (fabs B) 490000.0)
(fma
(* (pow (fma x 2.0 (fma F F 2.0)) -0.5) (/ 1.0 (fabs B)))
F
(- (/ x (fabs B))))
(/ 1.0 (sin (fabs B))))))double code(double F, double B, double x) {
double tmp;
if (fabs(B) <= 490000.0) {
tmp = fma((pow(fma(x, 2.0, fma(F, F, 2.0)), -0.5) * (1.0 / fabs(B))), F, -(x / fabs(B)));
} else {
tmp = 1.0 / sin(fabs(B));
}
return copysign(1.0, B) * tmp;
}
function code(F, B, x) tmp = 0.0 if (abs(B) <= 490000.0) tmp = fma(Float64((fma(x, 2.0, fma(F, F, 2.0)) ^ -0.5) * Float64(1.0 / abs(B))), F, Float64(-Float64(x / abs(B)))); else tmp = Float64(1.0 / sin(abs(B))); end return Float64(copysign(1.0, B) * tmp) end
code[F_, B_, x_] := N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[B]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[B], $MachinePrecision], 490000.0], N[(N[(N[Power[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * N[(1.0 / N[Abs[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * F + (-N[(x / N[Abs[B], $MachinePrecision]), $MachinePrecision])), $MachinePrecision], N[(1.0 / N[Sin[N[Abs[B], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\mathsf{copysign}\left(1, B\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|B\right| \leq 490000:\\
\;\;\;\;\mathsf{fma}\left({\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5} \cdot \frac{1}{\left|B\right|}, F, -\frac{x}{\left|B\right|}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin \left(\left|B\right|\right)}\\
\end{array}
if B < 4.9e5Initial program 77.5%
Taylor expanded in B around 0
lower-/.f6449.4%
Applied rewrites49.4%
Applied rewrites57.2%
Taylor expanded in B around 0
lower-/.f6443.1%
Applied rewrites43.1%
if 4.9e5 < B Initial program 77.5%
Taylor expanded in F around inf
lower-/.f64N/A
lower-sin.f6416.6%
Applied rewrites16.6%
(FPCore (F B x)
:precision binary64
(if (<= F -1e-135)
(/ -1.0 (sin B))
(if (<= F 3.3e-6)
(/ -1.0 (* 0.008333333333333333 (pow B 5.0)))
(/ 1.0 (sin B)))))double code(double F, double B, double x) {
double tmp;
if (F <= -1e-135) {
tmp = -1.0 / sin(B);
} else if (F <= 3.3e-6) {
tmp = -1.0 / (0.008333333333333333 * pow(B, 5.0));
} 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 <= (-1d-135)) then
tmp = (-1.0d0) / sin(b)
else if (f <= 3.3d-6) then
tmp = (-1.0d0) / (0.008333333333333333d0 * (b ** 5.0d0))
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 <= -1e-135) {
tmp = -1.0 / Math.sin(B);
} else if (F <= 3.3e-6) {
tmp = -1.0 / (0.008333333333333333 * Math.pow(B, 5.0));
} else {
tmp = 1.0 / Math.sin(B);
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -1e-135: tmp = -1.0 / math.sin(B) elif F <= 3.3e-6: tmp = -1.0 / (0.008333333333333333 * math.pow(B, 5.0)) else: tmp = 1.0 / math.sin(B) return tmp
function code(F, B, x) tmp = 0.0 if (F <= -1e-135) tmp = Float64(-1.0 / sin(B)); elseif (F <= 3.3e-6) tmp = Float64(-1.0 / Float64(0.008333333333333333 * (B ^ 5.0))); else tmp = Float64(1.0 / sin(B)); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -1e-135) tmp = -1.0 / sin(B); elseif (F <= 3.3e-6) tmp = -1.0 / (0.008333333333333333 * (B ^ 5.0)); else tmp = 1.0 / sin(B); end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -1e-135], N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 3.3e-6], N[(-1.0 / N[(0.008333333333333333 * N[Power[B, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;F \leq -1 \cdot 10^{-135}:\\
\;\;\;\;\frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 3.3 \cdot 10^{-6}:\\
\;\;\;\;\frac{-1}{0.008333333333333333 \cdot {B}^{5}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B}\\
\end{array}
if F < -1e-135Initial program 77.5%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6417.0%
Applied rewrites17.0%
if -1e-135 < F < 3.3000000000000002e-6Initial program 77.5%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6417.0%
Applied rewrites17.0%
Taylor expanded in B around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-pow.f6410.3%
Applied rewrites10.3%
Taylor expanded in B around inf
lower-*.f64N/A
lower-pow.f649.9%
Applied rewrites9.9%
if 3.3000000000000002e-6 < F Initial program 77.5%
Taylor expanded in F around inf
lower-/.f64N/A
lower-sin.f6416.6%
Applied rewrites16.6%
(FPCore (F B x)
:precision binary64
(*
(copysign 1.0 B)
(if (<= F -1e-135)
(/ -1.0 (sin (fabs B)))
(if (<= F 270000000000.0)
(/ -1.0 (* 0.008333333333333333 (pow (fabs B) 5.0)))
(fabs (/ 1.0 (fabs B)))))))double code(double F, double B, double x) {
double tmp;
if (F <= -1e-135) {
tmp = -1.0 / sin(fabs(B));
} else if (F <= 270000000000.0) {
tmp = -1.0 / (0.008333333333333333 * pow(fabs(B), 5.0));
} else {
tmp = fabs((1.0 / fabs(B)));
}
return copysign(1.0, B) * tmp;
}
public static double code(double F, double B, double x) {
double tmp;
if (F <= -1e-135) {
tmp = -1.0 / Math.sin(Math.abs(B));
} else if (F <= 270000000000.0) {
tmp = -1.0 / (0.008333333333333333 * Math.pow(Math.abs(B), 5.0));
} else {
tmp = Math.abs((1.0 / Math.abs(B)));
}
return Math.copySign(1.0, B) * tmp;
}
def code(F, B, x): tmp = 0 if F <= -1e-135: tmp = -1.0 / math.sin(math.fabs(B)) elif F <= 270000000000.0: tmp = -1.0 / (0.008333333333333333 * math.pow(math.fabs(B), 5.0)) else: tmp = math.fabs((1.0 / math.fabs(B))) return math.copysign(1.0, B) * tmp
function code(F, B, x) tmp = 0.0 if (F <= -1e-135) tmp = Float64(-1.0 / sin(abs(B))); elseif (F <= 270000000000.0) tmp = Float64(-1.0 / Float64(0.008333333333333333 * (abs(B) ^ 5.0))); else tmp = abs(Float64(1.0 / abs(B))); end return Float64(copysign(1.0, B) * tmp) end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -1e-135) tmp = -1.0 / sin(abs(B)); elseif (F <= 270000000000.0) tmp = -1.0 / (0.008333333333333333 * (abs(B) ^ 5.0)); else tmp = abs((1.0 / abs(B))); end tmp_2 = (sign(B) * abs(1.0)) * tmp; end
code[F_, B_, x_] := N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[B]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[F, -1e-135], N[(-1.0 / N[Sin[N[Abs[B], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 270000000000.0], N[(-1.0 / N[(0.008333333333333333 * N[Power[N[Abs[B], $MachinePrecision], 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Abs[N[(1.0 / N[Abs[B], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]), $MachinePrecision]
\mathsf{copysign}\left(1, B\right) \cdot \begin{array}{l}
\mathbf{if}\;F \leq -1 \cdot 10^{-135}:\\
\;\;\;\;\frac{-1}{\sin \left(\left|B\right|\right)}\\
\mathbf{elif}\;F \leq 270000000000:\\
\;\;\;\;\frac{-1}{0.008333333333333333 \cdot {\left(\left|B\right|\right)}^{5}}\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{1}{\left|B\right|}\right|\\
\end{array}
if F < -1e-135Initial program 77.5%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6417.0%
Applied rewrites17.0%
if -1e-135 < F < 2.7e11Initial program 77.5%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6417.0%
Applied rewrites17.0%
Taylor expanded in B around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-pow.f6410.3%
Applied rewrites10.3%
Taylor expanded in B around inf
lower-*.f64N/A
lower-pow.f649.9%
Applied rewrites9.9%
if 2.7e11 < F Initial program 77.5%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6417.0%
Applied rewrites17.0%
Taylor expanded in B around 0
Applied rewrites10.4%
lift-/.f64N/A
frac-2negN/A
metadata-evalN/A
inv-powN/A
pow-to-expN/A
lower-unsound-exp.f64N/A
lower-unsound-*.f64N/A
lower-unsound-log.f64N/A
lower-neg.f644.9%
Applied rewrites4.9%
lift-exp.f64N/A
lift-*.f64N/A
exp-prodN/A
unpow-1N/A
metadata-evalN/A
exp-fabsN/A
lift-log.f64N/A
rem-exp-logN/A
lift-neg.f64N/A
fabs-negN/A
fabs-divN/A
lift-/.f64N/A
lower-fabs.f6410.3%
Applied rewrites10.3%
(FPCore (F B x)
:precision binary64
(*
(copysign 1.0 B)
(if (<= F -0.0005)
(/ (- (* -0.16666666666666666 (pow (fabs B) 2.0)) 1.0) (fabs B))
(if (<= F 270000000000.0)
(/ -1.0 (* 0.008333333333333333 (pow (fabs B) 5.0)))
(fabs (/ 1.0 (fabs B)))))))double code(double F, double B, double x) {
double tmp;
if (F <= -0.0005) {
tmp = ((-0.16666666666666666 * pow(fabs(B), 2.0)) - 1.0) / fabs(B);
} else if (F <= 270000000000.0) {
tmp = -1.0 / (0.008333333333333333 * pow(fabs(B), 5.0));
} else {
tmp = fabs((1.0 / fabs(B)));
}
return copysign(1.0, B) * tmp;
}
public static double code(double F, double B, double x) {
double tmp;
if (F <= -0.0005) {
tmp = ((-0.16666666666666666 * Math.pow(Math.abs(B), 2.0)) - 1.0) / Math.abs(B);
} else if (F <= 270000000000.0) {
tmp = -1.0 / (0.008333333333333333 * Math.pow(Math.abs(B), 5.0));
} else {
tmp = Math.abs((1.0 / Math.abs(B)));
}
return Math.copySign(1.0, B) * tmp;
}
def code(F, B, x): tmp = 0 if F <= -0.0005: tmp = ((-0.16666666666666666 * math.pow(math.fabs(B), 2.0)) - 1.0) / math.fabs(B) elif F <= 270000000000.0: tmp = -1.0 / (0.008333333333333333 * math.pow(math.fabs(B), 5.0)) else: tmp = math.fabs((1.0 / math.fabs(B))) return math.copysign(1.0, B) * tmp
function code(F, B, x) tmp = 0.0 if (F <= -0.0005) tmp = Float64(Float64(Float64(-0.16666666666666666 * (abs(B) ^ 2.0)) - 1.0) / abs(B)); elseif (F <= 270000000000.0) tmp = Float64(-1.0 / Float64(0.008333333333333333 * (abs(B) ^ 5.0))); else tmp = abs(Float64(1.0 / abs(B))); end return Float64(copysign(1.0, B) * tmp) end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -0.0005) tmp = ((-0.16666666666666666 * (abs(B) ^ 2.0)) - 1.0) / abs(B); elseif (F <= 270000000000.0) tmp = -1.0 / (0.008333333333333333 * (abs(B) ^ 5.0)); else tmp = abs((1.0 / abs(B))); end tmp_2 = (sign(B) * abs(1.0)) * tmp; end
code[F_, B_, x_] := N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[B]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[F, -0.0005], N[(N[(N[(-0.16666666666666666 * N[Power[N[Abs[B], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision] / N[Abs[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 270000000000.0], N[(-1.0 / N[(0.008333333333333333 * N[Power[N[Abs[B], $MachinePrecision], 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Abs[N[(1.0 / N[Abs[B], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]), $MachinePrecision]
\mathsf{copysign}\left(1, B\right) \cdot \begin{array}{l}
\mathbf{if}\;F \leq -0.0005:\\
\;\;\;\;\frac{-0.16666666666666666 \cdot {\left(\left|B\right|\right)}^{2} - 1}{\left|B\right|}\\
\mathbf{elif}\;F \leq 270000000000:\\
\;\;\;\;\frac{-1}{0.008333333333333333 \cdot {\left(\left|B\right|\right)}^{5}}\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{1}{\left|B\right|}\right|\\
\end{array}
if F < -5.0000000000000001e-4Initial program 77.5%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6417.0%
Applied rewrites17.0%
Taylor expanded in B around 0
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-pow.f6410.1%
Applied rewrites10.1%
if -5.0000000000000001e-4 < F < 2.7e11Initial program 77.5%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6417.0%
Applied rewrites17.0%
Taylor expanded in B around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-pow.f6410.3%
Applied rewrites10.3%
Taylor expanded in B around inf
lower-*.f64N/A
lower-pow.f649.9%
Applied rewrites9.9%
if 2.7e11 < F Initial program 77.5%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6417.0%
Applied rewrites17.0%
Taylor expanded in B around 0
Applied rewrites10.4%
lift-/.f64N/A
frac-2negN/A
metadata-evalN/A
inv-powN/A
pow-to-expN/A
lower-unsound-exp.f64N/A
lower-unsound-*.f64N/A
lower-unsound-log.f64N/A
lower-neg.f644.9%
Applied rewrites4.9%
lift-exp.f64N/A
lift-*.f64N/A
exp-prodN/A
unpow-1N/A
metadata-evalN/A
exp-fabsN/A
lift-log.f64N/A
rem-exp-logN/A
lift-neg.f64N/A
fabs-negN/A
fabs-divN/A
lift-/.f64N/A
lower-fabs.f6410.3%
Applied rewrites10.3%
(FPCore (F B x)
:precision binary64
(*
(copysign 1.0 B)
(if (<= F -1.4e-139)
(/ -1.0 (fabs B))
(if (<= F 270000000000.0)
(/ -1.0 (* 0.008333333333333333 (pow (fabs B) 5.0)))
(fabs (/ 1.0 (fabs B)))))))double code(double F, double B, double x) {
double tmp;
if (F <= -1.4e-139) {
tmp = -1.0 / fabs(B);
} else if (F <= 270000000000.0) {
tmp = -1.0 / (0.008333333333333333 * pow(fabs(B), 5.0));
} else {
tmp = fabs((1.0 / fabs(B)));
}
return copysign(1.0, B) * tmp;
}
public static double code(double F, double B, double x) {
double tmp;
if (F <= -1.4e-139) {
tmp = -1.0 / Math.abs(B);
} else if (F <= 270000000000.0) {
tmp = -1.0 / (0.008333333333333333 * Math.pow(Math.abs(B), 5.0));
} else {
tmp = Math.abs((1.0 / Math.abs(B)));
}
return Math.copySign(1.0, B) * tmp;
}
def code(F, B, x): tmp = 0 if F <= -1.4e-139: tmp = -1.0 / math.fabs(B) elif F <= 270000000000.0: tmp = -1.0 / (0.008333333333333333 * math.pow(math.fabs(B), 5.0)) else: tmp = math.fabs((1.0 / math.fabs(B))) return math.copysign(1.0, B) * tmp
function code(F, B, x) tmp = 0.0 if (F <= -1.4e-139) tmp = Float64(-1.0 / abs(B)); elseif (F <= 270000000000.0) tmp = Float64(-1.0 / Float64(0.008333333333333333 * (abs(B) ^ 5.0))); else tmp = abs(Float64(1.0 / abs(B))); end return Float64(copysign(1.0, B) * tmp) end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -1.4e-139) tmp = -1.0 / abs(B); elseif (F <= 270000000000.0) tmp = -1.0 / (0.008333333333333333 * (abs(B) ^ 5.0)); else tmp = abs((1.0 / abs(B))); end tmp_2 = (sign(B) * abs(1.0)) * tmp; end
code[F_, B_, x_] := N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[B]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[F, -1.4e-139], N[(-1.0 / N[Abs[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 270000000000.0], N[(-1.0 / N[(0.008333333333333333 * N[Power[N[Abs[B], $MachinePrecision], 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Abs[N[(1.0 / N[Abs[B], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]), $MachinePrecision]
\mathsf{copysign}\left(1, B\right) \cdot \begin{array}{l}
\mathbf{if}\;F \leq -1.4 \cdot 10^{-139}:\\
\;\;\;\;\frac{-1}{\left|B\right|}\\
\mathbf{elif}\;F \leq 270000000000:\\
\;\;\;\;\frac{-1}{0.008333333333333333 \cdot {\left(\left|B\right|\right)}^{5}}\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{1}{\left|B\right|}\right|\\
\end{array}
if F < -1.3999999999999999e-139Initial program 77.5%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6417.0%
Applied rewrites17.0%
Taylor expanded in B around 0
Applied rewrites10.4%
if -1.3999999999999999e-139 < F < 2.7e11Initial program 77.5%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6417.0%
Applied rewrites17.0%
Taylor expanded in B around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-pow.f6410.3%
Applied rewrites10.3%
Taylor expanded in B around inf
lower-*.f64N/A
lower-pow.f649.9%
Applied rewrites9.9%
if 2.7e11 < F Initial program 77.5%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6417.0%
Applied rewrites17.0%
Taylor expanded in B around 0
Applied rewrites10.4%
lift-/.f64N/A
frac-2negN/A
metadata-evalN/A
inv-powN/A
pow-to-expN/A
lower-unsound-exp.f64N/A
lower-unsound-*.f64N/A
lower-unsound-log.f64N/A
lower-neg.f644.9%
Applied rewrites4.9%
lift-exp.f64N/A
lift-*.f64N/A
exp-prodN/A
unpow-1N/A
metadata-evalN/A
exp-fabsN/A
lift-log.f64N/A
rem-exp-logN/A
lift-neg.f64N/A
fabs-negN/A
fabs-divN/A
lift-/.f64N/A
lower-fabs.f6410.3%
Applied rewrites10.3%
(FPCore (F B x) :precision binary64 (* (copysign 1.0 B) (if (<= F -6.8e-251) (/ -1.0 (fabs B)) (fabs (/ 1.0 (fabs B))))))
double code(double F, double B, double x) {
double tmp;
if (F <= -6.8e-251) {
tmp = -1.0 / fabs(B);
} else {
tmp = fabs((1.0 / fabs(B)));
}
return copysign(1.0, B) * tmp;
}
public static double code(double F, double B, double x) {
double tmp;
if (F <= -6.8e-251) {
tmp = -1.0 / Math.abs(B);
} else {
tmp = Math.abs((1.0 / Math.abs(B)));
}
return Math.copySign(1.0, B) * tmp;
}
def code(F, B, x): tmp = 0 if F <= -6.8e-251: tmp = -1.0 / math.fabs(B) else: tmp = math.fabs((1.0 / math.fabs(B))) return math.copysign(1.0, B) * tmp
function code(F, B, x) tmp = 0.0 if (F <= -6.8e-251) tmp = Float64(-1.0 / abs(B)); else tmp = abs(Float64(1.0 / abs(B))); end return Float64(copysign(1.0, B) * tmp) end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -6.8e-251) tmp = -1.0 / abs(B); else tmp = abs((1.0 / abs(B))); end tmp_2 = (sign(B) * abs(1.0)) * tmp; end
code[F_, B_, x_] := N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[B]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[F, -6.8e-251], N[(-1.0 / N[Abs[B], $MachinePrecision]), $MachinePrecision], N[Abs[N[(1.0 / N[Abs[B], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]), $MachinePrecision]
\mathsf{copysign}\left(1, B\right) \cdot \begin{array}{l}
\mathbf{if}\;F \leq -6.8 \cdot 10^{-251}:\\
\;\;\;\;\frac{-1}{\left|B\right|}\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{1}{\left|B\right|}\right|\\
\end{array}
if F < -6.8000000000000003e-251Initial program 77.5%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6417.0%
Applied rewrites17.0%
Taylor expanded in B around 0
Applied rewrites10.4%
if -6.8000000000000003e-251 < F Initial program 77.5%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6417.0%
Applied rewrites17.0%
Taylor expanded in B around 0
Applied rewrites10.4%
lift-/.f64N/A
frac-2negN/A
metadata-evalN/A
inv-powN/A
pow-to-expN/A
lower-unsound-exp.f64N/A
lower-unsound-*.f64N/A
lower-unsound-log.f64N/A
lower-neg.f644.9%
Applied rewrites4.9%
lift-exp.f64N/A
lift-*.f64N/A
exp-prodN/A
unpow-1N/A
metadata-evalN/A
exp-fabsN/A
lift-log.f64N/A
rem-exp-logN/A
lift-neg.f64N/A
fabs-negN/A
fabs-divN/A
lift-/.f64N/A
lower-fabs.f6410.3%
Applied rewrites10.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]
\frac{-1}{B}
Initial program 77.5%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6417.0%
Applied rewrites17.0%
Taylor expanded in B around 0
Applied rewrites10.4%
herbie shell --seed 2025188
(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))))))