
(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 24 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 -4e+48)
(- (/ -1.0 (sin B)) t_0)
(if (<= F 100000000.0)
(fma
(/ 1.0 (/ (sin B) (pow (fma x 2.0 (fma F F 2.0)) -0.5)))
F
(/ (- x) (tan B)))
(- (/ 1.0 (sin B)) t_0)))))double code(double F, double B, double x) {
double t_0 = x / tan(B);
double tmp;
if (F <= -4e+48) {
tmp = (-1.0 / sin(B)) - t_0;
} else if (F <= 100000000.0) {
tmp = fma((1.0 / (sin(B) / pow(fma(x, 2.0, fma(F, F, 2.0)), -0.5))), F, (-x / tan(B)));
} 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 <= -4e+48) tmp = Float64(Float64(-1.0 / sin(B)) - t_0); elseif (F <= 100000000.0) tmp = fma(Float64(1.0 / Float64(sin(B) / (fma(x, 2.0, fma(F, F, 2.0)) ^ -0.5))), F, Float64(Float64(-x) / tan(B))); 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, -4e+48], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[F, 100000000.0], N[(N[(1.0 / N[(N[Sin[B], $MachinePrecision] / N[Power[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * F + N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $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 -4 \cdot 10^{+48}:\\
\;\;\;\;\frac{-1}{\sin B} - t\_0\\
\mathbf{elif}\;F \leq 100000000:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{\frac{\sin B}{{\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}}, F, \frac{-x}{\tan B}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B} - t\_0\\
\end{array}
if F < -4.0000000000000002e48Initial program 76.6%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6476.6%
Applied rewrites85.5%
Taylor expanded in F around -inf
Applied rewrites56.1%
if -4.0000000000000002e48 < F < 1e8Initial program 76.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
mult-flipN/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites85.4%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6485.4%
lift-pow.f64N/A
sqr-powN/A
lift-fma.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
associate-+r+N/A
lift-*.f64N/A
pow2N/A
lift-pow.f64N/A
lift-fma.f64N/A
+-commutativeN/A
lift-+.f64N/A
Applied rewrites85.4%
if 1e8 < F Initial program 76.6%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6476.6%
Applied rewrites85.5%
Taylor expanded in F around inf
Applied rewrites56.6%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ x (tan B))))
(if (<= F -4e+48)
(- (/ -1.0 (sin B)) t_0)
(if (<= F 100000000.0)
(fma
(/ (pow (fma 2.0 x (fma F F 2.0)) -0.5) (sin B))
F
(/ (- x) (tan B)))
(- (/ 1.0 (sin B)) t_0)))))double code(double F, double B, double x) {
double t_0 = x / tan(B);
double tmp;
if (F <= -4e+48) {
tmp = (-1.0 / sin(B)) - t_0;
} else if (F <= 100000000.0) {
tmp = fma((pow(fma(2.0, x, fma(F, F, 2.0)), -0.5) / sin(B)), F, (-x / tan(B)));
} 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 <= -4e+48) tmp = Float64(Float64(-1.0 / sin(B)) - t_0); elseif (F <= 100000000.0) tmp = fma(Float64((fma(2.0, x, fma(F, F, 2.0)) ^ -0.5) / sin(B)), F, Float64(Float64(-x) / tan(B))); 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, -4e+48], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[F, 100000000.0], N[(N[(N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] * F + N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $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 -4 \cdot 10^{+48}:\\
\;\;\;\;\frac{-1}{\sin B} - t\_0\\
\mathbf{elif}\;F \leq 100000000:\\
\;\;\;\;\mathsf{fma}\left(\frac{{\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{\sin B}, F, \frac{-x}{\tan B}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B} - t\_0\\
\end{array}
if F < -4.0000000000000002e48Initial program 76.6%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6476.6%
Applied rewrites85.5%
Taylor expanded in F around -inf
Applied rewrites56.1%
if -4.0000000000000002e48 < F < 1e8Initial program 76.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
mult-flipN/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites85.4%
if 1e8 < F Initial program 76.6%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6476.6%
Applied rewrites85.5%
Taylor expanded in F around inf
Applied rewrites56.6%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ x (tan B))))
(if (<= F -5e+27)
(- (/ -1.0 (sin B)) t_0)
(if (<= F 1000000000000.0)
(- (/ F (* (sqrt (fma 2.0 x (fma F F 2.0))) (sin 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 <= -5e+27) {
tmp = (-1.0 / sin(B)) - t_0;
} else if (F <= 1000000000000.0) {
tmp = (F / (sqrt(fma(2.0, x, fma(F, F, 2.0))) * sin(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 <= -5e+27) tmp = Float64(Float64(-1.0 / sin(B)) - t_0); elseif (F <= 1000000000000.0) tmp = Float64(Float64(F / Float64(sqrt(fma(2.0, x, fma(F, F, 2.0))) * sin(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, -5e+27], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[F, 1000000000000.0], N[(N[(F / N[(N[Sqrt[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sin[B], $MachinePrecision]), $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 -5 \cdot 10^{+27}:\\
\;\;\;\;\frac{-1}{\sin B} - t\_0\\
\mathbf{elif}\;F \leq 1000000000000:\\
\;\;\;\;\frac{F}{\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)} \cdot \sin B} - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B} - t\_0\\
\end{array}
if F < -4.9999999999999998e27Initial program 76.6%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6476.6%
Applied rewrites85.5%
Taylor expanded in F around -inf
Applied rewrites56.1%
if -4.9999999999999998e27 < F < 1e12Initial program 76.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
mult-flipN/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites85.4%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6485.4%
lift-pow.f64N/A
sqr-powN/A
lift-fma.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
associate-+r+N/A
lift-*.f64N/A
pow2N/A
lift-pow.f64N/A
lift-fma.f64N/A
+-commutativeN/A
lift-+.f64N/A
Applied rewrites85.4%
lift-fma.f64N/A
add-flipN/A
lower--.f64N/A
Applied rewrites85.5%
if 1e12 < F Initial program 76.6%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6476.6%
Applied rewrites85.5%
Taylor expanded in F around inf
Applied rewrites56.6%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ x (tan B))))
(if (<= F -5700.0)
(- (/ -1.0 (sin B)) t_0)
(if (<= F 0.00036)
(- (/ F (* (sqrt (fma 2.0 x 2.0)) (sin 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 <= -5700.0) {
tmp = (-1.0 / sin(B)) - t_0;
} else if (F <= 0.00036) {
tmp = (F / (sqrt(fma(2.0, x, 2.0)) * sin(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 <= -5700.0) tmp = Float64(Float64(-1.0 / sin(B)) - t_0); elseif (F <= 0.00036) tmp = Float64(Float64(F / Float64(sqrt(fma(2.0, x, 2.0)) * sin(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, -5700.0], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[F, 0.00036], N[(N[(F / N[(N[Sqrt[N[(2.0 * x + 2.0), $MachinePrecision]], $MachinePrecision] * N[Sin[B], $MachinePrecision]), $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 -5700:\\
\;\;\;\;\frac{-1}{\sin B} - t\_0\\
\mathbf{elif}\;F \leq 0.00036:\\
\;\;\;\;\frac{F}{\sqrt{\mathsf{fma}\left(2, x, 2\right)} \cdot \sin B} - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B} - t\_0\\
\end{array}
if F < -5700Initial program 76.6%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6476.6%
Applied rewrites85.5%
Taylor expanded in F around -inf
Applied rewrites56.1%
if -5700 < F < 3.6000000000000002e-4Initial program 76.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
mult-flipN/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites85.4%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6485.4%
lift-pow.f64N/A
sqr-powN/A
lift-fma.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
associate-+r+N/A
lift-*.f64N/A
pow2N/A
lift-pow.f64N/A
lift-fma.f64N/A
+-commutativeN/A
lift-+.f64N/A
Applied rewrites85.4%
lift-fma.f64N/A
add-flipN/A
lower--.f64N/A
Applied rewrites85.5%
Taylor expanded in F around 0
Applied rewrites56.2%
if 3.6000000000000002e-4 < F Initial program 76.6%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6476.6%
Applied rewrites85.5%
Taylor expanded in F around inf
Applied rewrites56.6%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ x (tan B))))
(if (<= F -6800.0)
(- (/ -1.0 (sin B)) t_0)
(if (<= F 110000000.0)
(+
(- (* x (/ 1.0 (tan B))))
(*
(/ F B)
(pow (+ (+ (* F F) 2.0) (* 2.0 x)) (- (/ 1.0 2.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 <= -6800.0) {
tmp = (-1.0 / sin(B)) - t_0;
} else if (F <= 110000000.0) {
tmp = -(x * (1.0 / tan(B))) + ((F / B) * pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
} else {
tmp = (1.0 / sin(B)) - t_0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: tmp
t_0 = x / tan(b)
if (f <= (-6800.0d0)) then
tmp = ((-1.0d0) / sin(b)) - t_0
else if (f <= 110000000.0d0) then
tmp = -(x * (1.0d0 / tan(b))) + ((f / b) * ((((f * f) + 2.0d0) + (2.0d0 * x)) ** -(1.0d0 / 2.0d0)))
else
tmp = (1.0d0 / sin(b)) - t_0
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double t_0 = x / Math.tan(B);
double tmp;
if (F <= -6800.0) {
tmp = (-1.0 / Math.sin(B)) - t_0;
} else if (F <= 110000000.0) {
tmp = -(x * (1.0 / Math.tan(B))) + ((F / B) * Math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
} else {
tmp = (1.0 / Math.sin(B)) - t_0;
}
return tmp;
}
def code(F, B, x): t_0 = x / math.tan(B) tmp = 0 if F <= -6800.0: tmp = (-1.0 / math.sin(B)) - t_0 elif F <= 110000000.0: tmp = -(x * (1.0 / math.tan(B))) + ((F / B) * math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0))) else: tmp = (1.0 / math.sin(B)) - t_0 return tmp
function code(F, B, x) t_0 = Float64(x / tan(B)) tmp = 0.0 if (F <= -6800.0) tmp = Float64(Float64(-1.0 / sin(B)) - t_0); elseif (F <= 110000000.0) tmp = Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(Float64(F / B) * (Float64(Float64(Float64(F * F) + 2.0) + Float64(2.0 * x)) ^ Float64(-Float64(1.0 / 2.0))))); else tmp = Float64(Float64(1.0 / sin(B)) - t_0); end return tmp end
function tmp_2 = code(F, B, x) t_0 = x / tan(B); tmp = 0.0; if (F <= -6800.0) tmp = (-1.0 / sin(B)) - t_0; elseif (F <= 110000000.0) tmp = -(x * (1.0 / tan(B))) + ((F / B) * ((((F * F) + 2.0) + (2.0 * x)) ^ -(1.0 / 2.0))); else tmp = (1.0 / sin(B)) - t_0; end tmp_2 = tmp; end
code[F_, B_, x_] := Block[{t$95$0 = N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -6800.0], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[F, 110000000.0], N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(N[(F / B), $MachinePrecision] * N[Power[N[(N[(N[(F * F), $MachinePrecision] + 2.0), $MachinePrecision] + N[(2.0 * x), $MachinePrecision]), $MachinePrecision], (-N[(1.0 / 2.0), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(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 -6800:\\
\;\;\;\;\frac{-1}{\sin B} - t\_0\\
\mathbf{elif}\;F \leq 110000000:\\
\;\;\;\;\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B} - t\_0\\
\end{array}
if F < -6800Initial program 76.6%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6476.6%
Applied rewrites85.5%
Taylor expanded in F around -inf
Applied rewrites56.1%
if -6800 < F < 1.1e8Initial program 76.6%
Taylor expanded in B around 0
lower-/.f6462.3%
Applied rewrites62.3%
if 1.1e8 < F Initial program 76.6%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6476.6%
Applied rewrites85.5%
Taylor expanded in F around inf
Applied rewrites56.6%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (fma 2.0 x (fma F F 2.0))) (t_1 (/ x (tan B))))
(if (<= F -26.0)
(- (/ -1.0 (sin B)) t_1)
(if (<= F -1.42e-151)
(- (/ (* (pow t_0 -0.5) F) (sin B)) (/ x B))
(if (<= F 6.5e-131)
(* -1.0 (/ (* x (cos B)) (sin B)))
(if (<= F 920000000000.0)
(- (/ F (* (sqrt t_0) (sin B))) (/ x B))
(- (/ 1.0 (sin B)) t_1)))))))double code(double F, double B, double x) {
double t_0 = fma(2.0, x, fma(F, F, 2.0));
double t_1 = x / tan(B);
double tmp;
if (F <= -26.0) {
tmp = (-1.0 / sin(B)) - t_1;
} else if (F <= -1.42e-151) {
tmp = ((pow(t_0, -0.5) * F) / sin(B)) - (x / B);
} else if (F <= 6.5e-131) {
tmp = -1.0 * ((x * cos(B)) / sin(B));
} else if (F <= 920000000000.0) {
tmp = (F / (sqrt(t_0) * sin(B))) - (x / B);
} else {
tmp = (1.0 / sin(B)) - t_1;
}
return tmp;
}
function code(F, B, x) t_0 = fma(2.0, x, fma(F, F, 2.0)) t_1 = Float64(x / tan(B)) tmp = 0.0 if (F <= -26.0) tmp = Float64(Float64(-1.0 / sin(B)) - t_1); elseif (F <= -1.42e-151) tmp = Float64(Float64(Float64((t_0 ^ -0.5) * F) / sin(B)) - Float64(x / B)); elseif (F <= 6.5e-131) tmp = Float64(-1.0 * Float64(Float64(x * cos(B)) / sin(B))); elseif (F <= 920000000000.0) tmp = Float64(Float64(F / Float64(sqrt(t_0) * sin(B))) - Float64(x / B)); else tmp = Float64(Float64(1.0 / sin(B)) - t_1); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -26.0], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision], If[LessEqual[F, -1.42e-151], N[(N[(N[(N[Power[t$95$0, -0.5], $MachinePrecision] * F), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 6.5e-131], N[(-1.0 * N[(N[(x * N[Cos[B], $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 920000000000.0], N[(N[(F / N[(N[Sqrt[t$95$0], $MachinePrecision] * N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision]]]]]]]
\begin{array}{l}
t_0 := \mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\\
t_1 := \frac{x}{\tan B}\\
\mathbf{if}\;F \leq -26:\\
\;\;\;\;\frac{-1}{\sin B} - t\_1\\
\mathbf{elif}\;F \leq -1.42 \cdot 10^{-151}:\\
\;\;\;\;\frac{{t\_0}^{-0.5} \cdot F}{\sin B} - \frac{x}{B}\\
\mathbf{elif}\;F \leq 6.5 \cdot 10^{-131}:\\
\;\;\;\;-1 \cdot \frac{x \cdot \cos B}{\sin B}\\
\mathbf{elif}\;F \leq 920000000000:\\
\;\;\;\;\frac{F}{\sqrt{t\_0} \cdot \sin B} - \frac{x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B} - t\_1\\
\end{array}
if F < -26Initial program 76.6%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6476.6%
Applied rewrites85.5%
Taylor expanded in F around -inf
Applied rewrites56.1%
if -26 < F < -1.42e-151Initial program 76.6%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6476.6%
Applied rewrites85.5%
Taylor expanded in B around 0
lower-/.f6458.5%
Applied rewrites58.5%
if -1.42e-151 < F < 6.5000000000000002e-131Initial program 76.6%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6456.1%
Applied rewrites56.1%
if 6.5000000000000002e-131 < F < 9.2e11Initial program 76.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
mult-flipN/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites85.4%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6485.4%
lift-pow.f64N/A
sqr-powN/A
lift-fma.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
associate-+r+N/A
lift-*.f64N/A
pow2N/A
lift-pow.f64N/A
lift-fma.f64N/A
+-commutativeN/A
lift-+.f64N/A
Applied rewrites85.4%
lift-fma.f64N/A
add-flipN/A
lower--.f64N/A
Applied rewrites85.5%
Taylor expanded in B around 0
lower-/.f6458.5%
Applied rewrites58.5%
if 9.2e11 < F Initial program 76.6%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6476.6%
Applied rewrites85.5%
Taylor expanded in F around inf
Applied rewrites56.6%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (fma 2.0 x (fma F F 2.0))) (t_1 (/ x (tan B))))
(if (<= F -26.0)
(- (/ -1.0 (sin B)) t_1)
(if (<= F -1.42e-151)
(- (/ (* (pow t_0 -0.5) F) (sin B)) (/ x B))
(if (<= F 6.5e-131)
(* -1.0 (/ (* x (cos B)) (sin B)))
(if (<= F 920000000000.0)
(- (/ F (* (sqrt t_0) (sin B))) (/ x B))
(-
(/ 1.0 (* (fma (* B B) -0.16666666666666666 1.0) B))
t_1)))))))double code(double F, double B, double x) {
double t_0 = fma(2.0, x, fma(F, F, 2.0));
double t_1 = x / tan(B);
double tmp;
if (F <= -26.0) {
tmp = (-1.0 / sin(B)) - t_1;
} else if (F <= -1.42e-151) {
tmp = ((pow(t_0, -0.5) * F) / sin(B)) - (x / B);
} else if (F <= 6.5e-131) {
tmp = -1.0 * ((x * cos(B)) / sin(B));
} else if (F <= 920000000000.0) {
tmp = (F / (sqrt(t_0) * sin(B))) - (x / B);
} else {
tmp = (1.0 / (fma((B * B), -0.16666666666666666, 1.0) * B)) - t_1;
}
return tmp;
}
function code(F, B, x) t_0 = fma(2.0, x, fma(F, F, 2.0)) t_1 = Float64(x / tan(B)) tmp = 0.0 if (F <= -26.0) tmp = Float64(Float64(-1.0 / sin(B)) - t_1); elseif (F <= -1.42e-151) tmp = Float64(Float64(Float64((t_0 ^ -0.5) * F) / sin(B)) - Float64(x / B)); elseif (F <= 6.5e-131) tmp = Float64(-1.0 * Float64(Float64(x * cos(B)) / sin(B))); elseif (F <= 920000000000.0) tmp = Float64(Float64(F / Float64(sqrt(t_0) * sin(B))) - Float64(x / B)); else tmp = Float64(Float64(1.0 / Float64(fma(Float64(B * B), -0.16666666666666666, 1.0) * B)) - t_1); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -26.0], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision], If[LessEqual[F, -1.42e-151], N[(N[(N[(N[Power[t$95$0, -0.5], $MachinePrecision] * F), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 6.5e-131], N[(-1.0 * N[(N[(x * N[Cos[B], $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 920000000000.0], N[(N[(F / N[(N[Sqrt[t$95$0], $MachinePrecision] * N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(N[(N[(B * B), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * B), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision]]]]]]]
\begin{array}{l}
t_0 := \mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\\
t_1 := \frac{x}{\tan B}\\
\mathbf{if}\;F \leq -26:\\
\;\;\;\;\frac{-1}{\sin B} - t\_1\\
\mathbf{elif}\;F \leq -1.42 \cdot 10^{-151}:\\
\;\;\;\;\frac{{t\_0}^{-0.5} \cdot F}{\sin B} - \frac{x}{B}\\
\mathbf{elif}\;F \leq 6.5 \cdot 10^{-131}:\\
\;\;\;\;-1 \cdot \frac{x \cdot \cos B}{\sin B}\\
\mathbf{elif}\;F \leq 920000000000:\\
\;\;\;\;\frac{F}{\sqrt{t\_0} \cdot \sin B} - \frac{x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(B \cdot B, -0.16666666666666666, 1\right) \cdot B} - t\_1\\
\end{array}
if F < -26Initial program 76.6%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6476.6%
Applied rewrites85.5%
Taylor expanded in F around -inf
Applied rewrites56.1%
if -26 < F < -1.42e-151Initial program 76.6%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6476.6%
Applied rewrites85.5%
Taylor expanded in B around 0
lower-/.f6458.5%
Applied rewrites58.5%
if -1.42e-151 < F < 6.5000000000000002e-131Initial program 76.6%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6456.1%
Applied rewrites56.1%
if 6.5000000000000002e-131 < F < 9.2e11Initial program 76.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
mult-flipN/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites85.4%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6485.4%
lift-pow.f64N/A
sqr-powN/A
lift-fma.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
associate-+r+N/A
lift-*.f64N/A
pow2N/A
lift-pow.f64N/A
lift-fma.f64N/A
+-commutativeN/A
lift-+.f64N/A
Applied rewrites85.4%
lift-fma.f64N/A
add-flipN/A
lower--.f64N/A
Applied rewrites85.5%
Taylor expanded in B around 0
lower-/.f6458.5%
Applied rewrites58.5%
if 9.2e11 < F Initial program 76.6%
Taylor expanded in F around inf
lower-/.f64N/A
lower-sin.f6456.5%
Applied rewrites56.5%
Taylor expanded in B around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6455.6%
Applied rewrites55.6%
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
Applied rewrites55.7%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (* -1.0 (/ (* x (cos B)) (sin B)))))
(if (<= x -2.5e-33)
t_0
(if (<= x 5.2e-44)
(-
(/ (* (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 * ((x * cos(B)) / sin(B));
double tmp;
if (x <= -2.5e-33) {
tmp = t_0;
} else if (x <= 5.2e-44) {
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(-1.0 * Float64(Float64(x * cos(B)) / sin(B))) tmp = 0.0 if (x <= -2.5e-33) tmp = t_0; elseif (x <= 5.2e-44) 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[(-1.0 * N[(N[(x * N[Cos[B], $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.5e-33], t$95$0, If[LessEqual[x, 5.2e-44], 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 := -1 \cdot \frac{x \cdot \cos B}{\sin B}\\
\mathbf{if}\;x \leq -2.5 \cdot 10^{-33}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 5.2 \cdot 10^{-44}:\\
\;\;\;\;\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 < -2.5000000000000001e-33 or 5.1999999999999996e-44 < x Initial program 76.6%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6456.1%
Applied rewrites56.1%
if -2.5000000000000001e-33 < x < 5.1999999999999996e-44Initial program 76.6%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6476.6%
Applied rewrites85.5%
Taylor expanded in B around 0
lower-/.f6458.5%
Applied rewrites58.5%
(FPCore (F B x)
:precision binary64
(let* ((t_0
(-
(/ 1.0 (* (fma (* B B) -0.16666666666666666 1.0) B))
(/ x (tan B)))))
(if (<= x -2.5e-33)
t_0
(if (<= x 37000000.0)
(-
(/ (* (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 / (fma((B * B), -0.16666666666666666, 1.0) * B)) - (x / tan(B));
double tmp;
if (x <= -2.5e-33) {
tmp = t_0;
} else if (x <= 37000000.0) {
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(fma(Float64(B * B), -0.16666666666666666, 1.0) * B)) - Float64(x / tan(B))) tmp = 0.0 if (x <= -2.5e-33) tmp = t_0; elseif (x <= 37000000.0) 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[(N[(N[(B * B), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * B), $MachinePrecision]), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.5e-33], t$95$0, If[LessEqual[x, 37000000.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] - N[(x / B), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
t_0 := \frac{1}{\mathsf{fma}\left(B \cdot B, -0.16666666666666666, 1\right) \cdot B} - \frac{x}{\tan B}\\
\mathbf{if}\;x \leq -2.5 \cdot 10^{-33}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 37000000:\\
\;\;\;\;\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 < -2.5000000000000001e-33 or 3.7e7 < x Initial program 76.6%
Taylor expanded in F around inf
lower-/.f64N/A
lower-sin.f6456.5%
Applied rewrites56.5%
Taylor expanded in B around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6455.6%
Applied rewrites55.6%
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
Applied rewrites55.7%
if -2.5000000000000001e-33 < x < 3.7e7Initial program 76.6%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6476.6%
Applied rewrites85.5%
Taylor expanded in B around 0
lower-/.f6458.5%
Applied rewrites58.5%
(FPCore (F B x)
:precision binary64
(let* ((t_0
(-
(/ 1.0 (* (fma (* B B) -0.16666666666666666 1.0) B))
(/ x (tan B)))))
(if (<= x -2.5e-33)
t_0
(if (<= x 37000000.0)
(- (/ F (* (sqrt (fma 2.0 x (fma F F 2.0))) (sin B))) (/ x B))
t_0))))double code(double F, double B, double x) {
double t_0 = (1.0 / (fma((B * B), -0.16666666666666666, 1.0) * B)) - (x / tan(B));
double tmp;
if (x <= -2.5e-33) {
tmp = t_0;
} else if (x <= 37000000.0) {
tmp = (F / (sqrt(fma(2.0, x, fma(F, F, 2.0))) * sin(B))) - (x / B);
} else {
tmp = t_0;
}
return tmp;
}
function code(F, B, x) t_0 = Float64(Float64(1.0 / Float64(fma(Float64(B * B), -0.16666666666666666, 1.0) * B)) - Float64(x / tan(B))) tmp = 0.0 if (x <= -2.5e-33) tmp = t_0; elseif (x <= 37000000.0) tmp = Float64(Float64(F / Float64(sqrt(fma(2.0, x, fma(F, F, 2.0))) * 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[(N[(N[(B * B), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * B), $MachinePrecision]), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.5e-33], t$95$0, If[LessEqual[x, 37000000.0], N[(N[(F / N[(N[Sqrt[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
t_0 := \frac{1}{\mathsf{fma}\left(B \cdot B, -0.16666666666666666, 1\right) \cdot B} - \frac{x}{\tan B}\\
\mathbf{if}\;x \leq -2.5 \cdot 10^{-33}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 37000000:\\
\;\;\;\;\frac{F}{\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)} \cdot \sin B} - \frac{x}{B}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if x < -2.5000000000000001e-33 or 3.7e7 < x Initial program 76.6%
Taylor expanded in F around inf
lower-/.f64N/A
lower-sin.f6456.5%
Applied rewrites56.5%
Taylor expanded in B around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6455.6%
Applied rewrites55.6%
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
Applied rewrites55.7%
if -2.5000000000000001e-33 < x < 3.7e7Initial program 76.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
mult-flipN/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites85.4%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6485.4%
lift-pow.f64N/A
sqr-powN/A
lift-fma.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
associate-+r+N/A
lift-*.f64N/A
pow2N/A
lift-pow.f64N/A
lift-fma.f64N/A
+-commutativeN/A
lift-+.f64N/A
Applied rewrites85.4%
lift-fma.f64N/A
add-flipN/A
lower--.f64N/A
Applied rewrites85.5%
Taylor expanded in B around 0
lower-/.f6458.5%
Applied rewrites58.5%
(FPCore (F B x)
:precision binary64
(*
(copysign 1.0 B)
(if (<= (fabs B) 8.4e+19)
(/ (- (/ F (sqrt (+ 2.0 (fma 2.0 x (pow F 2.0))))) x) (fabs B))
(-
(/
1.0
(*
(fma (* (fabs B) (fabs B)) -0.16666666666666666 1.0)
(fabs B)))
(/ x (tan (fabs B)))))))double code(double F, double B, double x) {
double tmp;
if (fabs(B) <= 8.4e+19) {
tmp = ((F / sqrt((2.0 + fma(2.0, x, pow(F, 2.0))))) - x) / fabs(B);
} else {
tmp = (1.0 / (fma((fabs(B) * fabs(B)), -0.16666666666666666, 1.0) * fabs(B))) - (x / tan(fabs(B)));
}
return copysign(1.0, B) * tmp;
}
function code(F, B, x) tmp = 0.0 if (abs(B) <= 8.4e+19) tmp = Float64(Float64(Float64(F / sqrt(Float64(2.0 + fma(2.0, x, (F ^ 2.0))))) - x) / abs(B)); else tmp = Float64(Float64(1.0 / Float64(fma(Float64(abs(B) * abs(B)), -0.16666666666666666, 1.0) * abs(B))) - 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], 8.4e+19], N[(N[(N[(F / N[Sqrt[N[(2.0 + N[(2.0 * x + N[Power[F, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / N[Abs[B], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(N[(N[(N[Abs[B], $MachinePrecision] * N[Abs[B], $MachinePrecision]), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * N[Abs[B], $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 8.4 \cdot 10^{+19}:\\
\;\;\;\;\frac{\frac{F}{\sqrt{2 + \mathsf{fma}\left(2, x, {F}^{2}\right)}} - x}{\left|B\right|}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(\left|B\right| \cdot \left|B\right|, -0.16666666666666666, 1\right) \cdot \left|B\right|} - \frac{x}{\tan \left(\left|B\right|\right)}\\
\end{array}
if B < 8.4e19Initial program 76.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
mult-flipN/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites85.4%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6485.4%
lift-pow.f64N/A
sqr-powN/A
lift-fma.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
associate-+r+N/A
lift-*.f64N/A
pow2N/A
lift-pow.f64N/A
lift-fma.f64N/A
+-commutativeN/A
lift-+.f64N/A
Applied rewrites85.4%
lift-fma.f64N/A
add-flipN/A
lower--.f64N/A
Applied rewrites85.5%
Taylor expanded in B around 0
lower-/.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6445.0%
Applied rewrites45.0%
if 8.4e19 < B Initial program 76.6%
Taylor expanded in F around inf
lower-/.f64N/A
lower-sin.f6456.5%
Applied rewrites56.5%
Taylor expanded in B around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6455.6%
Applied rewrites55.6%
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
Applied rewrites55.7%
(FPCore (F B x) :precision binary64 (* (copysign 1.0 B) (if (<= (fabs B) 7.6e+18) (/ (- (/ F (sqrt (+ 2.0 (fma 2.0 x (pow F 2.0))))) x) (fabs B)) (fma (/ 1.0 (* (fabs B) F)) F (/ (- x) (tan (fabs B)))))))
double code(double F, double B, double x) {
double tmp;
if (fabs(B) <= 7.6e+18) {
tmp = ((F / sqrt((2.0 + fma(2.0, x, pow(F, 2.0))))) - x) / fabs(B);
} else {
tmp = fma((1.0 / (fabs(B) * F)), F, (-x / tan(fabs(B))));
}
return copysign(1.0, B) * tmp;
}
function code(F, B, x) tmp = 0.0 if (abs(B) <= 7.6e+18) tmp = Float64(Float64(Float64(F / sqrt(Float64(2.0 + fma(2.0, x, (F ^ 2.0))))) - x) / abs(B)); else tmp = fma(Float64(1.0 / Float64(abs(B) * F)), F, 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], 7.6e+18], N[(N[(N[(F / N[Sqrt[N[(2.0 + N[(2.0 * x + N[Power[F, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / N[Abs[B], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(N[Abs[B], $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision] * F + 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 7.6 \cdot 10^{+18}:\\
\;\;\;\;\frac{\frac{F}{\sqrt{2 + \mathsf{fma}\left(2, x, {F}^{2}\right)}} - x}{\left|B\right|}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{\left|B\right| \cdot F}, F, \frac{-x}{\tan \left(\left|B\right|\right)}\right)\\
\end{array}
if B < 7.6e18Initial program 76.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
mult-flipN/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites85.4%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6485.4%
lift-pow.f64N/A
sqr-powN/A
lift-fma.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
associate-+r+N/A
lift-*.f64N/A
pow2N/A
lift-pow.f64N/A
lift-fma.f64N/A
+-commutativeN/A
lift-+.f64N/A
Applied rewrites85.4%
lift-fma.f64N/A
add-flipN/A
lower--.f64N/A
Applied rewrites85.5%
Taylor expanded in B around 0
lower-/.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6445.0%
Applied rewrites45.0%
if 7.6e18 < B Initial program 76.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
mult-flipN/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites85.4%
Taylor expanded in F around inf
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f6452.9%
Applied rewrites52.9%
Taylor expanded in B around 0
lower-*.f6450.6%
Applied rewrites50.6%
(FPCore (F B x)
:precision binary64
(if (<= F -1.16e+171)
(/ (* -1.0 (* F (+ (/ 1.0 F) (/ x F)))) B)
(if (<= F 9.5e+130)
(/ (- (/ F (sqrt (+ 2.0 (fma 2.0 x (pow F 2.0))))) x) B)
(/ 1.0 (sin B)))))double code(double F, double B, double x) {
double tmp;
if (F <= -1.16e+171) {
tmp = (-1.0 * (F * ((1.0 / F) + (x / F)))) / B;
} else if (F <= 9.5e+130) {
tmp = ((F / sqrt((2.0 + fma(2.0, x, pow(F, 2.0))))) - x) / B;
} else {
tmp = 1.0 / sin(B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -1.16e+171) tmp = Float64(Float64(-1.0 * Float64(F * Float64(Float64(1.0 / F) + Float64(x / F)))) / B); elseif (F <= 9.5e+130) tmp = Float64(Float64(Float64(F / sqrt(Float64(2.0 + fma(2.0, x, (F ^ 2.0))))) - x) / B); else tmp = Float64(1.0 / sin(B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -1.16e+171], N[(N[(-1.0 * N[(F * N[(N[(1.0 / F), $MachinePrecision] + N[(x / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 9.5e+130], N[(N[(N[(F / N[Sqrt[N[(2.0 + N[(2.0 * x + N[Power[F, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;F \leq -1.16 \cdot 10^{+171}:\\
\;\;\;\;\frac{-1 \cdot \left(F \cdot \left(\frac{1}{F} + \frac{x}{F}\right)\right)}{B}\\
\mathbf{elif}\;F \leq 9.5 \cdot 10^{+130}:\\
\;\;\;\;\frac{\frac{F}{\sqrt{2 + \mathsf{fma}\left(2, x, {F}^{2}\right)}} - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B}\\
\end{array}
if F < -1.16e171Initial program 76.6%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites45.0%
Taylor expanded in F around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-/.f6429.0%
Applied rewrites29.0%
if -1.16e171 < F < 9.5000000000000009e130Initial program 76.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
mult-flipN/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites85.4%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6485.4%
lift-pow.f64N/A
sqr-powN/A
lift-fma.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
associate-+r+N/A
lift-*.f64N/A
pow2N/A
lift-pow.f64N/A
lift-fma.f64N/A
+-commutativeN/A
lift-+.f64N/A
Applied rewrites85.4%
lift-fma.f64N/A
add-flipN/A
lower--.f64N/A
Applied rewrites85.5%
Taylor expanded in B around 0
lower-/.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6445.0%
Applied rewrites45.0%
if 9.5000000000000009e130 < F Initial program 76.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
mult-flipN/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites85.4%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6485.4%
lift-pow.f64N/A
sqr-powN/A
lift-fma.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
associate-+r+N/A
lift-*.f64N/A
pow2N/A
lift-pow.f64N/A
lift-fma.f64N/A
+-commutativeN/A
lift-+.f64N/A
Applied rewrites85.4%
Taylor expanded in F around inf
lower-/.f64N/A
lower-sin.f6416.6%
Applied rewrites16.6%
(FPCore (F B x)
:precision binary64
(if (<= F -1.16e+171)
(/ (* -1.0 (* F (+ (/ 1.0 F) (/ x F)))) B)
(if (<= F 6e+85)
(/ (- (/ F (sqrt (+ 2.0 (fma 2.0 x (pow F 2.0))))) x) B)
(/ (* F (fma -1.0 (/ x F) (/ 1.0 F))) B))))double code(double F, double B, double x) {
double tmp;
if (F <= -1.16e+171) {
tmp = (-1.0 * (F * ((1.0 / F) + (x / F)))) / B;
} else if (F <= 6e+85) {
tmp = ((F / sqrt((2.0 + fma(2.0, x, pow(F, 2.0))))) - x) / B;
} else {
tmp = (F * fma(-1.0, (x / F), (1.0 / F))) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -1.16e+171) tmp = Float64(Float64(-1.0 * Float64(F * Float64(Float64(1.0 / F) + Float64(x / F)))) / B); elseif (F <= 6e+85) tmp = Float64(Float64(Float64(F / sqrt(Float64(2.0 + fma(2.0, x, (F ^ 2.0))))) - x) / B); else tmp = Float64(Float64(F * fma(-1.0, Float64(x / F), Float64(1.0 / F))) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -1.16e+171], N[(N[(-1.0 * N[(F * N[(N[(1.0 / F), $MachinePrecision] + N[(x / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 6e+85], N[(N[(N[(F / N[Sqrt[N[(2.0 + N[(2.0 * x + N[Power[F, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(F * N[(-1.0 * N[(x / F), $MachinePrecision] + N[(1.0 / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;F \leq -1.16 \cdot 10^{+171}:\\
\;\;\;\;\frac{-1 \cdot \left(F \cdot \left(\frac{1}{F} + \frac{x}{F}\right)\right)}{B}\\
\mathbf{elif}\;F \leq 6 \cdot 10^{+85}:\\
\;\;\;\;\frac{\frac{F}{\sqrt{2 + \mathsf{fma}\left(2, x, {F}^{2}\right)}} - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{F \cdot \mathsf{fma}\left(-1, \frac{x}{F}, \frac{1}{F}\right)}{B}\\
\end{array}
if F < -1.16e171Initial program 76.6%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites45.0%
Taylor expanded in F around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-/.f6429.0%
Applied rewrites29.0%
if -1.16e171 < F < 6.0000000000000001e85Initial program 76.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
mult-flipN/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites85.4%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6485.4%
lift-pow.f64N/A
sqr-powN/A
lift-fma.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
associate-+r+N/A
lift-*.f64N/A
pow2N/A
lift-pow.f64N/A
lift-fma.f64N/A
+-commutativeN/A
lift-+.f64N/A
Applied rewrites85.4%
lift-fma.f64N/A
add-flipN/A
lower--.f64N/A
Applied rewrites85.5%
Taylor expanded in B around 0
lower-/.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6445.0%
Applied rewrites45.0%
if 6.0000000000000001e85 < F Initial program 76.6%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites45.0%
Taylor expanded in F around inf
lower-*.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f6429.1%
Applied rewrites29.1%
(FPCore (F B x)
:precision binary64
(if (<= F -1.92e+146)
(* -1.0 (* F (+ (/ 1.0 (* B F)) (/ x (* B F)))))
(if (<= F 1e+124)
(/ (- (* (pow (fma x 2.0 (fma F F 2.0)) -0.5) F) x) B)
(/ (* F (fma -1.0 (/ x F) (/ 1.0 F))) B))))double code(double F, double B, double x) {
double tmp;
if (F <= -1.92e+146) {
tmp = -1.0 * (F * ((1.0 / (B * F)) + (x / (B * F))));
} else if (F <= 1e+124) {
tmp = ((pow(fma(x, 2.0, fma(F, F, 2.0)), -0.5) * F) - x) / B;
} else {
tmp = (F * fma(-1.0, (x / F), (1.0 / F))) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -1.92e+146) tmp = Float64(-1.0 * Float64(F * Float64(Float64(1.0 / Float64(B * F)) + Float64(x / Float64(B * F))))); elseif (F <= 1e+124) tmp = Float64(Float64(Float64((fma(x, 2.0, fma(F, F, 2.0)) ^ -0.5) * F) - x) / B); else tmp = Float64(Float64(F * fma(-1.0, Float64(x / F), Float64(1.0 / F))) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -1.92e+146], N[(-1.0 * N[(F * N[(N[(1.0 / N[(B * F), $MachinePrecision]), $MachinePrecision] + N[(x / N[(B * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1e+124], 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[(F * N[(-1.0 * N[(x / F), $MachinePrecision] + N[(1.0 / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;F \leq -1.92 \cdot 10^{+146}:\\
\;\;\;\;-1 \cdot \left(F \cdot \left(\frac{1}{B \cdot F} + \frac{x}{B \cdot F}\right)\right)\\
\mathbf{elif}\;F \leq 10^{+124}:\\
\;\;\;\;\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{F \cdot \mathsf{fma}\left(-1, \frac{x}{F}, \frac{1}{F}\right)}{B}\\
\end{array}
if F < -1.9199999999999999e146Initial program 76.6%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites45.0%
Taylor expanded in F around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6427.7%
Applied rewrites27.7%
if -1.9199999999999999e146 < F < 9.9999999999999995e123Initial program 76.6%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites45.0%
Applied rewrites45.0%
if 9.9999999999999995e123 < F Initial program 76.6%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites45.0%
Taylor expanded in F around inf
lower-*.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f6429.1%
Applied rewrites29.1%
(FPCore (F B x)
:precision binary64
(if (<= F -5700.0)
(/ (* -1.0 (* F (+ (/ 1.0 F) (/ x F)))) B)
(if (<= F 0.00036)
(/ (- (* F (pow (+ 2.0 (* 2.0 x)) -0.5)) x) B)
(/ (* F (fma -1.0 (/ x F) (/ 1.0 F))) B))))double code(double F, double B, double x) {
double tmp;
if (F <= -5700.0) {
tmp = (-1.0 * (F * ((1.0 / F) + (x / F)))) / B;
} else if (F <= 0.00036) {
tmp = ((F * pow((2.0 + (2.0 * x)), -0.5)) - x) / B;
} else {
tmp = (F * fma(-1.0, (x / F), (1.0 / F))) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -5700.0) tmp = Float64(Float64(-1.0 * Float64(F * Float64(Float64(1.0 / F) + Float64(x / F)))) / B); elseif (F <= 0.00036) tmp = Float64(Float64(Float64(F * (Float64(2.0 + Float64(2.0 * x)) ^ -0.5)) - x) / B); else tmp = Float64(Float64(F * fma(-1.0, Float64(x / F), Float64(1.0 / F))) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -5700.0], N[(N[(-1.0 * N[(F * N[(N[(1.0 / F), $MachinePrecision] + N[(x / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 0.00036], N[(N[(N[(F * N[Power[N[(2.0 + N[(2.0 * x), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(F * N[(-1.0 * N[(x / F), $MachinePrecision] + N[(1.0 / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;F \leq -5700:\\
\;\;\;\;\frac{-1 \cdot \left(F \cdot \left(\frac{1}{F} + \frac{x}{F}\right)\right)}{B}\\
\mathbf{elif}\;F \leq 0.00036:\\
\;\;\;\;\frac{F \cdot {\left(2 + 2 \cdot x\right)}^{-0.5} - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{F \cdot \mathsf{fma}\left(-1, \frac{x}{F}, \frac{1}{F}\right)}{B}\\
\end{array}
if F < -5700Initial program 76.6%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites45.0%
Taylor expanded in F around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-/.f6429.0%
Applied rewrites29.0%
if -5700 < F < 3.6000000000000002e-4Initial program 76.6%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites45.0%
Taylor expanded in F around 0
lower-*.f6430.7%
Applied rewrites30.7%
if 3.6000000000000002e-4 < F Initial program 76.6%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites45.0%
Taylor expanded in F around inf
lower-*.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f6429.1%
Applied rewrites29.1%
(FPCore (F B x) :precision binary64 (* (copysign 1.0 B) (if (<= (fabs B) 4.5e+20) (/ (- (/ F (sqrt (+ 2.0 (fma 2.0 x (pow F 2.0))))) x) (fabs B)) (/ -1.0 (sin (fabs B))))))
double code(double F, double B, double x) {
double tmp;
if (fabs(B) <= 4.5e+20) {
tmp = ((F / sqrt((2.0 + fma(2.0, x, pow(F, 2.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) <= 4.5e+20) tmp = Float64(Float64(Float64(F / sqrt(Float64(2.0 + fma(2.0, x, (F ^ 2.0))))) - 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], 4.5e+20], N[(N[(N[(F / N[Sqrt[N[(2.0 + N[(2.0 * x + N[Power[F, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $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 4.5 \cdot 10^{+20}:\\
\;\;\;\;\frac{\frac{F}{\sqrt{2 + \mathsf{fma}\left(2, x, {F}^{2}\right)}} - x}{\left|B\right|}\\
\mathbf{else}:\\
\;\;\;\;\frac{-1}{\sin \left(\left|B\right|\right)}\\
\end{array}
if B < 4.5e20Initial program 76.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
mult-flipN/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites85.4%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6485.4%
lift-pow.f64N/A
sqr-powN/A
lift-fma.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
associate-+r+N/A
lift-*.f64N/A
pow2N/A
lift-pow.f64N/A
lift-fma.f64N/A
+-commutativeN/A
lift-+.f64N/A
Applied rewrites85.4%
lift-fma.f64N/A
add-flipN/A
lower--.f64N/A
Applied rewrites85.5%
Taylor expanded in B around 0
lower-/.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6445.0%
Applied rewrites45.0%
if 4.5e20 < B Initial program 76.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
mult-flipN/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites85.4%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6485.4%
lift-pow.f64N/A
sqr-powN/A
lift-fma.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
associate-+r+N/A
lift-*.f64N/A
pow2N/A
lift-pow.f64N/A
lift-fma.f64N/A
+-commutativeN/A
lift-+.f64N/A
Applied rewrites85.4%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6416.7%
Applied rewrites16.7%
(FPCore (F B x)
:precision binary64
(if (<= F -1e-58)
(/ (* -1.0 (* F (+ (/ 1.0 F) (/ x F)))) B)
(if (<= F 7.8e-47)
(/ (* -1.0 x) B)
(/ (* F (fma -1.0 (/ x F) (/ 1.0 F))) B))))double code(double F, double B, double x) {
double tmp;
if (F <= -1e-58) {
tmp = (-1.0 * (F * ((1.0 / F) + (x / F)))) / B;
} else if (F <= 7.8e-47) {
tmp = (-1.0 * x) / B;
} else {
tmp = (F * fma(-1.0, (x / F), (1.0 / F))) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -1e-58) tmp = Float64(Float64(-1.0 * Float64(F * Float64(Float64(1.0 / F) + Float64(x / F)))) / B); elseif (F <= 7.8e-47) tmp = Float64(Float64(-1.0 * x) / B); else tmp = Float64(Float64(F * fma(-1.0, Float64(x / F), Float64(1.0 / F))) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -1e-58], N[(N[(-1.0 * N[(F * N[(N[(1.0 / F), $MachinePrecision] + N[(x / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 7.8e-47], N[(N[(-1.0 * x), $MachinePrecision] / B), $MachinePrecision], N[(N[(F * N[(-1.0 * N[(x / F), $MachinePrecision] + N[(1.0 / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;F \leq -1 \cdot 10^{-58}:\\
\;\;\;\;\frac{-1 \cdot \left(F \cdot \left(\frac{1}{F} + \frac{x}{F}\right)\right)}{B}\\
\mathbf{elif}\;F \leq 7.8 \cdot 10^{-47}:\\
\;\;\;\;\frac{-1 \cdot x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{F \cdot \mathsf{fma}\left(-1, \frac{x}{F}, \frac{1}{F}\right)}{B}\\
\end{array}
if F < -1e-58Initial program 76.6%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites45.0%
Taylor expanded in F around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-/.f6429.0%
Applied rewrites29.0%
if -1e-58 < F < 7.7999999999999996e-47Initial program 76.6%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites45.0%
Taylor expanded in F around 0
lower-*.f6430.0%
Applied rewrites30.0%
if 7.7999999999999996e-47 < F Initial program 76.6%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites45.0%
Taylor expanded in F around inf
lower-*.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f6429.1%
Applied rewrites29.1%
(FPCore (F B x)
:precision binary64
(if (<= F -1e-58)
(- (* (/ -1.0 F) (/ F B)) (/ x B))
(if (<= F 7.8e-47)
(/ (* -1.0 x) B)
(/ (* F (fma -1.0 (/ x F) (/ 1.0 F))) B))))double code(double F, double B, double x) {
double tmp;
if (F <= -1e-58) {
tmp = ((-1.0 / F) * (F / B)) - (x / B);
} else if (F <= 7.8e-47) {
tmp = (-1.0 * x) / B;
} else {
tmp = (F * fma(-1.0, (x / F), (1.0 / F))) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -1e-58) tmp = Float64(Float64(Float64(-1.0 / F) * Float64(F / B)) - Float64(x / B)); elseif (F <= 7.8e-47) tmp = Float64(Float64(-1.0 * x) / B); else tmp = Float64(Float64(F * fma(-1.0, Float64(x / F), Float64(1.0 / F))) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -1e-58], N[(N[(N[(-1.0 / F), $MachinePrecision] * N[(F / B), $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 7.8e-47], N[(N[(-1.0 * x), $MachinePrecision] / B), $MachinePrecision], N[(N[(F * N[(-1.0 * N[(x / F), $MachinePrecision] + N[(1.0 / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;F \leq -1 \cdot 10^{-58}:\\
\;\;\;\;\frac{-1}{F} \cdot \frac{F}{B} - \frac{x}{B}\\
\mathbf{elif}\;F \leq 7.8 \cdot 10^{-47}:\\
\;\;\;\;\frac{-1 \cdot x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{F \cdot \mathsf{fma}\left(-1, \frac{x}{F}, \frac{1}{F}\right)}{B}\\
\end{array}
if F < -1e-58Initial program 76.6%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites45.0%
Applied rewrites36.2%
Taylor expanded in F around -inf
lower-/.f6421.8%
Applied rewrites21.8%
if -1e-58 < F < 7.7999999999999996e-47Initial program 76.6%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites45.0%
Taylor expanded in F around 0
lower-*.f6430.0%
Applied rewrites30.0%
if 7.7999999999999996e-47 < F Initial program 76.6%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites45.0%
Taylor expanded in F around inf
lower-*.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f6429.1%
Applied rewrites29.1%
(FPCore (F B x)
:precision binary64
(if (<= F -1e-58)
(- (* (/ -1.0 F) (/ F B)) (/ x B))
(if (<= F 7.8e-47)
(/ (* -1.0 x) B)
(- (* (/ 1.0 F) (/ F B)) (/ x B)))))double code(double F, double B, double x) {
double tmp;
if (F <= -1e-58) {
tmp = ((-1.0 / F) * (F / B)) - (x / B);
} else if (F <= 7.8e-47) {
tmp = (-1.0 * x) / B;
} else {
tmp = ((1.0 / F) * (F / B)) - (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 <= (-1d-58)) then
tmp = (((-1.0d0) / f) * (f / b)) - (x / b)
else if (f <= 7.8d-47) then
tmp = ((-1.0d0) * x) / b
else
tmp = ((1.0d0 / f) * (f / b)) - (x / b)
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -1e-58) {
tmp = ((-1.0 / F) * (F / B)) - (x / B);
} else if (F <= 7.8e-47) {
tmp = (-1.0 * x) / B;
} else {
tmp = ((1.0 / F) * (F / B)) - (x / B);
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -1e-58: tmp = ((-1.0 / F) * (F / B)) - (x / B) elif F <= 7.8e-47: tmp = (-1.0 * x) / B else: tmp = ((1.0 / F) * (F / B)) - (x / B) return tmp
function code(F, B, x) tmp = 0.0 if (F <= -1e-58) tmp = Float64(Float64(Float64(-1.0 / F) * Float64(F / B)) - Float64(x / B)); elseif (F <= 7.8e-47) tmp = Float64(Float64(-1.0 * x) / B); else tmp = Float64(Float64(Float64(1.0 / F) * Float64(F / B)) - Float64(x / B)); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -1e-58) tmp = ((-1.0 / F) * (F / B)) - (x / B); elseif (F <= 7.8e-47) tmp = (-1.0 * x) / B; else tmp = ((1.0 / F) * (F / B)) - (x / B); end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -1e-58], N[(N[(N[(-1.0 / F), $MachinePrecision] * N[(F / B), $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 7.8e-47], N[(N[(-1.0 * x), $MachinePrecision] / B), $MachinePrecision], N[(N[(N[(1.0 / F), $MachinePrecision] * N[(F / B), $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;F \leq -1 \cdot 10^{-58}:\\
\;\;\;\;\frac{-1}{F} \cdot \frac{F}{B} - \frac{x}{B}\\
\mathbf{elif}\;F \leq 7.8 \cdot 10^{-47}:\\
\;\;\;\;\frac{-1 \cdot x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{F} \cdot \frac{F}{B} - \frac{x}{B}\\
\end{array}
if F < -1e-58Initial program 76.6%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites45.0%
Applied rewrites36.2%
Taylor expanded in F around -inf
lower-/.f6421.8%
Applied rewrites21.8%
if -1e-58 < F < 7.7999999999999996e-47Initial program 76.6%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites45.0%
Taylor expanded in F around 0
lower-*.f6430.0%
Applied rewrites30.0%
if 7.7999999999999996e-47 < F Initial program 76.6%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites45.0%
Applied rewrites36.2%
Taylor expanded in F around inf
lower-/.f6421.9%
Applied rewrites21.9%
(FPCore (F B x) :precision binary64 (if (<= F -1e-58) (- (* (/ -1.0 F) (/ F B)) (/ x B)) (if (<= F 9e+136) (/ (* -1.0 x) B) (/ 1.0 B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1e-58) {
tmp = ((-1.0 / F) * (F / B)) - (x / B);
} else if (F <= 9e+136) {
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 <= (-1d-58)) then
tmp = (((-1.0d0) / f) * (f / b)) - (x / b)
else if (f <= 9d+136) 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 <= -1e-58) {
tmp = ((-1.0 / F) * (F / B)) - (x / B);
} else if (F <= 9e+136) {
tmp = (-1.0 * x) / B;
} else {
tmp = 1.0 / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -1e-58: tmp = ((-1.0 / F) * (F / B)) - (x / B) elif F <= 9e+136: tmp = (-1.0 * x) / B else: tmp = 1.0 / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= -1e-58) tmp = Float64(Float64(Float64(-1.0 / F) * Float64(F / B)) - Float64(x / B)); elseif (F <= 9e+136) 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 <= -1e-58) tmp = ((-1.0 / F) * (F / B)) - (x / B); elseif (F <= 9e+136) tmp = (-1.0 * x) / B; else tmp = 1.0 / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -1e-58], N[(N[(N[(-1.0 / F), $MachinePrecision] * N[(F / B), $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 9e+136], N[(N[(-1.0 * x), $MachinePrecision] / B), $MachinePrecision], N[(1.0 / B), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;F \leq -1 \cdot 10^{-58}:\\
\;\;\;\;\frac{-1}{F} \cdot \frac{F}{B} - \frac{x}{B}\\
\mathbf{elif}\;F \leq 9 \cdot 10^{+136}:\\
\;\;\;\;\frac{-1 \cdot x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{B}\\
\end{array}
if F < -1e-58Initial program 76.6%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites45.0%
Applied rewrites36.2%
Taylor expanded in F around -inf
lower-/.f6421.8%
Applied rewrites21.8%
if -1e-58 < F < 8.9999999999999999e136Initial program 76.6%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites45.0%
Taylor expanded in F around 0
lower-*.f6430.0%
Applied rewrites30.0%
if 8.9999999999999999e136 < F Initial program 76.6%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites45.0%
Taylor expanded in F around -inf
lower-/.f6410.5%
Applied rewrites10.5%
Taylor expanded in F around inf
lower-/.f6410.1%
Applied rewrites10.1%
(FPCore (F B x) :precision binary64 (let* ((t_0 (/ (* -1.0 x) B))) (if (<= x -6.2e-99) t_0 (if (<= x 6e-186) (/ -1.0 B) t_0))))
double code(double F, double B, double x) {
double t_0 = (-1.0 * x) / B;
double tmp;
if (x <= -6.2e-99) {
tmp = t_0;
} else if (x <= 6e-186) {
tmp = -1.0 / B;
} else {
tmp = t_0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: tmp
t_0 = ((-1.0d0) * x) / b
if (x <= (-6.2d-99)) then
tmp = t_0
else if (x <= 6d-186) then
tmp = (-1.0d0) / b
else
tmp = t_0
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double t_0 = (-1.0 * x) / B;
double tmp;
if (x <= -6.2e-99) {
tmp = t_0;
} else if (x <= 6e-186) {
tmp = -1.0 / B;
} else {
tmp = t_0;
}
return tmp;
}
def code(F, B, x): t_0 = (-1.0 * x) / B tmp = 0 if x <= -6.2e-99: tmp = t_0 elif x <= 6e-186: tmp = -1.0 / B else: tmp = t_0 return tmp
function code(F, B, x) t_0 = Float64(Float64(-1.0 * x) / B) tmp = 0.0 if (x <= -6.2e-99) tmp = t_0; elseif (x <= 6e-186) tmp = Float64(-1.0 / B); else tmp = t_0; end return tmp end
function tmp_2 = code(F, B, x) t_0 = (-1.0 * x) / B; tmp = 0.0; if (x <= -6.2e-99) tmp = t_0; elseif (x <= 6e-186) tmp = -1.0 / B; else tmp = t_0; end tmp_2 = tmp; end
code[F_, B_, x_] := Block[{t$95$0 = N[(N[(-1.0 * x), $MachinePrecision] / B), $MachinePrecision]}, If[LessEqual[x, -6.2e-99], t$95$0, If[LessEqual[x, 6e-186], N[(-1.0 / B), $MachinePrecision], t$95$0]]]
\begin{array}{l}
t_0 := \frac{-1 \cdot x}{B}\\
\mathbf{if}\;x \leq -6.2 \cdot 10^{-99}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 6 \cdot 10^{-186}:\\
\;\;\;\;\frac{-1}{B}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if x < -6.1999999999999997e-99 or 6.0000000000000003e-186 < x Initial program 76.6%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites45.0%
Taylor expanded in F around 0
lower-*.f6430.0%
Applied rewrites30.0%
if -6.1999999999999997e-99 < x < 6.0000000000000003e-186Initial program 76.6%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites45.0%
Taylor expanded in F around -inf
lower-/.f6410.5%
Applied rewrites10.5%
(FPCore (F B x) :precision binary64 (if (<= F 4.2e-175) (/ -1.0 B) (/ 1.0 B)))
double code(double F, double B, double x) {
double tmp;
if (F <= 4.2e-175) {
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 <= 4.2d-175) 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 <= 4.2e-175) {
tmp = -1.0 / B;
} else {
tmp = 1.0 / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= 4.2e-175: tmp = -1.0 / B else: tmp = 1.0 / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= 4.2e-175) 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 <= 4.2e-175) tmp = -1.0 / B; else tmp = 1.0 / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, 4.2e-175], N[(-1.0 / B), $MachinePrecision], N[(1.0 / B), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;F \leq 4.2 \cdot 10^{-175}:\\
\;\;\;\;\frac{-1}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{B}\\
\end{array}
if F < 4.2e-175Initial program 76.6%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites45.0%
Taylor expanded in F around -inf
lower-/.f6410.5%
Applied rewrites10.5%
if 4.2e-175 < F Initial program 76.6%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites45.0%
Taylor expanded in F around -inf
lower-/.f6410.5%
Applied rewrites10.5%
Taylor expanded in F around inf
lower-/.f6410.1%
Applied rewrites10.1%
(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.6%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites45.0%
Taylor expanded in F around -inf
lower-/.f6410.5%
Applied rewrites10.5%
herbie shell --seed 2025210
(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))))))