
(FPCore (F B x) :precision binary64 (+ (- (* x (/ 1.0 (tan B)))) (* (/ F (sin B)) (pow (+ (+ (* F F) 2.0) (* 2.0 x)) (- (/ 1.0 2.0))))))
double code(double F, double B, double x) {
return -(x * (1.0 / tan(B))) + ((F / sin(B)) * pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
code = -(x * (1.0d0 / tan(b))) + ((f / sin(b)) * ((((f * f) + 2.0d0) + (2.0d0 * x)) ** -(1.0d0 / 2.0d0)))
end function
public static double code(double F, double B, double x) {
return -(x * (1.0 / Math.tan(B))) + ((F / Math.sin(B)) * Math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
}
def code(F, B, x): return -(x * (1.0 / math.tan(B))) + ((F / math.sin(B)) * math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)))
function code(F, B, x) return Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(Float64(F / sin(B)) * (Float64(Float64(Float64(F * F) + 2.0) + Float64(2.0 * x)) ^ Float64(-Float64(1.0 / 2.0))))) end
function tmp = code(F, B, x) tmp = -(x * (1.0 / tan(B))) + ((F / sin(B)) * ((((F * F) + 2.0) + (2.0 * x)) ^ -(1.0 / 2.0))); end
code[F_, B_, x_] := N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(N[(F * F), $MachinePrecision] + 2.0), $MachinePrecision] + N[(2.0 * x), $MachinePrecision]), $MachinePrecision], (-N[(1.0 / 2.0), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}
\end{array}
Herbie found 25 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (F B x) :precision binary64 (+ (- (* x (/ 1.0 (tan B)))) (* (/ F (sin B)) (pow (+ (+ (* F F) 2.0) (* 2.0 x)) (- (/ 1.0 2.0))))))
double code(double F, double B, double x) {
return -(x * (1.0 / tan(B))) + ((F / sin(B)) * pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
code = -(x * (1.0d0 / tan(b))) + ((f / sin(b)) * ((((f * f) + 2.0d0) + (2.0d0 * x)) ** -(1.0d0 / 2.0d0)))
end function
public static double code(double F, double B, double x) {
return -(x * (1.0 / Math.tan(B))) + ((F / Math.sin(B)) * Math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
}
def code(F, B, x): return -(x * (1.0 / math.tan(B))) + ((F / math.sin(B)) * math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)))
function code(F, B, x) return Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(Float64(F / sin(B)) * (Float64(Float64(Float64(F * F) + 2.0) + Float64(2.0 * x)) ^ Float64(-Float64(1.0 / 2.0))))) end
function tmp = code(F, B, x) tmp = -(x * (1.0 / tan(B))) + ((F / sin(B)) * ((((F * F) + 2.0) + (2.0 * x)) ^ -(1.0 / 2.0))); end
code[F_, B_, x_] := N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(N[(F * F), $MachinePrecision] + 2.0), $MachinePrecision] + N[(2.0 * x), $MachinePrecision]), $MachinePrecision], (-N[(1.0 / 2.0), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}
\end{array}
(FPCore (F B x)
:precision binary64
(if (<= F -3.4e+66)
(- (/ (fma (cos B) x 1.0) (sin B)))
(if (<= F 100000000.0)
(+
(- (/ (* x 1.0) (tan B)))
(* (/ F (sin B)) (pow (+ (+ (* F F) 2.0) (* 2.0 x)) (- (/ 1.0 2.0)))))
(/ (- 1.0 (* (cos B) x)) (sin B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -3.4e+66) {
tmp = -(fma(cos(B), x, 1.0) / sin(B));
} else if (F <= 100000000.0) {
tmp = -((x * 1.0) / tan(B)) + ((F / sin(B)) * pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
} else {
tmp = (1.0 - (cos(B) * x)) / sin(B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -3.4e+66) tmp = Float64(-Float64(fma(cos(B), x, 1.0) / sin(B))); elseif (F <= 100000000.0) tmp = Float64(Float64(-Float64(Float64(x * 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))))); else tmp = Float64(Float64(1.0 - Float64(cos(B) * x)) / sin(B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -3.4e+66], (-N[(N[(N[Cos[B], $MachinePrecision] * x + 1.0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), If[LessEqual[F, 100000000.0], N[((-N[(N[(x * 1.0), $MachinePrecision] / N[Tan[B], $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], N[(N[(1.0 - N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -3.4 \cdot 10^{+66}:\\
\;\;\;\;-\frac{\mathsf{fma}\left(\cos B, x, 1\right)}{\sin B}\\
\mathbf{elif}\;F \leq 100000000:\\
\;\;\;\;\left(-\frac{x \cdot 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)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - \cos B \cdot x}{\sin B}\\
\end{array}
\end{array}
if F < -3.4000000000000003e66Initial program 51.8%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6499.8
Applied rewrites99.8%
lift-+.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift-cos.f6499.8
Applied rewrites99.8%
if -3.4000000000000003e66 < F < 1e8Initial program 99.2%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6499.3
Applied rewrites99.3%
if 1e8 < F Initial program 58.6%
Taylor expanded in F around inf
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
(FPCore (F B x)
:precision binary64
(if (<= F -3.6e+57)
(- (/ (fma (cos B) x 1.0) (sin B)))
(if (<= F 130000000.0)
(+
(- (* x (/ 1.0 (tan B))))
(* (/ F (sin B)) (sqrt (/ 1.0 (fma F F 2.0)))))
(/ (- 1.0 (* (cos B) x)) (sin B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -3.6e+57) {
tmp = -(fma(cos(B), x, 1.0) / sin(B));
} else if (F <= 130000000.0) {
tmp = -(x * (1.0 / tan(B))) + ((F / sin(B)) * sqrt((1.0 / fma(F, F, 2.0))));
} else {
tmp = (1.0 - (cos(B) * x)) / sin(B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -3.6e+57) tmp = Float64(-Float64(fma(cos(B), x, 1.0) / sin(B))); elseif (F <= 130000000.0) tmp = Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(Float64(F / sin(B)) * sqrt(Float64(1.0 / fma(F, F, 2.0))))); else tmp = Float64(Float64(1.0 - Float64(cos(B) * x)) / sin(B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -3.6e+57], (-N[(N[(N[Cos[B], $MachinePrecision] * x + 1.0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), If[LessEqual[F, 130000000.0], N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -3.6 \cdot 10^{+57}:\\
\;\;\;\;-\frac{\mathsf{fma}\left(\cos B, x, 1\right)}{\sin B}\\
\mathbf{elif}\;F \leq 130000000:\\
\;\;\;\;\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot \sqrt{\frac{1}{\mathsf{fma}\left(F, F, 2\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - \cos B \cdot x}{\sin B}\\
\end{array}
\end{array}
if F < -3.6000000000000002e57Initial program 52.9%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6499.8
Applied rewrites99.8%
lift-+.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift-cos.f6499.8
Applied rewrites99.8%
if -3.6000000000000002e57 < F < 1.3e8Initial program 99.3%
Taylor expanded in x around 0
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
pow2N/A
lower-fma.f6499.3
Applied rewrites99.3%
if 1.3e8 < F Initial program 58.6%
Taylor expanded in F around inf
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
(FPCore (F B x)
:precision binary64
(if (<= F -1.35)
(- (/ (fma (cos B) x 1.0) (sin B)))
(if (<= F 0.051)
(+ (- (* x (/ 1.0 (tan B)))) (/ (* F (sqrt 0.5)) (sin B)))
(/ (- 1.0 (* (cos B) x)) (sin B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1.35) {
tmp = -(fma(cos(B), x, 1.0) / sin(B));
} else if (F <= 0.051) {
tmp = -(x * (1.0 / tan(B))) + ((F * sqrt(0.5)) / sin(B));
} else {
tmp = (1.0 - (cos(B) * x)) / sin(B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -1.35) tmp = Float64(-Float64(fma(cos(B), x, 1.0) / sin(B))); elseif (F <= 0.051) tmp = Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(Float64(F * sqrt(0.5)) / sin(B))); else tmp = Float64(Float64(1.0 - Float64(cos(B) * x)) / sin(B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -1.35], (-N[(N[(N[Cos[B], $MachinePrecision] * x + 1.0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), If[LessEqual[F, 0.051], N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(N[(F * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.35:\\
\;\;\;\;-\frac{\mathsf{fma}\left(\cos B, x, 1\right)}{\sin B}\\
\mathbf{elif}\;F \leq 0.051:\\
\;\;\;\;\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F \cdot \sqrt{0.5}}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - \cos B \cdot x}{\sin B}\\
\end{array}
\end{array}
if F < -1.3500000000000001Initial program 60.0%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6499.4
Applied rewrites99.4%
lift-+.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift-cos.f6499.4
Applied rewrites99.4%
if -1.3500000000000001 < F < 0.0509999999999999967Initial program 99.5%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-neg.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites99.5%
Taylor expanded in x around 0
+-commutativeN/A
metadata-evalN/A
metadata-evalN/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
pow2N/A
lift-fma.f6499.4
Applied rewrites99.4%
Taylor expanded in F around 0
Applied rewrites98.9%
if 0.0509999999999999967 < F Initial program 59.6%
Taylor expanded in F around inf
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6498.9
Applied rewrites98.9%
(FPCore (F B x)
:precision binary64
(if (<= F -1.4e-24)
(- (/ (fma (cos B) x 1.0) (sin B)))
(if (<= F 7e-12)
(+ (/ (- x) (tan B)) (* (/ F B) (/ 1.0 (sqrt (fma 2.0 x (fma F F 2.0))))))
(/ (- 1.0 (* (cos B) x)) (sin B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1.4e-24) {
tmp = -(fma(cos(B), x, 1.0) / sin(B));
} else if (F <= 7e-12) {
tmp = (-x / tan(B)) + ((F / B) * (1.0 / sqrt(fma(2.0, x, fma(F, F, 2.0)))));
} else {
tmp = (1.0 - (cos(B) * x)) / sin(B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -1.4e-24) tmp = Float64(-Float64(fma(cos(B), x, 1.0) / sin(B))); elseif (F <= 7e-12) tmp = Float64(Float64(Float64(-x) / tan(B)) + Float64(Float64(F / B) * Float64(1.0 / sqrt(fma(2.0, x, fma(F, F, 2.0)))))); else tmp = Float64(Float64(1.0 - Float64(cos(B) * x)) / sin(B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -1.4e-24], (-N[(N[(N[Cos[B], $MachinePrecision] * x + 1.0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), If[LessEqual[F, 7e-12], N[(N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision] + N[(N[(F / B), $MachinePrecision] * N[(1.0 / N[Sqrt[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.4 \cdot 10^{-24}:\\
\;\;\;\;-\frac{\mathsf{fma}\left(\cos B, x, 1\right)}{\sin B}\\
\mathbf{elif}\;F \leq 7 \cdot 10^{-12}:\\
\;\;\;\;\frac{-x}{\tan B} + \frac{F}{B} \cdot \frac{1}{\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - \cos B \cdot x}{\sin B}\\
\end{array}
\end{array}
if F < -1.4000000000000001e-24Initial program 62.4%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6495.7
Applied rewrites95.7%
lift-+.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift-cos.f6495.7
Applied rewrites95.7%
if -1.4000000000000001e-24 < F < 7.0000000000000001e-12Initial program 99.5%
Taylor expanded in B around 0
lower-*.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
pow2N/A
lower-fma.f64N/A
count-2-revN/A
lower-+.f6483.6
Applied rewrites83.6%
lift-neg.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
distribute-neg-fracN/A
*-rgt-identityN/A
lower-/.f64N/A
lower-neg.f64N/A
lift-tan.f6483.7
lift-sqrt.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-fma.f64N/A
Applied rewrites83.7%
if 7.0000000000000001e-12 < F Initial program 60.7%
Taylor expanded in F around inf
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6497.5
Applied rewrites97.5%
(FPCore (F B x)
:precision binary64
(if (<= F -2.7e+42)
(- (/ (+ 1.0 x) (sin B)))
(if (<= F 7e-12)
(+ (/ (- x) (tan B)) (* (/ F B) (/ 1.0 (sqrt (fma 2.0 x (fma F F 2.0))))))
(/ (- 1.0 (* (cos B) x)) (sin B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -2.7e+42) {
tmp = -((1.0 + x) / sin(B));
} else if (F <= 7e-12) {
tmp = (-x / tan(B)) + ((F / B) * (1.0 / sqrt(fma(2.0, x, fma(F, F, 2.0)))));
} else {
tmp = (1.0 - (cos(B) * x)) / sin(B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -2.7e+42) tmp = Float64(-Float64(Float64(1.0 + x) / sin(B))); elseif (F <= 7e-12) tmp = Float64(Float64(Float64(-x) / tan(B)) + Float64(Float64(F / B) * Float64(1.0 / sqrt(fma(2.0, x, fma(F, F, 2.0)))))); else tmp = Float64(Float64(1.0 - Float64(cos(B) * x)) / sin(B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -2.7e+42], (-N[(N[(1.0 + x), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), If[LessEqual[F, 7e-12], N[(N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision] + N[(N[(F / B), $MachinePrecision] * N[(1.0 / N[Sqrt[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -2.7 \cdot 10^{+42}:\\
\;\;\;\;-\frac{1 + x}{\sin B}\\
\mathbf{elif}\;F \leq 7 \cdot 10^{-12}:\\
\;\;\;\;\frac{-x}{\tan B} + \frac{F}{B} \cdot \frac{1}{\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - \cos B \cdot x}{\sin B}\\
\end{array}
\end{array}
if F < -2.7000000000000001e42Initial program 55.2%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6499.8
Applied rewrites99.8%
Taylor expanded in B around 0
Applied rewrites77.9%
if -2.7000000000000001e42 < F < 7.0000000000000001e-12Initial program 99.4%
Taylor expanded in B around 0
lower-*.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
pow2N/A
lower-fma.f64N/A
count-2-revN/A
lower-+.f6482.1
Applied rewrites82.1%
lift-neg.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
distribute-neg-fracN/A
*-rgt-identityN/A
lower-/.f64N/A
lower-neg.f64N/A
lift-tan.f6482.2
lift-sqrt.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-fma.f64N/A
Applied rewrites82.2%
if 7.0000000000000001e-12 < F Initial program 60.7%
Taylor expanded in F around inf
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6497.5
Applied rewrites97.5%
(FPCore (F B x)
:precision binary64
(if (<= F -2.7e+42)
(- (/ (+ 1.0 x) (sin B)))
(if (<= F 4.5e-31)
(+ (/ (- x) (tan B)) (* (/ F B) (/ 1.0 (sqrt (fma 2.0 x (fma F F 2.0))))))
(if (<= F 7.6e+132)
(+ (- (/ x B)) (/ (* F (sqrt (/ 1.0 (fma F F 2.0)))) (sin B)))
(- (/ (* (cos B) x) (sin B)))))))
double code(double F, double B, double x) {
double tmp;
if (F <= -2.7e+42) {
tmp = -((1.0 + x) / sin(B));
} else if (F <= 4.5e-31) {
tmp = (-x / tan(B)) + ((F / B) * (1.0 / sqrt(fma(2.0, x, fma(F, F, 2.0)))));
} else if (F <= 7.6e+132) {
tmp = -(x / B) + ((F * sqrt((1.0 / fma(F, F, 2.0)))) / sin(B));
} else {
tmp = -((cos(B) * x) / sin(B));
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -2.7e+42) tmp = Float64(-Float64(Float64(1.0 + x) / sin(B))); elseif (F <= 4.5e-31) tmp = Float64(Float64(Float64(-x) / tan(B)) + Float64(Float64(F / B) * Float64(1.0 / sqrt(fma(2.0, x, fma(F, F, 2.0)))))); elseif (F <= 7.6e+132) tmp = Float64(Float64(-Float64(x / B)) + Float64(Float64(F * sqrt(Float64(1.0 / fma(F, F, 2.0)))) / sin(B))); else tmp = Float64(-Float64(Float64(cos(B) * x) / sin(B))); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -2.7e+42], (-N[(N[(1.0 + x), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), If[LessEqual[F, 4.5e-31], N[(N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision] + N[(N[(F / B), $MachinePrecision] * N[(1.0 / N[Sqrt[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 7.6e+132], N[((-N[(x / B), $MachinePrecision]) + N[(N[(F * N[Sqrt[N[(1.0 / N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], (-N[(N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision])]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -2.7 \cdot 10^{+42}:\\
\;\;\;\;-\frac{1 + x}{\sin B}\\
\mathbf{elif}\;F \leq 4.5 \cdot 10^{-31}:\\
\;\;\;\;\frac{-x}{\tan B} + \frac{F}{B} \cdot \frac{1}{\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}\\
\mathbf{elif}\;F \leq 7.6 \cdot 10^{+132}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{F \cdot \sqrt{\frac{1}{\mathsf{fma}\left(F, F, 2\right)}}}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;-\frac{\cos B \cdot x}{\sin B}\\
\end{array}
\end{array}
if F < -2.7000000000000001e42Initial program 55.2%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6499.8
Applied rewrites99.8%
Taylor expanded in B around 0
Applied rewrites77.9%
if -2.7000000000000001e42 < F < 4.5000000000000004e-31Initial program 99.4%
Taylor expanded in B around 0
lower-*.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
pow2N/A
lower-fma.f64N/A
count-2-revN/A
lower-+.f6482.3
Applied rewrites82.3%
lift-neg.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
distribute-neg-fracN/A
*-rgt-identityN/A
lower-/.f64N/A
lower-neg.f64N/A
lift-tan.f6482.4
lift-sqrt.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-fma.f64N/A
Applied rewrites82.3%
if 4.5000000000000004e-31 < F < 7.60000000000000012e132Initial program 92.3%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-neg.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites99.5%
Taylor expanded in x around 0
+-commutativeN/A
metadata-evalN/A
metadata-evalN/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
pow2N/A
lift-fma.f6499.5
Applied rewrites99.5%
Taylor expanded in B around 0
lower-/.f6478.3
Applied rewrites78.3%
if 7.60000000000000012e132 < F Initial program 38.5%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6449.5
Applied rewrites49.5%
(FPCore (F B x)
:precision binary64
(if (<= F -2.7e+42)
(- (/ (+ 1.0 x) (sin B)))
(if (<= F 4.5e-31)
(+ (/ (- x) (tan B)) (* (/ F B) (/ 1.0 (sqrt (fma 2.0 x (fma F F 2.0))))))
(if (<= F 7.6e+132)
(+ (- (/ x B)) (/ (* F (sqrt (/ 1.0 (fma F F 2.0)))) (sin B)))
(+ (- (* x (/ 1.0 (tan B)))) (/ -1.0 B))))))
double code(double F, double B, double x) {
double tmp;
if (F <= -2.7e+42) {
tmp = -((1.0 + x) / sin(B));
} else if (F <= 4.5e-31) {
tmp = (-x / tan(B)) + ((F / B) * (1.0 / sqrt(fma(2.0, x, fma(F, F, 2.0)))));
} else if (F <= 7.6e+132) {
tmp = -(x / B) + ((F * sqrt((1.0 / fma(F, F, 2.0)))) / sin(B));
} else {
tmp = -(x * (1.0 / tan(B))) + (-1.0 / B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -2.7e+42) tmp = Float64(-Float64(Float64(1.0 + x) / sin(B))); elseif (F <= 4.5e-31) tmp = Float64(Float64(Float64(-x) / tan(B)) + Float64(Float64(F / B) * Float64(1.0 / sqrt(fma(2.0, x, fma(F, F, 2.0)))))); elseif (F <= 7.6e+132) tmp = Float64(Float64(-Float64(x / B)) + Float64(Float64(F * sqrt(Float64(1.0 / fma(F, F, 2.0)))) / sin(B))); else tmp = Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(-1.0 / B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -2.7e+42], (-N[(N[(1.0 + x), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), If[LessEqual[F, 4.5e-31], N[(N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision] + N[(N[(F / B), $MachinePrecision] * N[(1.0 / N[Sqrt[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 7.6e+132], N[((-N[(x / B), $MachinePrecision]) + N[(N[(F * N[Sqrt[N[(1.0 / N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(-1.0 / B), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -2.7 \cdot 10^{+42}:\\
\;\;\;\;-\frac{1 + x}{\sin B}\\
\mathbf{elif}\;F \leq 4.5 \cdot 10^{-31}:\\
\;\;\;\;\frac{-x}{\tan B} + \frac{F}{B} \cdot \frac{1}{\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}\\
\mathbf{elif}\;F \leq 7.6 \cdot 10^{+132}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{F \cdot \sqrt{\frac{1}{\mathsf{fma}\left(F, F, 2\right)}}}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;\left(-x \cdot \frac{1}{\tan B}\right) + \frac{-1}{B}\\
\end{array}
\end{array}
if F < -2.7000000000000001e42Initial program 55.2%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6499.8
Applied rewrites99.8%
Taylor expanded in B around 0
Applied rewrites77.9%
if -2.7000000000000001e42 < F < 4.5000000000000004e-31Initial program 99.4%
Taylor expanded in B around 0
lower-*.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
pow2N/A
lower-fma.f64N/A
count-2-revN/A
lower-+.f6482.3
Applied rewrites82.3%
lift-neg.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
distribute-neg-fracN/A
*-rgt-identityN/A
lower-/.f64N/A
lower-neg.f64N/A
lift-tan.f6482.4
lift-sqrt.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-fma.f64N/A
Applied rewrites82.3%
if 4.5000000000000004e-31 < F < 7.60000000000000012e132Initial program 92.3%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-neg.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites99.5%
Taylor expanded in x around 0
+-commutativeN/A
metadata-evalN/A
metadata-evalN/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
pow2N/A
lift-fma.f6499.5
Applied rewrites99.5%
Taylor expanded in B around 0
lower-/.f6478.3
Applied rewrites78.3%
if 7.60000000000000012e132 < F Initial program 38.5%
Taylor expanded in B around 0
lower-*.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
pow2N/A
lower-fma.f64N/A
count-2-revN/A
lower-+.f6434.9
Applied rewrites34.9%
Taylor expanded in F around -inf
lower-/.f6448.9
Applied rewrites48.9%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (- (* x (/ 1.0 (tan B))))) (t_1 (sqrt (/ 1.0 (fma F F 2.0)))))
(if (<= F -2.7e+42)
(- (/ (+ 1.0 x) (sin B)))
(if (<= F 4.5e-31)
(+ t_0 (* (/ F B) t_1))
(if (<= F 7.6e+132)
(+ (- (/ x B)) (/ (* F t_1) (sin B)))
(+ t_0 (/ -1.0 B)))))))
double code(double F, double B, double x) {
double t_0 = -(x * (1.0 / tan(B)));
double t_1 = sqrt((1.0 / fma(F, F, 2.0)));
double tmp;
if (F <= -2.7e+42) {
tmp = -((1.0 + x) / sin(B));
} else if (F <= 4.5e-31) {
tmp = t_0 + ((F / B) * t_1);
} else if (F <= 7.6e+132) {
tmp = -(x / B) + ((F * t_1) / sin(B));
} else {
tmp = t_0 + (-1.0 / B);
}
return tmp;
}
function code(F, B, x) t_0 = Float64(-Float64(x * Float64(1.0 / tan(B)))) t_1 = sqrt(Float64(1.0 / fma(F, F, 2.0))) tmp = 0.0 if (F <= -2.7e+42) tmp = Float64(-Float64(Float64(1.0 + x) / sin(B))); elseif (F <= 4.5e-31) tmp = Float64(t_0 + Float64(Float64(F / B) * t_1)); elseif (F <= 7.6e+132) tmp = Float64(Float64(-Float64(x / B)) + Float64(Float64(F * t_1) / sin(B))); else tmp = Float64(t_0 + Float64(-1.0 / B)); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = (-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision])}, Block[{t$95$1 = N[Sqrt[N[(1.0 / N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[F, -2.7e+42], (-N[(N[(1.0 + x), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), If[LessEqual[F, 4.5e-31], N[(t$95$0 + N[(N[(F / B), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 7.6e+132], N[((-N[(x / B), $MachinePrecision]) + N[(N[(F * t$95$1), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(-1.0 / B), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -x \cdot \frac{1}{\tan B}\\
t_1 := \sqrt{\frac{1}{\mathsf{fma}\left(F, F, 2\right)}}\\
\mathbf{if}\;F \leq -2.7 \cdot 10^{+42}:\\
\;\;\;\;-\frac{1 + x}{\sin B}\\
\mathbf{elif}\;F \leq 4.5 \cdot 10^{-31}:\\
\;\;\;\;t\_0 + \frac{F}{B} \cdot t\_1\\
\mathbf{elif}\;F \leq 7.6 \cdot 10^{+132}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{F \cdot t\_1}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \frac{-1}{B}\\
\end{array}
\end{array}
if F < -2.7000000000000001e42Initial program 55.2%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6499.8
Applied rewrites99.8%
Taylor expanded in B around 0
Applied rewrites77.9%
if -2.7000000000000001e42 < F < 4.5000000000000004e-31Initial program 99.4%
Taylor expanded in B around 0
lower-*.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
pow2N/A
lower-fma.f64N/A
count-2-revN/A
lower-+.f6482.3
Applied rewrites82.3%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
pow2N/A
lift-fma.f6482.2
Applied rewrites82.2%
if 4.5000000000000004e-31 < F < 7.60000000000000012e132Initial program 92.3%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-neg.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites99.5%
Taylor expanded in x around 0
+-commutativeN/A
metadata-evalN/A
metadata-evalN/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
pow2N/A
lift-fma.f6499.5
Applied rewrites99.5%
Taylor expanded in B around 0
lower-/.f6478.3
Applied rewrites78.3%
if 7.60000000000000012e132 < F Initial program 38.5%
Taylor expanded in B around 0
lower-*.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
pow2N/A
lower-fma.f64N/A
count-2-revN/A
lower-+.f6434.9
Applied rewrites34.9%
Taylor expanded in F around -inf
lower-/.f6448.9
Applied rewrites48.9%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (+ (- (* x (/ 1.0 (tan B)))) (/ -1.0 B))))
(if (<= x -4.8e-10)
t_0
(if (<= x 2.5e-10)
(+ (- (/ x B)) (/ (* F (sqrt (/ 1.0 (fma F F 2.0)))) (sin B)))
t_0))))
double code(double F, double B, double x) {
double t_0 = -(x * (1.0 / tan(B))) + (-1.0 / B);
double tmp;
if (x <= -4.8e-10) {
tmp = t_0;
} else if (x <= 2.5e-10) {
tmp = -(x / B) + ((F * sqrt((1.0 / fma(F, F, 2.0)))) / sin(B));
} else {
tmp = t_0;
}
return tmp;
}
function code(F, B, x) t_0 = Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(-1.0 / B)) tmp = 0.0 if (x <= -4.8e-10) tmp = t_0; elseif (x <= 2.5e-10) tmp = Float64(Float64(-Float64(x / B)) + Float64(Float64(F * sqrt(Float64(1.0 / fma(F, F, 2.0)))) / sin(B))); else tmp = t_0; end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(-1.0 / B), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -4.8e-10], t$95$0, If[LessEqual[x, 2.5e-10], N[((-N[(x / B), $MachinePrecision]) + N[(N[(F * N[Sqrt[N[(1.0 / N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(-x \cdot \frac{1}{\tan B}\right) + \frac{-1}{B}\\
\mathbf{if}\;x \leq -4.8 \cdot 10^{-10}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 2.5 \cdot 10^{-10}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{F \cdot \sqrt{\frac{1}{\mathsf{fma}\left(F, F, 2\right)}}}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -4.8e-10 or 2.50000000000000016e-10 < x Initial program 84.0%
Taylor expanded in B around 0
lower-*.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
pow2N/A
lower-fma.f64N/A
count-2-revN/A
lower-+.f6483.1
Applied rewrites83.1%
Taylor expanded in F around -inf
lower-/.f6495.5
Applied rewrites95.5%
if -4.8e-10 < x < 2.50000000000000016e-10Initial program 72.9%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-neg.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites75.7%
Taylor expanded in x around 0
+-commutativeN/A
metadata-evalN/A
metadata-evalN/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
pow2N/A
lift-fma.f6475.7
Applied rewrites75.7%
Taylor expanded in B around 0
lower-/.f6462.9
Applied rewrites62.9%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (+ (- (* x (/ 1.0 (tan B)))) (/ -1.0 B))))
(if (<= x -2.75e-95)
t_0
(if (<= x 2.1e-147)
(* (sqrt (/ 1.0 (fma F F 2.0))) (/ F (sin B)))
(if (<= x 1.95e-10)
(/ (- (* (sqrt (/ 1.0 (+ (fma F F (+ x x)) 2.0))) F) x) B)
t_0)))))
double code(double F, double B, double x) {
double t_0 = -(x * (1.0 / tan(B))) + (-1.0 / B);
double tmp;
if (x <= -2.75e-95) {
tmp = t_0;
} else if (x <= 2.1e-147) {
tmp = sqrt((1.0 / fma(F, F, 2.0))) * (F / sin(B));
} else if (x <= 1.95e-10) {
tmp = ((sqrt((1.0 / (fma(F, F, (x + x)) + 2.0))) * F) - x) / B;
} else {
tmp = t_0;
}
return tmp;
}
function code(F, B, x) t_0 = Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(-1.0 / B)) tmp = 0.0 if (x <= -2.75e-95) tmp = t_0; elseif (x <= 2.1e-147) tmp = Float64(sqrt(Float64(1.0 / fma(F, F, 2.0))) * Float64(F / sin(B))); elseif (x <= 1.95e-10) tmp = Float64(Float64(Float64(sqrt(Float64(1.0 / Float64(fma(F, F, Float64(x + x)) + 2.0))) * F) - x) / B); else tmp = t_0; end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(-1.0 / B), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.75e-95], t$95$0, If[LessEqual[x, 2.1e-147], N[(N[Sqrt[N[(1.0 / N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.95e-10], N[(N[(N[(N[Sqrt[N[(1.0 / N[(N[(F * F + N[(x + x), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * F), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(-x \cdot \frac{1}{\tan B}\right) + \frac{-1}{B}\\
\mathbf{if}\;x \leq -2.75 \cdot 10^{-95}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 2.1 \cdot 10^{-147}:\\
\;\;\;\;\sqrt{\frac{1}{\mathsf{fma}\left(F, F, 2\right)}} \cdot \frac{F}{\sin B}\\
\mathbf{elif}\;x \leq 1.95 \cdot 10^{-10}:\\
\;\;\;\;\frac{\sqrt{\frac{1}{\mathsf{fma}\left(F, F, x + x\right) + 2}} \cdot F - x}{B}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -2.75000000000000001e-95 or 1.95e-10 < x Initial program 81.7%
Taylor expanded in B around 0
lower-*.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
pow2N/A
lower-fma.f64N/A
count-2-revN/A
lower-+.f6478.0
Applied rewrites78.0%
Taylor expanded in F around -inf
lower-/.f6484.4
Applied rewrites84.4%
if -2.75000000000000001e-95 < x < 2.1e-147Initial program 73.2%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
pow2N/A
lower-fma.f64N/A
lift-sin.f64N/A
lift-/.f6457.1
Applied rewrites57.1%
if 2.1e-147 < x < 1.95e-10Initial program 73.1%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites35.9%
(FPCore (F B x)
:precision binary64
(if (<= F -1.4e-24)
(- (/ (+ 1.0 x) (sin B)))
(if (<= F 7.4e-66)
(+
(/ (- (* 0.3333333333333333 (* (* B B) x)) x) B)
(* (/ F B) (sqrt (/ 1.0 (+ (fma F F (+ x x)) 2.0)))))
(if (<= F 1.3e+151)
(* (sqrt (/ 1.0 (fma F F 2.0))) (/ F (sin B)))
(/ (- 1.0 x) B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1.4e-24) {
tmp = -((1.0 + x) / sin(B));
} else if (F <= 7.4e-66) {
tmp = (((0.3333333333333333 * ((B * B) * x)) - x) / B) + ((F / B) * sqrt((1.0 / (fma(F, F, (x + x)) + 2.0))));
} else if (F <= 1.3e+151) {
tmp = sqrt((1.0 / fma(F, F, 2.0))) * (F / sin(B));
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -1.4e-24) tmp = Float64(-Float64(Float64(1.0 + x) / sin(B))); elseif (F <= 7.4e-66) tmp = Float64(Float64(Float64(Float64(0.3333333333333333 * Float64(Float64(B * B) * x)) - x) / B) + Float64(Float64(F / B) * sqrt(Float64(1.0 / Float64(fma(F, F, Float64(x + x)) + 2.0))))); elseif (F <= 1.3e+151) tmp = Float64(sqrt(Float64(1.0 / fma(F, F, 2.0))) * Float64(F / sin(B))); else tmp = Float64(Float64(1.0 - x) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -1.4e-24], (-N[(N[(1.0 + x), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), If[LessEqual[F, 7.4e-66], N[(N[(N[(N[(0.3333333333333333 * N[(N[(B * B), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision] + N[(N[(F / B), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(N[(F * F + N[(x + x), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.3e+151], N[(N[Sqrt[N[(1.0 / N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.4 \cdot 10^{-24}:\\
\;\;\;\;-\frac{1 + x}{\sin B}\\
\mathbf{elif}\;F \leq 7.4 \cdot 10^{-66}:\\
\;\;\;\;\frac{0.3333333333333333 \cdot \left(\left(B \cdot B\right) \cdot x\right) - x}{B} + \frac{F}{B} \cdot \sqrt{\frac{1}{\mathsf{fma}\left(F, F, x + x\right) + 2}}\\
\mathbf{elif}\;F \leq 1.3 \cdot 10^{+151}:\\
\;\;\;\;\sqrt{\frac{1}{\mathsf{fma}\left(F, F, 2\right)}} \cdot \frac{F}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < -1.4000000000000001e-24Initial program 62.4%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6495.7
Applied rewrites95.7%
Taylor expanded in B around 0
Applied rewrites74.8%
if -1.4000000000000001e-24 < F < 7.4000000000000004e-66Initial program 99.5%
Taylor expanded in B around 0
lower-*.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
pow2N/A
lower-fma.f64N/A
count-2-revN/A
lower-+.f6484.5
Applied rewrites84.5%
Taylor expanded in B around 0
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6450.0
Applied rewrites50.0%
if 7.4000000000000004e-66 < F < 1.30000000000000007e151Initial program 92.8%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
pow2N/A
lower-fma.f64N/A
lift-sin.f64N/A
lift-/.f6454.3
Applied rewrites54.3%
if 1.30000000000000007e151 < F Initial program 33.2%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites26.7%
Taylor expanded in F around inf
Applied rewrites50.0%
(FPCore (F B x)
:precision binary64
(if (<= F -1.4e-24)
(- (/ (+ 1.0 x) (sin B)))
(if (<= F 106000000.0)
(+
(/ (- (* 0.3333333333333333 (* (* B B) x)) x) B)
(* (/ F B) (sqrt (/ 1.0 (+ (fma F F (+ x x)) 2.0)))))
(/ (- 1.0 x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1.4e-24) {
tmp = -((1.0 + x) / sin(B));
} else if (F <= 106000000.0) {
tmp = (((0.3333333333333333 * ((B * B) * x)) - x) / B) + ((F / B) * sqrt((1.0 / (fma(F, F, (x + x)) + 2.0))));
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -1.4e-24) tmp = Float64(-Float64(Float64(1.0 + x) / sin(B))); elseif (F <= 106000000.0) tmp = Float64(Float64(Float64(Float64(0.3333333333333333 * Float64(Float64(B * B) * x)) - x) / B) + Float64(Float64(F / B) * sqrt(Float64(1.0 / Float64(fma(F, F, Float64(x + x)) + 2.0))))); else tmp = Float64(Float64(1.0 - x) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -1.4e-24], (-N[(N[(1.0 + x), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), If[LessEqual[F, 106000000.0], N[(N[(N[(N[(0.3333333333333333 * N[(N[(B * B), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision] + N[(N[(F / B), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(N[(F * F + N[(x + x), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.4 \cdot 10^{-24}:\\
\;\;\;\;-\frac{1 + x}{\sin B}\\
\mathbf{elif}\;F \leq 106000000:\\
\;\;\;\;\frac{0.3333333333333333 \cdot \left(\left(B \cdot B\right) \cdot x\right) - x}{B} + \frac{F}{B} \cdot \sqrt{\frac{1}{\mathsf{fma}\left(F, F, x + x\right) + 2}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < -1.4000000000000001e-24Initial program 62.4%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6495.7
Applied rewrites95.7%
Taylor expanded in B around 0
Applied rewrites74.8%
if -1.4000000000000001e-24 < F < 1.06e8Initial program 99.5%
Taylor expanded in B around 0
lower-*.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
pow2N/A
lower-fma.f64N/A
count-2-revN/A
lower-+.f6483.2
Applied rewrites83.2%
Taylor expanded in B around 0
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6450.4
Applied rewrites50.4%
if 1.06e8 < F Initial program 58.6%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites36.1%
Taylor expanded in F around inf
Applied rewrites49.0%
(FPCore (F B x)
:precision binary64
(if (<= F -1.4e-24)
(- (/ (+ 1.0 x) (sin B)))
(if (<= F 0.051)
(/ (- (* (sqrt (/ 1.0 (fma 2.0 x 2.0))) F) x) B)
(/ (- (- 1.0 (/ 1.0 (* F F))) x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1.4e-24) {
tmp = -((1.0 + x) / sin(B));
} else if (F <= 0.051) {
tmp = ((sqrt((1.0 / fma(2.0, x, 2.0))) * F) - x) / B;
} else {
tmp = ((1.0 - (1.0 / (F * F))) - x) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -1.4e-24) tmp = Float64(-Float64(Float64(1.0 + x) / sin(B))); elseif (F <= 0.051) tmp = Float64(Float64(Float64(sqrt(Float64(1.0 / fma(2.0, x, 2.0))) * F) - x) / B); else tmp = Float64(Float64(Float64(1.0 - Float64(1.0 / Float64(F * F))) - x) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -1.4e-24], (-N[(N[(1.0 + x), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), If[LessEqual[F, 0.051], N[(N[(N[(N[Sqrt[N[(1.0 / N[(2.0 * x + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * F), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(N[(1.0 - N[(1.0 / N[(F * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.4 \cdot 10^{-24}:\\
\;\;\;\;-\frac{1 + x}{\sin B}\\
\mathbf{elif}\;F \leq 0.051:\\
\;\;\;\;\frac{\sqrt{\frac{1}{\mathsf{fma}\left(2, x, 2\right)}} \cdot F - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 - \frac{1}{F \cdot F}\right) - x}{B}\\
\end{array}
\end{array}
if F < -1.4000000000000001e-24Initial program 62.4%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6495.7
Applied rewrites95.7%
Taylor expanded in B around 0
Applied rewrites74.8%
if -1.4000000000000001e-24 < F < 0.0509999999999999967Initial program 99.5%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites50.6%
Taylor expanded in F around 0
lower-/.f64N/A
+-commutativeN/A
lower-fma.f6450.4
Applied rewrites50.4%
if 0.0509999999999999967 < F Initial program 59.6%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites36.6%
Taylor expanded in F around inf
+-commutativeN/A
div-addN/A
metadata-evalN/A
associate-*r/N/A
associate-*r/N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
associate-*r/N/A
metadata-evalN/A
associate-*r/N/A
div-addN/A
lower-/.f64N/A
+-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6448.6
Applied rewrites48.6%
Taylor expanded in x around 0
lower--.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6448.7
Applied rewrites48.7%
(FPCore (F B x) :precision binary64 (if (<= B 0.046) (/ (- (* (sqrt (/ 1.0 (+ (fma F F (+ x x)) 2.0))) F) x) B) (/ -1.0 (sin B))))
double code(double F, double B, double x) {
double tmp;
if (B <= 0.046) {
tmp = ((sqrt((1.0 / (fma(F, F, (x + x)) + 2.0))) * F) - x) / B;
} else {
tmp = -1.0 / sin(B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (B <= 0.046) tmp = Float64(Float64(Float64(sqrt(Float64(1.0 / Float64(fma(F, F, Float64(x + x)) + 2.0))) * F) - x) / B); else tmp = Float64(-1.0 / sin(B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[B, 0.046], N[(N[(N[(N[Sqrt[N[(1.0 / N[(N[(F * F + N[(x + x), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * F), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq 0.046:\\
\;\;\;\;\frac{\sqrt{\frac{1}{\mathsf{fma}\left(F, F, x + x\right) + 2}} \cdot F - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{-1}{\sin B}\\
\end{array}
\end{array}
if B < 0.045999999999999999Initial program 75.0%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites56.8%
if 0.045999999999999999 < B Initial program 84.5%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6454.0
Applied rewrites54.0%
Taylor expanded in x around 0
lower-/.f64N/A
lift-sin.f6417.6
Applied rewrites17.6%
(FPCore (F B x)
:precision binary64
(if (<= F -1.8e+149)
(/
(-
(-
(*
(* B B)
(- (* -0.16666666666666666 x) (fma -0.5 x 0.16666666666666666)))
1.0)
x)
B)
(if (<= F 0.051)
(/ (- (* (/ 1.0 (sqrt (fma 2.0 x (fma F F 2.0)))) F) x) B)
(/ (- (- 1.0 (/ 1.0 (* F F))) x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1.8e+149) {
tmp = ((((B * B) * ((-0.16666666666666666 * x) - fma(-0.5, x, 0.16666666666666666))) - 1.0) - x) / B;
} else if (F <= 0.051) {
tmp = (((1.0 / sqrt(fma(2.0, x, fma(F, F, 2.0)))) * F) - x) / B;
} else {
tmp = ((1.0 - (1.0 / (F * F))) - x) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -1.8e+149) tmp = Float64(Float64(Float64(Float64(Float64(B * B) * Float64(Float64(-0.16666666666666666 * x) - fma(-0.5, x, 0.16666666666666666))) - 1.0) - x) / B); elseif (F <= 0.051) tmp = Float64(Float64(Float64(Float64(1.0 / sqrt(fma(2.0, x, fma(F, F, 2.0)))) * F) - x) / B); else tmp = Float64(Float64(Float64(1.0 - Float64(1.0 / Float64(F * F))) - x) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -1.8e+149], N[(N[(N[(N[(N[(B * B), $MachinePrecision] * N[(N[(-0.16666666666666666 * x), $MachinePrecision] - N[(-0.5 * x + 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 0.051], N[(N[(N[(N[(1.0 / N[Sqrt[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * F), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(N[(1.0 - N[(1.0 / N[(F * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.8 \cdot 10^{+149}:\\
\;\;\;\;\frac{\left(\left(B \cdot B\right) \cdot \left(-0.16666666666666666 \cdot x - \mathsf{fma}\left(-0.5, x, 0.16666666666666666\right)\right) - 1\right) - x}{B}\\
\mathbf{elif}\;F \leq 0.051:\\
\;\;\;\;\frac{\frac{1}{\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}} \cdot F - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 - \frac{1}{F \cdot F}\right) - x}{B}\\
\end{array}
\end{array}
if F < -1.79999999999999997e149Initial program 32.2%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6499.8
Applied rewrites99.8%
Taylor expanded in B around 0
lower-/.f64N/A
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6451.9
Applied rewrites51.9%
if -1.79999999999999997e149 < F < 0.0509999999999999967Initial program 97.8%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites50.3%
Applied rewrites50.3%
if 0.0509999999999999967 < F Initial program 59.6%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites36.6%
Taylor expanded in F around inf
+-commutativeN/A
div-addN/A
metadata-evalN/A
associate-*r/N/A
associate-*r/N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
associate-*r/N/A
metadata-evalN/A
associate-*r/N/A
div-addN/A
lower-/.f64N/A
+-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6448.6
Applied rewrites48.6%
Taylor expanded in x around 0
lower--.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6448.7
Applied rewrites48.7%
(FPCore (F B x)
:precision binary64
(if (<= F -2.5e+149)
(- (/ (+ 1.0 (+ x (* -0.5 (* (* B B) x)))) B))
(if (<= F 0.051)
(/ (- (* (/ 1.0 (sqrt (fma 2.0 x (fma F F 2.0)))) F) x) B)
(/ (- (- 1.0 (/ 1.0 (* F F))) x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -2.5e+149) {
tmp = -((1.0 + (x + (-0.5 * ((B * B) * x)))) / B);
} else if (F <= 0.051) {
tmp = (((1.0 / sqrt(fma(2.0, x, fma(F, F, 2.0)))) * F) - x) / B;
} else {
tmp = ((1.0 - (1.0 / (F * F))) - x) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -2.5e+149) tmp = Float64(-Float64(Float64(1.0 + Float64(x + Float64(-0.5 * Float64(Float64(B * B) * x)))) / B)); elseif (F <= 0.051) tmp = Float64(Float64(Float64(Float64(1.0 / sqrt(fma(2.0, x, fma(F, F, 2.0)))) * F) - x) / B); else tmp = Float64(Float64(Float64(1.0 - Float64(1.0 / Float64(F * F))) - x) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -2.5e+149], (-N[(N[(1.0 + N[(x + N[(-0.5 * N[(N[(B * B), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision]), If[LessEqual[F, 0.051], N[(N[(N[(N[(1.0 / N[Sqrt[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * F), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(N[(1.0 - N[(1.0 / N[(F * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -2.5 \cdot 10^{+149}:\\
\;\;\;\;-\frac{1 + \left(x + -0.5 \cdot \left(\left(B \cdot B\right) \cdot x\right)\right)}{B}\\
\mathbf{elif}\;F \leq 0.051:\\
\;\;\;\;\frac{\frac{1}{\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}} \cdot F - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 - \frac{1}{F \cdot F}\right) - x}{B}\\
\end{array}
\end{array}
if F < -2.49999999999999995e149Initial program 32.1%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6499.8
Applied rewrites99.8%
Taylor expanded in B around 0
Applied rewrites51.9%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-+.f64N/A
lower-*.f64N/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6451.7
Applied rewrites51.7%
if -2.49999999999999995e149 < F < 0.0509999999999999967Initial program 97.8%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites50.3%
Applied rewrites50.3%
if 0.0509999999999999967 < F Initial program 59.6%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites36.6%
Taylor expanded in F around inf
+-commutativeN/A
div-addN/A
metadata-evalN/A
associate-*r/N/A
associate-*r/N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
associate-*r/N/A
metadata-evalN/A
associate-*r/N/A
div-addN/A
lower-/.f64N/A
+-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6448.6
Applied rewrites48.6%
Taylor expanded in x around 0
lower--.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6448.7
Applied rewrites48.7%
(FPCore (F B x)
:precision binary64
(if (<= F -1.3e-6)
(/ (- (- (* 0.5 (/ (fma 2.0 x 2.0) (* F F))) 1.0) x) B)
(if (<= F 0.051)
(/ (- (* (sqrt (/ 1.0 (fma 2.0 x 2.0))) F) x) B)
(/ (- (- 1.0 (/ 1.0 (* F F))) x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1.3e-6) {
tmp = (((0.5 * (fma(2.0, x, 2.0) / (F * F))) - 1.0) - x) / B;
} else if (F <= 0.051) {
tmp = ((sqrt((1.0 / fma(2.0, x, 2.0))) * F) - x) / B;
} else {
tmp = ((1.0 - (1.0 / (F * F))) - x) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -1.3e-6) tmp = Float64(Float64(Float64(Float64(0.5 * Float64(fma(2.0, x, 2.0) / Float64(F * F))) - 1.0) - x) / B); elseif (F <= 0.051) tmp = Float64(Float64(Float64(sqrt(Float64(1.0 / fma(2.0, x, 2.0))) * F) - x) / B); else tmp = Float64(Float64(Float64(1.0 - Float64(1.0 / Float64(F * F))) - x) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -1.3e-6], N[(N[(N[(N[(0.5 * N[(N[(2.0 * x + 2.0), $MachinePrecision] / N[(F * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 0.051], N[(N[(N[(N[Sqrt[N[(1.0 / N[(2.0 * x + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * F), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(N[(1.0 - N[(1.0 / N[(F * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.3 \cdot 10^{-6}:\\
\;\;\;\;\frac{\left(0.5 \cdot \frac{\mathsf{fma}\left(2, x, 2\right)}{F \cdot F} - 1\right) - x}{B}\\
\mathbf{elif}\;F \leq 0.051:\\
\;\;\;\;\frac{\sqrt{\frac{1}{\mathsf{fma}\left(2, x, 2\right)}} \cdot F - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 - \frac{1}{F \cdot F}\right) - x}{B}\\
\end{array}
\end{array}
if F < -1.30000000000000005e-6Initial program 60.6%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites37.6%
Taylor expanded in F around -inf
metadata-evalN/A
lower--.f64N/A
Applied rewrites49.8%
if -1.30000000000000005e-6 < F < 0.0509999999999999967Initial program 99.5%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites50.6%
Taylor expanded in F around 0
lower-/.f64N/A
+-commutativeN/A
lower-fma.f6450.4
Applied rewrites50.4%
if 0.0509999999999999967 < F Initial program 59.6%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites36.6%
Taylor expanded in F around inf
+-commutativeN/A
div-addN/A
metadata-evalN/A
associate-*r/N/A
associate-*r/N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
associate-*r/N/A
metadata-evalN/A
associate-*r/N/A
div-addN/A
lower-/.f64N/A
+-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6448.6
Applied rewrites48.6%
Taylor expanded in x around 0
lower--.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6448.7
Applied rewrites48.7%
(FPCore (F B x)
:precision binary64
(if (<= F -1.4e-24)
(/ (- -1.0 x) B)
(if (<= F 0.051)
(/ (- (* (sqrt (/ 1.0 (fma 2.0 x 2.0))) F) x) B)
(/ (- (- 1.0 (/ 1.0 (* F F))) x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1.4e-24) {
tmp = (-1.0 - x) / B;
} else if (F <= 0.051) {
tmp = ((sqrt((1.0 / fma(2.0, x, 2.0))) * F) - x) / B;
} else {
tmp = ((1.0 - (1.0 / (F * F))) - x) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -1.4e-24) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 0.051) tmp = Float64(Float64(Float64(sqrt(Float64(1.0 / fma(2.0, x, 2.0))) * F) - x) / B); else tmp = Float64(Float64(Float64(1.0 - Float64(1.0 / Float64(F * F))) - x) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -1.4e-24], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 0.051], N[(N[(N[(N[Sqrt[N[(1.0 / N[(2.0 * x + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * F), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(N[(1.0 - N[(1.0 / N[(F * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.4 \cdot 10^{-24}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 0.051:\\
\;\;\;\;\frac{\sqrt{\frac{1}{\mathsf{fma}\left(2, x, 2\right)}} \cdot F - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 - \frac{1}{F \cdot F}\right) - x}{B}\\
\end{array}
\end{array}
if F < -1.4000000000000001e-24Initial program 62.4%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites38.2%
Taylor expanded in F around -inf
Applied rewrites48.8%
if -1.4000000000000001e-24 < F < 0.0509999999999999967Initial program 99.5%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites50.6%
Taylor expanded in F around 0
lower-/.f64N/A
+-commutativeN/A
lower-fma.f6450.4
Applied rewrites50.4%
if 0.0509999999999999967 < F Initial program 59.6%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites36.6%
Taylor expanded in F around inf
+-commutativeN/A
div-addN/A
metadata-evalN/A
associate-*r/N/A
associate-*r/N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
associate-*r/N/A
metadata-evalN/A
associate-*r/N/A
div-addN/A
lower-/.f64N/A
+-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6448.6
Applied rewrites48.6%
Taylor expanded in x around 0
lower--.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6448.7
Applied rewrites48.7%
(FPCore (F B x)
:precision binary64
(if (<= F -1.4e-24)
(/ (- -1.0 x) B)
(if (<= F 0.051)
(fma (/ F B) (sqrt 0.5) (/ (- x) B))
(/ (- (- 1.0 (/ 1.0 (* F F))) x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1.4e-24) {
tmp = (-1.0 - x) / B;
} else if (F <= 0.051) {
tmp = fma((F / B), sqrt(0.5), (-x / B));
} else {
tmp = ((1.0 - (1.0 / (F * F))) - x) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -1.4e-24) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 0.051) tmp = fma(Float64(F / B), sqrt(0.5), Float64(Float64(-x) / B)); else tmp = Float64(Float64(Float64(1.0 - Float64(1.0 / Float64(F * F))) - x) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -1.4e-24], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 0.051], N[(N[(F / B), $MachinePrecision] * N[Sqrt[0.5], $MachinePrecision] + N[((-x) / B), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 - N[(1.0 / N[(F * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.4 \cdot 10^{-24}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 0.051:\\
\;\;\;\;\mathsf{fma}\left(\frac{F}{B}, \sqrt{0.5}, \frac{-x}{B}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 - \frac{1}{F \cdot F}\right) - x}{B}\\
\end{array}
\end{array}
if F < -1.4000000000000001e-24Initial program 62.4%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites38.2%
Taylor expanded in F around -inf
Applied rewrites48.8%
if -1.4000000000000001e-24 < F < 0.0509999999999999967Initial program 99.5%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites50.6%
Taylor expanded in F around 0
+-commutativeN/A
lower-fma.f64N/A
lift-/.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-fma.f64N/A
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lower-neg.f6450.4
Applied rewrites50.4%
Taylor expanded in x around 0
Applied rewrites50.4%
if 0.0509999999999999967 < F Initial program 59.6%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites36.6%
Taylor expanded in F around inf
+-commutativeN/A
div-addN/A
metadata-evalN/A
associate-*r/N/A
associate-*r/N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
associate-*r/N/A
metadata-evalN/A
associate-*r/N/A
div-addN/A
lower-/.f64N/A
+-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6448.6
Applied rewrites48.6%
Taylor expanded in x around 0
lower--.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6448.7
Applied rewrites48.7%
(FPCore (F B x) :precision binary64 (if (<= F -1.4e-24) (/ (- -1.0 x) B) (if (<= F 7e-12) (fma (/ F B) (sqrt 0.5) (/ (- x) B)) (/ (- 1.0 x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1.4e-24) {
tmp = (-1.0 - x) / B;
} else if (F <= 7e-12) {
tmp = fma((F / B), sqrt(0.5), (-x / B));
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -1.4e-24) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 7e-12) tmp = fma(Float64(F / B), sqrt(0.5), Float64(Float64(-x) / B)); else tmp = Float64(Float64(1.0 - x) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -1.4e-24], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 7e-12], N[(N[(F / B), $MachinePrecision] * N[Sqrt[0.5], $MachinePrecision] + N[((-x) / B), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.4 \cdot 10^{-24}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 7 \cdot 10^{-12}:\\
\;\;\;\;\mathsf{fma}\left(\frac{F}{B}, \sqrt{0.5}, \frac{-x}{B}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < -1.4000000000000001e-24Initial program 62.4%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites38.2%
Taylor expanded in F around -inf
Applied rewrites48.8%
if -1.4000000000000001e-24 < F < 7.0000000000000001e-12Initial program 99.5%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites50.6%
Taylor expanded in F around 0
+-commutativeN/A
lower-fma.f64N/A
lift-/.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-fma.f64N/A
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lower-neg.f6450.6
Applied rewrites50.6%
Taylor expanded in x around 0
Applied rewrites50.6%
if 7.0000000000000001e-12 < F Initial program 60.7%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites36.9%
Taylor expanded in F around inf
Applied rewrites47.7%
(FPCore (F B x)
:precision binary64
(if (<= F -2.7e-50)
(/ (- -1.0 x) B)
(if (<= F 2.9e-117)
(/ (- x) B)
(if (<= F 7e-12) (/ (* F (sqrt 0.5)) B) (/ (- 1.0 x) B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -2.7e-50) {
tmp = (-1.0 - x) / B;
} else if (F <= 2.9e-117) {
tmp = -x / B;
} else if (F <= 7e-12) {
tmp = (F * sqrt(0.5)) / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: tmp
if (f <= (-2.7d-50)) then
tmp = ((-1.0d0) - x) / b
else if (f <= 2.9d-117) then
tmp = -x / b
else if (f <= 7d-12) then
tmp = (f * sqrt(0.5d0)) / b
else
tmp = (1.0d0 - x) / b
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -2.7e-50) {
tmp = (-1.0 - x) / B;
} else if (F <= 2.9e-117) {
tmp = -x / B;
} else if (F <= 7e-12) {
tmp = (F * Math.sqrt(0.5)) / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -2.7e-50: tmp = (-1.0 - x) / B elif F <= 2.9e-117: tmp = -x / B elif F <= 7e-12: tmp = (F * math.sqrt(0.5)) / B else: tmp = (1.0 - x) / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= -2.7e-50) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 2.9e-117) tmp = Float64(Float64(-x) / B); elseif (F <= 7e-12) tmp = Float64(Float64(F * sqrt(0.5)) / B); else tmp = Float64(Float64(1.0 - x) / B); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -2.7e-50) tmp = (-1.0 - x) / B; elseif (F <= 2.9e-117) tmp = -x / B; elseif (F <= 7e-12) tmp = (F * sqrt(0.5)) / B; else tmp = (1.0 - x) / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -2.7e-50], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 2.9e-117], N[((-x) / B), $MachinePrecision], If[LessEqual[F, 7e-12], N[(N[(F * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -2.7 \cdot 10^{-50}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 2.9 \cdot 10^{-117}:\\
\;\;\;\;\frac{-x}{B}\\
\mathbf{elif}\;F \leq 7 \cdot 10^{-12}:\\
\;\;\;\;\frac{F \cdot \sqrt{0.5}}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < -2.7e-50Initial program 64.5%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites38.7%
Taylor expanded in F around -inf
Applied rewrites47.3%
if -2.7e-50 < F < 2.9000000000000001e-117Initial program 99.5%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites50.4%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f6437.8
Applied rewrites37.8%
if 2.9000000000000001e-117 < F < 7.0000000000000001e-12Initial program 99.4%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites52.0%
Taylor expanded in F around 0
+-commutativeN/A
lower-fma.f64N/A
lift-/.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-fma.f64N/A
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lower-neg.f6452.0
Applied rewrites52.0%
Taylor expanded in x around 0
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
sqrt-unprodN/A
sqrt-unprodN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
metadata-eval28.2
Applied rewrites28.2%
if 7.0000000000000001e-12 < F Initial program 60.7%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites36.9%
Taylor expanded in F around inf
Applied rewrites47.7%
(FPCore (F B x) :precision binary64 (if (<= F -2.7e-50) (/ (- -1.0 x) B) (if (<= F 2.95e-114) (/ (- x) B) (/ (- 1.0 x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -2.7e-50) {
tmp = (-1.0 - x) / B;
} else if (F <= 2.95e-114) {
tmp = -x / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: tmp
if (f <= (-2.7d-50)) then
tmp = ((-1.0d0) - x) / b
else if (f <= 2.95d-114) then
tmp = -x / b
else
tmp = (1.0d0 - x) / b
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -2.7e-50) {
tmp = (-1.0 - x) / B;
} else if (F <= 2.95e-114) {
tmp = -x / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -2.7e-50: tmp = (-1.0 - x) / B elif F <= 2.95e-114: tmp = -x / B else: tmp = (1.0 - x) / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= -2.7e-50) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 2.95e-114) tmp = Float64(Float64(-x) / B); else tmp = Float64(Float64(1.0 - x) / B); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -2.7e-50) tmp = (-1.0 - x) / B; elseif (F <= 2.95e-114) tmp = -x / B; else tmp = (1.0 - x) / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -2.7e-50], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 2.95e-114], N[((-x) / B), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -2.7 \cdot 10^{-50}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 2.95 \cdot 10^{-114}:\\
\;\;\;\;\frac{-x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < -2.7e-50Initial program 64.5%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites38.7%
Taylor expanded in F around -inf
Applied rewrites47.3%
if -2.7e-50 < F < 2.9500000000000001e-114Initial program 99.5%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites50.4%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f6437.7
Applied rewrites37.7%
if 2.9500000000000001e-114 < F Initial program 68.5%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites40.0%
Taylor expanded in F around inf
Applied rewrites42.3%
(FPCore (F B x) :precision binary64 (if (<= F -2.7e-50) (/ (- -1.0 x) B) (/ (- x) B)))
double code(double F, double B, double x) {
double tmp;
if (F <= -2.7e-50) {
tmp = (-1.0 - x) / B;
} else {
tmp = -x / B;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: tmp
if (f <= (-2.7d-50)) then
tmp = ((-1.0d0) - x) / b
else
tmp = -x / b
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -2.7e-50) {
tmp = (-1.0 - x) / B;
} else {
tmp = -x / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -2.7e-50: tmp = (-1.0 - x) / B else: tmp = -x / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= -2.7e-50) tmp = Float64(Float64(-1.0 - x) / B); else tmp = Float64(Float64(-x) / B); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -2.7e-50) tmp = (-1.0 - x) / B; else tmp = -x / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -2.7e-50], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], N[((-x) / B), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -2.7 \cdot 10^{-50}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{-x}{B}\\
\end{array}
\end{array}
if F < -2.7e-50Initial program 64.5%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites38.7%
Taylor expanded in F around -inf
Applied rewrites47.3%
if -2.7e-50 < F Initial program 83.2%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites44.9%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f6430.5
Applied rewrites30.5%
(FPCore (F B x) :precision binary64 (let* ((t_0 (/ (- x) B))) (if (<= x -5.4e-12) t_0 (if (<= x 6.2e-138) (- (/ 1.0 B)) t_0))))
double code(double F, double B, double x) {
double t_0 = -x / B;
double tmp;
if (x <= -5.4e-12) {
tmp = t_0;
} else if (x <= 6.2e-138) {
tmp = -(1.0 / B);
} else {
tmp = t_0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: tmp
t_0 = -x / b
if (x <= (-5.4d-12)) then
tmp = t_0
else if (x <= 6.2d-138) then
tmp = -(1.0d0 / b)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double t_0 = -x / B;
double tmp;
if (x <= -5.4e-12) {
tmp = t_0;
} else if (x <= 6.2e-138) {
tmp = -(1.0 / B);
} else {
tmp = t_0;
}
return tmp;
}
def code(F, B, x): t_0 = -x / B tmp = 0 if x <= -5.4e-12: tmp = t_0 elif x <= 6.2e-138: tmp = -(1.0 / B) else: tmp = t_0 return tmp
function code(F, B, x) t_0 = Float64(Float64(-x) / B) tmp = 0.0 if (x <= -5.4e-12) tmp = t_0; elseif (x <= 6.2e-138) tmp = Float64(-Float64(1.0 / B)); else tmp = t_0; end return tmp end
function tmp_2 = code(F, B, x) t_0 = -x / B; tmp = 0.0; if (x <= -5.4e-12) tmp = t_0; elseif (x <= 6.2e-138) tmp = -(1.0 / B); else tmp = t_0; end tmp_2 = tmp; end
code[F_, B_, x_] := Block[{t$95$0 = N[((-x) / B), $MachinePrecision]}, If[LessEqual[x, -5.4e-12], t$95$0, If[LessEqual[x, 6.2e-138], (-N[(1.0 / B), $MachinePrecision]), t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-x}{B}\\
\mathbf{if}\;x \leq -5.4 \cdot 10^{-12}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 6.2 \cdot 10^{-138}:\\
\;\;\;\;-\frac{1}{B}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -5.39999999999999961e-12 or 6.1999999999999996e-138 < x Initial program 81.4%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites46.4%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f6441.9
Applied rewrites41.9%
if -5.39999999999999961e-12 < x < 6.1999999999999996e-138Initial program 73.0%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6426.3
Applied rewrites26.3%
Taylor expanded in B around 0
Applied rewrites14.7%
Taylor expanded in x around 0
Applied rewrites14.7%
(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(-Float64(1.0 / B)) end
function tmp = code(F, B, x) tmp = -(1.0 / B); end
code[F_, B_, x_] := (-N[(1.0 / B), $MachinePrecision])
\begin{array}{l}
\\
-\frac{1}{B}
\end{array}
Initial program 77.5%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6454.9
Applied rewrites54.9%
Taylor expanded in B around 0
Applied rewrites28.7%
Taylor expanded in x around 0
Applied rewrites10.4%
herbie shell --seed 2025113
(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))))))