
(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}
Sampling outcomes in binary64 precision:
Herbie found 21 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 -2e+26)
(/ (- -1.0 t_0) (sin B))
(if (<= F 60000.0)
(+ (/ (- x) (tan B)) (/ F (* (sqrt (fma 2.0 x (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 <= -2e+26) {
tmp = (-1.0 - t_0) / sin(B);
} else if (F <= 60000.0) {
tmp = (-x / tan(B)) + (F / (sqrt(fma(2.0, x, 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 <= -2e+26) tmp = Float64(Float64(-1.0 - t_0) / sin(B)); elseif (F <= 60000.0) tmp = Float64(Float64(Float64(-x) / tan(B)) + Float64(F / Float64(sqrt(fma(2.0, x, 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, -2e+26], N[(N[(-1.0 - t$95$0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 60000.0], N[(N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision] + N[(F / N[(N[Sqrt[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 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 -2 \cdot 10^{+26}:\\
\;\;\;\;\frac{-1 - t\_0}{\sin B}\\
\mathbf{elif}\;F \leq 60000:\\
\;\;\;\;\frac{-x}{\tan B} + \frac{F}{\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)} \cdot \sin B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - t\_0}{\sin B}\\
\end{array}
\end{array}
if F < -2.0000000000000001e26Initial program 45.8%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6499.8
Applied rewrites99.8%
if -2.0000000000000001e26 < F < 6e4Initial program 99.3%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites99.3%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6499.5
Applied rewrites99.5%
lift-*.f64N/A
lift-pow.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
+-commutativeN/A
+-commutativeN/A
pow2N/A
associate-+r+N/A
pow2N/A
metadata-evalN/A
sqrt-pow1N/A
pow2N/A
+-commutativeN/A
inv-powN/A
sqrt-divN/A
metadata-evalN/A
Applied rewrites99.6%
lift-/.f64N/A
lift-*.f64N/A
lift-/.f64N/A
*-rgt-identityN/A
lift-sqrt.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
lift-sin.f64N/A
associate-/l/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
lift-sqrt.f64N/A
lift-sin.f6499.6
Applied rewrites99.6%
if 6e4 < F Initial program 55.7%
Taylor expanded in F around inf
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6499.6
Applied rewrites99.6%
Final simplification99.7%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ F (sqrt (fma 2.0 x (fma F F 2.0))))) (t_1 (* (cos B) x)))
(if (<= F -7000000.0)
(/ (- -1.0 t_1) (sin B))
(if (<= F 7.5e-58)
(+ (/ (- x) (tan B)) (/ t_0 B))
(if (<= F 39000.0)
(+ (/ (- x) B) (/ t_0 (sin B)))
(/ (- 1.0 t_1) (sin B)))))))
double code(double F, double B, double x) {
double t_0 = F / sqrt(fma(2.0, x, fma(F, F, 2.0)));
double t_1 = cos(B) * x;
double tmp;
if (F <= -7000000.0) {
tmp = (-1.0 - t_1) / sin(B);
} else if (F <= 7.5e-58) {
tmp = (-x / tan(B)) + (t_0 / B);
} else if (F <= 39000.0) {
tmp = (-x / B) + (t_0 / sin(B));
} else {
tmp = (1.0 - t_1) / sin(B);
}
return tmp;
}
function code(F, B, x) t_0 = Float64(F / sqrt(fma(2.0, x, fma(F, F, 2.0)))) t_1 = Float64(cos(B) * x) tmp = 0.0 if (F <= -7000000.0) tmp = Float64(Float64(-1.0 - t_1) / sin(B)); elseif (F <= 7.5e-58) tmp = Float64(Float64(Float64(-x) / tan(B)) + Float64(t_0 / B)); elseif (F <= 39000.0) tmp = Float64(Float64(Float64(-x) / B) + Float64(t_0 / sin(B))); else tmp = Float64(Float64(1.0 - t_1) / sin(B)); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(F / N[Sqrt[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[F, -7000000.0], N[(N[(-1.0 - t$95$1), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 7.5e-58], N[(N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision] + N[(t$95$0 / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 39000.0], N[(N[((-x) / B), $MachinePrecision] + N[(t$95$0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - t$95$1), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{F}{\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}\\
t_1 := \cos B \cdot x\\
\mathbf{if}\;F \leq -7000000:\\
\;\;\;\;\frac{-1 - t\_1}{\sin B}\\
\mathbf{elif}\;F \leq 7.5 \cdot 10^{-58}:\\
\;\;\;\;\frac{-x}{\tan B} + \frac{t\_0}{B}\\
\mathbf{elif}\;F \leq 39000:\\
\;\;\;\;\frac{-x}{B} + \frac{t\_0}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - t\_1}{\sin B}\\
\end{array}
\end{array}
if F < -7e6Initial program 49.7%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6499.8
Applied rewrites99.8%
if -7e6 < F < 7.50000000000000002e-58Initial program 99.3%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites99.3%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6499.6
Applied rewrites99.6%
lift-*.f64N/A
lift-pow.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
+-commutativeN/A
+-commutativeN/A
pow2N/A
associate-+r+N/A
pow2N/A
metadata-evalN/A
sqrt-pow1N/A
pow2N/A
+-commutativeN/A
inv-powN/A
sqrt-divN/A
metadata-evalN/A
Applied rewrites99.6%
Taylor expanded in B around 0
Applied rewrites85.4%
if 7.50000000000000002e-58 < F < 39000Initial program 99.1%
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-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites98.7%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6498.7
Applied rewrites98.7%
lift-*.f64N/A
lift-pow.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
+-commutativeN/A
+-commutativeN/A
pow2N/A
associate-+r+N/A
pow2N/A
metadata-evalN/A
sqrt-pow1N/A
pow2N/A
+-commutativeN/A
inv-powN/A
sqrt-divN/A
metadata-evalN/A
Applied rewrites99.4%
Taylor expanded in B around 0
associate-*r/N/A
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lower-neg.f6486.2
Applied rewrites86.2%
if 39000 < F Initial program 55.7%
Taylor expanded in F around inf
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6499.6
Applied rewrites99.6%
Final simplification92.6%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ F (sqrt (fma 2.0 x (fma F F 2.0))))))
(if (<= F -6e+150)
(+ (- (/ x B)) (/ -1.0 (sin B)))
(if (<= F 7.5e-58)
(+ (/ (- x) (tan B)) (/ t_0 B))
(if (<= F 39000.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(fma(2.0, x, fma(F, F, 2.0)));
double tmp;
if (F <= -6e+150) {
tmp = -(x / B) + (-1.0 / sin(B));
} else if (F <= 7.5e-58) {
tmp = (-x / tan(B)) + (t_0 / B);
} else if (F <= 39000.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(fma(2.0, x, fma(F, F, 2.0)))) tmp = 0.0 if (F <= -6e+150) tmp = Float64(Float64(-Float64(x / B)) + Float64(-1.0 / sin(B))); elseif (F <= 7.5e-58) tmp = Float64(Float64(Float64(-x) / tan(B)) + Float64(t_0 / B)); elseif (F <= 39000.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[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -6e+150], N[((-N[(x / B), $MachinePrecision]) + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 7.5e-58], N[(N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision] + N[(t$95$0 / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 39000.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 := \frac{F}{\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}\\
\mathbf{if}\;F \leq -6 \cdot 10^{+150}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 7.5 \cdot 10^{-58}:\\
\;\;\;\;\frac{-x}{\tan B} + \frac{t\_0}{B}\\
\mathbf{elif}\;F \leq 39000:\\
\;\;\;\;\frac{-x}{B} + \frac{t\_0}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - \cos B \cdot x}{\sin B}\\
\end{array}
\end{array}
if F < -6.00000000000000025e150Initial program 13.0%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
Taylor expanded in B around 0
lower-/.f6492.8
Applied rewrites92.8%
if -6.00000000000000025e150 < F < 7.50000000000000002e-58Initial program 99.3%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites99.3%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6499.6
Applied rewrites99.6%
lift-*.f64N/A
lift-pow.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
+-commutativeN/A
+-commutativeN/A
pow2N/A
associate-+r+N/A
pow2N/A
metadata-evalN/A
sqrt-pow1N/A
pow2N/A
+-commutativeN/A
inv-powN/A
sqrt-divN/A
metadata-evalN/A
Applied rewrites99.6%
Taylor expanded in B around 0
Applied rewrites84.0%
if 7.50000000000000002e-58 < F < 39000Initial program 99.1%
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-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites98.7%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6498.7
Applied rewrites98.7%
lift-*.f64N/A
lift-pow.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
+-commutativeN/A
+-commutativeN/A
pow2N/A
associate-+r+N/A
pow2N/A
metadata-evalN/A
sqrt-pow1N/A
pow2N/A
+-commutativeN/A
inv-powN/A
sqrt-divN/A
metadata-evalN/A
Applied rewrites99.4%
Taylor expanded in B around 0
associate-*r/N/A
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lower-neg.f6486.2
Applied rewrites86.2%
if 39000 < F Initial program 55.7%
Taylor expanded in F around inf
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6499.6
Applied rewrites99.6%
Final simplification89.7%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (- (/ x B))))
(if (<= F -6e+150)
(+ t_0 (/ -1.0 (sin B)))
(if (<= F 4.2e+120)
(+ (/ (- x) (tan B)) (/ (/ F (sqrt (fma 2.0 x (fma F F 2.0)))) B))
(+
t_0
(/ (* F (/ (fma (/ (/ (fma 2.0 x 2.0) F) F) -0.5 1.0) F)) (sin B)))))))
double code(double F, double B, double x) {
double t_0 = -(x / B);
double tmp;
if (F <= -6e+150) {
tmp = t_0 + (-1.0 / sin(B));
} else if (F <= 4.2e+120) {
tmp = (-x / tan(B)) + ((F / sqrt(fma(2.0, x, fma(F, F, 2.0)))) / B);
} else {
tmp = t_0 + ((F * (fma(((fma(2.0, x, 2.0) / F) / F), -0.5, 1.0) / F)) / sin(B));
}
return tmp;
}
function code(F, B, x) t_0 = Float64(-Float64(x / B)) tmp = 0.0 if (F <= -6e+150) tmp = Float64(t_0 + Float64(-1.0 / sin(B))); elseif (F <= 4.2e+120) tmp = Float64(Float64(Float64(-x) / tan(B)) + Float64(Float64(F / sqrt(fma(2.0, x, fma(F, F, 2.0)))) / B)); else tmp = Float64(t_0 + Float64(Float64(F * Float64(fma(Float64(Float64(fma(2.0, x, 2.0) / F) / F), -0.5, 1.0) / F)) / sin(B))); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = (-N[(x / B), $MachinePrecision])}, If[LessEqual[F, -6e+150], N[(t$95$0 + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 4.2e+120], N[(N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision] + N[(N[(F / N[Sqrt[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(N[(F * N[(N[(N[(N[(N[(2.0 * x + 2.0), $MachinePrecision] / F), $MachinePrecision] / F), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -\frac{x}{B}\\
\mathbf{if}\;F \leq -6 \cdot 10^{+150}:\\
\;\;\;\;t\_0 + \frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 4.2 \cdot 10^{+120}:\\
\;\;\;\;\frac{-x}{\tan B} + \frac{\frac{F}{\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}}{B}\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \frac{F \cdot \frac{\mathsf{fma}\left(\frac{\frac{\mathsf{fma}\left(2, x, 2\right)}{F}}{F}, -0.5, 1\right)}{F}}{\sin B}\\
\end{array}
\end{array}
if F < -6.00000000000000025e150Initial program 13.0%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
Taylor expanded in B around 0
lower-/.f6492.8
Applied rewrites92.8%
if -6.00000000000000025e150 < F < 4.2000000000000001e120Initial program 98.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-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites99.4%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6499.5
Applied rewrites99.5%
lift-*.f64N/A
lift-pow.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
+-commutativeN/A
+-commutativeN/A
pow2N/A
associate-+r+N/A
pow2N/A
metadata-evalN/A
sqrt-pow1N/A
pow2N/A
+-commutativeN/A
inv-powN/A
sqrt-divN/A
metadata-evalN/A
Applied rewrites99.6%
Taylor expanded in B around 0
Applied rewrites80.0%
if 4.2000000000000001e120 < F Initial program 39.0%
Taylor expanded in F around inf
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites67.9%
Taylor expanded in B around 0
lower-/.f6447.4
Applied rewrites47.4%
metadata-evalN/A
metadata-evalN/A
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites79.0%
Final simplification81.3%
(FPCore (F B x) :precision binary64 (if (or (<= x -2.9e-9) (not (<= x 2.75e-14))) (+ (/ (- x) (tan B)) (/ -1.0 (* (fma (* B B) -0.16666666666666666 1.0) B))) (+ (/ (- x) B) (/ (/ F (sqrt (fma 2.0 x (fma F F 2.0)))) (sin B)))))
double code(double F, double B, double x) {
double tmp;
if ((x <= -2.9e-9) || !(x <= 2.75e-14)) {
tmp = (-x / tan(B)) + (-1.0 / (fma((B * B), -0.16666666666666666, 1.0) * B));
} else {
tmp = (-x / B) + ((F / sqrt(fma(2.0, x, fma(F, F, 2.0)))) / sin(B));
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if ((x <= -2.9e-9) || !(x <= 2.75e-14)) tmp = Float64(Float64(Float64(-x) / tan(B)) + Float64(-1.0 / Float64(fma(Float64(B * B), -0.16666666666666666, 1.0) * B))); else tmp = Float64(Float64(Float64(-x) / B) + Float64(Float64(F / sqrt(fma(2.0, x, fma(F, F, 2.0)))) / sin(B))); end return tmp end
code[F_, B_, x_] := If[Or[LessEqual[x, -2.9e-9], N[Not[LessEqual[x, 2.75e-14]], $MachinePrecision]], N[(N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision] + N[(-1.0 / N[(N[(N[(B * B), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[((-x) / B), $MachinePrecision] + N[(N[(F / N[Sqrt[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.9 \cdot 10^{-9} \lor \neg \left(x \leq 2.75 \cdot 10^{-14}\right):\\
\;\;\;\;\frac{-x}{\tan B} + \frac{-1}{\mathsf{fma}\left(B \cdot B, -0.16666666666666666, 1\right) \cdot B}\\
\mathbf{else}:\\
\;\;\;\;\frac{-x}{B} + \frac{\frac{F}{\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}}{\sin B}\\
\end{array}
\end{array}
if x < -2.89999999999999991e-9 or 2.74999999999999996e-14 < x Initial program 83.3%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6494.0
Applied rewrites94.0%
Taylor expanded in B around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6495.3
Applied rewrites95.3%
Applied rewrites95.5%
if -2.89999999999999991e-9 < x < 2.74999999999999996e-14Initial program 70.7%
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-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites71.6%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6471.7
Applied rewrites71.7%
lift-*.f64N/A
lift-pow.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
+-commutativeN/A
+-commutativeN/A
pow2N/A
associate-+r+N/A
pow2N/A
metadata-evalN/A
sqrt-pow1N/A
pow2N/A
+-commutativeN/A
inv-powN/A
sqrt-divN/A
metadata-evalN/A
Applied rewrites71.8%
Taylor expanded in B around 0
associate-*r/N/A
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lower-neg.f6461.1
Applied rewrites61.1%
Final simplification76.3%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (- (/ x B))))
(if (<= F -6e+150)
(+ t_0 (/ -1.0 (sin B)))
(if (<= F 4.8e+238)
(+ (/ (- x) (tan B)) (/ (/ F (sqrt (fma 2.0 x (fma F F 2.0)))) B))
(if (<= F 4.6e+255)
(+ t_0 (* (/ F (sin B)) (/ 1.0 F)))
(/ (- 1.0 x) B))))))
double code(double F, double B, double x) {
double t_0 = -(x / B);
double tmp;
if (F <= -6e+150) {
tmp = t_0 + (-1.0 / sin(B));
} else if (F <= 4.8e+238) {
tmp = (-x / tan(B)) + ((F / sqrt(fma(2.0, x, fma(F, F, 2.0)))) / B);
} else if (F <= 4.6e+255) {
tmp = t_0 + ((F / sin(B)) * (1.0 / F));
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
function code(F, B, x) t_0 = Float64(-Float64(x / B)) tmp = 0.0 if (F <= -6e+150) tmp = Float64(t_0 + Float64(-1.0 / sin(B))); elseif (F <= 4.8e+238) tmp = Float64(Float64(Float64(-x) / tan(B)) + Float64(Float64(F / sqrt(fma(2.0, x, fma(F, F, 2.0)))) / B)); elseif (F <= 4.6e+255) tmp = Float64(t_0 + Float64(Float64(F / sin(B)) * Float64(1.0 / F))); else tmp = Float64(Float64(1.0 - x) / B); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = (-N[(x / B), $MachinePrecision])}, If[LessEqual[F, -6e+150], N[(t$95$0 + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 4.8e+238], N[(N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision] + N[(N[(F / N[Sqrt[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 4.6e+255], N[(t$95$0 + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[(1.0 / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -\frac{x}{B}\\
\mathbf{if}\;F \leq -6 \cdot 10^{+150}:\\
\;\;\;\;t\_0 + \frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 4.8 \cdot 10^{+238}:\\
\;\;\;\;\frac{-x}{\tan B} + \frac{\frac{F}{\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}}{B}\\
\mathbf{elif}\;F \leq 4.6 \cdot 10^{+255}:\\
\;\;\;\;t\_0 + \frac{F}{\sin B} \cdot \frac{1}{F}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < -6.00000000000000025e150Initial program 13.0%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
Taylor expanded in B around 0
lower-/.f6492.8
Applied rewrites92.8%
if -6.00000000000000025e150 < F < 4.8e238Initial program 90.9%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites94.5%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6494.7
Applied rewrites94.7%
lift-*.f64N/A
lift-pow.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
+-commutativeN/A
+-commutativeN/A
pow2N/A
associate-+r+N/A
pow2N/A
metadata-evalN/A
sqrt-pow1N/A
pow2N/A
+-commutativeN/A
inv-powN/A
sqrt-divN/A
metadata-evalN/A
Applied rewrites94.8%
Taylor expanded in B around 0
Applied rewrites76.5%
if 4.8e238 < F < 4.6000000000000001e255Initial program 2.2%
Taylor expanded in F around inf
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites85.9%
Taylor expanded in B around 0
lower-/.f6485.9
Applied rewrites85.9%
Taylor expanded in F around inf
Applied rewrites85.9%
if 4.6000000000000001e255 < F Initial program 20.0%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites27.2%
Taylor expanded in F around inf
Applied rewrites79.4%
Final simplification78.9%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ F (sqrt (fma 2.0 x (fma F F 2.0))))))
(if (<= B 4800.0)
(/
(-
(fma (* B B) (fma 0.3333333333333333 x (* 0.16666666666666666 t_0)) t_0)
x)
B)
(+
(* x (/ -1.0 (tan B)))
(/
-1.0
(*
B
(+
1.0
(*
(* B B)
(- (* 0.008333333333333333 (* B B)) 0.16666666666666666)))))))))
double code(double F, double B, double x) {
double t_0 = F / sqrt(fma(2.0, x, fma(F, F, 2.0)));
double tmp;
if (B <= 4800.0) {
tmp = (fma((B * B), fma(0.3333333333333333, x, (0.16666666666666666 * t_0)), t_0) - x) / B;
} else {
tmp = (x * (-1.0 / tan(B))) + (-1.0 / (B * (1.0 + ((B * B) * ((0.008333333333333333 * (B * B)) - 0.16666666666666666)))));
}
return tmp;
}
function code(F, B, x) t_0 = Float64(F / sqrt(fma(2.0, x, fma(F, F, 2.0)))) tmp = 0.0 if (B <= 4800.0) tmp = Float64(Float64(fma(Float64(B * B), fma(0.3333333333333333, x, Float64(0.16666666666666666 * t_0)), t_0) - x) / B); else tmp = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64(-1.0 / Float64(B * Float64(1.0 + Float64(Float64(B * B) * Float64(Float64(0.008333333333333333 * Float64(B * B)) - 0.16666666666666666)))))); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(F / N[Sqrt[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, 4800.0], N[(N[(N[(N[(B * B), $MachinePrecision] * N[(0.3333333333333333 * x + N[(0.16666666666666666 * t$95$0), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-1.0 / N[(B * N[(1.0 + N[(N[(B * B), $MachinePrecision] * N[(N[(0.008333333333333333 * N[(B * B), $MachinePrecision]), $MachinePrecision] - 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{F}{\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}\\
\mathbf{if}\;B \leq 4800:\\
\;\;\;\;\frac{\mathsf{fma}\left(B \cdot B, \mathsf{fma}\left(0.3333333333333333, x, 0.16666666666666666 \cdot t\_0\right), t\_0\right) - x}{B}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{-1}{B \cdot \left(1 + \left(B \cdot B\right) \cdot \left(0.008333333333333333 \cdot \left(B \cdot B\right) - 0.16666666666666666\right)\right)}\\
\end{array}
\end{array}
if B < 4800Initial program 76.2%
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-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites84.6%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6484.8
Applied rewrites84.8%
lift-*.f64N/A
lift-pow.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
+-commutativeN/A
+-commutativeN/A
pow2N/A
associate-+r+N/A
pow2N/A
metadata-evalN/A
sqrt-pow1N/A
pow2N/A
+-commutativeN/A
inv-powN/A
sqrt-divN/A
metadata-evalN/A
Applied rewrites84.9%
Taylor expanded in B around 0
Applied rewrites54.4%
if 4800 < B Initial program 76.4%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6453.6
Applied rewrites53.6%
Taylor expanded in B around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6447.0
Applied rewrites47.0%
Final simplification52.6%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ F (sqrt (fma 2.0 x (fma F F 2.0))))))
(if (<= B 4800.0)
(/
(-
(fma (* B B) (fma 0.3333333333333333 x (* 0.16666666666666666 t_0)) t_0)
x)
B)
(+
(/ (- x) (tan B))
(/ -1.0 (* (fma (* B B) -0.16666666666666666 1.0) B))))))
double code(double F, double B, double x) {
double t_0 = F / sqrt(fma(2.0, x, fma(F, F, 2.0)));
double tmp;
if (B <= 4800.0) {
tmp = (fma((B * B), fma(0.3333333333333333, x, (0.16666666666666666 * t_0)), t_0) - x) / B;
} else {
tmp = (-x / tan(B)) + (-1.0 / (fma((B * B), -0.16666666666666666, 1.0) * B));
}
return tmp;
}
function code(F, B, x) t_0 = Float64(F / sqrt(fma(2.0, x, fma(F, F, 2.0)))) tmp = 0.0 if (B <= 4800.0) tmp = Float64(Float64(fma(Float64(B * B), fma(0.3333333333333333, x, Float64(0.16666666666666666 * t_0)), t_0) - x) / B); else tmp = Float64(Float64(Float64(-x) / tan(B)) + Float64(-1.0 / Float64(fma(Float64(B * B), -0.16666666666666666, 1.0) * B))); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(F / N[Sqrt[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, 4800.0], N[(N[(N[(N[(B * B), $MachinePrecision] * N[(0.3333333333333333 * x + N[(0.16666666666666666 * t$95$0), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision] + N[(-1.0 / N[(N[(N[(B * B), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{F}{\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}\\
\mathbf{if}\;B \leq 4800:\\
\;\;\;\;\frac{\mathsf{fma}\left(B \cdot B, \mathsf{fma}\left(0.3333333333333333, x, 0.16666666666666666 \cdot t\_0\right), t\_0\right) - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{-x}{\tan B} + \frac{-1}{\mathsf{fma}\left(B \cdot B, -0.16666666666666666, 1\right) \cdot B}\\
\end{array}
\end{array}
if B < 4800Initial program 76.2%
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-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites84.6%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6484.8
Applied rewrites84.8%
lift-*.f64N/A
lift-pow.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
+-commutativeN/A
+-commutativeN/A
pow2N/A
associate-+r+N/A
pow2N/A
metadata-evalN/A
sqrt-pow1N/A
pow2N/A
+-commutativeN/A
inv-powN/A
sqrt-divN/A
metadata-evalN/A
Applied rewrites84.9%
Taylor expanded in B around 0
Applied rewrites54.4%
if 4800 < B Initial program 76.4%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6453.6
Applied rewrites53.6%
Taylor expanded in B around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6446.4
Applied rewrites46.4%
Applied rewrites46.4%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ F (sqrt (fma 2.0 x (fma F F 2.0))))))
(if (<= B 4800.0)
(/
(-
(fma (* B B) (fma 0.3333333333333333 x (* 0.16666666666666666 t_0)) t_0)
x)
B)
(+ (* x (/ -1.0 (tan B))) (/ -1.0 B)))))
double code(double F, double B, double x) {
double t_0 = F / sqrt(fma(2.0, x, fma(F, F, 2.0)));
double tmp;
if (B <= 4800.0) {
tmp = (fma((B * B), fma(0.3333333333333333, x, (0.16666666666666666 * t_0)), t_0) - x) / B;
} else {
tmp = (x * (-1.0 / tan(B))) + (-1.0 / B);
}
return tmp;
}
function code(F, B, x) t_0 = Float64(F / sqrt(fma(2.0, x, fma(F, F, 2.0)))) tmp = 0.0 if (B <= 4800.0) tmp = Float64(Float64(fma(Float64(B * B), fma(0.3333333333333333, x, Float64(0.16666666666666666 * t_0)), t_0) - x) / B); else tmp = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64(-1.0 / B)); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(F / N[Sqrt[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, 4800.0], N[(N[(N[(N[(B * B), $MachinePrecision] * N[(0.3333333333333333 * x + N[(0.16666666666666666 * t$95$0), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-1.0 / B), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{F}{\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}\\
\mathbf{if}\;B \leq 4800:\\
\;\;\;\;\frac{\mathsf{fma}\left(B \cdot B, \mathsf{fma}\left(0.3333333333333333, x, 0.16666666666666666 \cdot t\_0\right), t\_0\right) - x}{B}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{-1}{B}\\
\end{array}
\end{array}
if B < 4800Initial program 76.2%
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-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites84.6%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6484.8
Applied rewrites84.8%
lift-*.f64N/A
lift-pow.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
+-commutativeN/A
+-commutativeN/A
pow2N/A
associate-+r+N/A
pow2N/A
metadata-evalN/A
sqrt-pow1N/A
pow2N/A
+-commutativeN/A
inv-powN/A
sqrt-divN/A
metadata-evalN/A
Applied rewrites84.9%
Taylor expanded in B around 0
Applied rewrites54.4%
if 4800 < B Initial program 76.4%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6453.6
Applied rewrites53.6%
Taylor expanded in B around 0
Applied rewrites44.9%
Final simplification52.1%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ F (sqrt (fma 2.0 x (fma F F 2.0))))))
(if (<= F -7000000.0)
(+ (- (/ x B)) (/ -1.0 (sin B)))
(if (<= F 280000000000.0)
(/
(-
(fma
(* B B)
(fma 0.3333333333333333 x (* 0.16666666666666666 t_0))
t_0)
x)
B)
(/ (- 1.0 x) B)))))
double code(double F, double B, double x) {
double t_0 = F / sqrt(fma(2.0, x, fma(F, F, 2.0)));
double tmp;
if (F <= -7000000.0) {
tmp = -(x / B) + (-1.0 / sin(B));
} else if (F <= 280000000000.0) {
tmp = (fma((B * B), fma(0.3333333333333333, x, (0.16666666666666666 * t_0)), t_0) - x) / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
function code(F, B, x) t_0 = Float64(F / sqrt(fma(2.0, x, fma(F, F, 2.0)))) tmp = 0.0 if (F <= -7000000.0) tmp = Float64(Float64(-Float64(x / B)) + Float64(-1.0 / sin(B))); elseif (F <= 280000000000.0) tmp = Float64(Float64(fma(Float64(B * B), fma(0.3333333333333333, x, Float64(0.16666666666666666 * t_0)), t_0) - x) / B); else tmp = Float64(Float64(1.0 - x) / B); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(F / N[Sqrt[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -7000000.0], N[((-N[(x / B), $MachinePrecision]) + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 280000000000.0], N[(N[(N[(N[(B * B), $MachinePrecision] * N[(0.3333333333333333 * x + N[(0.16666666666666666 * t$95$0), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{F}{\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}\\
\mathbf{if}\;F \leq -7000000:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 280000000000:\\
\;\;\;\;\frac{\mathsf{fma}\left(B \cdot B, \mathsf{fma}\left(0.3333333333333333, x, 0.16666666666666666 \cdot t\_0\right), t\_0\right) - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < -7e6Initial program 49.7%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6499.8
Applied rewrites99.8%
Taylor expanded in B around 0
lower-/.f6485.8
Applied rewrites85.8%
if -7e6 < F < 2.8e11Initial program 99.3%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites99.3%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6499.5
Applied rewrites99.5%
lift-*.f64N/A
lift-pow.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
+-commutativeN/A
+-commutativeN/A
pow2N/A
associate-+r+N/A
pow2N/A
metadata-evalN/A
sqrt-pow1N/A
pow2N/A
+-commutativeN/A
inv-powN/A
sqrt-divN/A
metadata-evalN/A
Applied rewrites99.6%
Taylor expanded in B around 0
Applied rewrites49.8%
if 2.8e11 < F Initial program 53.9%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites30.6%
Taylor expanded in F around inf
Applied rewrites45.4%
Final simplification56.2%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ F (sqrt (fma 2.0 x (fma F F 2.0))))))
(if (<= F -115000000.0)
(+
(* (- x) (/ (fma -0.3333333333333333 (* B B) 1.0) B))
(/ -1.0 (* B (+ 1.0 (* -0.16666666666666666 (* B B))))))
(if (<= F 280000000000.0)
(/
(-
(fma
(* B B)
(fma 0.3333333333333333 x (* 0.16666666666666666 t_0))
t_0)
x)
B)
(/ (- 1.0 x) B)))))
double code(double F, double B, double x) {
double t_0 = F / sqrt(fma(2.0, x, fma(F, F, 2.0)));
double tmp;
if (F <= -115000000.0) {
tmp = (-x * (fma(-0.3333333333333333, (B * B), 1.0) / B)) + (-1.0 / (B * (1.0 + (-0.16666666666666666 * (B * B)))));
} else if (F <= 280000000000.0) {
tmp = (fma((B * B), fma(0.3333333333333333, x, (0.16666666666666666 * t_0)), t_0) - x) / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
function code(F, B, x) t_0 = Float64(F / sqrt(fma(2.0, x, fma(F, F, 2.0)))) tmp = 0.0 if (F <= -115000000.0) tmp = Float64(Float64(Float64(-x) * Float64(fma(-0.3333333333333333, Float64(B * B), 1.0) / B)) + Float64(-1.0 / Float64(B * Float64(1.0 + Float64(-0.16666666666666666 * Float64(B * B)))))); elseif (F <= 280000000000.0) tmp = Float64(Float64(fma(Float64(B * B), fma(0.3333333333333333, x, Float64(0.16666666666666666 * t_0)), t_0) - x) / B); else tmp = Float64(Float64(1.0 - x) / B); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(F / N[Sqrt[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -115000000.0], N[(N[((-x) * N[(N[(-0.3333333333333333 * N[(B * B), $MachinePrecision] + 1.0), $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision] + N[(-1.0 / N[(B * N[(1.0 + N[(-0.16666666666666666 * N[(B * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 280000000000.0], N[(N[(N[(N[(B * B), $MachinePrecision] * N[(0.3333333333333333 * x + N[(0.16666666666666666 * t$95$0), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{F}{\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}\\
\mathbf{if}\;F \leq -115000000:\\
\;\;\;\;\left(-x\right) \cdot \frac{\mathsf{fma}\left(-0.3333333333333333, B \cdot B, 1\right)}{B} + \frac{-1}{B \cdot \left(1 + -0.16666666666666666 \cdot \left(B \cdot B\right)\right)}\\
\mathbf{elif}\;F \leq 280000000000:\\
\;\;\;\;\frac{\mathsf{fma}\left(B \cdot B, \mathsf{fma}\left(0.3333333333333333, x, 0.16666666666666666 \cdot t\_0\right), t\_0\right) - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < -1.15e8Initial program 49.7%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6499.8
Applied rewrites99.8%
Taylor expanded in B around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6473.8
Applied rewrites73.8%
Taylor expanded in B around 0
lower-/.f64N/A
+-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6462.5
Applied rewrites62.5%
if -1.15e8 < F < 2.8e11Initial program 99.3%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites99.3%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6499.5
Applied rewrites99.5%
lift-*.f64N/A
lift-pow.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
+-commutativeN/A
+-commutativeN/A
pow2N/A
associate-+r+N/A
pow2N/A
metadata-evalN/A
sqrt-pow1N/A
pow2N/A
+-commutativeN/A
inv-powN/A
sqrt-divN/A
metadata-evalN/A
Applied rewrites99.6%
Taylor expanded in B around 0
Applied rewrites49.8%
if 2.8e11 < F Initial program 53.9%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites30.6%
Taylor expanded in F around inf
Applied rewrites45.4%
Final simplification51.3%
(FPCore (F B x)
:precision binary64
(if (<= F -5.8e+118)
(+
(* (- x) (/ (fma -0.3333333333333333 (* B B) 1.0) B))
(/ -1.0 (* B (+ 1.0 (* -0.16666666666666666 (* B B))))))
(if (<= F 3.25e-6)
(/ (- (/ F (sqrt (fma 2.0 x (fma F F 2.0)))) x) B)
(/ (- (fma (/ (fma 2.0 x 2.0) (* F F)) -0.5 1.0) x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -5.8e+118) {
tmp = (-x * (fma(-0.3333333333333333, (B * B), 1.0) / B)) + (-1.0 / (B * (1.0 + (-0.16666666666666666 * (B * B)))));
} else if (F <= 3.25e-6) {
tmp = ((F / sqrt(fma(2.0, x, fma(F, F, 2.0)))) - x) / B;
} else {
tmp = (fma((fma(2.0, x, 2.0) / (F * F)), -0.5, 1.0) - x) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -5.8e+118) tmp = Float64(Float64(Float64(-x) * Float64(fma(-0.3333333333333333, Float64(B * B), 1.0) / B)) + Float64(-1.0 / Float64(B * Float64(1.0 + Float64(-0.16666666666666666 * Float64(B * B)))))); elseif (F <= 3.25e-6) tmp = Float64(Float64(Float64(F / sqrt(fma(2.0, x, fma(F, F, 2.0)))) - x) / B); else tmp = Float64(Float64(fma(Float64(fma(2.0, x, 2.0) / Float64(F * F)), -0.5, 1.0) - x) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -5.8e+118], N[(N[((-x) * N[(N[(-0.3333333333333333 * N[(B * B), $MachinePrecision] + 1.0), $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision] + N[(-1.0 / N[(B * N[(1.0 + N[(-0.16666666666666666 * N[(B * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 3.25e-6], N[(N[(N[(F / N[Sqrt[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(N[(N[(N[(2.0 * x + 2.0), $MachinePrecision] / N[(F * F), $MachinePrecision]), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -5.8 \cdot 10^{+118}:\\
\;\;\;\;\left(-x\right) \cdot \frac{\mathsf{fma}\left(-0.3333333333333333, B \cdot B, 1\right)}{B} + \frac{-1}{B \cdot \left(1 + -0.16666666666666666 \cdot \left(B \cdot B\right)\right)}\\
\mathbf{elif}\;F \leq 3.25 \cdot 10^{-6}:\\
\;\;\;\;\frac{\frac{F}{\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}} - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{\mathsf{fma}\left(2, x, 2\right)}{F \cdot F}, -0.5, 1\right) - x}{B}\\
\end{array}
\end{array}
if F < -5.80000000000000032e118Initial program 34.0%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
Taylor expanded in B around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6467.8
Applied rewrites67.8%
Taylor expanded in B around 0
lower-/.f64N/A
+-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6455.4
Applied rewrites55.4%
if -5.80000000000000032e118 < F < 3.2499999999999998e-6Initial program 99.3%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites99.3%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6499.5
Applied rewrites99.5%
lift-*.f64N/A
lift-pow.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
+-commutativeN/A
+-commutativeN/A
pow2N/A
associate-+r+N/A
pow2N/A
metadata-evalN/A
sqrt-pow1N/A
pow2N/A
+-commutativeN/A
inv-powN/A
sqrt-divN/A
metadata-evalN/A
Applied rewrites99.6%
Taylor expanded in B around 0
Applied rewrites51.8%
if 3.2499999999999998e-6 < F Initial program 56.3%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites31.7%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f6428.0
Applied rewrites28.0%
Taylor expanded in F around inf
lower--.f64N/A
Applied rewrites45.7%
Final simplification50.6%
(FPCore (F B x)
:precision binary64
(if (<= F -7.4e+127)
(+ (* x (/ -1.0 B)) (/ -1.0 (* B (+ 1.0 (* -0.16666666666666666 (* B B))))))
(if (<= F 3.25e-6)
(/ (- (/ F (sqrt (fma 2.0 x (fma F F 2.0)))) x) B)
(/ (- (fma (/ (fma 2.0 x 2.0) (* F F)) -0.5 1.0) x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -7.4e+127) {
tmp = (x * (-1.0 / B)) + (-1.0 / (B * (1.0 + (-0.16666666666666666 * (B * B)))));
} else if (F <= 3.25e-6) {
tmp = ((F / sqrt(fma(2.0, x, fma(F, F, 2.0)))) - x) / B;
} else {
tmp = (fma((fma(2.0, x, 2.0) / (F * F)), -0.5, 1.0) - x) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -7.4e+127) tmp = Float64(Float64(x * Float64(-1.0 / B)) + Float64(-1.0 / Float64(B * Float64(1.0 + Float64(-0.16666666666666666 * Float64(B * B)))))); elseif (F <= 3.25e-6) tmp = Float64(Float64(Float64(F / sqrt(fma(2.0, x, fma(F, F, 2.0)))) - x) / B); else tmp = Float64(Float64(fma(Float64(fma(2.0, x, 2.0) / Float64(F * F)), -0.5, 1.0) - x) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -7.4e+127], N[(N[(x * N[(-1.0 / B), $MachinePrecision]), $MachinePrecision] + N[(-1.0 / N[(B * N[(1.0 + N[(-0.16666666666666666 * N[(B * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 3.25e-6], N[(N[(N[(F / N[Sqrt[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(N[(N[(N[(2.0 * x + 2.0), $MachinePrecision] / N[(F * F), $MachinePrecision]), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -7.4 \cdot 10^{+127}:\\
\;\;\;\;x \cdot \frac{-1}{B} + \frac{-1}{B \cdot \left(1 + -0.16666666666666666 \cdot \left(B \cdot B\right)\right)}\\
\mathbf{elif}\;F \leq 3.25 \cdot 10^{-6}:\\
\;\;\;\;\frac{\frac{F}{\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}} - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{\mathsf{fma}\left(2, x, 2\right)}{F \cdot F}, -0.5, 1\right) - x}{B}\\
\end{array}
\end{array}
if F < -7.39999999999999959e127Initial program 30.7%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
Taylor expanded in B around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6468.8
Applied rewrites68.8%
Taylor expanded in B around 0
Applied rewrites54.6%
if -7.39999999999999959e127 < F < 3.2499999999999998e-6Initial program 99.3%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites99.3%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6499.5
Applied rewrites99.5%
lift-*.f64N/A
lift-pow.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
+-commutativeN/A
+-commutativeN/A
pow2N/A
associate-+r+N/A
pow2N/A
metadata-evalN/A
sqrt-pow1N/A
pow2N/A
+-commutativeN/A
inv-powN/A
sqrt-divN/A
metadata-evalN/A
Applied rewrites99.6%
Taylor expanded in B around 0
Applied rewrites51.7%
if 3.2499999999999998e-6 < F Initial program 56.3%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites31.7%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f6428.0
Applied rewrites28.0%
Taylor expanded in F around inf
lower--.f64N/A
Applied rewrites45.7%
Final simplification50.4%
(FPCore (F B x)
:precision binary64
(if (<= F -1e+154)
(/ (- -1.0 x) B)
(if (<= F 3.25e-6)
(/ (- (/ F (sqrt (fma 2.0 x (fma F F 2.0)))) x) B)
(/ (- (fma (/ (fma 2.0 x 2.0) (* F F)) -0.5 1.0) x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1e+154) {
tmp = (-1.0 - x) / B;
} else if (F <= 3.25e-6) {
tmp = ((F / sqrt(fma(2.0, x, fma(F, F, 2.0)))) - x) / B;
} else {
tmp = (fma((fma(2.0, x, 2.0) / (F * F)), -0.5, 1.0) - x) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -1e+154) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 3.25e-6) tmp = Float64(Float64(Float64(F / sqrt(fma(2.0, x, fma(F, F, 2.0)))) - x) / B); else tmp = Float64(Float64(fma(Float64(fma(2.0, x, 2.0) / Float64(F * F)), -0.5, 1.0) - x) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -1e+154], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 3.25e-6], N[(N[(N[(F / N[Sqrt[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(N[(N[(N[(2.0 * x + 2.0), $MachinePrecision] / N[(F * F), $MachinePrecision]), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1 \cdot 10^{+154}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 3.25 \cdot 10^{-6}:\\
\;\;\;\;\frac{\frac{F}{\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}} - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{\mathsf{fma}\left(2, x, 2\right)}{F \cdot F}, -0.5, 1\right) - x}{B}\\
\end{array}
\end{array}
if F < -1.00000000000000004e154Initial program 13.0%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites25.4%
Taylor expanded in F around -inf
Applied rewrites64.7%
if -1.00000000000000004e154 < F < 3.2499999999999998e-6Initial program 99.3%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites99.3%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6499.5
Applied rewrites99.5%
lift-*.f64N/A
lift-pow.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
+-commutativeN/A
+-commutativeN/A
pow2N/A
associate-+r+N/A
pow2N/A
metadata-evalN/A
sqrt-pow1N/A
pow2N/A
+-commutativeN/A
inv-powN/A
sqrt-divN/A
metadata-evalN/A
Applied rewrites99.6%
Taylor expanded in B around 0
Applied rewrites49.8%
if 3.2499999999999998e-6 < F Initial program 56.3%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites31.7%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f6428.0
Applied rewrites28.0%
Taylor expanded in F around inf
lower--.f64N/A
Applied rewrites45.7%
Final simplification50.4%
(FPCore (F B x)
:precision binary64
(if (<= F -2e+64)
(/ (- -1.0 x) B)
(if (<= F 3.25e-6)
(/ (- (* F (/ 1.0 (sqrt (fma F F 2.0)))) x) B)
(/ (- (fma (/ (fma 2.0 x 2.0) (* F F)) -0.5 1.0) x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -2e+64) {
tmp = (-1.0 - x) / B;
} else if (F <= 3.25e-6) {
tmp = ((F * (1.0 / sqrt(fma(F, F, 2.0)))) - x) / B;
} else {
tmp = (fma((fma(2.0, x, 2.0) / (F * F)), -0.5, 1.0) - x) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -2e+64) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 3.25e-6) tmp = Float64(Float64(Float64(F * Float64(1.0 / sqrt(fma(F, F, 2.0)))) - x) / B); else tmp = Float64(Float64(fma(Float64(fma(2.0, x, 2.0) / Float64(F * F)), -0.5, 1.0) - x) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -2e+64], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 3.25e-6], N[(N[(N[(F * N[(1.0 / N[Sqrt[N[(F * F + 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(N[(N[(N[(2.0 * x + 2.0), $MachinePrecision] / N[(F * F), $MachinePrecision]), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -2 \cdot 10^{+64}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 3.25 \cdot 10^{-6}:\\
\;\;\;\;\frac{F \cdot \frac{1}{\sqrt{\mathsf{fma}\left(F, F, 2\right)}} - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{\mathsf{fma}\left(2, x, 2\right)}{F \cdot F}, -0.5, 1\right) - x}{B}\\
\end{array}
\end{array}
if F < -2.00000000000000004e64Initial program 43.6%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites33.5%
Taylor expanded in F around -inf
Applied rewrites59.0%
if -2.00000000000000004e64 < F < 3.2499999999999998e-6Initial program 99.3%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites99.3%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites49.9%
Taylor expanded in x around 0
lower-sqrt.f64N/A
+-commutativeN/A
pow2N/A
lift-fma.f6449.9
Applied rewrites49.9%
if 3.2499999999999998e-6 < F Initial program 56.3%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites31.7%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f6428.0
Applied rewrites28.0%
Taylor expanded in F around inf
lower--.f64N/A
Applied rewrites45.7%
Final simplification50.4%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ (fma 2.0 x 2.0) (* F F))))
(if (<= F -38.0)
(/ (- (- (* t_0 0.5) 1.0) x) B)
(if (<= F 3.25e-6)
(/ (- (* F (/ 1.0 (sqrt (fma 2.0 x 2.0)))) x) B)
(/ (- (fma t_0 -0.5 1.0) x) B)))))
double code(double F, double B, double x) {
double t_0 = fma(2.0, x, 2.0) / (F * F);
double tmp;
if (F <= -38.0) {
tmp = (((t_0 * 0.5) - 1.0) - x) / B;
} else if (F <= 3.25e-6) {
tmp = ((F * (1.0 / sqrt(fma(2.0, x, 2.0)))) - x) / B;
} else {
tmp = (fma(t_0, -0.5, 1.0) - x) / B;
}
return tmp;
}
function code(F, B, x) t_0 = Float64(fma(2.0, x, 2.0) / Float64(F * F)) tmp = 0.0 if (F <= -38.0) tmp = Float64(Float64(Float64(Float64(t_0 * 0.5) - 1.0) - x) / B); elseif (F <= 3.25e-6) tmp = Float64(Float64(Float64(F * Float64(1.0 / sqrt(fma(2.0, x, 2.0)))) - x) / B); else tmp = Float64(Float64(fma(t_0, -0.5, 1.0) - x) / B); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(N[(2.0 * x + 2.0), $MachinePrecision] / N[(F * F), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -38.0], N[(N[(N[(N[(t$95$0 * 0.5), $MachinePrecision] - 1.0), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 3.25e-6], N[(N[(N[(F * N[(1.0 / N[Sqrt[N[(2.0 * x + 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(N[(t$95$0 * -0.5 + 1.0), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\mathsf{fma}\left(2, x, 2\right)}{F \cdot F}\\
\mathbf{if}\;F \leq -38:\\
\;\;\;\;\frac{\left(t\_0 \cdot 0.5 - 1\right) - x}{B}\\
\mathbf{elif}\;F \leq 3.25 \cdot 10^{-6}:\\
\;\;\;\;\frac{F \cdot \frac{1}{\sqrt{\mathsf{fma}\left(2, x, 2\right)}} - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t\_0, -0.5, 1\right) - x}{B}\\
\end{array}
\end{array}
if F < -38Initial program 51.5%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites41.3%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f6425.8
Applied rewrites25.8%
Taylor expanded in F around -inf
metadata-evalN/A
associate--r+N/A
lower--.f64N/A
Applied rewrites62.5%
if -38 < F < 3.2499999999999998e-6Initial program 99.3%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites99.3%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites47.5%
Taylor expanded in F around 0
lower-sqrt.f64N/A
+-commutativeN/A
lower-fma.f6447.5
Applied rewrites47.5%
if 3.2499999999999998e-6 < F Initial program 56.3%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites31.7%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f6428.0
Applied rewrites28.0%
Taylor expanded in F around inf
lower--.f64N/A
Applied rewrites45.7%
Final simplification50.2%
(FPCore (F B x)
:precision binary64
(if (<= F -4.7)
(/ (- (- (* (/ (fma 2.0 x 2.0) (* F F)) 0.5) 1.0) x) B)
(if (<= F 1e-66)
(- (/ (fma (* x -0.3333333333333333) (* B B) x) B))
(/ (- 1.0 x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -4.7) {
tmp = ((((fma(2.0, x, 2.0) / (F * F)) * 0.5) - 1.0) - x) / B;
} else if (F <= 1e-66) {
tmp = -(fma((x * -0.3333333333333333), (B * B), x) / B);
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -4.7) tmp = Float64(Float64(Float64(Float64(Float64(fma(2.0, x, 2.0) / Float64(F * F)) * 0.5) - 1.0) - x) / B); elseif (F <= 1e-66) tmp = Float64(-Float64(fma(Float64(x * -0.3333333333333333), Float64(B * B), x) / B)); else tmp = Float64(Float64(1.0 - x) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -4.7], N[(N[(N[(N[(N[(N[(2.0 * x + 2.0), $MachinePrecision] / N[(F * F), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision] - 1.0), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 1e-66], (-N[(N[(N[(x * -0.3333333333333333), $MachinePrecision] * N[(B * B), $MachinePrecision] + x), $MachinePrecision] / B), $MachinePrecision]), N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -4.7:\\
\;\;\;\;\frac{\left(\frac{\mathsf{fma}\left(2, x, 2\right)}{F \cdot F} \cdot 0.5 - 1\right) - x}{B}\\
\mathbf{elif}\;F \leq 10^{-66}:\\
\;\;\;\;-\frac{\mathsf{fma}\left(x \cdot -0.3333333333333333, B \cdot B, x\right)}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < -4.70000000000000018Initial program 51.5%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites41.3%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f6425.8
Applied rewrites25.8%
Taylor expanded in F around -inf
metadata-evalN/A
associate--r+N/A
lower--.f64N/A
Applied rewrites62.5%
if -4.70000000000000018 < F < 9.9999999999999998e-67Initial program 99.3%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites99.3%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6470.2
Applied rewrites70.2%
Taylor expanded in B around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
distribute-rgt-out--N/A
metadata-evalN/A
lower-*.f64N/A
pow2N/A
lift-*.f6436.9
Applied rewrites36.9%
if 9.9999999999999998e-67 < F Initial program 63.1%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites31.7%
Taylor expanded in F around inf
Applied rewrites39.5%
Final simplification43.4%
(FPCore (F B x)
:precision binary64
(if (<= F -2.4e-12)
(/ (- -1.0 x) B)
(if (<= F 1e-66)
(- (/ (fma (* x -0.3333333333333333) (* B B) x) B))
(/ (- 1.0 x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -2.4e-12) {
tmp = (-1.0 - x) / B;
} else if (F <= 1e-66) {
tmp = -(fma((x * -0.3333333333333333), (B * B), x) / B);
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -2.4e-12) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 1e-66) tmp = Float64(-Float64(fma(Float64(x * -0.3333333333333333), Float64(B * B), x) / B)); else tmp = Float64(Float64(1.0 - x) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -2.4e-12], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 1e-66], (-N[(N[(N[(x * -0.3333333333333333), $MachinePrecision] * N[(B * B), $MachinePrecision] + x), $MachinePrecision] / B), $MachinePrecision]), N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -2.4 \cdot 10^{-12}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 10^{-66}:\\
\;\;\;\;-\frac{\mathsf{fma}\left(x \cdot -0.3333333333333333, B \cdot B, x\right)}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < -2.39999999999999987e-12Initial program 54.0%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites42.7%
Taylor expanded in F around -inf
Applied rewrites62.3%
if -2.39999999999999987e-12 < F < 9.9999999999999998e-67Initial program 99.3%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites99.3%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6469.7
Applied rewrites69.7%
Taylor expanded in B around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
distribute-rgt-out--N/A
metadata-evalN/A
lower-*.f64N/A
pow2N/A
lift-*.f6436.1
Applied rewrites36.1%
if 9.9999999999999998e-67 < F Initial program 63.1%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites31.7%
Taylor expanded in F around inf
Applied rewrites39.5%
Final simplification43.3%
(FPCore (F B x) :precision binary64 (if (<= F -3.9e-77) (/ (- -1.0 x) B) (if (<= F 3.2e-56) (/ (- x) B) (/ (- 1.0 x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -3.9e-77) {
tmp = (-1.0 - x) / B;
} else if (F <= 3.2e-56) {
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 <= (-3.9d-77)) then
tmp = ((-1.0d0) - x) / b
else if (f <= 3.2d-56) 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 <= -3.9e-77) {
tmp = (-1.0 - x) / B;
} else if (F <= 3.2e-56) {
tmp = -x / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -3.9e-77: tmp = (-1.0 - x) / B elif F <= 3.2e-56: tmp = -x / B else: tmp = (1.0 - x) / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= -3.9e-77) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 3.2e-56) 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 <= -3.9e-77) tmp = (-1.0 - x) / B; elseif (F <= 3.2e-56) tmp = -x / B; else tmp = (1.0 - x) / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -3.9e-77], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 3.2e-56], N[((-x) / B), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -3.9 \cdot 10^{-77}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 3.2 \cdot 10^{-56}:\\
\;\;\;\;\frac{-x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < -3.89999999999999979e-77Initial program 65.9%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites43.1%
Taylor expanded in F around -inf
Applied rewrites52.9%
if -3.89999999999999979e-77 < F < 3.19999999999999986e-56Initial program 99.3%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites48.6%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f6434.6
Applied rewrites34.6%
if 3.19999999999999986e-56 < F Initial program 60.9%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites32.2%
Taylor expanded in F around inf
Applied rewrites41.5%
Final simplification42.6%
(FPCore (F B x) :precision binary64 (if (<= F -3.9e-77) (/ (- -1.0 x) B) (/ (- x) B)))
double code(double F, double B, double x) {
double tmp;
if (F <= -3.9e-77) {
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 <= (-3.9d-77)) 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 <= -3.9e-77) {
tmp = (-1.0 - x) / B;
} else {
tmp = -x / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -3.9e-77: tmp = (-1.0 - x) / B else: tmp = -x / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= -3.9e-77) 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 <= -3.9e-77) tmp = (-1.0 - x) / B; else tmp = -x / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -3.9e-77], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], N[((-x) / B), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -3.9 \cdot 10^{-77}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{-x}{B}\\
\end{array}
\end{array}
if F < -3.89999999999999979e-77Initial program 65.9%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites43.1%
Taylor expanded in F around -inf
Applied rewrites52.9%
if -3.89999999999999979e-77 < F Initial program 81.0%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites40.8%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f6430.2
Applied rewrites30.2%
Final simplification37.3%
(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 76.3%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites41.5%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f6429.3
Applied rewrites29.3%
Final simplification29.3%
herbie shell --seed 2025061
(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))))))