
(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 23 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+61)
(- (/ -1.0 (sin B)) t_0)
(if (<= F 1e+159)
(-
(/ 1.0 (/ (sin B) (* (pow (fma x 2.0 (fma F F 2.0)) -0.5) F)))
t_0)
(+ (- (* x (/ 1.0 (tan B)))) (/ 1.0 (sin B)))))))double code(double F, double B, double x) {
double t_0 = x / tan(B);
double tmp;
if (F <= -2e+61) {
tmp = (-1.0 / sin(B)) - t_0;
} else if (F <= 1e+159) {
tmp = (1.0 / (sin(B) / (pow(fma(x, 2.0, fma(F, F, 2.0)), -0.5) * F))) - t_0;
} else {
tmp = -(x * (1.0 / tan(B))) + (1.0 / sin(B));
}
return tmp;
}
function code(F, B, x) t_0 = Float64(x / tan(B)) tmp = 0.0 if (F <= -2e+61) tmp = Float64(Float64(-1.0 / sin(B)) - t_0); elseif (F <= 1e+159) tmp = Float64(Float64(1.0 / Float64(sin(B) / Float64((fma(x, 2.0, fma(F, F, 2.0)) ^ -0.5) * F))) - t_0); else tmp = Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(1.0 / sin(B))); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -2e+61], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[F, 1e+159], N[(N[(1.0 / N[(N[Sin[B], $MachinePrecision] / N[(N[Power[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \frac{x}{\tan B}\\
\mathbf{if}\;F \leq -2 \cdot 10^{+61}:\\
\;\;\;\;\frac{-1}{\sin B} - t\_0\\
\mathbf{elif}\;F \leq 10^{+159}:\\
\;\;\;\;\frac{1}{\frac{\sin B}{{\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5} \cdot F}} - t\_0\\
\mathbf{else}:\\
\;\;\;\;\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B}\\
\end{array}
if F < -1.9999999999999999e61Initial program 76.7%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6476.7%
Applied rewrites84.7%
Taylor expanded in F around -inf
Applied rewrites56.3%
if -1.9999999999999999e61 < F < 9.9999999999999993e158Initial program 76.7%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6476.7%
Applied rewrites84.7%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lift-*.f64N/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
*-commutativeN/A
lift-*.f64N/A
lower-unsound-/.f6484.7%
lift-*.f64N/A
Applied rewrites84.7%
if 9.9999999999999993e158 < F Initial program 76.7%
Taylor expanded in F around inf
lower-/.f64N/A
lower-sin.f6455.8%
Applied rewrites55.8%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ x (tan B))))
(if (<= F -4e+76)
(- (/ -1.0 (sin B)) t_0)
(if (<= F 20000.0)
(- (/ F (* (sin B) (pow (fma 2.0 x (fma F F 2.0)) 0.5))) 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 <= -4e+76) {
tmp = (-1.0 / sin(B)) - t_0;
} else if (F <= 20000.0) {
tmp = (F / (sin(B) * pow(fma(2.0, x, fma(F, F, 2.0)), 0.5))) - 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 <= -4e+76) tmp = Float64(Float64(-1.0 / sin(B)) - t_0); elseif (F <= 20000.0) tmp = Float64(Float64(F / Float64(sin(B) * (fma(2.0, x, fma(F, F, 2.0)) ^ 0.5))) - 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, -4e+76], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[F, 20000.0], N[(N[(F / N[(N[Sin[B], $MachinePrecision] * N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], 0.5], $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 -4 \cdot 10^{+76}:\\
\;\;\;\;\frac{-1}{\sin B} - t\_0\\
\mathbf{elif}\;F \leq 20000:\\
\;\;\;\;\frac{F}{\sin B \cdot {\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{0.5}} - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B} - t\_0\\
\end{array}
if F < -4.0000000000000002e76Initial program 76.7%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6476.7%
Applied rewrites84.7%
Taylor expanded in F around -inf
Applied rewrites56.3%
if -4.0000000000000002e76 < F < 2e4Initial program 76.7%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6476.7%
Applied rewrites84.7%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lift-*.f64N/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
*-commutativeN/A
lift-*.f64N/A
lower-unsound-/.f6484.7%
lift-*.f64N/A
Applied rewrites84.7%
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
div-flip-revN/A
lower-/.f64N/A
lift-fma.f64N/A
*-commutativeN/A
lift-*.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
metadata-evalN/A
metadata-evalN/A
lift-/.f64N/A
lift-neg.f64N/A
Applied rewrites84.7%
if 2e4 < F Initial program 76.7%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6476.7%
Applied rewrites84.7%
Taylor expanded in F around inf
Applied rewrites55.9%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ x (tan B))))
(if (<= F -2.85e+23)
(- (/ -1.0 (sin B)) t_0)
(if (<= F 20000.0)
(- (/ (/ F (sin B)) (sqrt (fma x 2.0 (fma F F 2.0)))) 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 <= -2.85e+23) {
tmp = (-1.0 / sin(B)) - t_0;
} else if (F <= 20000.0) {
tmp = ((F / sin(B)) / sqrt(fma(x, 2.0, fma(F, F, 2.0)))) - 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 <= -2.85e+23) tmp = Float64(Float64(-1.0 / sin(B)) - t_0); elseif (F <= 20000.0) tmp = Float64(Float64(Float64(F / sin(B)) / sqrt(fma(x, 2.0, fma(F, F, 2.0)))) - 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, -2.85e+23], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[F, 20000.0], N[(N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $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 -2.85 \cdot 10^{+23}:\\
\;\;\;\;\frac{-1}{\sin B} - t\_0\\
\mathbf{elif}\;F \leq 20000:\\
\;\;\;\;\frac{\frac{F}{\sin B}}{\sqrt{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}} - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B} - t\_0\\
\end{array}
if F < -2.85e23Initial program 76.7%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6476.7%
Applied rewrites84.7%
Taylor expanded in F around -inf
Applied rewrites56.3%
if -2.85e23 < F < 2e4Initial program 76.7%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6476.7%
Applied rewrites84.7%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lift-*.f64N/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
*-commutativeN/A
lift-*.f64N/A
lower-unsound-/.f6484.7%
lift-*.f64N/A
Applied rewrites84.7%
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
div-flip-revN/A
lower-/.f64N/A
lift-fma.f64N/A
*-commutativeN/A
lift-*.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
metadata-evalN/A
metadata-evalN/A
lift-/.f64N/A
lift-neg.f64N/A
Applied rewrites84.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
lower-/.f6476.9%
lift-pow.f64N/A
unpow1/2N/A
lift-fma.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lower-sqrt.f6476.9%
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6476.9%
Applied rewrites76.9%
if 2e4 < F Initial program 76.7%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6476.7%
Applied rewrites84.7%
Taylor expanded in F around inf
Applied rewrites55.9%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ x (tan B))))
(if (<= F -0.43)
(- (/ -1.0 (sin B)) t_0)
(if (<= F 2.9e-12)
(- (/ F (* (sin B) (sqrt (+ 2.0 (* 2.0 x))))) 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 <= -0.43) {
tmp = (-1.0 / sin(B)) - t_0;
} else if (F <= 2.9e-12) {
tmp = (F / (sin(B) * sqrt((2.0 + (2.0 * x))))) - t_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 <= (-0.43d0)) then
tmp = ((-1.0d0) / sin(b)) - t_0
else if (f <= 2.9d-12) then
tmp = (f / (sin(b) * sqrt((2.0d0 + (2.0d0 * x))))) - t_0
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 <= -0.43) {
tmp = (-1.0 / Math.sin(B)) - t_0;
} else if (F <= 2.9e-12) {
tmp = (F / (Math.sin(B) * Math.sqrt((2.0 + (2.0 * x))))) - t_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 <= -0.43: tmp = (-1.0 / math.sin(B)) - t_0 elif F <= 2.9e-12: tmp = (F / (math.sin(B) * math.sqrt((2.0 + (2.0 * x))))) - t_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 <= -0.43) tmp = Float64(Float64(-1.0 / sin(B)) - t_0); elseif (F <= 2.9e-12) tmp = Float64(Float64(F / Float64(sin(B) * sqrt(Float64(2.0 + Float64(2.0 * x))))) - t_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 <= -0.43) tmp = (-1.0 / sin(B)) - t_0; elseif (F <= 2.9e-12) tmp = (F / (sin(B) * sqrt((2.0 + (2.0 * x))))) - t_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, -0.43], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[F, 2.9e-12], N[(N[(F / N[(N[Sin[B], $MachinePrecision] * N[Sqrt[N[(2.0 + N[(2.0 * x), $MachinePrecision]), $MachinePrecision]], $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 -0.43:\\
\;\;\;\;\frac{-1}{\sin B} - t\_0\\
\mathbf{elif}\;F \leq 2.9 \cdot 10^{-12}:\\
\;\;\;\;\frac{F}{\sin B \cdot \sqrt{2 + 2 \cdot x}} - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B} - t\_0\\
\end{array}
if F < -0.42999999999999999Initial program 76.7%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6476.7%
Applied rewrites84.7%
Taylor expanded in F around -inf
Applied rewrites56.3%
if -0.42999999999999999 < F < 2.9000000000000002e-12Initial program 76.7%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6476.7%
Applied rewrites84.7%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lift-*.f64N/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
*-commutativeN/A
lift-*.f64N/A
lower-unsound-/.f6484.7%
lift-*.f64N/A
Applied rewrites84.7%
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
div-flip-revN/A
lower-/.f64N/A
lift-fma.f64N/A
*-commutativeN/A
lift-*.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
metadata-evalN/A
metadata-evalN/A
lift-/.f64N/A
lift-neg.f64N/A
Applied rewrites84.7%
Taylor expanded in F around 0
lower-sqrt.f64N/A
lower-+.f64N/A
lower-*.f6455.5%
Applied rewrites55.5%
if 2.9000000000000002e-12 < F Initial program 76.7%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6476.7%
Applied rewrites84.7%
Taylor expanded in F around inf
Applied rewrites55.9%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ x (tan B))))
(if (<= F -3.5e-12)
(- (/ -1.0 (sin B)) t_0)
(if (<= F 20000.0)
(- (/ F (* B (sqrt (+ 2.0 (fma 2.0 x (pow F 2.0)))))) 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 <= -3.5e-12) {
tmp = (-1.0 / sin(B)) - t_0;
} else if (F <= 20000.0) {
tmp = (F / (B * sqrt((2.0 + fma(2.0, x, pow(F, 2.0)))))) - 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 <= -3.5e-12) tmp = Float64(Float64(-1.0 / sin(B)) - t_0); elseif (F <= 20000.0) tmp = Float64(Float64(F / Float64(B * sqrt(Float64(2.0 + fma(2.0, x, (F ^ 2.0)))))) - 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, -3.5e-12], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[F, 20000.0], N[(N[(F / N[(B * N[Sqrt[N[(2.0 + N[(2.0 * x + N[Power[F, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $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 -3.5 \cdot 10^{-12}:\\
\;\;\;\;\frac{-1}{\sin B} - t\_0\\
\mathbf{elif}\;F \leq 20000:\\
\;\;\;\;\frac{F}{B \cdot \sqrt{2 + \mathsf{fma}\left(2, x, {F}^{2}\right)}} - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B} - t\_0\\
\end{array}
if F < -3.5e-12Initial program 76.7%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6476.7%
Applied rewrites84.7%
Taylor expanded in F around -inf
Applied rewrites56.3%
if -3.5e-12 < F < 2e4Initial program 76.7%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6476.7%
Applied rewrites84.7%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lift-*.f64N/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
*-commutativeN/A
lift-*.f64N/A
lower-unsound-/.f6484.7%
lift-*.f64N/A
Applied rewrites84.7%
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
div-flip-revN/A
lower-/.f64N/A
lift-fma.f64N/A
*-commutativeN/A
lift-*.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
metadata-evalN/A
metadata-evalN/A
lift-/.f64N/A
lift-neg.f64N/A
Applied rewrites84.7%
Taylor expanded in B around 0
lower-*.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6470.4%
Applied rewrites70.4%
if 2e4 < F Initial program 76.7%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6476.7%
Applied rewrites84.7%
Taylor expanded in F around inf
Applied rewrites55.9%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ x (tan B))))
(if (<= F -3.5e-12)
(- (/ -1.0 (sin B)) t_0)
(- (/ F (* B (sqrt (+ 2.0 (fma 2.0 x (pow F 2.0)))))) t_0))))double code(double F, double B, double x) {
double t_0 = x / tan(B);
double tmp;
if (F <= -3.5e-12) {
tmp = (-1.0 / sin(B)) - t_0;
} else {
tmp = (F / (B * sqrt((2.0 + fma(2.0, x, pow(F, 2.0)))))) - t_0;
}
return tmp;
}
function code(F, B, x) t_0 = Float64(x / tan(B)) tmp = 0.0 if (F <= -3.5e-12) tmp = Float64(Float64(-1.0 / sin(B)) - t_0); else tmp = Float64(Float64(F / Float64(B * sqrt(Float64(2.0 + fma(2.0, x, (F ^ 2.0)))))) - t_0); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -3.5e-12], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[(N[(F / N[(B * N[Sqrt[N[(2.0 + N[(2.0 * x + N[Power[F, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]]]
\begin{array}{l}
t_0 := \frac{x}{\tan B}\\
\mathbf{if}\;F \leq -3.5 \cdot 10^{-12}:\\
\;\;\;\;\frac{-1}{\sin B} - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{F}{B \cdot \sqrt{2 + \mathsf{fma}\left(2, x, {F}^{2}\right)}} - t\_0\\
\end{array}
if F < -3.5e-12Initial program 76.7%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6476.7%
Applied rewrites84.7%
Taylor expanded in F around -inf
Applied rewrites56.3%
if -3.5e-12 < F Initial program 76.7%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6476.7%
Applied rewrites84.7%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lift-*.f64N/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
*-commutativeN/A
lift-*.f64N/A
lower-unsound-/.f6484.7%
lift-*.f64N/A
Applied rewrites84.7%
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
div-flip-revN/A
lower-/.f64N/A
lift-fma.f64N/A
*-commutativeN/A
lift-*.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
metadata-evalN/A
metadata-evalN/A
lift-/.f64N/A
lift-neg.f64N/A
Applied rewrites84.7%
Taylor expanded in B around 0
lower-*.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6470.4%
Applied rewrites70.4%
(FPCore (F B x)
:precision binary64
(let* ((t_0
(-
(/ F (* B (sqrt (+ 2.0 (fma 2.0 x (pow F 2.0))))))
(/ x (tan B)))))
(if (<= x -5.6e-54)
t_0
(if (<= x 2.7e-129)
(- (/ F (* (sqrt (fma x 2.0 (fma F F 2.0))) (sin B))) (/ x B))
t_0))))double code(double F, double B, double x) {
double t_0 = (F / (B * sqrt((2.0 + fma(2.0, x, pow(F, 2.0)))))) - (x / tan(B));
double tmp;
if (x <= -5.6e-54) {
tmp = t_0;
} else if (x <= 2.7e-129) {
tmp = (F / (sqrt(fma(x, 2.0, fma(F, F, 2.0))) * sin(B))) - (x / B);
} else {
tmp = t_0;
}
return tmp;
}
function code(F, B, x) t_0 = Float64(Float64(F / Float64(B * sqrt(Float64(2.0 + fma(2.0, x, (F ^ 2.0)))))) - Float64(x / tan(B))) tmp = 0.0 if (x <= -5.6e-54) tmp = t_0; elseif (x <= 2.7e-129) tmp = Float64(Float64(F / Float64(sqrt(fma(x, 2.0, 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[(F / N[(B * N[Sqrt[N[(2.0 + N[(2.0 * x + N[Power[F, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -5.6e-54], t$95$0, If[LessEqual[x, 2.7e-129], N[(N[(F / N[(N[Sqrt[N[(x * 2.0 + 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{F}{B \cdot \sqrt{2 + \mathsf{fma}\left(2, x, {F}^{2}\right)}} - \frac{x}{\tan B}\\
\mathbf{if}\;x \leq -5.6 \cdot 10^{-54}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 2.7 \cdot 10^{-129}:\\
\;\;\;\;\frac{F}{\sqrt{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)} \cdot \sin B} - \frac{x}{B}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if x < -5.6000000000000004e-54 or 2.7e-129 < x Initial program 76.7%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6476.7%
Applied rewrites84.7%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lift-*.f64N/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
*-commutativeN/A
lift-*.f64N/A
lower-unsound-/.f6484.7%
lift-*.f64N/A
Applied rewrites84.7%
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
div-flip-revN/A
lower-/.f64N/A
lift-fma.f64N/A
*-commutativeN/A
lift-*.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
metadata-evalN/A
metadata-evalN/A
lift-/.f64N/A
lift-neg.f64N/A
Applied rewrites84.7%
Taylor expanded in B around 0
lower-*.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6470.4%
Applied rewrites70.4%
if -5.6000000000000004e-54 < x < 2.7e-129Initial program 76.7%
Taylor expanded in B around 0
lower-/.f6449.8%
Applied rewrites49.8%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6449.8%
Applied rewrites57.6%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (* -1.0 (/ (* x (cos B)) (sin B)))))
(if (<= x -5.6e-54)
t_0
(if (<= x 1e-125)
(- (/ F (* (sqrt (fma x 2.0 (fma F F 2.0))) (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 <= -5.6e-54) {
tmp = t_0;
} else if (x <= 1e-125) {
tmp = (F / (sqrt(fma(x, 2.0, fma(F, F, 2.0))) * 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 <= -5.6e-54) tmp = t_0; elseif (x <= 1e-125) tmp = Float64(Float64(F / Float64(sqrt(fma(x, 2.0, 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[(-1.0 * N[(N[(x * N[Cos[B], $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -5.6e-54], t$95$0, If[LessEqual[x, 1e-125], N[(N[(F / N[(N[Sqrt[N[(x * 2.0 + 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 := -1 \cdot \frac{x \cdot \cos B}{\sin B}\\
\mathbf{if}\;x \leq -5.6 \cdot 10^{-54}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 10^{-125}:\\
\;\;\;\;\frac{F}{\sqrt{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)} \cdot \sin B} - \frac{x}{B}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if x < -5.6000000000000004e-54 or 1e-125 < x Initial program 76.7%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6456.5%
Applied rewrites56.5%
if -5.6000000000000004e-54 < x < 1e-125Initial program 76.7%
Taylor expanded in B around 0
lower-/.f6449.8%
Applied rewrites49.8%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6449.8%
Applied rewrites57.6%
(FPCore (F B x)
:precision binary64
(if (<= F -3e+154)
(* -1.0 (* F (+ (/ 1.0 (* F (sin B))) (/ x (* B F)))))
(if (<= F 8e+160)
(- (/ F (* (sqrt (fma x 2.0 (fma F F 2.0))) (sin B))) (/ x B))
(+ (- (/ x B)) (* (/ F (sin B)) (/ 1.0 F))))))double code(double F, double B, double x) {
double tmp;
if (F <= -3e+154) {
tmp = -1.0 * (F * ((1.0 / (F * sin(B))) + (x / (B * F))));
} else if (F <= 8e+160) {
tmp = (F / (sqrt(fma(x, 2.0, fma(F, F, 2.0))) * sin(B))) - (x / B);
} else {
tmp = -(x / B) + ((F / sin(B)) * (1.0 / F));
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -3e+154) tmp = Float64(-1.0 * Float64(F * Float64(Float64(1.0 / Float64(F * sin(B))) + Float64(x / Float64(B * F))))); elseif (F <= 8e+160) tmp = Float64(Float64(F / Float64(sqrt(fma(x, 2.0, fma(F, F, 2.0))) * sin(B))) - Float64(x / B)); else tmp = Float64(Float64(-Float64(x / B)) + Float64(Float64(F / sin(B)) * Float64(1.0 / F))); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -3e+154], N[(-1.0 * N[(F * N[(N[(1.0 / N[(F * N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x / N[(B * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 8e+160], N[(N[(F / N[(N[Sqrt[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision], N[((-N[(x / B), $MachinePrecision]) + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[(1.0 / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;F \leq -3 \cdot 10^{+154}:\\
\;\;\;\;-1 \cdot \left(F \cdot \left(\frac{1}{F \cdot \sin B} + \frac{x}{B \cdot F}\right)\right)\\
\mathbf{elif}\;F \leq 8 \cdot 10^{+160}:\\
\;\;\;\;\frac{F}{\sqrt{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)} \cdot \sin B} - \frac{x}{B}\\
\mathbf{else}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{F}{\sin B} \cdot \frac{1}{F}\\
\end{array}
if F < -3.0000000000000003e154Initial program 76.7%
Taylor expanded in F around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sin.f6450.0%
Applied rewrites50.0%
Taylor expanded in B around 0
lower-/.f64N/A
lower-*.f6434.3%
Applied rewrites34.3%
if -3.0000000000000003e154 < F < 8.0000000000000001e160Initial program 76.7%
Taylor expanded in B around 0
lower-/.f6449.8%
Applied rewrites49.8%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6449.8%
Applied rewrites57.6%
if 8.0000000000000001e160 < F Initial program 76.7%
Taylor expanded in B around 0
lower-/.f6449.8%
Applied rewrites49.8%
Taylor expanded in F around inf
lower-/.f6428.9%
Applied rewrites28.9%
(FPCore (F B x)
:precision binary64
(if (<= F -3.5e+39)
(* -1.0 (* F (+ (/ 1.0 (* F (sin B))) (/ x (* B F)))))
(if (<= F 20000.0)
(-
(* (pow (fma 2.0 x (fma F F 2.0)) -0.5) (/ F B))
(* (/ (fma (* B B) -0.3333333333333333 1.0) B) x))
(+ (- (/ x B)) (* (/ F (sin B)) (/ 1.0 F))))))double code(double F, double B, double x) {
double tmp;
if (F <= -3.5e+39) {
tmp = -1.0 * (F * ((1.0 / (F * sin(B))) + (x / (B * F))));
} else if (F <= 20000.0) {
tmp = (pow(fma(2.0, x, fma(F, F, 2.0)), -0.5) * (F / B)) - ((fma((B * B), -0.3333333333333333, 1.0) / B) * x);
} else {
tmp = -(x / B) + ((F / sin(B)) * (1.0 / F));
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -3.5e+39) tmp = Float64(-1.0 * Float64(F * Float64(Float64(1.0 / Float64(F * sin(B))) + Float64(x / Float64(B * F))))); elseif (F <= 20000.0) tmp = Float64(Float64((fma(2.0, x, fma(F, F, 2.0)) ^ -0.5) * Float64(F / B)) - Float64(Float64(fma(Float64(B * B), -0.3333333333333333, 1.0) / B) * x)); else tmp = Float64(Float64(-Float64(x / B)) + Float64(Float64(F / sin(B)) * Float64(1.0 / F))); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -3.5e+39], N[(-1.0 * N[(F * N[(N[(1.0 / N[(F * N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x / N[(B * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 20000.0], N[(N[(N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * N[(F / B), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(N[(B * B), $MachinePrecision] * -0.3333333333333333 + 1.0), $MachinePrecision] / B), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision], N[((-N[(x / B), $MachinePrecision]) + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[(1.0 / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;F \leq -3.5 \cdot 10^{+39}:\\
\;\;\;\;-1 \cdot \left(F \cdot \left(\frac{1}{F \cdot \sin B} + \frac{x}{B \cdot F}\right)\right)\\
\mathbf{elif}\;F \leq 20000:\\
\;\;\;\;{\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5} \cdot \frac{F}{B} - \frac{\mathsf{fma}\left(B \cdot B, -0.3333333333333333, 1\right)}{B} \cdot x\\
\mathbf{else}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{F}{\sin B} \cdot \frac{1}{F}\\
\end{array}
if F < -3.5000000000000002e39Initial program 76.7%
Taylor expanded in F around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sin.f6450.0%
Applied rewrites50.0%
Taylor expanded in B around 0
lower-/.f64N/A
lower-*.f6434.3%
Applied rewrites34.3%
if -3.5000000000000002e39 < F < 2e4Initial program 76.7%
Taylor expanded in B around 0
lower-/.f6462.4%
Applied rewrites62.4%
Taylor expanded in B around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6436.1%
Applied rewrites36.1%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6436.1%
Applied rewrites36.1%
if 2e4 < F Initial program 76.7%
Taylor expanded in B around 0
lower-/.f6449.8%
Applied rewrites49.8%
Taylor expanded in F around inf
lower-/.f6428.9%
Applied rewrites28.9%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (- (/ x B))) (t_1 (/ F (sin B))))
(if (<= F -2.4e+217)
(/ (* -1.0 (* F (+ (/ 1.0 F) (/ x F)))) B)
(if (<= F -3.5e+39)
(+ t_0 (* t_1 (/ -1.0 F)))
(if (<= F 20000.0)
(-
(* (pow (fma 2.0 x (fma F F 2.0)) -0.5) (/ F B))
(* (/ (fma (* B B) -0.3333333333333333 1.0) B) x))
(+ t_0 (* t_1 (/ 1.0 F))))))))double code(double F, double B, double x) {
double t_0 = -(x / B);
double t_1 = F / sin(B);
double tmp;
if (F <= -2.4e+217) {
tmp = (-1.0 * (F * ((1.0 / F) + (x / F)))) / B;
} else if (F <= -3.5e+39) {
tmp = t_0 + (t_1 * (-1.0 / F));
} else if (F <= 20000.0) {
tmp = (pow(fma(2.0, x, fma(F, F, 2.0)), -0.5) * (F / B)) - ((fma((B * B), -0.3333333333333333, 1.0) / B) * x);
} else {
tmp = t_0 + (t_1 * (1.0 / F));
}
return tmp;
}
function code(F, B, x) t_0 = Float64(-Float64(x / B)) t_1 = Float64(F / sin(B)) tmp = 0.0 if (F <= -2.4e+217) tmp = Float64(Float64(-1.0 * Float64(F * Float64(Float64(1.0 / F) + Float64(x / F)))) / B); elseif (F <= -3.5e+39) tmp = Float64(t_0 + Float64(t_1 * Float64(-1.0 / F))); elseif (F <= 20000.0) tmp = Float64(Float64((fma(2.0, x, fma(F, F, 2.0)) ^ -0.5) * Float64(F / B)) - Float64(Float64(fma(Float64(B * B), -0.3333333333333333, 1.0) / B) * x)); else tmp = Float64(t_0 + Float64(t_1 * Float64(1.0 / F))); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = (-N[(x / B), $MachinePrecision])}, Block[{t$95$1 = N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -2.4e+217], N[(N[(-1.0 * N[(F * N[(N[(1.0 / F), $MachinePrecision] + N[(x / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, -3.5e+39], N[(t$95$0 + N[(t$95$1 * N[(-1.0 / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 20000.0], N[(N[(N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * N[(F / B), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(N[(B * B), $MachinePrecision] * -0.3333333333333333 + 1.0), $MachinePrecision] / B), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(t$95$1 * N[(1.0 / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
t_0 := -\frac{x}{B}\\
t_1 := \frac{F}{\sin B}\\
\mathbf{if}\;F \leq -2.4 \cdot 10^{+217}:\\
\;\;\;\;\frac{-1 \cdot \left(F \cdot \left(\frac{1}{F} + \frac{x}{F}\right)\right)}{B}\\
\mathbf{elif}\;F \leq -3.5 \cdot 10^{+39}:\\
\;\;\;\;t\_0 + t\_1 \cdot \frac{-1}{F}\\
\mathbf{elif}\;F \leq 20000:\\
\;\;\;\;{\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5} \cdot \frac{F}{B} - \frac{\mathsf{fma}\left(B \cdot B, -0.3333333333333333, 1\right)}{B} \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_0 + t\_1 \cdot \frac{1}{F}\\
\end{array}
if F < -2.3999999999999998e217Initial program 76.7%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites44.1%
Taylor expanded in F around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-/.f6428.8%
Applied rewrites28.8%
if -2.3999999999999998e217 < F < -3.5000000000000002e39Initial program 76.7%
Taylor expanded in B around 0
lower-/.f6449.8%
Applied rewrites49.8%
Taylor expanded in F around -inf
lower-/.f6428.8%
Applied rewrites28.8%
if -3.5000000000000002e39 < F < 2e4Initial program 76.7%
Taylor expanded in B around 0
lower-/.f6462.4%
Applied rewrites62.4%
Taylor expanded in B around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6436.1%
Applied rewrites36.1%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6436.1%
Applied rewrites36.1%
if 2e4 < F Initial program 76.7%
Taylor expanded in B around 0
lower-/.f6449.8%
Applied rewrites49.8%
Taylor expanded in F around inf
lower-/.f6428.9%
Applied rewrites28.9%
(FPCore (F B x) :precision binary64 (* (copysign 1.0 B) (if (<= (fabs B) 2.7e+16) (/ (- (* (pow (fma x 2.0 (fma F F 2.0)) -0.5) F) x) (fabs B)) (+ (- (/ x (fabs B))) (* (/ F (sin (fabs B))) (/ -1.0 F))))))
double code(double F, double B, double x) {
double tmp;
if (fabs(B) <= 2.7e+16) {
tmp = ((pow(fma(x, 2.0, fma(F, F, 2.0)), -0.5) * F) - x) / fabs(B);
} else {
tmp = -(x / fabs(B)) + ((F / sin(fabs(B))) * (-1.0 / F));
}
return copysign(1.0, B) * tmp;
}
function code(F, B, x) tmp = 0.0 if (abs(B) <= 2.7e+16) tmp = Float64(Float64(Float64((fma(x, 2.0, fma(F, F, 2.0)) ^ -0.5) * F) - x) / abs(B)); else tmp = Float64(Float64(-Float64(x / abs(B))) + Float64(Float64(F / sin(abs(B))) * Float64(-1.0 / F))); end return Float64(copysign(1.0, B) * tmp) end
code[F_, B_, x_] := N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[B]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[B], $MachinePrecision], 2.7e+16], 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[(x / N[Abs[B], $MachinePrecision]), $MachinePrecision]) + N[(N[(F / N[Sin[N[Abs[B], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\mathsf{copysign}\left(1, B\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|B\right| \leq 2.7 \cdot 10^{+16}:\\
\;\;\;\;\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}:\\
\;\;\;\;\left(-\frac{x}{\left|B\right|}\right) + \frac{F}{\sin \left(\left|B\right|\right)} \cdot \frac{-1}{F}\\
\end{array}
if B < 2.7e16Initial program 76.7%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites44.1%
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-*.f6444.1%
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6444.1%
Applied rewrites44.1%
if 2.7e16 < B Initial program 76.7%
Taylor expanded in B around 0
lower-/.f6449.8%
Applied rewrites49.8%
Taylor expanded in F around -inf
lower-/.f6428.8%
Applied rewrites28.8%
(FPCore (F B x)
:precision binary64
(if (<= F -1.6e+25)
(/ (* -1.0 (* F (+ (/ 1.0 F) (/ x F)))) B)
(if (<= F 0.0028)
(-
(* (pow (fma 2.0 x (fma F F 2.0)) -0.5) (/ F B))
(* (/ (fma (* B B) -0.3333333333333333 1.0) B) x))
(/
(*
F
(-
(fma -0.5 (/ (+ 2.0 (* 2.0 x)) (pow F 3.0)) (/ 1.0 F))
(/ x F)))
B))))double code(double F, double B, double x) {
double tmp;
if (F <= -1.6e+25) {
tmp = (-1.0 * (F * ((1.0 / F) + (x / F)))) / B;
} else if (F <= 0.0028) {
tmp = (pow(fma(2.0, x, fma(F, F, 2.0)), -0.5) * (F / B)) - ((fma((B * B), -0.3333333333333333, 1.0) / B) * x);
} else {
tmp = (F * (fma(-0.5, ((2.0 + (2.0 * x)) / pow(F, 3.0)), (1.0 / F)) - (x / F))) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -1.6e+25) tmp = Float64(Float64(-1.0 * Float64(F * Float64(Float64(1.0 / F) + Float64(x / F)))) / B); elseif (F <= 0.0028) tmp = Float64(Float64((fma(2.0, x, fma(F, F, 2.0)) ^ -0.5) * Float64(F / B)) - Float64(Float64(fma(Float64(B * B), -0.3333333333333333, 1.0) / B) * x)); else tmp = Float64(Float64(F * Float64(fma(-0.5, Float64(Float64(2.0 + Float64(2.0 * x)) / (F ^ 3.0)), Float64(1.0 / F)) - Float64(x / F))) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -1.6e+25], 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.0028], N[(N[(N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * N[(F / B), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(N[(B * B), $MachinePrecision] * -0.3333333333333333 + 1.0), $MachinePrecision] / B), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision], N[(N[(F * N[(N[(-0.5 * N[(N[(2.0 + N[(2.0 * x), $MachinePrecision]), $MachinePrecision] / N[Power[F, 3.0], $MachinePrecision]), $MachinePrecision] + N[(1.0 / F), $MachinePrecision]), $MachinePrecision] - N[(x / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;F \leq -1.6 \cdot 10^{+25}:\\
\;\;\;\;\frac{-1 \cdot \left(F \cdot \left(\frac{1}{F} + \frac{x}{F}\right)\right)}{B}\\
\mathbf{elif}\;F \leq 0.0028:\\
\;\;\;\;{\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5} \cdot \frac{F}{B} - \frac{\mathsf{fma}\left(B \cdot B, -0.3333333333333333, 1\right)}{B} \cdot x\\
\mathbf{else}:\\
\;\;\;\;\frac{F \cdot \left(\mathsf{fma}\left(-0.5, \frac{2 + 2 \cdot x}{{F}^{3}}, \frac{1}{F}\right) - \frac{x}{F}\right)}{B}\\
\end{array}
if F < -1.6e25Initial program 76.7%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites44.1%
Taylor expanded in F around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-/.f6428.8%
Applied rewrites28.8%
if -1.6e25 < F < 0.0028Initial program 76.7%
Taylor expanded in B around 0
lower-/.f6462.4%
Applied rewrites62.4%
Taylor expanded in B around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6436.1%
Applied rewrites36.1%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6436.1%
Applied rewrites36.1%
if 0.0028 < F Initial program 76.7%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites44.1%
Taylor expanded in F around inf
lower-*.f64N/A
lower--.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-/.f64N/A
lower-/.f6425.4%
Applied rewrites25.4%
(FPCore (F B x)
:precision binary64
(if (<= F -1.6e+25)
(/ (* -1.0 (* F (+ (/ 1.0 F) (/ x F)))) B)
(if (<= F 0.0028)
(-
(* (/ 1.0 (sqrt (fma x 2.0 (fma F F 2.0)))) (/ F B))
(* (/ (fma -0.3333333333333333 (* B B) 1.0) B) x))
(/
(*
F
(-
(fma -0.5 (/ (+ 2.0 (* 2.0 x)) (pow F 3.0)) (/ 1.0 F))
(/ x F)))
B))))double code(double F, double B, double x) {
double tmp;
if (F <= -1.6e+25) {
tmp = (-1.0 * (F * ((1.0 / F) + (x / F)))) / B;
} else if (F <= 0.0028) {
tmp = ((1.0 / sqrt(fma(x, 2.0, fma(F, F, 2.0)))) * (F / B)) - ((fma(-0.3333333333333333, (B * B), 1.0) / B) * x);
} else {
tmp = (F * (fma(-0.5, ((2.0 + (2.0 * x)) / pow(F, 3.0)), (1.0 / F)) - (x / F))) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -1.6e+25) tmp = Float64(Float64(-1.0 * Float64(F * Float64(Float64(1.0 / F) + Float64(x / F)))) / B); elseif (F <= 0.0028) tmp = Float64(Float64(Float64(1.0 / sqrt(fma(x, 2.0, fma(F, F, 2.0)))) * Float64(F / B)) - Float64(Float64(fma(-0.3333333333333333, Float64(B * B), 1.0) / B) * x)); else tmp = Float64(Float64(F * Float64(fma(-0.5, Float64(Float64(2.0 + Float64(2.0 * x)) / (F ^ 3.0)), Float64(1.0 / F)) - Float64(x / F))) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -1.6e+25], 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.0028], N[(N[(N[(1.0 / N[Sqrt[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(F / B), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(-0.3333333333333333 * N[(B * B), $MachinePrecision] + 1.0), $MachinePrecision] / B), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision], N[(N[(F * N[(N[(-0.5 * N[(N[(2.0 + N[(2.0 * x), $MachinePrecision]), $MachinePrecision] / N[Power[F, 3.0], $MachinePrecision]), $MachinePrecision] + N[(1.0 / F), $MachinePrecision]), $MachinePrecision] - N[(x / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;F \leq -1.6 \cdot 10^{+25}:\\
\;\;\;\;\frac{-1 \cdot \left(F \cdot \left(\frac{1}{F} + \frac{x}{F}\right)\right)}{B}\\
\mathbf{elif}\;F \leq 0.0028:\\
\;\;\;\;\frac{1}{\sqrt{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}} \cdot \frac{F}{B} - \frac{\mathsf{fma}\left(-0.3333333333333333, B \cdot B, 1\right)}{B} \cdot x\\
\mathbf{else}:\\
\;\;\;\;\frac{F \cdot \left(\mathsf{fma}\left(-0.5, \frac{2 + 2 \cdot x}{{F}^{3}}, \frac{1}{F}\right) - \frac{x}{F}\right)}{B}\\
\end{array}
if F < -1.6e25Initial program 76.7%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites44.1%
Taylor expanded in F around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-/.f6428.8%
Applied rewrites28.8%
if -1.6e25 < F < 0.0028Initial program 76.7%
Taylor expanded in B around 0
lower-/.f6462.4%
Applied rewrites62.4%
Taylor expanded in B around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6436.1%
Applied rewrites36.1%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6436.1%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6436.1%
lift-pow.f64N/A
unpow2N/A
lower-*.f6436.1%
Applied rewrites36.1%
Applied rewrites36.1%
if 0.0028 < F Initial program 76.7%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites44.1%
Taylor expanded in F around inf
lower-*.f64N/A
lower--.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-/.f64N/A
lower-/.f6425.4%
Applied rewrites25.4%
(FPCore (F B x)
:precision binary64
(if (<= F -1.6e+25)
(/ (* -1.0 (* F (+ (/ 1.0 F) (/ x F)))) B)
(if (<= F 1.55e+31)
(-
(* (/ 1.0 (sqrt (fma x 2.0 (fma F F 2.0)))) (/ F B))
(* (/ (fma -0.3333333333333333 (* B B) 1.0) B) x))
(/ (* F (fma -1.0 (/ x F) (/ 1.0 F))) B))))double code(double F, double B, double x) {
double tmp;
if (F <= -1.6e+25) {
tmp = (-1.0 * (F * ((1.0 / F) + (x / F)))) / B;
} else if (F <= 1.55e+31) {
tmp = ((1.0 / sqrt(fma(x, 2.0, fma(F, F, 2.0)))) * (F / B)) - ((fma(-0.3333333333333333, (B * B), 1.0) / B) * x);
} 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.6e+25) tmp = Float64(Float64(-1.0 * Float64(F * Float64(Float64(1.0 / F) + Float64(x / F)))) / B); elseif (F <= 1.55e+31) tmp = Float64(Float64(Float64(1.0 / sqrt(fma(x, 2.0, fma(F, F, 2.0)))) * Float64(F / B)) - Float64(Float64(fma(-0.3333333333333333, Float64(B * B), 1.0) / B) * x)); 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.6e+25], N[(N[(-1.0 * N[(F * N[(N[(1.0 / F), $MachinePrecision] + N[(x / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 1.55e+31], N[(N[(N[(1.0 / N[Sqrt[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(F / B), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(-0.3333333333333333 * N[(B * B), $MachinePrecision] + 1.0), $MachinePrecision] / B), $MachinePrecision] * x), $MachinePrecision]), $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.6 \cdot 10^{+25}:\\
\;\;\;\;\frac{-1 \cdot \left(F \cdot \left(\frac{1}{F} + \frac{x}{F}\right)\right)}{B}\\
\mathbf{elif}\;F \leq 1.55 \cdot 10^{+31}:\\
\;\;\;\;\frac{1}{\sqrt{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}} \cdot \frac{F}{B} - \frac{\mathsf{fma}\left(-0.3333333333333333, B \cdot B, 1\right)}{B} \cdot x\\
\mathbf{else}:\\
\;\;\;\;\frac{F \cdot \mathsf{fma}\left(-1, \frac{x}{F}, \frac{1}{F}\right)}{B}\\
\end{array}
if F < -1.6e25Initial program 76.7%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites44.1%
Taylor expanded in F around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-/.f6428.8%
Applied rewrites28.8%
if -1.6e25 < F < 1.5500000000000001e31Initial program 76.7%
Taylor expanded in B around 0
lower-/.f6462.4%
Applied rewrites62.4%
Taylor expanded in B around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6436.1%
Applied rewrites36.1%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6436.1%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6436.1%
lift-pow.f64N/A
unpow2N/A
lower-*.f6436.1%
Applied rewrites36.1%
Applied rewrites36.1%
if 1.5500000000000001e31 < F Initial program 76.7%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites44.1%
Taylor expanded in F around inf
lower-*.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f6428.1%
Applied rewrites28.1%
(FPCore (F B x)
:precision binary64
(if (<= F -0.046)
(/ (* -1.0 (* F (+ (/ 1.0 F) (/ x F)))) B)
(if (<= F 2.9e-12)
(/ (- (* 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 <= -0.046) {
tmp = (-1.0 * (F * ((1.0 / F) + (x / F)))) / B;
} else if (F <= 2.9e-12) {
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 <= -0.046) tmp = Float64(Float64(-1.0 * Float64(F * Float64(Float64(1.0 / F) + Float64(x / F)))) / B); elseif (F <= 2.9e-12) 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, -0.046], N[(N[(-1.0 * N[(F * N[(N[(1.0 / F), $MachinePrecision] + N[(x / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 2.9e-12], 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 -0.046:\\
\;\;\;\;\frac{-1 \cdot \left(F \cdot \left(\frac{1}{F} + \frac{x}{F}\right)\right)}{B}\\
\mathbf{elif}\;F \leq 2.9 \cdot 10^{-12}:\\
\;\;\;\;\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 < -0.045999999999999999Initial program 76.7%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites44.1%
Taylor expanded in F around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-/.f6428.8%
Applied rewrites28.8%
if -0.045999999999999999 < F < 2.9000000000000002e-12Initial program 76.7%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites44.1%
Taylor expanded in F around 0
lower-*.f6429.7%
Applied rewrites29.7%
if 2.9000000000000002e-12 < F Initial program 76.7%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites44.1%
Taylor expanded in F around inf
lower-*.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f6428.1%
Applied rewrites28.1%
(FPCore (F B x) :precision binary64 (if (<= F -9.5e+99) (/ (* -1.0 (* F (+ (/ 1.0 F) (/ x F)))) B) (/ (- (* (pow (fma x 2.0 (fma F F 2.0)) -0.5) F) x) B)))
double code(double F, double B, double x) {
double tmp;
if (F <= -9.5e+99) {
tmp = (-1.0 * (F * ((1.0 / F) + (x / F)))) / B;
} else {
tmp = ((pow(fma(x, 2.0, fma(F, F, 2.0)), -0.5) * F) - x) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -9.5e+99) tmp = Float64(Float64(-1.0 * Float64(F * Float64(Float64(1.0 / F) + Float64(x / F)))) / B); else tmp = Float64(Float64(Float64((fma(x, 2.0, fma(F, F, 2.0)) ^ -0.5) * F) - x) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -9.5e+99], N[(N[(-1.0 * N[(F * N[(N[(1.0 / F), $MachinePrecision] + N[(x / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision], 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]]
\begin{array}{l}
\mathbf{if}\;F \leq -9.5 \cdot 10^{+99}:\\
\;\;\;\;\frac{-1 \cdot \left(F \cdot \left(\frac{1}{F} + \frac{x}{F}\right)\right)}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{{\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5} \cdot F - x}{B}\\
\end{array}
if F < -9.4999999999999991e99Initial program 76.7%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites44.1%
Taylor expanded in F around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-/.f6428.8%
Applied rewrites28.8%
if -9.4999999999999991e99 < F Initial program 76.7%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites44.1%
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-*.f6444.1%
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6444.1%
Applied rewrites44.1%
(FPCore (F B x)
:precision binary64
(if (<= F -3.6e-32)
(/ (* -1.0 (* F (+ (/ 1.0 F) (/ x F)))) B)
(if (<= F 6.2e-36)
(/ (* -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 <= -3.6e-32) {
tmp = (-1.0 * (F * ((1.0 / F) + (x / F)))) / B;
} else if (F <= 6.2e-36) {
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 <= -3.6e-32) tmp = Float64(Float64(-1.0 * Float64(F * Float64(Float64(1.0 / F) + Float64(x / F)))) / B); elseif (F <= 6.2e-36) 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, -3.6e-32], N[(N[(-1.0 * N[(F * N[(N[(1.0 / F), $MachinePrecision] + N[(x / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 6.2e-36], 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 -3.6 \cdot 10^{-32}:\\
\;\;\;\;\frac{-1 \cdot \left(F \cdot \left(\frac{1}{F} + \frac{x}{F}\right)\right)}{B}\\
\mathbf{elif}\;F \leq 6.2 \cdot 10^{-36}:\\
\;\;\;\;\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 < -3.5999999999999999e-32Initial program 76.7%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites44.1%
Taylor expanded in F around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-/.f6428.8%
Applied rewrites28.8%
if -3.5999999999999999e-32 < F < 6.1999999999999997e-36Initial program 76.7%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites44.1%
Taylor expanded in F around 0
lower-*.f6430.1%
Applied rewrites30.1%
if 6.1999999999999997e-36 < F Initial program 76.7%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites44.1%
Taylor expanded in F around inf
lower-*.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f6428.1%
Applied rewrites28.1%
(FPCore (F B x)
:precision binary64
(if (<= F -3.9e-32)
(* -1.0 (* F (/ (+ (/ 1.0 F) (/ x F)) B)))
(if (<= F 6.2e-36)
(/ (* -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 <= -3.9e-32) {
tmp = -1.0 * (F * (((1.0 / F) + (x / F)) / B));
} else if (F <= 6.2e-36) {
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 <= -3.9e-32) tmp = Float64(-1.0 * Float64(F * Float64(Float64(Float64(1.0 / F) + Float64(x / F)) / B))); elseif (F <= 6.2e-36) 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, -3.9e-32], N[(-1.0 * N[(F * N[(N[(N[(1.0 / F), $MachinePrecision] + N[(x / F), $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 6.2e-36], 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 -3.9 \cdot 10^{-32}:\\
\;\;\;\;-1 \cdot \left(F \cdot \frac{\frac{1}{F} + \frac{x}{F}}{B}\right)\\
\mathbf{elif}\;F \leq 6.2 \cdot 10^{-36}:\\
\;\;\;\;\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 < -3.9000000000000001e-32Initial program 76.7%
Taylor expanded in F around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sin.f6450.0%
Applied rewrites50.0%
Taylor expanded in B around 0
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-/.f6427.5%
Applied rewrites27.5%
if -3.9000000000000001e-32 < F < 6.1999999999999997e-36Initial program 76.7%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites44.1%
Taylor expanded in F around 0
lower-*.f6430.1%
Applied rewrites30.1%
if 6.1999999999999997e-36 < F Initial program 76.7%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites44.1%
Taylor expanded in F around inf
lower-*.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f6428.1%
Applied rewrites28.1%
(FPCore (F B x) :precision binary64 (let* ((t_0 (/ (* -1.0 x) B))) (if (<= x -5.5e-114) t_0 (if (<= x 2.3e-41) (/ -1.0 B) t_0))))
double code(double F, double B, double x) {
double t_0 = (-1.0 * x) / B;
double tmp;
if (x <= -5.5e-114) {
tmp = t_0;
} else if (x <= 2.3e-41) {
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 <= (-5.5d-114)) then
tmp = t_0
else if (x <= 2.3d-41) 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 <= -5.5e-114) {
tmp = t_0;
} else if (x <= 2.3e-41) {
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 <= -5.5e-114: tmp = t_0 elif x <= 2.3e-41: 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 <= -5.5e-114) tmp = t_0; elseif (x <= 2.3e-41) 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 <= -5.5e-114) tmp = t_0; elseif (x <= 2.3e-41) 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, -5.5e-114], t$95$0, If[LessEqual[x, 2.3e-41], N[(-1.0 / B), $MachinePrecision], t$95$0]]]
\begin{array}{l}
t_0 := \frac{-1 \cdot x}{B}\\
\mathbf{if}\;x \leq -5.5 \cdot 10^{-114}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 2.3 \cdot 10^{-41}:\\
\;\;\;\;\frac{-1}{B}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if x < -5.5000000000000001e-114 or 2.3000000000000001e-41 < x Initial program 76.7%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites44.1%
Taylor expanded in F around 0
lower-*.f6430.1%
Applied rewrites30.1%
if -5.5000000000000001e-114 < x < 2.3000000000000001e-41Initial program 76.7%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites44.1%
Taylor expanded in F around -inf
lower-/.f6410.6%
Applied rewrites10.6%
(FPCore (F B x) :precision binary64 (if (<= F 6.2e-36) (/ (* -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 <= 6.2e-36) {
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 <= 6.2e-36) 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, 6.2e-36], 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 6.2 \cdot 10^{-36}:\\
\;\;\;\;\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 < 6.1999999999999997e-36Initial program 76.7%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites44.1%
Taylor expanded in F around 0
lower-*.f6430.1%
Applied rewrites30.1%
if 6.1999999999999997e-36 < F Initial program 76.7%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites44.1%
Taylor expanded in F around inf
lower-*.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f6428.1%
Applied rewrites28.1%
(FPCore (F B x) :precision binary64 (if (<= F 6.2e-36) (/ -1.0 B) (/ 1.0 B)))
double code(double F, double B, double x) {
double tmp;
if (F <= 6.2e-36) {
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 <= 6.2d-36) 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 <= 6.2e-36) {
tmp = -1.0 / B;
} else {
tmp = 1.0 / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= 6.2e-36: tmp = -1.0 / B else: tmp = 1.0 / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= 6.2e-36) 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 <= 6.2e-36) tmp = -1.0 / B; else tmp = 1.0 / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, 6.2e-36], N[(-1.0 / B), $MachinePrecision], N[(1.0 / B), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;F \leq 6.2 \cdot 10^{-36}:\\
\;\;\;\;\frac{-1}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{B}\\
\end{array}
if F < 6.1999999999999997e-36Initial program 76.7%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites44.1%
Taylor expanded in F around -inf
lower-/.f6410.6%
Applied rewrites10.6%
if 6.1999999999999997e-36 < F Initial program 76.7%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites44.1%
Taylor expanded in F around inf
lower-/.f649.4%
Applied rewrites9.4%
(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.7%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites44.1%
Taylor expanded in F around -inf
lower-/.f6410.6%
Applied rewrites10.6%
herbie shell --seed 2025213
(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))))))