
(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 (/ x (tan B))) (t_1 (* F (sin B))))
(if (<= F -6e+27)
(- (/ -1.0 (sin B)) t_0)
(if (<= F 2.9e+30)
(- (* (pow (fma 2.0 x (fma F F 2.0)) -0.5) (/ F (sin B))) t_0)
(* F (fma -1.0 (/ (* x (cos B)) t_1) (/ 1.0 t_1)))))))
double code(double F, double B, double x) {
double t_0 = x / tan(B);
double t_1 = F * sin(B);
double tmp;
if (F <= -6e+27) {
tmp = (-1.0 / sin(B)) - t_0;
} else if (F <= 2.9e+30) {
tmp = (pow(fma(2.0, x, fma(F, F, 2.0)), -0.5) * (F / sin(B))) - t_0;
} else {
tmp = F * fma(-1.0, ((x * cos(B)) / t_1), (1.0 / t_1));
}
return tmp;
}
function code(F, B, x) t_0 = Float64(x / tan(B)) t_1 = Float64(F * sin(B)) tmp = 0.0 if (F <= -6e+27) tmp = Float64(Float64(-1.0 / sin(B)) - t_0); elseif (F <= 2.9e+30) tmp = Float64(Float64((fma(2.0, x, fma(F, F, 2.0)) ^ -0.5) * Float64(F / sin(B))) - t_0); else tmp = Float64(F * fma(-1.0, Float64(Float64(x * cos(B)) / t_1), Float64(1.0 / t_1))); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(F * N[Sin[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -6e+27], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[F, 2.9e+30], N[(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] - t$95$0), $MachinePrecision], N[(F * N[(-1.0 * N[(N[(x * N[Cos[B], $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision] + N[(1.0 / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{\tan B}\\
t_1 := F \cdot \sin B\\
\mathbf{if}\;F \leq -6 \cdot 10^{+27}:\\
\;\;\;\;\frac{-1}{\sin B} - t\_0\\
\mathbf{elif}\;F \leq 2.9 \cdot 10^{+30}:\\
\;\;\;\;{\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5} \cdot \frac{F}{\sin B} - t\_0\\
\mathbf{else}:\\
\;\;\;\;F \cdot \mathsf{fma}\left(-1, \frac{x \cdot \cos B}{t\_1}, \frac{1}{t\_1}\right)\\
\end{array}
\end{array}
if F < -5.99999999999999953e27Initial program 76.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f64N/A
*-commutativeN/A
lower-*.f6484.4
Applied rewrites84.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites84.4%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6484.4
Applied rewrites84.5%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6455.5
Applied rewrites55.5%
if -5.99999999999999953e27 < F < 2.8999999999999998e30Initial program 76.6%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6476.6
Applied rewrites76.7%
if 2.8999999999999998e30 < F Initial program 76.6%
Taylor expanded in F around inf
lower-*.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f6447.7
Applied rewrites47.7%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ -1.0 (sin B))))
(if (<= F -2000000000000.0)
(- t_0 (/ x (tan B)))
(fma
(- F)
(* t_0 (pow (fma 2.0 x (fma F F 2.0)) -0.5))
(/ (- x) (tan B))))))
double code(double F, double B, double x) {
double t_0 = -1.0 / sin(B);
double tmp;
if (F <= -2000000000000.0) {
tmp = t_0 - (x / tan(B));
} else {
tmp = fma(-F, (t_0 * pow(fma(2.0, x, fma(F, F, 2.0)), -0.5)), (-x / tan(B)));
}
return tmp;
}
function code(F, B, x) t_0 = Float64(-1.0 / sin(B)) tmp = 0.0 if (F <= -2000000000000.0) tmp = Float64(t_0 - Float64(x / tan(B))); else tmp = fma(Float64(-F), Float64(t_0 * (fma(2.0, x, fma(F, F, 2.0)) ^ -0.5)), Float64(Float64(-x) / tan(B))); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -2000000000000.0], N[(t$95$0 - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-F) * N[(t$95$0 * N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision] + N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-1}{\sin B}\\
\mathbf{if}\;F \leq -2000000000000:\\
\;\;\;\;t\_0 - \frac{x}{\tan B}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-F, t\_0 \cdot {\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}, \frac{-x}{\tan B}\right)\\
\end{array}
\end{array}
if F < -2e12Initial program 76.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f64N/A
*-commutativeN/A
lower-*.f6484.4
Applied rewrites84.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites84.4%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6484.4
Applied rewrites84.5%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6455.5
Applied rewrites55.5%
if -2e12 < F Initial program 76.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites84.5%
(FPCore (F B x)
:precision binary64
(if (<= F -1e+14)
(- (/ -1.0 (sin B)) (/ x (tan B)))
(fma
(/ 1.0 (sin B))
(* (pow (fma 2.0 x (fma F F 2.0)) -0.5) F)
(/ (- x) (tan B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1e+14) {
tmp = (-1.0 / sin(B)) - (x / tan(B));
} else {
tmp = fma((1.0 / sin(B)), (pow(fma(2.0, x, fma(F, F, 2.0)), -0.5) * F), (-x / tan(B)));
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -1e+14) tmp = Float64(Float64(-1.0 / sin(B)) - Float64(x / tan(B))); else tmp = fma(Float64(1.0 / sin(B)), Float64((fma(2.0, x, fma(F, F, 2.0)) ^ -0.5) * F), Float64(Float64(-x) / tan(B))); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -1e+14], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * F), $MachinePrecision] + N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1 \cdot 10^{+14}:\\
\;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{\sin B}, {\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5} \cdot F, \frac{-x}{\tan B}\right)\\
\end{array}
\end{array}
if F < -1e14Initial program 76.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f64N/A
*-commutativeN/A
lower-*.f6484.4
Applied rewrites84.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites84.4%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6484.4
Applied rewrites84.5%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6455.5
Applied rewrites55.5%
if -1e14 < F Initial program 76.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites84.5%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ x (tan B))))
(if (<= F -5e+74)
(- (/ -1.0 (sin B)) t_0)
(- (/ F (* (sin B) (sqrt (fma F F 2.0)))) t_0))))
double code(double F, double B, double x) {
double t_0 = x / tan(B);
double tmp;
if (F <= -5e+74) {
tmp = (-1.0 / sin(B)) - t_0;
} else {
tmp = (F / (sin(B) * sqrt(fma(F, F, 2.0)))) - t_0;
}
return tmp;
}
function code(F, B, x) t_0 = Float64(x / tan(B)) tmp = 0.0 if (F <= -5e+74) tmp = Float64(Float64(-1.0 / sin(B)) - t_0); else tmp = Float64(Float64(F / Float64(sin(B) * sqrt(fma(F, F, 2.0)))) - t_0); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -5e+74], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[(N[(F / N[(N[Sin[B], $MachinePrecision] * N[Sqrt[N[(F * F + 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{\tan B}\\
\mathbf{if}\;F \leq -5 \cdot 10^{+74}:\\
\;\;\;\;\frac{-1}{\sin B} - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{F}{\sin B \cdot \sqrt{\mathsf{fma}\left(F, F, 2\right)}} - t\_0\\
\end{array}
\end{array}
if F < -4.99999999999999963e74Initial program 76.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f64N/A
*-commutativeN/A
lower-*.f6484.4
Applied rewrites84.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites84.4%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6484.4
Applied rewrites84.5%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6455.5
Applied rewrites55.5%
if -4.99999999999999963e74 < F Initial program 76.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f64N/A
*-commutativeN/A
lower-*.f6484.4
Applied rewrites84.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites84.4%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6484.4
Applied rewrites84.5%
Taylor expanded in x around 0
Applied rewrites84.5%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ -1.0 (sin B))))
(if (<= F -24000000.0)
(- t_0 (/ x (tan B)))
(if (<= F -1.15e-206)
(fma
(- F)
(* t_0 (pow (fma 2.0 x (fma F F 2.0)) -0.5))
(* -1.0 (/ x B)))
(if (<= F 1.65e-31)
(+
(- (* x (/ 1.0 (tan B))))
(* (/ F B) (pow (+ (+ (* F F) 2.0) (* 2.0 x)) (- (/ 1.0 2.0)))))
(if (<= F 4.8e+141)
(+
(- (/ x B))
(/ 1.0 (/ (* (sin B) (pow (fma x 2.0 (fma F F 2.0)) 0.5)) F)))
(/ (- x) (tan B))))))))
double code(double F, double B, double x) {
double t_0 = -1.0 / sin(B);
double tmp;
if (F <= -24000000.0) {
tmp = t_0 - (x / tan(B));
} else if (F <= -1.15e-206) {
tmp = fma(-F, (t_0 * pow(fma(2.0, x, fma(F, F, 2.0)), -0.5)), (-1.0 * (x / B)));
} else if (F <= 1.65e-31) {
tmp = -(x * (1.0 / tan(B))) + ((F / B) * pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
} else if (F <= 4.8e+141) {
tmp = -(x / B) + (1.0 / ((sin(B) * pow(fma(x, 2.0, fma(F, F, 2.0)), 0.5)) / F));
} else {
tmp = -x / tan(B);
}
return tmp;
}
function code(F, B, x) t_0 = Float64(-1.0 / sin(B)) tmp = 0.0 if (F <= -24000000.0) tmp = Float64(t_0 - Float64(x / tan(B))); elseif (F <= -1.15e-206) tmp = fma(Float64(-F), Float64(t_0 * (fma(2.0, x, fma(F, F, 2.0)) ^ -0.5)), Float64(-1.0 * Float64(x / B))); elseif (F <= 1.65e-31) tmp = Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(Float64(F / B) * (Float64(Float64(Float64(F * F) + 2.0) + Float64(2.0 * x)) ^ Float64(-Float64(1.0 / 2.0))))); elseif (F <= 4.8e+141) tmp = Float64(Float64(-Float64(x / B)) + Float64(1.0 / Float64(Float64(sin(B) * (fma(x, 2.0, fma(F, F, 2.0)) ^ 0.5)) / F))); else tmp = Float64(Float64(-x) / tan(B)); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -24000000.0], N[(t$95$0 - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, -1.15e-206], N[((-F) * N[(t$95$0 * N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision] + N[(-1.0 * N[(x / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.65e-31], N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(N[(F / B), $MachinePrecision] * N[Power[N[(N[(N[(F * F), $MachinePrecision] + 2.0), $MachinePrecision] + N[(2.0 * x), $MachinePrecision]), $MachinePrecision], (-N[(1.0 / 2.0), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 4.8e+141], N[((-N[(x / B), $MachinePrecision]) + N[(1.0 / N[(N[(N[Sin[B], $MachinePrecision] * N[Power[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-1}{\sin B}\\
\mathbf{if}\;F \leq -24000000:\\
\;\;\;\;t\_0 - \frac{x}{\tan B}\\
\mathbf{elif}\;F \leq -1.15 \cdot 10^{-206}:\\
\;\;\;\;\mathsf{fma}\left(-F, t\_0 \cdot {\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}, -1 \cdot \frac{x}{B}\right)\\
\mathbf{elif}\;F \leq 1.65 \cdot 10^{-31}:\\
\;\;\;\;\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}\\
\mathbf{elif}\;F \leq 4.8 \cdot 10^{+141}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{1}{\frac{\sin B \cdot {\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{0.5}}{F}}\\
\mathbf{else}:\\
\;\;\;\;\frac{-x}{\tan B}\\
\end{array}
\end{array}
if F < -2.4e7Initial program 76.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f64N/A
*-commutativeN/A
lower-*.f6484.4
Applied rewrites84.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites84.4%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6484.4
Applied rewrites84.5%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6455.5
Applied rewrites55.5%
if -2.4e7 < F < -1.15e-206Initial program 76.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites84.5%
Taylor expanded in B around 0
lower-*.f64N/A
lower-/.f6457.5
Applied rewrites57.5%
if -1.15e-206 < F < 1.65e-31Initial program 76.6%
Taylor expanded in B around 0
lower-/.f6462.5
Applied rewrites62.5%
if 1.65e-31 < F < 4.79999999999999995e141Initial program 76.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f64N/A
*-commutativeN/A
lower-*.f6484.4
Applied rewrites84.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites84.4%
Taylor expanded in B around 0
lower-/.f6457.5
Applied rewrites57.5%
if 4.79999999999999995e141 < F Initial program 76.6%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6455.6
Applied rewrites55.6%
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
associate-*l*N/A
mult-flipN/A
div-flip-revN/A
lift-sin.f64N/A
lift-cos.f64N/A
tan-quotN/A
lift-tan.f64N/A
mult-flip-revN/A
distribute-frac-negN/A
lift-neg.f64N/A
lift-/.f6455.6
Applied rewrites55.6%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ -1.0 (sin B))) (t_1 (/ (- x) (tan B))))
(if (<= F -24000000.0)
(- t_0 (/ x (tan B)))
(if (<= F -1.15e-206)
(fma
(- F)
(* t_0 (pow (fma 2.0 x (fma F F 2.0)) -0.5))
(* -1.0 (/ x B)))
(if (<= F 6.9e-183)
t_1
(if (<= F 4.8e+141)
(+
(- (/ x B))
(/ 1.0 (/ (* (sin B) (pow (fma x 2.0 (fma F F 2.0)) 0.5)) F)))
t_1))))))
double code(double F, double B, double x) {
double t_0 = -1.0 / sin(B);
double t_1 = -x / tan(B);
double tmp;
if (F <= -24000000.0) {
tmp = t_0 - (x / tan(B));
} else if (F <= -1.15e-206) {
tmp = fma(-F, (t_0 * pow(fma(2.0, x, fma(F, F, 2.0)), -0.5)), (-1.0 * (x / B)));
} else if (F <= 6.9e-183) {
tmp = t_1;
} else if (F <= 4.8e+141) {
tmp = -(x / B) + (1.0 / ((sin(B) * pow(fma(x, 2.0, fma(F, F, 2.0)), 0.5)) / F));
} else {
tmp = t_1;
}
return tmp;
}
function code(F, B, x) t_0 = Float64(-1.0 / sin(B)) t_1 = Float64(Float64(-x) / tan(B)) tmp = 0.0 if (F <= -24000000.0) tmp = Float64(t_0 - Float64(x / tan(B))); elseif (F <= -1.15e-206) tmp = fma(Float64(-F), Float64(t_0 * (fma(2.0, x, fma(F, F, 2.0)) ^ -0.5)), Float64(-1.0 * Float64(x / B))); elseif (F <= 6.9e-183) tmp = t_1; elseif (F <= 4.8e+141) tmp = Float64(Float64(-Float64(x / B)) + Float64(1.0 / Float64(Float64(sin(B) * (fma(x, 2.0, fma(F, F, 2.0)) ^ 0.5)) / F))); else tmp = t_1; end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -24000000.0], N[(t$95$0 - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, -1.15e-206], N[((-F) * N[(t$95$0 * N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision] + N[(-1.0 * N[(x / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 6.9e-183], t$95$1, If[LessEqual[F, 4.8e+141], N[((-N[(x / B), $MachinePrecision]) + N[(1.0 / N[(N[(N[Sin[B], $MachinePrecision] * N[Power[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-1}{\sin B}\\
t_1 := \frac{-x}{\tan B}\\
\mathbf{if}\;F \leq -24000000:\\
\;\;\;\;t\_0 - \frac{x}{\tan B}\\
\mathbf{elif}\;F \leq -1.15 \cdot 10^{-206}:\\
\;\;\;\;\mathsf{fma}\left(-F, t\_0 \cdot {\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}, -1 \cdot \frac{x}{B}\right)\\
\mathbf{elif}\;F \leq 6.9 \cdot 10^{-183}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;F \leq 4.8 \cdot 10^{+141}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{1}{\frac{\sin B \cdot {\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{0.5}}{F}}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if F < -2.4e7Initial program 76.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f64N/A
*-commutativeN/A
lower-*.f6484.4
Applied rewrites84.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites84.4%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6484.4
Applied rewrites84.5%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6455.5
Applied rewrites55.5%
if -2.4e7 < F < -1.15e-206Initial program 76.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites84.5%
Taylor expanded in B around 0
lower-*.f64N/A
lower-/.f6457.5
Applied rewrites57.5%
if -1.15e-206 < F < 6.9000000000000001e-183 or 4.79999999999999995e141 < F Initial program 76.6%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6455.6
Applied rewrites55.6%
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
associate-*l*N/A
mult-flipN/A
div-flip-revN/A
lift-sin.f64N/A
lift-cos.f64N/A
tan-quotN/A
lift-tan.f64N/A
mult-flip-revN/A
distribute-frac-negN/A
lift-neg.f64N/A
lift-/.f6455.6
Applied rewrites55.6%
if 6.9000000000000001e-183 < F < 4.79999999999999995e141Initial program 76.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f64N/A
*-commutativeN/A
lower-*.f6484.4
Applied rewrites84.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites84.4%
Taylor expanded in B around 0
lower-/.f6457.5
Applied rewrites57.5%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ (- x) (tan B))))
(if (<= x -2.45e-20)
t_0
(if (<= x 3850000000000.0)
(+
(- (/ x B))
(/ 1.0 (/ (* (sin B) (pow (fma x 2.0 (fma F F 2.0)) 0.5)) F)))
t_0))))
double code(double F, double B, double x) {
double t_0 = -x / tan(B);
double tmp;
if (x <= -2.45e-20) {
tmp = t_0;
} else if (x <= 3850000000000.0) {
tmp = -(x / B) + (1.0 / ((sin(B) * pow(fma(x, 2.0, fma(F, F, 2.0)), 0.5)) / F));
} else {
tmp = t_0;
}
return tmp;
}
function code(F, B, x) t_0 = Float64(Float64(-x) / tan(B)) tmp = 0.0 if (x <= -2.45e-20) tmp = t_0; elseif (x <= 3850000000000.0) tmp = Float64(Float64(-Float64(x / B)) + Float64(1.0 / Float64(Float64(sin(B) * (fma(x, 2.0, fma(F, F, 2.0)) ^ 0.5)) / F))); else tmp = t_0; end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.45e-20], t$95$0, If[LessEqual[x, 3850000000000.0], N[((-N[(x / B), $MachinePrecision]) + N[(1.0 / N[(N[(N[Sin[B], $MachinePrecision] * N[Power[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-x}{\tan B}\\
\mathbf{if}\;x \leq -2.45 \cdot 10^{-20}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 3850000000000:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{1}{\frac{\sin B \cdot {\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{0.5}}{F}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -2.4500000000000001e-20 or 3.85e12 < x Initial program 76.6%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6455.6
Applied rewrites55.6%
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
associate-*l*N/A
mult-flipN/A
div-flip-revN/A
lift-sin.f64N/A
lift-cos.f64N/A
tan-quotN/A
lift-tan.f64N/A
mult-flip-revN/A
distribute-frac-negN/A
lift-neg.f64N/A
lift-/.f6455.6
Applied rewrites55.6%
if -2.4500000000000001e-20 < x < 3.85e12Initial program 76.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f64N/A
*-commutativeN/A
lower-*.f6484.4
Applied rewrites84.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites84.4%
Taylor expanded in B around 0
lower-/.f6457.5
Applied rewrites57.5%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ (- x) (tan B))))
(if (<= x -2.45e-20)
t_0
(if (<= x 3850000000000.0)
(- (/ F (* (sin B) (sqrt (fma F F (fma 2.0 x 2.0))))) (/ x B))
t_0))))
double code(double F, double B, double x) {
double t_0 = -x / tan(B);
double tmp;
if (x <= -2.45e-20) {
tmp = t_0;
} else if (x <= 3850000000000.0) {
tmp = (F / (sin(B) * sqrt(fma(F, F, fma(2.0, x, 2.0))))) - (x / B);
} else {
tmp = t_0;
}
return tmp;
}
function code(F, B, x) t_0 = Float64(Float64(-x) / tan(B)) tmp = 0.0 if (x <= -2.45e-20) tmp = t_0; elseif (x <= 3850000000000.0) tmp = Float64(Float64(F / Float64(sin(B) * sqrt(fma(F, F, fma(2.0, x, 2.0))))) - Float64(x / B)); else tmp = t_0; end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.45e-20], t$95$0, If[LessEqual[x, 3850000000000.0], N[(N[(F / N[(N[Sin[B], $MachinePrecision] * N[Sqrt[N[(F * F + N[(2.0 * x + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-x}{\tan B}\\
\mathbf{if}\;x \leq -2.45 \cdot 10^{-20}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 3850000000000:\\
\;\;\;\;\frac{F}{\sin B \cdot \sqrt{\mathsf{fma}\left(F, F, \mathsf{fma}\left(2, x, 2\right)\right)}} - \frac{x}{B}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -2.4500000000000001e-20 or 3.85e12 < x Initial program 76.6%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6455.6
Applied rewrites55.6%
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
associate-*l*N/A
mult-flipN/A
div-flip-revN/A
lift-sin.f64N/A
lift-cos.f64N/A
tan-quotN/A
lift-tan.f64N/A
mult-flip-revN/A
distribute-frac-negN/A
lift-neg.f64N/A
lift-/.f6455.6
Applied rewrites55.6%
if -2.4500000000000001e-20 < x < 3.85e12Initial program 76.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f64N/A
*-commutativeN/A
lower-*.f6484.4
Applied rewrites84.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites84.4%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6484.4
Applied rewrites84.5%
Taylor expanded in B around 0
lower-/.f6457.5
Applied rewrites57.5%
(FPCore (F B x) :precision binary64 (if (<= B 2.5e-7) (/ (- (* F (pow (+ 2.0 (fma 2.0 x (pow F 2.0))) -0.5)) x) B) (/ (- x) (tan B))))
double code(double F, double B, double x) {
double tmp;
if (B <= 2.5e-7) {
tmp = ((F * pow((2.0 + fma(2.0, x, pow(F, 2.0))), -0.5)) - x) / B;
} else {
tmp = -x / tan(B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (B <= 2.5e-7) tmp = Float64(Float64(Float64(F * (Float64(2.0 + fma(2.0, x, (F ^ 2.0))) ^ -0.5)) - x) / B); else tmp = Float64(Float64(-x) / tan(B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[B, 2.5e-7], N[(N[(N[(F * N[Power[N[(2.0 + N[(2.0 * x + N[Power[F, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq 2.5 \cdot 10^{-7}:\\
\;\;\;\;\frac{F \cdot {\left(2 + \mathsf{fma}\left(2, x, {F}^{2}\right)\right)}^{-0.5} - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{-x}{\tan B}\\
\end{array}
\end{array}
if B < 2.49999999999999989e-7Initial program 76.6%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites44.2%
if 2.49999999999999989e-7 < B Initial program 76.6%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6455.6
Applied rewrites55.6%
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
associate-*l*N/A
mult-flipN/A
div-flip-revN/A
lift-sin.f64N/A
lift-cos.f64N/A
tan-quotN/A
lift-tan.f64N/A
mult-flip-revN/A
distribute-frac-negN/A
lift-neg.f64N/A
lift-/.f6455.6
Applied rewrites55.6%
(FPCore (F B x) :precision binary64 (if (<= B 2.5e-7) (/ (- (/ F (sqrt (+ 2.0 (fma 2.0 x (pow F 2.0))))) x) B) (/ (- x) (tan B))))
double code(double F, double B, double x) {
double tmp;
if (B <= 2.5e-7) {
tmp = ((F / sqrt((2.0 + fma(2.0, x, pow(F, 2.0))))) - x) / B;
} else {
tmp = -x / tan(B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (B <= 2.5e-7) tmp = Float64(Float64(Float64(F / sqrt(Float64(2.0 + fma(2.0, x, (F ^ 2.0))))) - x) / B); else tmp = Float64(Float64(-x) / tan(B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[B, 2.5e-7], N[(N[(N[(F / N[Sqrt[N[(2.0 + N[(2.0 * x + N[Power[F, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq 2.5 \cdot 10^{-7}:\\
\;\;\;\;\frac{\frac{F}{\sqrt{2 + \mathsf{fma}\left(2, x, {F}^{2}\right)}} - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{-x}{\tan B}\\
\end{array}
\end{array}
if B < 2.49999999999999989e-7Initial program 76.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f64N/A
*-commutativeN/A
lower-*.f6484.4
Applied rewrites84.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites84.4%
Taylor expanded in B around 0
lower-/.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6444.2
Applied rewrites44.2%
if 2.49999999999999989e-7 < B Initial program 76.6%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6455.6
Applied rewrites55.6%
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
associate-*l*N/A
mult-flipN/A
div-flip-revN/A
lift-sin.f64N/A
lift-cos.f64N/A
tan-quotN/A
lift-tan.f64N/A
mult-flip-revN/A
distribute-frac-negN/A
lift-neg.f64N/A
lift-/.f6455.6
Applied rewrites55.6%
(FPCore (F B x)
:precision binary64
(if (<= F -2.2e+14)
(/ -1.0 (sin B))
(if (<= F 0.009)
(/ (- (/ F (sqrt (+ 2.0 (fma 2.0 x (pow F 2.0))))) x) B)
(/ 1.0 (sin B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -2.2e+14) {
tmp = -1.0 / sin(B);
} else if (F <= 0.009) {
tmp = ((F / sqrt((2.0 + fma(2.0, x, pow(F, 2.0))))) - x) / B;
} else {
tmp = 1.0 / sin(B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -2.2e+14) tmp = Float64(-1.0 / sin(B)); elseif (F <= 0.009) tmp = Float64(Float64(Float64(F / sqrt(Float64(2.0 + fma(2.0, x, (F ^ 2.0))))) - x) / B); else tmp = Float64(1.0 / sin(B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -2.2e+14], N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 0.009], N[(N[(N[(F / N[Sqrt[N[(2.0 + N[(2.0 * x + N[Power[F, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -2.2 \cdot 10^{+14}:\\
\;\;\;\;\frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 0.009:\\
\;\;\;\;\frac{\frac{F}{\sqrt{2 + \mathsf{fma}\left(2, x, {F}^{2}\right)}} - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B}\\
\end{array}
\end{array}
if F < -2.2e14Initial program 76.6%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6417.7
Applied rewrites17.7%
if -2.2e14 < F < 0.00899999999999999932Initial program 76.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f64N/A
*-commutativeN/A
lower-*.f6484.4
Applied rewrites84.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites84.4%
Taylor expanded in B around 0
lower-/.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6444.2
Applied rewrites44.2%
if 0.00899999999999999932 < F Initial program 76.6%
Taylor expanded in F around inf
lower-/.f64N/A
lower-sin.f6417.8
Applied rewrites17.8%
(FPCore (F B x) :precision binary64 (if (<= B 7800000.0) (/ (- (/ F (sqrt (+ 2.0 (fma 2.0 x (pow F 2.0))))) x) B) (/ -1.0 (sin B))))
double code(double F, double B, double x) {
double tmp;
if (B <= 7800000.0) {
tmp = ((F / sqrt((2.0 + fma(2.0, x, pow(F, 2.0))))) - x) / B;
} else {
tmp = -1.0 / sin(B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (B <= 7800000.0) tmp = Float64(Float64(Float64(F / sqrt(Float64(2.0 + fma(2.0, x, (F ^ 2.0))))) - x) / B); else tmp = Float64(-1.0 / sin(B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[B, 7800000.0], N[(N[(N[(F / N[Sqrt[N[(2.0 + N[(2.0 * x + N[Power[F, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq 7800000:\\
\;\;\;\;\frac{\frac{F}{\sqrt{2 + \mathsf{fma}\left(2, x, {F}^{2}\right)}} - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{-1}{\sin B}\\
\end{array}
\end{array}
if B < 7.8e6Initial program 76.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f64N/A
*-commutativeN/A
lower-*.f6484.4
Applied rewrites84.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites84.4%
Taylor expanded in B around 0
lower-/.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6444.2
Applied rewrites44.2%
if 7.8e6 < B Initial program 76.6%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6417.7
Applied rewrites17.7%
(FPCore (F B x) :precision binary64 (/ (- (/ F (sqrt (+ 2.0 (fma 2.0 x (pow F 2.0))))) x) B))
double code(double F, double B, double x) {
return ((F / sqrt((2.0 + fma(2.0, x, pow(F, 2.0))))) - x) / B;
}
function code(F, B, x) return Float64(Float64(Float64(F / sqrt(Float64(2.0 + fma(2.0, x, (F ^ 2.0))))) - x) / B) end
code[F_, B_, x_] := N[(N[(N[(F / N[Sqrt[N[(2.0 + N[(2.0 * x + N[Power[F, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{F}{\sqrt{2 + \mathsf{fma}\left(2, x, {F}^{2}\right)}} - x}{B}
\end{array}
Initial program 76.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f64N/A
*-commutativeN/A
lower-*.f6484.4
Applied rewrites84.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites84.4%
Taylor expanded in B around 0
lower-/.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6444.2
Applied rewrites44.2%
(FPCore (F B x) :precision binary64 (if (<= F -6.5e-10) (/ (- (* -0.16666666666666666 (pow B 2.0)) 1.0) B) (* -1.0 (/ (fma (* (* -0.3333333333333333 x) B) B x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -6.5e-10) {
tmp = ((-0.16666666666666666 * pow(B, 2.0)) - 1.0) / B;
} else {
tmp = -1.0 * (fma(((-0.3333333333333333 * x) * B), B, x) / B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -6.5e-10) tmp = Float64(Float64(Float64(-0.16666666666666666 * (B ^ 2.0)) - 1.0) / B); else tmp = Float64(-1.0 * Float64(fma(Float64(Float64(-0.3333333333333333 * x) * B), B, x) / B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -6.5e-10], N[(N[(N[(-0.16666666666666666 * N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision] / B), $MachinePrecision], N[(-1.0 * N[(N[(N[(N[(-0.3333333333333333 * x), $MachinePrecision] * B), $MachinePrecision] * B + x), $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -6.5 \cdot 10^{-10}:\\
\;\;\;\;\frac{-0.16666666666666666 \cdot {B}^{2} - 1}{B}\\
\mathbf{else}:\\
\;\;\;\;-1 \cdot \frac{\mathsf{fma}\left(\left(-0.3333333333333333 \cdot x\right) \cdot B, B, x\right)}{B}\\
\end{array}
\end{array}
if F < -6.5000000000000003e-10Initial program 76.6%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6417.7
Applied rewrites17.7%
Taylor expanded in B around 0
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-pow.f6410.5
Applied rewrites10.5%
if -6.5000000000000003e-10 < F Initial program 76.6%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6455.6
Applied rewrites55.6%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites29.3%
metadata-evalN/A
metadata-evalN/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites29.5%
(FPCore (F B x) :precision binary64 (if (<= F -6.5e-10) (/ -1.0 B) (* -1.0 (/ (fma (* (* -0.3333333333333333 x) B) B x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -6.5e-10) {
tmp = -1.0 / B;
} else {
tmp = -1.0 * (fma(((-0.3333333333333333 * x) * B), B, x) / B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -6.5e-10) tmp = Float64(-1.0 / B); else tmp = Float64(-1.0 * Float64(fma(Float64(Float64(-0.3333333333333333 * x) * B), B, x) / B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -6.5e-10], N[(-1.0 / B), $MachinePrecision], N[(-1.0 * N[(N[(N[(N[(-0.3333333333333333 * x), $MachinePrecision] * B), $MachinePrecision] * B + x), $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -6.5 \cdot 10^{-10}:\\
\;\;\;\;\frac{-1}{B}\\
\mathbf{else}:\\
\;\;\;\;-1 \cdot \frac{\mathsf{fma}\left(\left(-0.3333333333333333 \cdot x\right) \cdot B, B, x\right)}{B}\\
\end{array}
\end{array}
if F < -6.5000000000000003e-10Initial program 76.6%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6417.7
Applied rewrites17.7%
Taylor expanded in B around 0
Applied rewrites10.7%
if -6.5000000000000003e-10 < F Initial program 76.6%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6455.6
Applied rewrites55.6%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites29.3%
metadata-evalN/A
metadata-evalN/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites29.5%
(FPCore (F B x) :precision binary64 (if (<= F -6.5e-10) (/ -1.0 B) (- (/ (fma (* -0.3333333333333333 x) (* B B) x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -6.5e-10) {
tmp = -1.0 / B;
} else {
tmp = -(fma((-0.3333333333333333 * x), (B * B), x) / B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -6.5e-10) tmp = Float64(-1.0 / B); else tmp = Float64(-Float64(fma(Float64(-0.3333333333333333 * x), Float64(B * B), x) / B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -6.5e-10], N[(-1.0 / B), $MachinePrecision], (-N[(N[(N[(-0.3333333333333333 * x), $MachinePrecision] * N[(B * B), $MachinePrecision] + x), $MachinePrecision] / B), $MachinePrecision])]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -6.5 \cdot 10^{-10}:\\
\;\;\;\;\frac{-1}{B}\\
\mathbf{else}:\\
\;\;\;\;-\frac{\mathsf{fma}\left(-0.3333333333333333 \cdot x, B \cdot B, x\right)}{B}\\
\end{array}
\end{array}
if F < -6.5000000000000003e-10Initial program 76.6%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6417.7
Applied rewrites17.7%
Taylor expanded in B around 0
Applied rewrites10.7%
if -6.5000000000000003e-10 < F Initial program 76.6%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6455.6
Applied rewrites55.6%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites29.3%
metadata-evalN/A
metadata-evalN/A
lift-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
Applied rewrites29.3%
(FPCore (F B x) :precision binary64 (if (<= F -6.5e-10) (/ -1.0 B) (- (/ x B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -6.5e-10) {
tmp = -1.0 / 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 <= (-6.5d-10)) then
tmp = (-1.0d0) / 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 <= -6.5e-10) {
tmp = -1.0 / B;
} else {
tmp = -(x / B);
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -6.5e-10: tmp = -1.0 / B else: tmp = -(x / B) return tmp
function code(F, B, x) tmp = 0.0 if (F <= -6.5e-10) tmp = Float64(-1.0 / B); else tmp = Float64(-Float64(x / B)); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -6.5e-10) tmp = -1.0 / B; else tmp = -(x / B); end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -6.5e-10], N[(-1.0 / B), $MachinePrecision], (-N[(x / B), $MachinePrecision])]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -6.5 \cdot 10^{-10}:\\
\;\;\;\;\frac{-1}{B}\\
\mathbf{else}:\\
\;\;\;\;-\frac{x}{B}\\
\end{array}
\end{array}
if F < -6.5000000000000003e-10Initial program 76.6%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6417.7
Applied rewrites17.7%
Taylor expanded in B around 0
Applied rewrites10.7%
if -6.5000000000000003e-10 < F Initial program 76.6%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6455.6
Applied rewrites55.6%
Taylor expanded in B around 0
lower-/.f6429.3
Applied rewrites29.3%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6429.3
Applied rewrites29.3%
(FPCore (F B x) :precision binary64 (/ -1.0 B))
double code(double F, double B, double x) {
return -1.0 / B;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
code = (-1.0d0) / b
end function
public static double code(double F, double B, double x) {
return -1.0 / B;
}
def code(F, B, x): return -1.0 / B
function code(F, B, x) return Float64(-1.0 / B) end
function tmp = code(F, B, x) tmp = -1.0 / B; end
code[F_, B_, x_] := N[(-1.0 / B), $MachinePrecision]
\begin{array}{l}
\\
\frac{-1}{B}
\end{array}
Initial program 76.6%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6417.7
Applied rewrites17.7%
Taylor expanded in B around 0
Applied rewrites10.7%
herbie shell --seed 2025163
(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))))))