
(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 19 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 (/ x (tan B))))
(if (<= F -2e+32)
(- (/ -1.0 (sin B)) t_0)
(if (<= F 68000000.0)
(- (/ (* (pow (fma 2.0 x (fma F F 2.0)) -0.5) F) (sin B)) t_0)
(- (/ 1.0 (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+32) {
tmp = (-1.0 / sin(B)) - t_0;
} else if (F <= 68000000.0) {
tmp = ((pow(fma(2.0, x, fma(F, F, 2.0)), -0.5) * F) / sin(B)) - t_0;
} else {
tmp = (1.0 / sin(B)) - (1.0 / (tan(B) / x));
}
return tmp;
}
function code(F, B, x) t_0 = Float64(x / tan(B)) tmp = 0.0 if (F <= -2e+32) tmp = Float64(Float64(-1.0 / sin(B)) - t_0); elseif (F <= 68000000.0) tmp = Float64(Float64(Float64((fma(2.0, x, fma(F, F, 2.0)) ^ -0.5) * F) / sin(B)) - t_0); else tmp = Float64(Float64(1.0 / 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+32], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[F, 68000000.0], N[(N[(N[(N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * F), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[(N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(1.0 / N[(N[Tan[B], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \frac{x}{\tan B}\\
\mathbf{if}\;F \leq -2 \cdot 10^{+32}:\\
\;\;\;\;\frac{-1}{\sin B} - t\_0\\
\mathbf{elif}\;F \leq 68000000:\\
\;\;\;\;\frac{{\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5} \cdot F}{\sin B} - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B} - \frac{1}{\frac{\tan B}{x}}\\
\end{array}
if F < -2.0000000000000001e32Initial program 76.8%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6476.8%
Applied rewrites85.8%
Taylor expanded in F around -inf
Applied rewrites56.1%
if -2.0000000000000001e32 < F < 6.8e7Initial program 76.8%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6476.8%
Applied rewrites85.8%
if 6.8e7 < F Initial program 76.8%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6476.8%
Applied rewrites85.8%
Taylor expanded in F around inf
Applied rewrites56.0%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6455.9%
Applied rewrites55.9%
(FPCore (F B x)
:precision binary64
(if (<= F -2e+32)
(- (/ -1.0 (sin B)) (/ x (tan B)))
(if (<= F 1.55e+41)
(/ (fma (pow (fma x 2.0 (fma F F 2.0)) -0.5) F (* (cos B) (- x))) (sin B))
(fma (/ -1.0 (tan B)) x (/ 1.0 (sin B))))))double code(double F, double B, double x) {
double tmp;
if (F <= -2e+32) {
tmp = (-1.0 / sin(B)) - (x / tan(B));
} else if (F <= 1.55e+41) {
tmp = fma(pow(fma(x, 2.0, fma(F, F, 2.0)), -0.5), F, (cos(B) * -x)) / sin(B);
} else {
tmp = fma((-1.0 / tan(B)), x, (1.0 / sin(B)));
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -2e+32) tmp = Float64(Float64(-1.0 / sin(B)) - Float64(x / tan(B))); elseif (F <= 1.55e+41) tmp = Float64(fma((fma(x, 2.0, fma(F, F, 2.0)) ^ -0.5), F, Float64(cos(B) * Float64(-x))) / sin(B)); else tmp = fma(Float64(-1.0 / tan(B)), x, Float64(1.0 / sin(B))); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -2e+32], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.55e+41], N[(N[(N[Power[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * F + N[(N[Cos[B], $MachinePrecision] * (-x)), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], N[(N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision] * x + N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;F \leq -2 \cdot 10^{+32}:\\
\;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\
\mathbf{elif}\;F \leq 1.55 \cdot 10^{+41}:\\
\;\;\;\;\frac{\mathsf{fma}\left({\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}, F, \cos B \cdot \left(-x\right)\right)}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{-1}{\tan B}, x, \frac{1}{\sin B}\right)\\
\end{array}
if F < -2.0000000000000001e32Initial program 76.8%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6476.8%
Applied rewrites85.8%
Taylor expanded in F around -inf
Applied rewrites56.1%
if -2.0000000000000001e32 < F < 1.5500000000000001e41Initial program 76.8%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6476.8%
Applied rewrites85.8%
Applied rewrites85.7%
if 1.5500000000000001e41 < F Initial program 76.8%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6476.8%
Applied rewrites85.8%
Taylor expanded in F around inf
Applied rewrites56.0%
lift--.f64N/A
sub-flipN/A
lift-/.f64N/A
mult-flip-revN/A
lift-tan.f64N/A
+-commutativeN/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lift-tan.f64N/A
distribute-neg-fracN/A
metadata-evalN/A
lower-/.f6455.9%
Applied rewrites55.9%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ x (tan B))))
(if (<= F -1.25)
(- (/ -1.0 (sin B)) t_0)
(if (<= F 0.85)
(- (/ (* (pow (fma 2.0 x 2.0) -0.5) F) (sin B)) t_0)
(- (/ 1.0 (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.25) {
tmp = (-1.0 / sin(B)) - t_0;
} else if (F <= 0.85) {
tmp = ((pow(fma(2.0, x, 2.0), -0.5) * F) / sin(B)) - t_0;
} else {
tmp = (1.0 / sin(B)) - (1.0 / (tan(B) / x));
}
return tmp;
}
function code(F, B, x) t_0 = Float64(x / tan(B)) tmp = 0.0 if (F <= -1.25) tmp = Float64(Float64(-1.0 / sin(B)) - t_0); elseif (F <= 0.85) tmp = Float64(Float64(Float64((fma(2.0, x, 2.0) ^ -0.5) * F) / sin(B)) - t_0); else tmp = Float64(Float64(1.0 / 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.25], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[F, 0.85], N[(N[(N[(N[Power[N[(2.0 * x + 2.0), $MachinePrecision], -0.5], $MachinePrecision] * F), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[(N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(1.0 / N[(N[Tan[B], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \frac{x}{\tan B}\\
\mathbf{if}\;F \leq -1.25:\\
\;\;\;\;\frac{-1}{\sin B} - t\_0\\
\mathbf{elif}\;F \leq 0.85:\\
\;\;\;\;\frac{{\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{-0.5} \cdot F}{\sin B} - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B} - \frac{1}{\frac{\tan B}{x}}\\
\end{array}
if F < -1.25Initial program 76.8%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6476.8%
Applied rewrites85.8%
Taylor expanded in F around -inf
Applied rewrites56.1%
if -1.25 < F < 0.84999999999999998Initial program 76.8%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6476.8%
Applied rewrites85.8%
Taylor expanded in F around 0
Applied rewrites56.0%
if 0.84999999999999998 < F Initial program 76.8%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6476.8%
Applied rewrites85.8%
Taylor expanded in F around inf
Applied rewrites56.0%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6455.9%
Applied rewrites55.9%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ x (tan B))))
(if (<= F -2600000.0)
(- (/ -1.0 (sin B)) t_0)
(if (<= F 8.5e-42)
(- (* (pow (fma x 2.0 (fma F F 2.0)) -0.5) (/ F B)) t_0)
(- (/ 1.0 (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 <= -2600000.0) {
tmp = (-1.0 / sin(B)) - t_0;
} else if (F <= 8.5e-42) {
tmp = (pow(fma(x, 2.0, fma(F, F, 2.0)), -0.5) * (F / B)) - t_0;
} else {
tmp = (1.0 / sin(B)) - (1.0 / (tan(B) / x));
}
return tmp;
}
function code(F, B, x) t_0 = Float64(x / tan(B)) tmp = 0.0 if (F <= -2600000.0) tmp = Float64(Float64(-1.0 / sin(B)) - t_0); elseif (F <= 8.5e-42) tmp = Float64(Float64((fma(x, 2.0, fma(F, F, 2.0)) ^ -0.5) * Float64(F / B)) - t_0); else tmp = Float64(Float64(1.0 / 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, -2600000.0], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[F, 8.5e-42], N[(N[(N[Power[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * N[(F / B), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[(N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(1.0 / N[(N[Tan[B], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \frac{x}{\tan B}\\
\mathbf{if}\;F \leq -2600000:\\
\;\;\;\;\frac{-1}{\sin B} - t\_0\\
\mathbf{elif}\;F \leq 8.5 \cdot 10^{-42}:\\
\;\;\;\;{\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5} \cdot \frac{F}{B} - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B} - \frac{1}{\frac{\tan B}{x}}\\
\end{array}
if F < -2.6e6Initial program 76.8%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6476.8%
Applied rewrites85.8%
Taylor expanded in F around -inf
Applied rewrites56.1%
if -2.6e6 < F < 8.4999999999999996e-42Initial program 76.8%
Taylor expanded in B around 0
lower-/.f6462.2%
Applied rewrites62.2%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
lift-tan.f64N/A
mult-flip-revN/A
lift-/.f64N/A
sub-flip-reverseN/A
lower--.f6462.3%
Applied rewrites62.3%
if 8.4999999999999996e-42 < F Initial program 76.8%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6476.8%
Applied rewrites85.8%
Taylor expanded in F around inf
Applied rewrites56.0%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6455.9%
Applied rewrites55.9%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ x (tan B))))
(if (<= F -2600000.0)
(- (/ -1.0 (sin B)) t_0)
(if (<= F 8.5e-42)
(- (* (pow (fma x 2.0 (fma F F 2.0)) -0.5) (/ F B)) t_0)
(- (/ 1.0 (sin B)) t_0)))))double code(double F, double B, double x) {
double t_0 = x / tan(B);
double tmp;
if (F <= -2600000.0) {
tmp = (-1.0 / sin(B)) - t_0;
} else if (F <= 8.5e-42) {
tmp = (pow(fma(x, 2.0, fma(F, F, 2.0)), -0.5) * (F / B)) - t_0;
} else {
tmp = (1.0 / sin(B)) - t_0;
}
return tmp;
}
function code(F, B, x) t_0 = Float64(x / tan(B)) tmp = 0.0 if (F <= -2600000.0) tmp = Float64(Float64(-1.0 / sin(B)) - t_0); elseif (F <= 8.5e-42) tmp = Float64(Float64((fma(x, 2.0, fma(F, F, 2.0)) ^ -0.5) * Float64(F / B)) - t_0); else tmp = Float64(Float64(1.0 / sin(B)) - t_0); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -2600000.0], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[F, 8.5e-42], N[(N[(N[Power[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * N[(F / B), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[(N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \frac{x}{\tan B}\\
\mathbf{if}\;F \leq -2600000:\\
\;\;\;\;\frac{-1}{\sin B} - t\_0\\
\mathbf{elif}\;F \leq 8.5 \cdot 10^{-42}:\\
\;\;\;\;{\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5} \cdot \frac{F}{B} - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B} - t\_0\\
\end{array}
if F < -2.6e6Initial program 76.8%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6476.8%
Applied rewrites85.8%
Taylor expanded in F around -inf
Applied rewrites56.1%
if -2.6e6 < F < 8.4999999999999996e-42Initial program 76.8%
Taylor expanded in B around 0
lower-/.f6462.2%
Applied rewrites62.2%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
lift-tan.f64N/A
mult-flip-revN/A
lift-/.f64N/A
sub-flip-reverseN/A
lower--.f6462.3%
Applied rewrites62.3%
if 8.4999999999999996e-42 < F Initial program 76.8%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6476.8%
Applied rewrites85.8%
Taylor expanded in F around inf
Applied rewrites56.0%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ x (tan B))))
(if (<= F -2600000.0)
(- (/ -1.0 (sin B)) t_0)
(if (<= F 6.2e+165)
(- (* (pow (fma x 2.0 (fma F F 2.0)) -0.5) (/ F B)) t_0)
(-
(/ 1.0 (sin B))
(/ x (* B (+ 1.0 (* 0.3333333333333333 (pow B 2.0))))))))))double code(double F, double B, double x) {
double t_0 = x / tan(B);
double tmp;
if (F <= -2600000.0) {
tmp = (-1.0 / sin(B)) - t_0;
} else if (F <= 6.2e+165) {
tmp = (pow(fma(x, 2.0, fma(F, F, 2.0)), -0.5) * (F / B)) - t_0;
} else {
tmp = (1.0 / sin(B)) - (x / (B * (1.0 + (0.3333333333333333 * pow(B, 2.0)))));
}
return tmp;
}
function code(F, B, x) t_0 = Float64(x / tan(B)) tmp = 0.0 if (F <= -2600000.0) tmp = Float64(Float64(-1.0 / sin(B)) - t_0); elseif (F <= 6.2e+165) tmp = Float64(Float64((fma(x, 2.0, fma(F, F, 2.0)) ^ -0.5) * Float64(F / B)) - t_0); else tmp = Float64(Float64(1.0 / sin(B)) - Float64(x / Float64(B * Float64(1.0 + Float64(0.3333333333333333 * (B ^ 2.0)))))); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -2600000.0], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[F, 6.2e+165], N[(N[(N[Power[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * N[(F / B), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[(N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x / N[(B * N[(1.0 + N[(0.3333333333333333 * N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \frac{x}{\tan B}\\
\mathbf{if}\;F \leq -2600000:\\
\;\;\;\;\frac{-1}{\sin B} - t\_0\\
\mathbf{elif}\;F \leq 6.2 \cdot 10^{+165}:\\
\;\;\;\;{\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5} \cdot \frac{F}{B} - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B} - \frac{x}{B \cdot \left(1 + 0.3333333333333333 \cdot {B}^{2}\right)}\\
\end{array}
if F < -2.6e6Initial program 76.8%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6476.8%
Applied rewrites85.8%
Taylor expanded in F around -inf
Applied rewrites56.1%
if -2.6e6 < F < 6.2000000000000003e165Initial program 76.8%
Taylor expanded in B around 0
lower-/.f6462.2%
Applied rewrites62.2%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
lift-tan.f64N/A
mult-flip-revN/A
lift-/.f64N/A
sub-flip-reverseN/A
lower--.f6462.3%
Applied rewrites62.3%
if 6.2000000000000003e165 < F Initial program 76.8%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6476.8%
Applied rewrites85.8%
Taylor expanded in F around inf
Applied rewrites56.0%
Taylor expanded in B around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6436.7%
Applied rewrites36.7%
(FPCore (F B x)
:precision binary64
(if (<= F -8.6e+144)
(* -1.0 (/ (* x (cos B)) (sin B)))
(if (<= F -2.6e-74)
(- (/ (* (pow (fma 2.0 x (fma F F 2.0)) -0.5) F) (sin B)) (/ x B))
(if (<= F 6.2e+165)
(- (* (pow (fma x 2.0 (fma F F 2.0)) -0.5) (/ F B)) (/ x (tan B)))
(-
(/ 1.0 (sin B))
(/ x (* B (+ 1.0 (* 0.3333333333333333 (pow B 2.0))))))))))double code(double F, double B, double x) {
double tmp;
if (F <= -8.6e+144) {
tmp = -1.0 * ((x * cos(B)) / sin(B));
} else if (F <= -2.6e-74) {
tmp = ((pow(fma(2.0, x, fma(F, F, 2.0)), -0.5) * F) / sin(B)) - (x / B);
} else if (F <= 6.2e+165) {
tmp = (pow(fma(x, 2.0, fma(F, F, 2.0)), -0.5) * (F / B)) - (x / tan(B));
} else {
tmp = (1.0 / sin(B)) - (x / (B * (1.0 + (0.3333333333333333 * pow(B, 2.0)))));
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -8.6e+144) tmp = Float64(-1.0 * Float64(Float64(x * cos(B)) / sin(B))); elseif (F <= -2.6e-74) tmp = Float64(Float64(Float64((fma(2.0, x, fma(F, F, 2.0)) ^ -0.5) * F) / sin(B)) - Float64(x / B)); elseif (F <= 6.2e+165) tmp = Float64(Float64((fma(x, 2.0, fma(F, F, 2.0)) ^ -0.5) * Float64(F / B)) - Float64(x / tan(B))); else tmp = Float64(Float64(1.0 / sin(B)) - Float64(x / Float64(B * Float64(1.0 + Float64(0.3333333333333333 * (B ^ 2.0)))))); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -8.6e+144], N[(-1.0 * N[(N[(x * N[Cos[B], $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, -2.6e-74], N[(N[(N[(N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * F), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 6.2e+165], N[(N[(N[Power[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * N[(F / B), $MachinePrecision]), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x / N[(B * N[(1.0 + N[(0.3333333333333333 * N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\mathbf{if}\;F \leq -8.6 \cdot 10^{+144}:\\
\;\;\;\;-1 \cdot \frac{x \cdot \cos B}{\sin B}\\
\mathbf{elif}\;F \leq -2.6 \cdot 10^{-74}:\\
\;\;\;\;\frac{{\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5} \cdot F}{\sin B} - \frac{x}{B}\\
\mathbf{elif}\;F \leq 6.2 \cdot 10^{+165}:\\
\;\;\;\;{\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5} \cdot \frac{F}{B} - \frac{x}{\tan B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B} - \frac{x}{B \cdot \left(1 + 0.3333333333333333 \cdot {B}^{2}\right)}\\
\end{array}
if F < -8.5999999999999997e144Initial program 76.8%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6456.3%
Applied rewrites56.3%
if -8.5999999999999997e144 < F < -2.6000000000000001e-74Initial program 76.8%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6476.8%
Applied rewrites85.8%
Taylor expanded in B around 0
lower-/.f6458.9%
Applied rewrites58.9%
if -2.6000000000000001e-74 < F < 6.2000000000000003e165Initial program 76.8%
Taylor expanded in B around 0
lower-/.f6462.2%
Applied rewrites62.2%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
lift-tan.f64N/A
mult-flip-revN/A
lift-/.f64N/A
sub-flip-reverseN/A
lower--.f6462.3%
Applied rewrites62.3%
if 6.2000000000000003e165 < F Initial program 76.8%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6476.8%
Applied rewrites85.8%
Taylor expanded in F around inf
Applied rewrites56.0%
Taylor expanded in B around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6436.7%
Applied rewrites36.7%
(FPCore (F B x)
:precision binary64
(if (<= x -4.2e-58)
(* -1.0 (/ (* x (cos B)) (sin B)))
(if (<= x 1.08e-107)
(- (/ (* (pow (fma 2.0 x (fma F F 2.0)) -0.5) F) (sin B)) (/ x B))
(-
(/ 1.0 (* B (+ 1.0 (* -0.16666666666666666 (pow B 2.0)))))
(/ x (tan B))))))double code(double F, double B, double x) {
double tmp;
if (x <= -4.2e-58) {
tmp = -1.0 * ((x * cos(B)) / sin(B));
} else if (x <= 1.08e-107) {
tmp = ((pow(fma(2.0, x, fma(F, F, 2.0)), -0.5) * F) / sin(B)) - (x / B);
} else {
tmp = (1.0 / (B * (1.0 + (-0.16666666666666666 * pow(B, 2.0))))) - (x / tan(B));
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (x <= -4.2e-58) tmp = Float64(-1.0 * Float64(Float64(x * cos(B)) / sin(B))); elseif (x <= 1.08e-107) tmp = Float64(Float64(Float64((fma(2.0, x, fma(F, F, 2.0)) ^ -0.5) * F) / sin(B)) - Float64(x / B)); else tmp = Float64(Float64(1.0 / Float64(B * Float64(1.0 + Float64(-0.16666666666666666 * (B ^ 2.0))))) - Float64(x / tan(B))); end return tmp end
code[F_, B_, x_] := If[LessEqual[x, -4.2e-58], N[(-1.0 * N[(N[(x * N[Cos[B], $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.08e-107], N[(N[(N[(N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * F), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(B * N[(1.0 + N[(-0.16666666666666666 * N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;x \leq -4.2 \cdot 10^{-58}:\\
\;\;\;\;-1 \cdot \frac{x \cdot \cos B}{\sin B}\\
\mathbf{elif}\;x \leq 1.08 \cdot 10^{-107}:\\
\;\;\;\;\frac{{\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5} \cdot F}{\sin B} - \frac{x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{B \cdot \left(1 + -0.16666666666666666 \cdot {B}^{2}\right)} - \frac{x}{\tan B}\\
\end{array}
if x < -4.1999999999999998e-58Initial program 76.8%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6456.3%
Applied rewrites56.3%
if -4.1999999999999998e-58 < x < 1.08e-107Initial program 76.8%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6476.8%
Applied rewrites85.8%
Taylor expanded in B around 0
lower-/.f6458.9%
Applied rewrites58.9%
if 1.08e-107 < x Initial program 76.8%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6476.8%
Applied rewrites85.8%
Taylor expanded in F around inf
Applied rewrites56.0%
Taylor expanded in B around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6455.2%
Applied rewrites55.2%
(FPCore (F B x)
:precision binary64
(let* ((t_0
(-
(/ 1.0 (* B (+ 1.0 (* -0.16666666666666666 (pow B 2.0)))))
(/ x (tan B)))))
(if (<= x -3.6e-58)
t_0
(if (<= x 1.08e-107)
(- (/ (* (pow (fma 2.0 x (fma F F 2.0)) -0.5) F) (sin B)) (/ x B))
t_0))))double code(double F, double B, double x) {
double t_0 = (1.0 / (B * (1.0 + (-0.16666666666666666 * pow(B, 2.0))))) - (x / tan(B));
double tmp;
if (x <= -3.6e-58) {
tmp = t_0;
} else if (x <= 1.08e-107) {
tmp = ((pow(fma(2.0, x, fma(F, F, 2.0)), -0.5) * F) / sin(B)) - (x / B);
} else {
tmp = t_0;
}
return tmp;
}
function code(F, B, x) t_0 = Float64(Float64(1.0 / Float64(B * Float64(1.0 + Float64(-0.16666666666666666 * (B ^ 2.0))))) - Float64(x / tan(B))) tmp = 0.0 if (x <= -3.6e-58) tmp = t_0; elseif (x <= 1.08e-107) tmp = Float64(Float64(Float64((fma(2.0, x, fma(F, F, 2.0)) ^ -0.5) * F) / sin(B)) - Float64(x / B)); else tmp = t_0; end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(N[(1.0 / N[(B * N[(1.0 + N[(-0.16666666666666666 * N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -3.6e-58], t$95$0, If[LessEqual[x, 1.08e-107], N[(N[(N[(N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * F), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
t_0 := \frac{1}{B \cdot \left(1 + -0.16666666666666666 \cdot {B}^{2}\right)} - \frac{x}{\tan B}\\
\mathbf{if}\;x \leq -3.6 \cdot 10^{-58}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 1.08 \cdot 10^{-107}:\\
\;\;\;\;\frac{{\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5} \cdot F}{\sin B} - \frac{x}{B}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if x < -3.6000000000000001e-58 or 1.08e-107 < x Initial program 76.8%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6476.8%
Applied rewrites85.8%
Taylor expanded in F around inf
Applied rewrites56.0%
Taylor expanded in B around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6455.2%
Applied rewrites55.2%
if -3.6000000000000001e-58 < x < 1.08e-107Initial program 76.8%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6476.8%
Applied rewrites85.8%
Taylor expanded in B around 0
lower-/.f6458.9%
Applied rewrites58.9%
(FPCore (F B x)
:precision binary64
(*
(copysign 1.0 B)
(if (<= (fabs B) 3.1e-5)
(/ (- (* (pow (fma x 2.0 (fma F F 2.0)) -0.5) F) x) (fabs B))
(-
(/ 1.0 (* (fabs B) (+ 1.0 (* -0.16666666666666666 (pow (fabs B) 2.0)))))
(/ x (tan (fabs B)))))))double code(double F, double B, double x) {
double tmp;
if (fabs(B) <= 3.1e-5) {
tmp = ((pow(fma(x, 2.0, fma(F, F, 2.0)), -0.5) * F) - x) / fabs(B);
} else {
tmp = (1.0 / (fabs(B) * (1.0 + (-0.16666666666666666 * pow(fabs(B), 2.0))))) - (x / tan(fabs(B)));
}
return copysign(1.0, B) * tmp;
}
function code(F, B, x) tmp = 0.0 if (abs(B) <= 3.1e-5) tmp = Float64(Float64(Float64((fma(x, 2.0, fma(F, F, 2.0)) ^ -0.5) * F) - x) / abs(B)); else tmp = Float64(Float64(1.0 / Float64(abs(B) * Float64(1.0 + Float64(-0.16666666666666666 * (abs(B) ^ 2.0))))) - 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], 3.1e-5], N[(N[(N[(N[Power[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * F), $MachinePrecision] - x), $MachinePrecision] / N[Abs[B], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(N[Abs[B], $MachinePrecision] * N[(1.0 + N[(-0.16666666666666666 * N[Power[N[Abs[B], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 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 3.1 \cdot 10^{-5}:\\
\;\;\;\;\frac{{\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5} \cdot F - x}{\left|B\right|}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\left|B\right| \cdot \left(1 + -0.16666666666666666 \cdot {\left(\left|B\right|\right)}^{2}\right)} - \frac{x}{\tan \left(\left|B\right|\right)}\\
\end{array}
if B < 3.1000000000000001e-5Initial program 76.8%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites45.2%
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
associate-+r+N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
lift-*.f6445.2%
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6445.2%
Applied rewrites45.2%
if 3.1000000000000001e-5 < B Initial program 76.8%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6476.8%
Applied rewrites85.8%
Taylor expanded in F around inf
Applied rewrites56.0%
Taylor expanded in B around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6455.2%
Applied rewrites55.2%
(FPCore (F B x)
:precision binary64
(if (<= F -2.9e+138)
(/ (- -1.0 x) B)
(if (<= F -7.5e+14)
(/ -1.0 (sin B))
(if (<= F 8.5e-42)
(/ (- (* (pow (fma x 2.0 (fma F F 2.0)) -0.5) F) x) B)
(-
(/ 1.0 (sin B))
(/ x (* B (+ 1.0 (* 0.3333333333333333 (pow B 2.0))))))))))double code(double F, double B, double x) {
double tmp;
if (F <= -2.9e+138) {
tmp = (-1.0 - x) / B;
} else if (F <= -7.5e+14) {
tmp = -1.0 / sin(B);
} else if (F <= 8.5e-42) {
tmp = ((pow(fma(x, 2.0, fma(F, F, 2.0)), -0.5) * F) - x) / B;
} else {
tmp = (1.0 / sin(B)) - (x / (B * (1.0 + (0.3333333333333333 * pow(B, 2.0)))));
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -2.9e+138) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= -7.5e+14) tmp = Float64(-1.0 / sin(B)); elseif (F <= 8.5e-42) tmp = Float64(Float64(Float64((fma(x, 2.0, fma(F, F, 2.0)) ^ -0.5) * F) - x) / B); else tmp = Float64(Float64(1.0 / sin(B)) - Float64(x / Float64(B * Float64(1.0 + Float64(0.3333333333333333 * (B ^ 2.0)))))); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -2.9e+138], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, -7.5e+14], N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 8.5e-42], N[(N[(N[(N[Power[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * F), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x / N[(B * N[(1.0 + N[(0.3333333333333333 * N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\mathbf{if}\;F \leq -2.9 \cdot 10^{+138}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq -7.5 \cdot 10^{+14}:\\
\;\;\;\;\frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 8.5 \cdot 10^{-42}:\\
\;\;\;\;\frac{{\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5} \cdot F - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B} - \frac{x}{B \cdot \left(1 + 0.3333333333333333 \cdot {B}^{2}\right)}\\
\end{array}
if F < -2.9000000000000001e138Initial program 76.8%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites45.2%
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
associate-+r+N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
lift-*.f6445.2%
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6445.2%
Applied rewrites45.2%
Taylor expanded in F around -inf
Applied rewrites30.0%
if -2.9000000000000001e138 < F < -7.5e14Initial program 76.8%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites45.2%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6445.1%
Applied rewrites45.1%
Taylor expanded in F around inf
Applied rewrites10.0%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6417.2%
Applied rewrites17.2%
if -7.5e14 < F < 8.4999999999999996e-42Initial program 76.8%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites45.2%
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
associate-+r+N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
lift-*.f6445.2%
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6445.2%
Applied rewrites45.2%
if 8.4999999999999996e-42 < F Initial program 76.8%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6476.8%
Applied rewrites85.8%
Taylor expanded in F around inf
Applied rewrites56.0%
Taylor expanded in B around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6436.7%
Applied rewrites36.7%
(FPCore (F B x)
:precision binary64
(*
(copysign 1.0 B)
(if (<= (fabs B) 460.0)
(/ (- (* (pow (fma x 2.0 (fma F F 2.0)) -0.5) F) x) (fabs B))
(/ -1.0 (sin (fabs B))))))double code(double F, double B, double x) {
double tmp;
if (fabs(B) <= 460.0) {
tmp = ((pow(fma(x, 2.0, fma(F, F, 2.0)), -0.5) * 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) <= 460.0) tmp = Float64(Float64(Float64((fma(x, 2.0, fma(F, F, 2.0)) ^ -0.5) * F) - 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], 460.0], N[(N[(N[(N[Power[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * F), $MachinePrecision] - x), $MachinePrecision] / N[Abs[B], $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 460:\\
\;\;\;\;\frac{{\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5} \cdot F - x}{\left|B\right|}\\
\mathbf{else}:\\
\;\;\;\;\frac{-1}{\sin \left(\left|B\right|\right)}\\
\end{array}
if B < 460Initial program 76.8%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites45.2%
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
associate-+r+N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
lift-*.f6445.2%
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6445.2%
Applied rewrites45.2%
if 460 < B Initial program 76.8%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites45.2%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6445.1%
Applied rewrites45.1%
Taylor expanded in F around inf
Applied rewrites10.0%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6417.2%
Applied rewrites17.2%
(FPCore (F B x)
:precision binary64
(if (<= F -5e+58)
(/ (- -1.0 x) B)
(if (<= F 200000000.0)
(/ (- (* (pow (fma x 2.0 (fma F F 2.0)) -0.5) F) x) B)
(/ (- 1.0 x) B))))double code(double F, double B, double x) {
double tmp;
if (F <= -5e+58) {
tmp = (-1.0 - x) / B;
} else if (F <= 200000000.0) {
tmp = ((pow(fma(x, 2.0, fma(F, F, 2.0)), -0.5) * F) - x) / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -5e+58) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 200000000.0) tmp = Float64(Float64(Float64((fma(x, 2.0, fma(F, F, 2.0)) ^ -0.5) * F) - x) / B); else tmp = Float64(Float64(1.0 - x) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -5e+58], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 200000000.0], N[(N[(N[(N[Power[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * F), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;F \leq -5 \cdot 10^{+58}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 200000000:\\
\;\;\;\;\frac{{\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5} \cdot F - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
if F < -4.9999999999999999e58Initial program 76.8%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites45.2%
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
associate-+r+N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
lift-*.f6445.2%
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6445.2%
Applied rewrites45.2%
Taylor expanded in F around -inf
Applied rewrites30.0%
if -4.9999999999999999e58 < F < 2e8Initial program 76.8%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites45.2%
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
associate-+r+N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
lift-*.f6445.2%
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6445.2%
Applied rewrites45.2%
if 2e8 < F Initial program 76.8%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites45.2%
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
associate-+r+N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
lift-*.f6445.2%
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6445.2%
Applied rewrites45.2%
Taylor expanded in F around inf
Applied rewrites30.1%
(FPCore (F B x)
:precision binary64
(if (<= F -0.35)
(/ (- -1.0 x) B)
(if (<= F 4.2e-35)
(/ (- (* (pow (fma x 2.0 2.0) -0.5) F) x) B)
(/ (- 1.0 x) B))))double code(double F, double B, double x) {
double tmp;
if (F <= -0.35) {
tmp = (-1.0 - x) / B;
} else if (F <= 4.2e-35) {
tmp = ((pow(fma(x, 2.0, 2.0), -0.5) * F) - x) / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -0.35) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 4.2e-35) tmp = Float64(Float64(Float64((fma(x, 2.0, 2.0) ^ -0.5) * F) - x) / B); else tmp = Float64(Float64(1.0 - x) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -0.35], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 4.2e-35], N[(N[(N[(N[Power[N[(x * 2.0 + 2.0), $MachinePrecision], -0.5], $MachinePrecision] * F), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;F \leq -0.35:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 4.2 \cdot 10^{-35}:\\
\;\;\;\;\frac{{\left(\mathsf{fma}\left(x, 2, 2\right)\right)}^{-0.5} \cdot F - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
if F < -0.34999999999999998Initial program 76.8%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites45.2%
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
associate-+r+N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
lift-*.f6445.2%
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6445.2%
Applied rewrites45.2%
Taylor expanded in F around -inf
Applied rewrites30.0%
if -0.34999999999999998 < F < 4.2e-35Initial program 76.8%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites45.2%
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
associate-+r+N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
lift-*.f6445.2%
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6445.2%
Applied rewrites45.2%
Taylor expanded in F around 0
Applied rewrites30.3%
if 4.2e-35 < F Initial program 76.8%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites45.2%
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
associate-+r+N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
lift-*.f6445.2%
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6445.2%
Applied rewrites45.2%
Taylor expanded in F around inf
Applied rewrites30.1%
(FPCore (F B x) :precision binary64 (if (<= F -7.8e-61) (/ (- -1.0 x) B) (if (<= F 1.1e-54) (/ (* -1.0 x) B) (/ (- 1.0 x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -7.8e-61) {
tmp = (-1.0 - x) / B;
} else if (F <= 1.1e-54) {
tmp = (-1.0 * x) / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: tmp
if (f <= (-7.8d-61)) then
tmp = ((-1.0d0) - x) / b
else if (f <= 1.1d-54) then
tmp = ((-1.0d0) * x) / b
else
tmp = (1.0d0 - x) / b
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -7.8e-61) {
tmp = (-1.0 - x) / B;
} else if (F <= 1.1e-54) {
tmp = (-1.0 * x) / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -7.8e-61: tmp = (-1.0 - x) / B elif F <= 1.1e-54: tmp = (-1.0 * x) / B else: tmp = (1.0 - x) / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= -7.8e-61) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 1.1e-54) tmp = Float64(Float64(-1.0 * x) / B); else tmp = Float64(Float64(1.0 - x) / B); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -7.8e-61) tmp = (-1.0 - x) / B; elseif (F <= 1.1e-54) tmp = (-1.0 * x) / B; else tmp = (1.0 - x) / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -7.8e-61], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 1.1e-54], N[(N[(-1.0 * x), $MachinePrecision] / B), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;F \leq -7.8 \cdot 10^{-61}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 1.1 \cdot 10^{-54}:\\
\;\;\;\;\frac{-1 \cdot x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
if F < -7.8000000000000007e-61Initial program 76.8%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites45.2%
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
associate-+r+N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
lift-*.f6445.2%
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6445.2%
Applied rewrites45.2%
Taylor expanded in F around -inf
Applied rewrites30.0%
if -7.8000000000000007e-61 < F < 1.1e-54Initial program 76.8%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites45.2%
Taylor expanded in F around 0
lower-*.f6430.3%
Applied rewrites30.3%
if 1.1e-54 < F Initial program 76.8%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites45.2%
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
associate-+r+N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
lift-*.f6445.2%
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6445.2%
Applied rewrites45.2%
Taylor expanded in F around inf
Applied rewrites30.1%
(FPCore (F B x) :precision binary64 (if (<= F -3.2e-159) (/ (- -1.0 x) B) (/ (- 1.0 x) B)))
double code(double F, double B, double x) {
double tmp;
if (F <= -3.2e-159) {
tmp = (-1.0 - x) / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: tmp
if (f <= (-3.2d-159)) then
tmp = ((-1.0d0) - x) / b
else
tmp = (1.0d0 - x) / b
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -3.2e-159) {
tmp = (-1.0 - x) / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -3.2e-159: tmp = (-1.0 - x) / B else: tmp = (1.0 - x) / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= -3.2e-159) tmp = Float64(Float64(-1.0 - x) / B); else tmp = Float64(Float64(1.0 - x) / B); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -3.2e-159) tmp = (-1.0 - x) / B; else tmp = (1.0 - x) / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -3.2e-159], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;F \leq -3.2 \cdot 10^{-159}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
if F < -3.2e-159Initial program 76.8%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites45.2%
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
associate-+r+N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
lift-*.f6445.2%
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6445.2%
Applied rewrites45.2%
Taylor expanded in F around -inf
Applied rewrites30.0%
if -3.2e-159 < F Initial program 76.8%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites45.2%
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
associate-+r+N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
lift-*.f6445.2%
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6445.2%
Applied rewrites45.2%
Taylor expanded in F around inf
Applied rewrites30.1%
(FPCore (F B x) :precision binary64 (if (<= F 30500000.0) (/ (- -1.0 x) B) (/ 1.0 B)))
double code(double F, double B, double x) {
double tmp;
if (F <= 30500000.0) {
tmp = (-1.0 - x) / B;
} else {
tmp = 1.0 / B;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: tmp
if (f <= 30500000.0d0) then
tmp = ((-1.0d0) - x) / b
else
tmp = 1.0d0 / b
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= 30500000.0) {
tmp = (-1.0 - x) / B;
} else {
tmp = 1.0 / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= 30500000.0: tmp = (-1.0 - x) / B else: tmp = 1.0 / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= 30500000.0) tmp = Float64(Float64(-1.0 - x) / B); else tmp = Float64(1.0 / B); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= 30500000.0) tmp = (-1.0 - x) / B; else tmp = 1.0 / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, 30500000.0], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], N[(1.0 / B), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;F \leq 30500000:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{B}\\
\end{array}
if F < 3.05e7Initial program 76.8%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites45.2%
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
associate-+r+N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
lift-*.f6445.2%
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6445.2%
Applied rewrites45.2%
Taylor expanded in F around -inf
Applied rewrites30.0%
if 3.05e7 < F Initial program 76.8%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites45.2%
Taylor expanded in F around inf
lower-/.f6410.0%
Applied rewrites10.0%
(FPCore (F B x) :precision binary64 (if (<= F 2.05e-299) (/ -1.0 B) (/ 1.0 B)))
double code(double F, double B, double x) {
double tmp;
if (F <= 2.05e-299) {
tmp = -1.0 / B;
} else {
tmp = 1.0 / B;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: tmp
if (f <= 2.05d-299) then
tmp = (-1.0d0) / b
else
tmp = 1.0d0 / b
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= 2.05e-299) {
tmp = -1.0 / B;
} else {
tmp = 1.0 / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= 2.05e-299: tmp = -1.0 / B else: tmp = 1.0 / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= 2.05e-299) tmp = Float64(-1.0 / B); else tmp = Float64(1.0 / B); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= 2.05e-299) tmp = -1.0 / B; else tmp = 1.0 / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, 2.05e-299], N[(-1.0 / B), $MachinePrecision], N[(1.0 / B), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;F \leq 2.05 \cdot 10^{-299}:\\
\;\;\;\;\frac{-1}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{B}\\
\end{array}
if F < 2.05e-299Initial program 76.8%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites45.2%
Taylor expanded in F around -inf
lower-/.f6410.4%
Applied rewrites10.4%
if 2.05e-299 < F Initial program 76.8%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites45.2%
Taylor expanded in F around inf
lower-/.f6410.0%
Applied rewrites10.0%
(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 76.8%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites45.2%
Taylor expanded in F around -inf
lower-/.f6410.4%
Applied rewrites10.4%
herbie shell --seed 2025209
(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))))))