
(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 18 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
(let* ((t_0 (* (cos B) x)))
(if (<= F -1.05e+129)
(- (/ (+ 1.0 t_0) (sin B)))
(if (<= F 5e+14)
(+
(- (/ (* x 1.0) (tan B)))
(* (/ F (sin B)) (pow (+ (+ (* F F) 2.0) (* 2.0 x)) (- (/ 1.0 2.0)))))
(/ (- 1.0 t_0) (sin B))))))
double code(double F, double B, double x) {
double t_0 = cos(B) * x;
double tmp;
if (F <= -1.05e+129) {
tmp = -((1.0 + t_0) / sin(B));
} else if (F <= 5e+14) {
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 - t_0) / sin(B);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: tmp
t_0 = cos(b) * x
if (f <= (-1.05d+129)) then
tmp = -((1.0d0 + t_0) / sin(b))
else if (f <= 5d+14) then
tmp = -((x * 1.0d0) / tan(b)) + ((f / sin(b)) * ((((f * f) + 2.0d0) + (2.0d0 * x)) ** -(1.0d0 / 2.0d0)))
else
tmp = (1.0d0 - t_0) / sin(b)
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double t_0 = Math.cos(B) * x;
double tmp;
if (F <= -1.05e+129) {
tmp = -((1.0 + t_0) / Math.sin(B));
} else if (F <= 5e+14) {
tmp = -((x * 1.0) / Math.tan(B)) + ((F / Math.sin(B)) * Math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
} else {
tmp = (1.0 - t_0) / Math.sin(B);
}
return tmp;
}
def code(F, B, x): t_0 = math.cos(B) * x tmp = 0 if F <= -1.05e+129: tmp = -((1.0 + t_0) / math.sin(B)) elif F <= 5e+14: tmp = -((x * 1.0) / math.tan(B)) + ((F / math.sin(B)) * math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0))) else: tmp = (1.0 - t_0) / math.sin(B) return tmp
function code(F, B, x) t_0 = Float64(cos(B) * x) tmp = 0.0 if (F <= -1.05e+129) tmp = Float64(-Float64(Float64(1.0 + t_0) / sin(B))); elseif (F <= 5e+14) 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 - t_0) / sin(B)); end return tmp end
function tmp_2 = code(F, B, x) t_0 = cos(B) * x; tmp = 0.0; if (F <= -1.05e+129) tmp = -((1.0 + t_0) / sin(B)); elseif (F <= 5e+14) tmp = -((x * 1.0) / tan(B)) + ((F / sin(B)) * ((((F * F) + 2.0) + (2.0 * x)) ^ -(1.0 / 2.0))); else tmp = (1.0 - t_0) / sin(B); end tmp_2 = tmp; end
code[F_, B_, x_] := Block[{t$95$0 = N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[F, -1.05e+129], (-N[(N[(1.0 + t$95$0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), If[LessEqual[F, 5e+14], 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 - t$95$0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos B \cdot x\\
\mathbf{if}\;F \leq -1.05 \cdot 10^{+129}:\\
\;\;\;\;-\frac{1 + t\_0}{\sin B}\\
\mathbf{elif}\;F \leq 5 \cdot 10^{+14}:\\
\;\;\;\;\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 - t\_0}{\sin B}\\
\end{array}
\end{array}
if F < -1.04999999999999998e129Initial program 77.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.f6455.9
Applied rewrites55.9%
if -1.04999999999999998e129 < F < 5e14Initial program 77.8%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6477.9
Applied rewrites77.9%
if 5e14 < F Initial program 77.8%
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.f6455.5
Applied rewrites55.5%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (* (cos B) x)))
(if (<= F -1.05e+129)
(- (/ (+ 1.0 t_0) (sin B)))
(if (<= F 400000000000.0)
(fma
(- x)
(/ 1.0 (tan B))
(* (pow (fma 2.0 x (fma F F 2.0)) -0.5) (/ F (sin B))))
(/ (- 1.0 t_0) (sin B))))))
double code(double F, double B, double x) {
double t_0 = cos(B) * x;
double tmp;
if (F <= -1.05e+129) {
tmp = -((1.0 + t_0) / sin(B));
} else if (F <= 400000000000.0) {
tmp = fma(-x, (1.0 / tan(B)), (pow(fma(2.0, x, fma(F, F, 2.0)), -0.5) * (F / sin(B))));
} else {
tmp = (1.0 - t_0) / sin(B);
}
return tmp;
}
function code(F, B, x) t_0 = Float64(cos(B) * x) tmp = 0.0 if (F <= -1.05e+129) tmp = Float64(-Float64(Float64(1.0 + t_0) / sin(B))); elseif (F <= 400000000000.0) tmp = fma(Float64(-x), Float64(1.0 / tan(B)), Float64((fma(2.0, x, fma(F, F, 2.0)) ^ -0.5) * Float64(F / sin(B)))); else tmp = Float64(Float64(1.0 - t_0) / sin(B)); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[F, -1.05e+129], (-N[(N[(1.0 + t$95$0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), If[LessEqual[F, 400000000000.0], N[((-x) * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision] + N[(N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - t$95$0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos B \cdot x\\
\mathbf{if}\;F \leq -1.05 \cdot 10^{+129}:\\
\;\;\;\;-\frac{1 + t\_0}{\sin B}\\
\mathbf{elif}\;F \leq 400000000000:\\
\;\;\;\;\mathsf{fma}\left(-x, \frac{1}{\tan B}, {\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5} \cdot \frac{F}{\sin B}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - t\_0}{\sin B}\\
\end{array}
\end{array}
if F < -1.04999999999999998e129Initial program 77.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.f6455.9
Applied rewrites55.9%
if -1.04999999999999998e129 < F < 4e11Initial program 77.8%
Applied rewrites77.9%
if 4e11 < F Initial program 77.8%
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.f6455.5
Applied rewrites55.5%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (* (cos B) x)))
(if (<= F -1.05e+129)
(- (/ (+ 1.0 t_0) (sin B)))
(if (<= F 300000000000.0)
(+
(- (* x (/ 1.0 (tan B))))
(* (/ F (sin B)) (sqrt (/ 1.0 (fma F F 2.0)))))
(/ (- 1.0 t_0) (sin B))))))
double code(double F, double B, double x) {
double t_0 = cos(B) * x;
double tmp;
if (F <= -1.05e+129) {
tmp = -((1.0 + t_0) / sin(B));
} else if (F <= 300000000000.0) {
tmp = -(x * (1.0 / tan(B))) + ((F / sin(B)) * sqrt((1.0 / fma(F, F, 2.0))));
} else {
tmp = (1.0 - t_0) / sin(B);
}
return tmp;
}
function code(F, B, x) t_0 = Float64(cos(B) * x) tmp = 0.0 if (F <= -1.05e+129) tmp = Float64(-Float64(Float64(1.0 + t_0) / sin(B))); elseif (F <= 300000000000.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 - t_0) / sin(B)); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[F, -1.05e+129], (-N[(N[(1.0 + t$95$0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), If[LessEqual[F, 300000000000.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 - t$95$0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos B \cdot x\\
\mathbf{if}\;F \leq -1.05 \cdot 10^{+129}:\\
\;\;\;\;-\frac{1 + t\_0}{\sin B}\\
\mathbf{elif}\;F \leq 300000000000:\\
\;\;\;\;\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 - t\_0}{\sin B}\\
\end{array}
\end{array}
if F < -1.04999999999999998e129Initial program 77.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.f6455.9
Applied rewrites55.9%
if -1.04999999999999998e129 < F < 3e11Initial program 77.8%
Taylor expanded in x around 0
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
pow2N/A
lower-fma.f6477.8
Applied rewrites77.8%
if 3e11 < F Initial program 77.8%
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.f6455.5
Applied rewrites55.5%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (* (cos B) x)))
(if (<= F -7200000.0)
(- (/ (+ 1.0 t_0) (sin B)))
(if (<= F 1.48)
(+ (- (* x (/ 1.0 (tan B)))) (/ (* F (sqrt 0.5)) (sin B)))
(/ (- 1.0 t_0) (sin B))))))
double code(double F, double B, double x) {
double t_0 = cos(B) * x;
double tmp;
if (F <= -7200000.0) {
tmp = -((1.0 + t_0) / sin(B));
} else if (F <= 1.48) {
tmp = -(x * (1.0 / tan(B))) + ((F * sqrt(0.5)) / sin(B));
} else {
tmp = (1.0 - t_0) / sin(B);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: tmp
t_0 = cos(b) * x
if (f <= (-7200000.0d0)) then
tmp = -((1.0d0 + t_0) / sin(b))
else if (f <= 1.48d0) then
tmp = -(x * (1.0d0 / tan(b))) + ((f * sqrt(0.5d0)) / sin(b))
else
tmp = (1.0d0 - t_0) / sin(b)
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double t_0 = Math.cos(B) * x;
double tmp;
if (F <= -7200000.0) {
tmp = -((1.0 + t_0) / Math.sin(B));
} else if (F <= 1.48) {
tmp = -(x * (1.0 / Math.tan(B))) + ((F * Math.sqrt(0.5)) / Math.sin(B));
} else {
tmp = (1.0 - t_0) / Math.sin(B);
}
return tmp;
}
def code(F, B, x): t_0 = math.cos(B) * x tmp = 0 if F <= -7200000.0: tmp = -((1.0 + t_0) / math.sin(B)) elif F <= 1.48: tmp = -(x * (1.0 / math.tan(B))) + ((F * math.sqrt(0.5)) / math.sin(B)) else: tmp = (1.0 - t_0) / math.sin(B) return tmp
function code(F, B, x) t_0 = Float64(cos(B) * x) tmp = 0.0 if (F <= -7200000.0) tmp = Float64(-Float64(Float64(1.0 + t_0) / sin(B))); elseif (F <= 1.48) tmp = Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(Float64(F * sqrt(0.5)) / sin(B))); else tmp = Float64(Float64(1.0 - t_0) / sin(B)); end return tmp end
function tmp_2 = code(F, B, x) t_0 = cos(B) * x; tmp = 0.0; if (F <= -7200000.0) tmp = -((1.0 + t_0) / sin(B)); elseif (F <= 1.48) tmp = -(x * (1.0 / tan(B))) + ((F * sqrt(0.5)) / sin(B)); else tmp = (1.0 - t_0) / sin(B); end tmp_2 = tmp; end
code[F_, B_, x_] := Block[{t$95$0 = N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[F, -7200000.0], (-N[(N[(1.0 + t$95$0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), If[LessEqual[F, 1.48], 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 - t$95$0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos B \cdot x\\
\mathbf{if}\;F \leq -7200000:\\
\;\;\;\;-\frac{1 + t\_0}{\sin B}\\
\mathbf{elif}\;F \leq 1.48:\\
\;\;\;\;\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F \cdot \sqrt{0.5}}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - t\_0}{\sin B}\\
\end{array}
\end{array}
if F < -7.2e6Initial program 77.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.f6455.9
Applied rewrites55.9%
if -7.2e6 < F < 1.48Initial program 77.8%
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 rewrites85.6%
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.f6485.5
Applied rewrites85.5%
Taylor expanded in F around 0
Applied rewrites58.0%
if 1.48 < F Initial program 77.8%
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.f6455.5
Applied rewrites55.5%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (* (cos B) x)))
(if (<= F -2.7e+14)
(- (/ (+ 1.0 t_0) (sin B)))
(if (<= F 1.02e-97)
(+
(- (* x (/ 1.0 (tan B))))
(* (/ F B) (sqrt (/ 1.0 (+ (fma F F (+ x x)) 2.0)))))
(if (<= F 180000.0)
(+ (- (/ x B)) (/ (* F (sqrt (/ 1.0 (fma F F 2.0)))) (sin B)))
(/ (- 1.0 t_0) (sin B)))))))
double code(double F, double B, double x) {
double t_0 = cos(B) * x;
double tmp;
if (F <= -2.7e+14) {
tmp = -((1.0 + t_0) / sin(B));
} else if (F <= 1.02e-97) {
tmp = -(x * (1.0 / tan(B))) + ((F / B) * sqrt((1.0 / (fma(F, F, (x + x)) + 2.0))));
} else if (F <= 180000.0) {
tmp = -(x / B) + ((F * sqrt((1.0 / fma(F, F, 2.0)))) / sin(B));
} else {
tmp = (1.0 - t_0) / sin(B);
}
return tmp;
}
function code(F, B, x) t_0 = Float64(cos(B) * x) tmp = 0.0 if (F <= -2.7e+14) tmp = Float64(-Float64(Float64(1.0 + t_0) / sin(B))); elseif (F <= 1.02e-97) tmp = Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(Float64(F / B) * sqrt(Float64(1.0 / Float64(fma(F, F, Float64(x + x)) + 2.0))))); elseif (F <= 180000.0) tmp = Float64(Float64(-Float64(x / B)) + Float64(Float64(F * sqrt(Float64(1.0 / fma(F, F, 2.0)))) / sin(B))); else tmp = Float64(Float64(1.0 - t_0) / sin(B)); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[F, -2.7e+14], (-N[(N[(1.0 + t$95$0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), If[LessEqual[F, 1.02e-97], N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $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, 180000.0], 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[(1.0 - t$95$0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos B \cdot x\\
\mathbf{if}\;F \leq -2.7 \cdot 10^{+14}:\\
\;\;\;\;-\frac{1 + t\_0}{\sin B}\\
\mathbf{elif}\;F \leq 1.02 \cdot 10^{-97}:\\
\;\;\;\;\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{B} \cdot \sqrt{\frac{1}{\mathsf{fma}\left(F, F, x + x\right) + 2}}\\
\mathbf{elif}\;F \leq 180000:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{F \cdot \sqrt{\frac{1}{\mathsf{fma}\left(F, F, 2\right)}}}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - t\_0}{\sin B}\\
\end{array}
\end{array}
if F < -2.7e14Initial program 77.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.f6455.9
Applied rewrites55.9%
if -2.7e14 < F < 1.02000000000000004e-97Initial program 77.8%
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-+.f6463.2
Applied rewrites63.2%
if 1.02000000000000004e-97 < F < 1.8e5Initial program 77.8%
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 rewrites85.6%
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.f6485.5
Applied rewrites85.5%
Taylor expanded in B around 0
lower-/.f6458.4
Applied rewrites58.4%
if 1.8e5 < F Initial program 77.8%
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.f6455.5
Applied rewrites55.5%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (* F (sqrt (/ 1.0 (fma F F 2.0))))))
(if (<= F 1.02e-97)
(+ (- (* x (/ 1.0 (tan B)))) (/ t_0 B))
(if (<= F 180000.0)
(+ (- (/ x B)) (/ t_0 (sin B)))
(/ (- 1.0 (* (cos B) x)) (sin B))))))
double code(double F, double B, double x) {
double t_0 = F * sqrt((1.0 / fma(F, F, 2.0)));
double tmp;
if (F <= 1.02e-97) {
tmp = -(x * (1.0 / tan(B))) + (t_0 / B);
} else if (F <= 180000.0) {
tmp = -(x / B) + (t_0 / sin(B));
} else {
tmp = (1.0 - (cos(B) * x)) / sin(B);
}
return tmp;
}
function code(F, B, x) t_0 = Float64(F * sqrt(Float64(1.0 / fma(F, F, 2.0)))) tmp = 0.0 if (F <= 1.02e-97) tmp = Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(t_0 / B)); elseif (F <= 180000.0) tmp = Float64(Float64(-Float64(x / B)) + Float64(t_0 / sin(B))); else tmp = Float64(Float64(1.0 - Float64(cos(B) * x)) / sin(B)); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(F * N[Sqrt[N[(1.0 / N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, 1.02e-97], N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(t$95$0 / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 180000.0], N[((-N[(x / B), $MachinePrecision]) + N[(t$95$0 / 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}
t_0 := F \cdot \sqrt{\frac{1}{\mathsf{fma}\left(F, F, 2\right)}}\\
\mathbf{if}\;F \leq 1.02 \cdot 10^{-97}:\\
\;\;\;\;\left(-x \cdot \frac{1}{\tan B}\right) + \frac{t\_0}{B}\\
\mathbf{elif}\;F \leq 180000:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{t\_0}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - \cos B \cdot x}{\sin B}\\
\end{array}
\end{array}
if F < 1.02000000000000004e-97Initial program 77.8%
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 rewrites85.6%
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.f6485.5
Applied rewrites85.5%
Taylor expanded in B around 0
Applied rewrites70.8%
if 1.02000000000000004e-97 < F < 1.8e5Initial program 77.8%
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 rewrites85.6%
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.f6485.5
Applied rewrites85.5%
Taylor expanded in B around 0
lower-/.f6458.4
Applied rewrites58.4%
if 1.8e5 < F Initial program 77.8%
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.f6455.5
Applied rewrites55.5%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (* F (sqrt (/ 1.0 (fma F F 2.0)))))
(t_1 (- (* x (/ 1.0 (tan B))))))
(if (<= F 1.02e-97)
(+ t_1 (/ t_0 B))
(if (<= F 2.7e+123) (+ (- (/ x B)) (/ t_0 (sin B))) (+ t_1 (/ 1.0 B))))))
double code(double F, double B, double x) {
double t_0 = F * sqrt((1.0 / fma(F, F, 2.0)));
double t_1 = -(x * (1.0 / tan(B)));
double tmp;
if (F <= 1.02e-97) {
tmp = t_1 + (t_0 / B);
} else if (F <= 2.7e+123) {
tmp = -(x / B) + (t_0 / sin(B));
} else {
tmp = t_1 + (1.0 / B);
}
return tmp;
}
function code(F, B, x) t_0 = Float64(F * sqrt(Float64(1.0 / fma(F, F, 2.0)))) t_1 = Float64(-Float64(x * Float64(1.0 / tan(B)))) tmp = 0.0 if (F <= 1.02e-97) tmp = Float64(t_1 + Float64(t_0 / B)); elseif (F <= 2.7e+123) tmp = Float64(Float64(-Float64(x / B)) + Float64(t_0 / sin(B))); else tmp = Float64(t_1 + Float64(1.0 / B)); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(F * N[Sqrt[N[(1.0 / N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = (-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision])}, If[LessEqual[F, 1.02e-97], N[(t$95$1 + N[(t$95$0 / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 2.7e+123], N[((-N[(x / B), $MachinePrecision]) + N[(t$95$0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(1.0 / B), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := F \cdot \sqrt{\frac{1}{\mathsf{fma}\left(F, F, 2\right)}}\\
t_1 := -x \cdot \frac{1}{\tan B}\\
\mathbf{if}\;F \leq 1.02 \cdot 10^{-97}:\\
\;\;\;\;t\_1 + \frac{t\_0}{B}\\
\mathbf{elif}\;F \leq 2.7 \cdot 10^{+123}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{t\_0}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;t\_1 + \frac{1}{B}\\
\end{array}
\end{array}
if F < 1.02000000000000004e-97Initial program 77.8%
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 rewrites85.6%
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.f6485.5
Applied rewrites85.5%
Taylor expanded in B around 0
Applied rewrites70.8%
if 1.02000000000000004e-97 < F < 2.70000000000000013e123Initial program 77.8%
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 rewrites85.6%
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.f6485.5
Applied rewrites85.5%
Taylor expanded in B around 0
lower-/.f6458.4
Applied rewrites58.4%
if 2.70000000000000013e123 < F Initial program 77.8%
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 rewrites85.6%
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.f6485.5
Applied rewrites85.5%
Taylor expanded in B around 0
Applied rewrites70.8%
Taylor expanded in F around inf
Applied rewrites53.3%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (+ (- (* x (/ 1.0 (tan B)))) (/ 1.0 B))))
(if (<= x -5.5e-51)
t_0
(if (<= x 5.8e-13)
(+ (- (/ 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 <= -5.5e-51) {
tmp = t_0;
} else if (x <= 5.8e-13) {
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 <= -5.5e-51) tmp = t_0; elseif (x <= 5.8e-13) 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, -5.5e-51], t$95$0, If[LessEqual[x, 5.8e-13], 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 -5.5 \cdot 10^{-51}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 5.8 \cdot 10^{-13}:\\
\;\;\;\;\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 < -5.4999999999999997e-51 or 5.7999999999999995e-13 < x Initial program 77.8%
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 rewrites85.6%
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.f6485.5
Applied rewrites85.5%
Taylor expanded in B around 0
Applied rewrites70.8%
Taylor expanded in F around inf
Applied rewrites53.3%
if -5.4999999999999997e-51 < x < 5.7999999999999995e-13Initial program 77.8%
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 rewrites85.6%
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.f6485.5
Applied rewrites85.5%
Taylor expanded in B around 0
lower-/.f6458.4
Applied rewrites58.4%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (* (sqrt (/ 1.0 (fma F F 2.0))) (/ F (sin B))))
(t_1 (- (* x (/ 1.0 (tan B)))))
(t_2 (+ t_1 (/ 1.0 B))))
(if (<= F -2.1e+57)
t_2
(if (<= F -7200000.0)
t_0
(if (<= F 1.65e-92)
(+ t_1 (/ (* F (sqrt 0.5)) B))
(if (<= F 1.4e+23) t_0 t_2))))))
double code(double F, double B, double x) {
double t_0 = sqrt((1.0 / fma(F, F, 2.0))) * (F / sin(B));
double t_1 = -(x * (1.0 / tan(B)));
double t_2 = t_1 + (1.0 / B);
double tmp;
if (F <= -2.1e+57) {
tmp = t_2;
} else if (F <= -7200000.0) {
tmp = t_0;
} else if (F <= 1.65e-92) {
tmp = t_1 + ((F * sqrt(0.5)) / B);
} else if (F <= 1.4e+23) {
tmp = t_0;
} else {
tmp = t_2;
}
return tmp;
}
function code(F, B, x) t_0 = Float64(sqrt(Float64(1.0 / fma(F, F, 2.0))) * Float64(F / sin(B))) t_1 = Float64(-Float64(x * Float64(1.0 / tan(B)))) t_2 = Float64(t_1 + Float64(1.0 / B)) tmp = 0.0 if (F <= -2.1e+57) tmp = t_2; elseif (F <= -7200000.0) tmp = t_0; elseif (F <= 1.65e-92) tmp = Float64(t_1 + Float64(Float64(F * sqrt(0.5)) / B)); elseif (F <= 1.4e+23) tmp = t_0; else tmp = t_2; end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(N[Sqrt[N[(1.0 / N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = (-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision])}, Block[{t$95$2 = N[(t$95$1 + N[(1.0 / B), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -2.1e+57], t$95$2, If[LessEqual[F, -7200000.0], t$95$0, If[LessEqual[F, 1.65e-92], N[(t$95$1 + N[(N[(F * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.4e+23], t$95$0, t$95$2]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\frac{1}{\mathsf{fma}\left(F, F, 2\right)}} \cdot \frac{F}{\sin B}\\
t_1 := -x \cdot \frac{1}{\tan B}\\
t_2 := t\_1 + \frac{1}{B}\\
\mathbf{if}\;F \leq -2.1 \cdot 10^{+57}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;F \leq -7200000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;F \leq 1.65 \cdot 10^{-92}:\\
\;\;\;\;t\_1 + \frac{F \cdot \sqrt{0.5}}{B}\\
\mathbf{elif}\;F \leq 1.4 \cdot 10^{+23}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if F < -2.09999999999999991e57 or 1.4e23 < F Initial program 77.8%
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 rewrites85.6%
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.f6485.5
Applied rewrites85.5%
Taylor expanded in B around 0
Applied rewrites70.8%
Taylor expanded in F around inf
Applied rewrites53.3%
if -2.09999999999999991e57 < F < -7.2e6 or 1.64999999999999999e-92 < F < 1.4e23Initial program 77.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-/.f6429.7
Applied rewrites29.7%
if -7.2e6 < F < 1.64999999999999999e-92Initial program 77.8%
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 rewrites85.6%
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.f6485.5
Applied rewrites85.5%
Taylor expanded in B around 0
Applied rewrites70.8%
Taylor expanded in F around 0
Applied rewrites55.2%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (+ (- (* x (/ 1.0 (tan B)))) (/ 1.0 B))))
(if (<= x -1.75e-53)
t_0
(if (<= x 7e-147)
(* (sqrt (/ 1.0 (fma F F 2.0))) (/ F (sin B)))
(if (<= x 5.4e-12)
(/ (- (* (/ 1.0 (sqrt (fma 2.0 x (fma F F 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 <= -1.75e-53) {
tmp = t_0;
} else if (x <= 7e-147) {
tmp = sqrt((1.0 / fma(F, F, 2.0))) * (F / sin(B));
} else if (x <= 5.4e-12) {
tmp = (((1.0 / sqrt(fma(2.0, x, fma(F, F, 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 <= -1.75e-53) tmp = t_0; elseif (x <= 7e-147) tmp = Float64(sqrt(Float64(1.0 / fma(F, F, 2.0))) * Float64(F / sin(B))); elseif (x <= 5.4e-12) tmp = Float64(Float64(Float64(Float64(1.0 / sqrt(fma(2.0, x, fma(F, F, 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, -1.75e-53], t$95$0, If[LessEqual[x, 7e-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, 5.4e-12], 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], 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 -1.75 \cdot 10^{-53}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 7 \cdot 10^{-147}:\\
\;\;\;\;\sqrt{\frac{1}{\mathsf{fma}\left(F, F, 2\right)}} \cdot \frac{F}{\sin B}\\
\mathbf{elif}\;x \leq 5.4 \cdot 10^{-12}:\\
\;\;\;\;\frac{\frac{1}{\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}} \cdot F - x}{B}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -1.74999999999999997e-53 or 5.39999999999999961e-12 < x Initial program 77.8%
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 rewrites85.6%
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.f6485.5
Applied rewrites85.5%
Taylor expanded in B around 0
Applied rewrites70.8%
Taylor expanded in F around inf
Applied rewrites53.3%
if -1.74999999999999997e-53 < x < 7.00000000000000007e-147Initial program 77.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-/.f6429.7
Applied rewrites29.7%
if 7.00000000000000007e-147 < x < 5.39999999999999961e-12Initial program 77.8%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites44.6%
Applied rewrites44.6%
(FPCore (F B x) :precision binary64 (if (<= B 3.1e-6) (/ (- (* (/ 1.0 (sqrt (fma 2.0 x (fma F F 2.0)))) F) x) B) (* (sqrt (/ 1.0 (fma F F 2.0))) (/ F (sin B)))))
double code(double F, double B, double x) {
double tmp;
if (B <= 3.1e-6) {
tmp = (((1.0 / sqrt(fma(2.0, x, fma(F, F, 2.0)))) * F) - x) / B;
} else {
tmp = sqrt((1.0 / fma(F, F, 2.0))) * (F / sin(B));
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (B <= 3.1e-6) tmp = Float64(Float64(Float64(Float64(1.0 / sqrt(fma(2.0, x, fma(F, F, 2.0)))) * F) - x) / B); else tmp = Float64(sqrt(Float64(1.0 / fma(F, F, 2.0))) * Float64(F / sin(B))); end return tmp end
code[F_, B_, x_] := If[LessEqual[B, 3.1e-6], 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[Sqrt[N[(1.0 / N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq 3.1 \cdot 10^{-6}:\\
\;\;\;\;\frac{\frac{1}{\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}} \cdot F - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{1}{\mathsf{fma}\left(F, F, 2\right)}} \cdot \frac{F}{\sin B}\\
\end{array}
\end{array}
if B < 3.1e-6Initial program 77.8%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites44.6%
Applied rewrites44.6%
if 3.1e-6 < B Initial program 77.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-/.f6429.7
Applied rewrites29.7%
(FPCore (F B x)
:precision binary64
(if (<= F -2e+14)
(/ (- -1.0 x) B)
(if (<= F 0.0085)
(/ (- (* (/ 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 <= -2e+14) {
tmp = (-1.0 - x) / B;
} else if (F <= 0.0085) {
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 <= -2e+14) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 0.0085) 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, -2e+14], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 0.0085], 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 \cdot 10^{+14}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 0.0085:\\
\;\;\;\;\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 < -2e14Initial program 77.8%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites44.6%
Taylor expanded in F around -inf
Applied rewrites29.8%
if -2e14 < F < 0.0085000000000000006Initial program 77.8%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites44.6%
Applied rewrites44.6%
if 0.0085000000000000006 < F Initial program 77.8%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites44.6%
Taylor expanded in F around inf
+-commutativeN/A
*-commutativeN/A
div-addN/A
metadata-evalN/A
associate-*r/N/A
associate-*r/N/A
+-commutativeN/A
lower-fma.f64N/A
Applied rewrites25.5%
Taylor expanded in x around 0
lower--.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6426.0
Applied rewrites26.0%
(FPCore (F B x)
:precision binary64
(if (<= F -7200000.0)
(/ (- -1.0 x) B)
(if (<= F 0.0085)
(fma (/ F B) (sqrt (/ 1.0 (fma 2.0 x 2.0))) (/ (- x) B))
(/ (- (- 1.0 (/ 1.0 (* F F))) x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -7200000.0) {
tmp = (-1.0 - x) / B;
} else if (F <= 0.0085) {
tmp = fma((F / B), sqrt((1.0 / fma(2.0, x, 2.0))), (-x / B));
} else {
tmp = ((1.0 - (1.0 / (F * F))) - x) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -7200000.0) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 0.0085) tmp = fma(Float64(F / B), sqrt(Float64(1.0 / fma(2.0, x, 2.0))), 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, -7200000.0], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 0.0085], N[(N[(F / B), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(2.0 * x + 2.0), $MachinePrecision]), $MachinePrecision]], $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 -7200000:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 0.0085:\\
\;\;\;\;\mathsf{fma}\left(\frac{F}{B}, \sqrt{\frac{1}{\mathsf{fma}\left(2, x, 2\right)}}, \frac{-x}{B}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 - \frac{1}{F \cdot F}\right) - x}{B}\\
\end{array}
\end{array}
if F < -7.2e6Initial program 77.8%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites44.6%
Taylor expanded in F around -inf
Applied rewrites29.8%
if -7.2e6 < F < 0.0085000000000000006Initial program 77.8%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites44.6%
Taylor expanded in F around 0
+-commutativeN/A
lower-fma.f64N/A
lower-/.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.f6429.7
Applied rewrites29.7%
if 0.0085000000000000006 < F Initial program 77.8%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites44.6%
Taylor expanded in F around inf
+-commutativeN/A
*-commutativeN/A
div-addN/A
metadata-evalN/A
associate-*r/N/A
associate-*r/N/A
+-commutativeN/A
lower-fma.f64N/A
Applied rewrites25.5%
Taylor expanded in x around 0
lower--.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6426.0
Applied rewrites26.0%
(FPCore (F B x)
:precision binary64
(if (<= F -7200000.0)
(/ (- -1.0 x) B)
(if (<= F 0.0085)
(/ (- (* (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 <= -7200000.0) {
tmp = (-1.0 - x) / B;
} else if (F <= 0.0085) {
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 <= -7200000.0) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 0.0085) 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, -7200000.0], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 0.0085], 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 -7200000:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 0.0085:\\
\;\;\;\;\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 < -7.2e6Initial program 77.8%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites44.6%
Taylor expanded in F around -inf
Applied rewrites29.8%
if -7.2e6 < F < 0.0085000000000000006Initial program 77.8%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites44.6%
Taylor expanded in F around 0
lower-/.f64N/A
+-commutativeN/A
lower-fma.f6430.6
Applied rewrites30.6%
if 0.0085000000000000006 < F Initial program 77.8%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites44.6%
Taylor expanded in F around inf
+-commutativeN/A
*-commutativeN/A
div-addN/A
metadata-evalN/A
associate-*r/N/A
associate-*r/N/A
+-commutativeN/A
lower-fma.f64N/A
Applied rewrites25.5%
Taylor expanded in x around 0
lower--.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6426.0
Applied rewrites26.0%
(FPCore (F B x)
:precision binary64
(if (<= F -9.6e-56)
(/ (- -1.0 x) B)
(if (<= F 1.65e-162)
(/ (- x) B)
(if (<= F 0.0085)
(* (sqrt (/ 1.0 (fma F F 2.0))) (/ F B))
(/ (- (- 1.0 (/ 1.0 (* F F))) x) B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -9.6e-56) {
tmp = (-1.0 - x) / B;
} else if (F <= 1.65e-162) {
tmp = -x / B;
} else if (F <= 0.0085) {
tmp = sqrt((1.0 / fma(F, F, 2.0))) * (F / B);
} else {
tmp = ((1.0 - (1.0 / (F * F))) - x) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -9.6e-56) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 1.65e-162) tmp = Float64(Float64(-x) / B); elseif (F <= 0.0085) tmp = Float64(sqrt(Float64(1.0 / fma(F, F, 2.0))) * Float64(F / 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, -9.6e-56], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 1.65e-162], N[((-x) / B), $MachinePrecision], If[LessEqual[F, 0.0085], N[(N[Sqrt[N[(1.0 / N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(F / 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 -9.6 \cdot 10^{-56}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 1.65 \cdot 10^{-162}:\\
\;\;\;\;\frac{-x}{B}\\
\mathbf{elif}\;F \leq 0.0085:\\
\;\;\;\;\sqrt{\frac{1}{\mathsf{fma}\left(F, F, 2\right)}} \cdot \frac{F}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 - \frac{1}{F \cdot F}\right) - x}{B}\\
\end{array}
\end{array}
if F < -9.60000000000000002e-56Initial program 77.8%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites44.6%
Taylor expanded in F around -inf
Applied rewrites29.8%
if -9.60000000000000002e-56 < F < 1.65000000000000007e-162Initial program 77.8%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites44.6%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f6429.8
Applied rewrites29.8%
if 1.65000000000000007e-162 < F < 0.0085000000000000006Initial program 77.8%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites44.6%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
pow2N/A
lift-fma.f64N/A
lower-/.f6415.8
Applied rewrites15.8%
if 0.0085000000000000006 < F Initial program 77.8%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites44.6%
Taylor expanded in F around inf
+-commutativeN/A
*-commutativeN/A
div-addN/A
metadata-evalN/A
associate-*r/N/A
associate-*r/N/A
+-commutativeN/A
lower-fma.f64N/A
Applied rewrites25.5%
Taylor expanded in x around 0
lower--.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6426.0
Applied rewrites26.0%
(FPCore (F B x) :precision binary64 (if (<= F -9.6e-56) (/ (- -1.0 x) B) (if (<= F 4.9e-37) (/ (- x) B) (/ (- 1.0 x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -9.6e-56) {
tmp = (-1.0 - x) / B;
} else if (F <= 4.9e-37) {
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 <= (-9.6d-56)) then
tmp = ((-1.0d0) - x) / b
else if (f <= 4.9d-37) 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 <= -9.6e-56) {
tmp = (-1.0 - x) / B;
} else if (F <= 4.9e-37) {
tmp = -x / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -9.6e-56: tmp = (-1.0 - x) / B elif F <= 4.9e-37: tmp = -x / B else: tmp = (1.0 - x) / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= -9.6e-56) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 4.9e-37) 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 <= -9.6e-56) tmp = (-1.0 - x) / B; elseif (F <= 4.9e-37) tmp = -x / B; else tmp = (1.0 - x) / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -9.6e-56], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 4.9e-37], N[((-x) / B), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -9.6 \cdot 10^{-56}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 4.9 \cdot 10^{-37}:\\
\;\;\;\;\frac{-x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < -9.60000000000000002e-56Initial program 77.8%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites44.6%
Taylor expanded in F around -inf
Applied rewrites29.8%
if -9.60000000000000002e-56 < F < 4.90000000000000018e-37Initial program 77.8%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites44.6%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f6429.8
Applied rewrites29.8%
if 4.90000000000000018e-37 < F Initial program 77.8%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites44.6%
Taylor expanded in F around inf
Applied rewrites29.4%
(FPCore (F B x) :precision binary64 (if (<= F -9.6e-56) (/ (- -1.0 x) B) (/ (- x) B)))
double code(double F, double B, double x) {
double tmp;
if (F <= -9.6e-56) {
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 <= (-9.6d-56)) 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 <= -9.6e-56) {
tmp = (-1.0 - x) / B;
} else {
tmp = -x / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -9.6e-56: tmp = (-1.0 - x) / B else: tmp = -x / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= -9.6e-56) 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 <= -9.6e-56) tmp = (-1.0 - x) / B; else tmp = -x / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -9.6e-56], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], N[((-x) / B), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -9.6 \cdot 10^{-56}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{-x}{B}\\
\end{array}
\end{array}
if F < -9.60000000000000002e-56Initial program 77.8%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites44.6%
Taylor expanded in F around -inf
Applied rewrites29.8%
if -9.60000000000000002e-56 < F Initial program 77.8%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites44.6%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f6429.8
Applied rewrites29.8%
(FPCore (F B x) :precision binary64 (/ (- x) B))
double code(double F, double B, double x) {
return -x / 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 = -x / b
end function
public static double code(double F, double B, double x) {
return -x / B;
}
def code(F, B, x): return -x / B
function code(F, B, x) return Float64(Float64(-x) / B) end
function tmp = code(F, B, x) tmp = -x / B; end
code[F_, B_, x_] := N[((-x) / B), $MachinePrecision]
\begin{array}{l}
\\
\frac{-x}{B}
\end{array}
Initial program 77.8%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites44.6%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f6429.8
Applied rewrites29.8%
herbie shell --seed 2025124
(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))))))