
(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 23 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (F B x) :precision binary64 (+ (- (* x (/ 1.0 (tan B)))) (* (/ F (sin B)) (pow (+ (+ (* F F) 2.0) (* 2.0 x)) (- (/ 1.0 2.0))))))
double code(double F, double B, double x) {
return -(x * (1.0 / tan(B))) + ((F / sin(B)) * pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
code = -(x * (1.0d0 / tan(b))) + ((f / sin(b)) * ((((f * f) + 2.0d0) + (2.0d0 * x)) ** -(1.0d0 / 2.0d0)))
end function
public static double code(double F, double B, double x) {
return -(x * (1.0 / Math.tan(B))) + ((F / Math.sin(B)) * Math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
}
def code(F, B, x): return -(x * (1.0 / math.tan(B))) + ((F / math.sin(B)) * math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)))
function code(F, B, x) return Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(Float64(F / sin(B)) * (Float64(Float64(Float64(F * F) + 2.0) + Float64(2.0 * x)) ^ Float64(-Float64(1.0 / 2.0))))) end
function tmp = code(F, B, x) tmp = -(x * (1.0 / tan(B))) + ((F / sin(B)) * ((((F * F) + 2.0) + (2.0 * x)) ^ -(1.0 / 2.0))); end
code[F_, B_, x_] := N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(N[(F * F), $MachinePrecision] + 2.0), $MachinePrecision] + N[(2.0 * x), $MachinePrecision]), $MachinePrecision], (-N[(1.0 / 2.0), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\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))))
(if (<= F -1e+113)
(/ (- (fma (cos B) x 1.0)) (sin B))
(if (<= F 880000.0)
(fma F (/ (/ 1.0 (sqrt (fma x 2.0 (fma F F 2.0)))) (sin B)) t_0)
(+ t_0 (/ 1.0 (sin B)))))))
double code(double F, double B, double x) {
double t_0 = -x / tan(B);
double tmp;
if (F <= -1e+113) {
tmp = -fma(cos(B), x, 1.0) / sin(B);
} else if (F <= 880000.0) {
tmp = fma(F, ((1.0 / sqrt(fma(x, 2.0, fma(F, F, 2.0)))) / sin(B)), t_0);
} else {
tmp = t_0 + (1.0 / sin(B));
}
return tmp;
}
function code(F, B, x) t_0 = Float64(Float64(-x) / tan(B)) tmp = 0.0 if (F <= -1e+113) tmp = Float64(Float64(-fma(cos(B), x, 1.0)) / sin(B)); elseif (F <= 880000.0) tmp = fma(F, Float64(Float64(1.0 / sqrt(fma(x, 2.0, fma(F, F, 2.0)))) / sin(B)), t_0); else tmp = Float64(t_0 + Float64(1.0 / sin(B))); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -1e+113], N[((-N[(N[Cos[B], $MachinePrecision] * x + 1.0), $MachinePrecision]) / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 880000.0], N[(F * N[(N[(1.0 / N[Sqrt[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision], N[(t$95$0 + N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-x}{\tan B}\\
\mathbf{if}\;F \leq -1 \cdot 10^{+113}:\\
\;\;\;\;\frac{-\mathsf{fma}\left(\cos B, x, 1\right)}{\sin B}\\
\mathbf{elif}\;F \leq 880000:\\
\;\;\;\;\mathsf{fma}\left(F, \frac{\frac{1}{\sqrt{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}}{\sin B}, t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \frac{1}{\sin B}\\
\end{array}
\end{array}
if F < -1e113Initial program 38.4%
Taylor expanded in F around -inf
Applied rewrites99.7%
if -1e113 < F < 8.8e5Initial program 98.1%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites99.7%
lift-pow.f64N/A
metadata-evalN/A
sqrt-pow1N/A
inv-powN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f6499.7
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6499.7
Applied rewrites99.7%
if 8.8e5 < F Initial program 54.0%
Taylor expanded in F around inf
Applied rewrites99.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
*-rgt-identityN/A
lower-/.f6499.8
Applied rewrites99.8%
Final simplification99.7%
(FPCore (F B x)
:precision binary64
(if (<= F -10000000000.0)
(/ (- (fma (cos B) x 1.0)) (sin B))
(if (<= F 880000.0)
(fma
(/ -1.0 (tan B))
x
(/ F (* (sin B) (sqrt (fma F F (fma 2.0 x 2.0))))))
(+ (/ (- x) (tan B)) (/ 1.0 (sin B))))))
double code(double F, double B, double x) {
double tmp;
if (F <= -10000000000.0) {
tmp = -fma(cos(B), x, 1.0) / sin(B);
} else if (F <= 880000.0) {
tmp = fma((-1.0 / tan(B)), x, (F / (sin(B) * sqrt(fma(F, F, fma(2.0, x, 2.0))))));
} else {
tmp = (-x / tan(B)) + (1.0 / sin(B));
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -10000000000.0) tmp = Float64(Float64(-fma(cos(B), x, 1.0)) / sin(B)); elseif (F <= 880000.0) tmp = fma(Float64(-1.0 / tan(B)), x, Float64(F / Float64(sin(B) * sqrt(fma(F, F, fma(2.0, x, 2.0)))))); else tmp = Float64(Float64(Float64(-x) / tan(B)) + Float64(1.0 / sin(B))); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -10000000000.0], N[((-N[(N[Cos[B], $MachinePrecision] * x + 1.0), $MachinePrecision]) / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 880000.0], N[(N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision] * x + N[(F / N[(N[Sin[B], $MachinePrecision] * N[Sqrt[N[(F * F + N[(2.0 * x + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -10000000000:\\
\;\;\;\;\frac{-\mathsf{fma}\left(\cos B, x, 1\right)}{\sin B}\\
\mathbf{elif}\;F \leq 880000:\\
\;\;\;\;\mathsf{fma}\left(\frac{-1}{\tan B}, x, \frac{F}{\sin B \cdot \sqrt{\mathsf{fma}\left(F, F, \mathsf{fma}\left(2, x, 2\right)\right)}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{-x}{\tan B} + \frac{1}{\sin B}\\
\end{array}
\end{array}
if F < -1e10Initial program 51.0%
Taylor expanded in F around -inf
Applied rewrites99.7%
if -1e10 < F < 8.8e5Initial program 99.5%
lift-+.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lift-/.f64N/A
distribute-neg-fracN/A
metadata-evalN/A
lower-/.f6499.5
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.5
Applied rewrites99.5%
lift-pow.f64N/A
metadata-evalN/A
sqrt-pow1N/A
inv-powN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f6499.5
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6499.5
Applied rewrites99.5%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-lft-identityN/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6499.6
lift-fma.f64N/A
+-commutativeN/A
lift-fma.f64N/A
*-commutativeN/A
associate-+l+N/A
+-commutativeN/A
lift-fma.f64N/A
lower-fma.f6499.6
Applied rewrites99.6%
if 8.8e5 < F Initial program 54.0%
Taylor expanded in F around inf
Applied rewrites99.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
*-rgt-identityN/A
lower-/.f6499.8
Applied rewrites99.8%
Final simplification99.7%
(FPCore (F B x)
:precision binary64
(if (<= F -3.35)
(/ (- (fma (cos B) x 1.0)) (sin B))
(if (<= F 1.3)
(/ (fma (sqrt (/ 1.0 (fma 2.0 x 2.0))) F (* (cos B) (- x))) (sin B))
(+ (/ (- x) (tan B)) (/ 1.0 (sin B))))))
double code(double F, double B, double x) {
double tmp;
if (F <= -3.35) {
tmp = -fma(cos(B), x, 1.0) / sin(B);
} else if (F <= 1.3) {
tmp = fma(sqrt((1.0 / fma(2.0, x, 2.0))), F, (cos(B) * -x)) / sin(B);
} else {
tmp = (-x / tan(B)) + (1.0 / sin(B));
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -3.35) tmp = Float64(Float64(-fma(cos(B), x, 1.0)) / sin(B)); elseif (F <= 1.3) tmp = Float64(fma(sqrt(Float64(1.0 / fma(2.0, x, 2.0))), F, Float64(cos(B) * Float64(-x))) / sin(B)); else tmp = Float64(Float64(Float64(-x) / tan(B)) + Float64(1.0 / sin(B))); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -3.35], N[((-N[(N[Cos[B], $MachinePrecision] * x + 1.0), $MachinePrecision]) / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.3], N[(N[(N[Sqrt[N[(1.0 / N[(2.0 * x + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * F + N[(N[Cos[B], $MachinePrecision] * (-x)), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], N[(N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -3.35:\\
\;\;\;\;\frac{-\mathsf{fma}\left(\cos B, x, 1\right)}{\sin B}\\
\mathbf{elif}\;F \leq 1.3:\\
\;\;\;\;\frac{\mathsf{fma}\left(\sqrt{\frac{1}{\mathsf{fma}\left(2, x, 2\right)}}, F, \cos B \cdot \left(-x\right)\right)}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;\frac{-x}{\tan B} + \frac{1}{\sin B}\\
\end{array}
\end{array}
if F < -3.35000000000000009Initial program 51.6%
Taylor expanded in F around -inf
Applied rewrites99.8%
if -3.35000000000000009 < F < 1.30000000000000004Initial program 99.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites99.6%
Taylor expanded in F around 0
Applied rewrites98.2%
if 1.30000000000000004 < F Initial program 55.3%
Taylor expanded in F around inf
Applied rewrites99.1%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
*-rgt-identityN/A
lower-/.f6499.1
Applied rewrites99.1%
Final simplification98.9%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ (- x) (tan B))))
(if (<= F -128000000000.0)
(/ (- (fma (cos B) x 1.0)) (sin B))
(if (<= F -4.4e-164)
(fma F (/ (/ 1.0 (sqrt (fma x 2.0 (fma F F 2.0)))) (sin B)) (/ (- x) B))
(if (<= F 5e-10)
(+ t_0 (* (/ F B) (sqrt (/ 1.0 (fma 2.0 x (fma F F 2.0))))))
(+ t_0 (/ 1.0 (sin B))))))))
double code(double F, double B, double x) {
double t_0 = -x / tan(B);
double tmp;
if (F <= -128000000000.0) {
tmp = -fma(cos(B), x, 1.0) / sin(B);
} else if (F <= -4.4e-164) {
tmp = fma(F, ((1.0 / sqrt(fma(x, 2.0, fma(F, F, 2.0)))) / sin(B)), (-x / B));
} else if (F <= 5e-10) {
tmp = t_0 + ((F / B) * sqrt((1.0 / fma(2.0, x, fma(F, F, 2.0)))));
} else {
tmp = t_0 + (1.0 / sin(B));
}
return tmp;
}
function code(F, B, x) t_0 = Float64(Float64(-x) / tan(B)) tmp = 0.0 if (F <= -128000000000.0) tmp = Float64(Float64(-fma(cos(B), x, 1.0)) / sin(B)); elseif (F <= -4.4e-164) tmp = fma(F, Float64(Float64(1.0 / sqrt(fma(x, 2.0, fma(F, F, 2.0)))) / sin(B)), Float64(Float64(-x) / B)); elseif (F <= 5e-10) tmp = Float64(t_0 + Float64(Float64(F / B) * sqrt(Float64(1.0 / fma(2.0, x, fma(F, F, 2.0)))))); else tmp = Float64(t_0 + Float64(1.0 / sin(B))); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -128000000000.0], N[((-N[(N[Cos[B], $MachinePrecision] * x + 1.0), $MachinePrecision]) / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, -4.4e-164], N[(F * N[(N[(1.0 / N[Sqrt[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] + N[((-x) / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 5e-10], N[(t$95$0 + N[(N[(F / B), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-x}{\tan B}\\
\mathbf{if}\;F \leq -128000000000:\\
\;\;\;\;\frac{-\mathsf{fma}\left(\cos B, x, 1\right)}{\sin B}\\
\mathbf{elif}\;F \leq -4.4 \cdot 10^{-164}:\\
\;\;\;\;\mathsf{fma}\left(F, \frac{\frac{1}{\sqrt{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}}{\sin B}, \frac{-x}{B}\right)\\
\mathbf{elif}\;F \leq 5 \cdot 10^{-10}:\\
\;\;\;\;t\_0 + \frac{F}{B} \cdot \sqrt{\frac{1}{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \frac{1}{\sin B}\\
\end{array}
\end{array}
if F < -1.28e11Initial program 49.5%
Taylor expanded in F around -inf
Applied rewrites99.7%
if -1.28e11 < F < -4.39999999999999975e-164Initial program 99.4%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites99.6%
lift-pow.f64N/A
metadata-evalN/A
sqrt-pow1N/A
inv-powN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f6499.6
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6499.6
Applied rewrites99.6%
Taylor expanded in B around 0
Applied rewrites88.1%
if -4.39999999999999975e-164 < F < 5.00000000000000031e-10Initial program 99.5%
Taylor expanded in B around 0
Applied rewrites91.3%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
*-rgt-identityN/A
lower-/.f6491.4
Applied rewrites91.4%
if 5.00000000000000031e-10 < F Initial program 56.4%
Taylor expanded in F around inf
Applied rewrites96.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
*-rgt-identityN/A
lower-/.f6496.8
Applied rewrites96.8%
Final simplification94.7%
(FPCore (F B x)
:precision binary64
(if (<= F -128000000000.0)
(/ (- (fma (cos B) x 1.0)) (sin B))
(if (<= F -4.4e-164)
(fma F (/ (/ 1.0 (sqrt (fma x 2.0 (fma F F 2.0)))) (sin B)) (/ (- x) B))
(if (<= F 5e-10)
(+
(/ (- x) (tan B))
(* (/ F B) (sqrt (/ 1.0 (fma 2.0 x (fma F F 2.0))))))
(/ (fma -1.0 (* (cos B) x) 1.0) (sin B))))))
double code(double F, double B, double x) {
double tmp;
if (F <= -128000000000.0) {
tmp = -fma(cos(B), x, 1.0) / sin(B);
} else if (F <= -4.4e-164) {
tmp = fma(F, ((1.0 / sqrt(fma(x, 2.0, fma(F, F, 2.0)))) / sin(B)), (-x / B));
} else if (F <= 5e-10) {
tmp = (-x / tan(B)) + ((F / B) * sqrt((1.0 / fma(2.0, x, fma(F, F, 2.0)))));
} else {
tmp = fma(-1.0, (cos(B) * x), 1.0) / sin(B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -128000000000.0) tmp = Float64(Float64(-fma(cos(B), x, 1.0)) / sin(B)); elseif (F <= -4.4e-164) tmp = fma(F, Float64(Float64(1.0 / sqrt(fma(x, 2.0, fma(F, F, 2.0)))) / sin(B)), Float64(Float64(-x) / B)); elseif (F <= 5e-10) tmp = Float64(Float64(Float64(-x) / tan(B)) + Float64(Float64(F / B) * sqrt(Float64(1.0 / fma(2.0, x, fma(F, F, 2.0)))))); else tmp = Float64(fma(-1.0, Float64(cos(B) * x), 1.0) / sin(B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -128000000000.0], N[((-N[(N[Cos[B], $MachinePrecision] * x + 1.0), $MachinePrecision]) / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, -4.4e-164], N[(F * N[(N[(1.0 / N[Sqrt[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] + N[((-x) / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 5e-10], N[(N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision] + N[(N[(F / B), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-1.0 * N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision] + 1.0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -128000000000:\\
\;\;\;\;\frac{-\mathsf{fma}\left(\cos B, x, 1\right)}{\sin B}\\
\mathbf{elif}\;F \leq -4.4 \cdot 10^{-164}:\\
\;\;\;\;\mathsf{fma}\left(F, \frac{\frac{1}{\sqrt{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}}{\sin B}, \frac{-x}{B}\right)\\
\mathbf{elif}\;F \leq 5 \cdot 10^{-10}:\\
\;\;\;\;\frac{-x}{\tan B} + \frac{F}{B} \cdot \sqrt{\frac{1}{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-1, \cos B \cdot x, 1\right)}{\sin B}\\
\end{array}
\end{array}
if F < -1.28e11Initial program 49.5%
Taylor expanded in F around -inf
Applied rewrites99.7%
if -1.28e11 < F < -4.39999999999999975e-164Initial program 99.4%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites99.6%
lift-pow.f64N/A
metadata-evalN/A
sqrt-pow1N/A
inv-powN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f6499.6
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6499.6
Applied rewrites99.6%
Taylor expanded in B around 0
Applied rewrites88.1%
if -4.39999999999999975e-164 < F < 5.00000000000000031e-10Initial program 99.5%
Taylor expanded in B around 0
Applied rewrites91.3%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
*-rgt-identityN/A
lower-/.f6491.4
Applied rewrites91.4%
if 5.00000000000000031e-10 < F Initial program 56.4%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites73.6%
Taylor expanded in F around inf
Applied rewrites96.7%
Final simplification94.7%
(FPCore (F B x)
:precision binary64
(let* ((t_0
(fma
F
(/ (/ 1.0 (sqrt (fma x 2.0 (fma F F 2.0)))) (sin B))
(/ (- x) B))))
(if (<= F -128000000000.0)
(/ (- (fma (cos B) x 1.0)) (sin B))
(if (<= F -4.4e-164)
t_0
(if (<= F 3.2e-32)
(+
(/ (- x) (tan B))
(* (/ F B) (sqrt (/ 1.0 (fma 2.0 x (fma F F 2.0))))))
(if (<= F 4.3e+92) t_0 (+ (* x (/ -1.0 (tan B))) (/ 1.0 B))))))))
double code(double F, double B, double x) {
double t_0 = fma(F, ((1.0 / sqrt(fma(x, 2.0, fma(F, F, 2.0)))) / sin(B)), (-x / B));
double tmp;
if (F <= -128000000000.0) {
tmp = -fma(cos(B), x, 1.0) / sin(B);
} else if (F <= -4.4e-164) {
tmp = t_0;
} else if (F <= 3.2e-32) {
tmp = (-x / tan(B)) + ((F / B) * sqrt((1.0 / fma(2.0, x, fma(F, F, 2.0)))));
} else if (F <= 4.3e+92) {
tmp = t_0;
} else {
tmp = (x * (-1.0 / tan(B))) + (1.0 / B);
}
return tmp;
}
function code(F, B, x) t_0 = fma(F, Float64(Float64(1.0 / sqrt(fma(x, 2.0, fma(F, F, 2.0)))) / sin(B)), Float64(Float64(-x) / B)) tmp = 0.0 if (F <= -128000000000.0) tmp = Float64(Float64(-fma(cos(B), x, 1.0)) / sin(B)); elseif (F <= -4.4e-164) tmp = t_0; elseif (F <= 3.2e-32) tmp = Float64(Float64(Float64(-x) / tan(B)) + Float64(Float64(F / B) * sqrt(Float64(1.0 / fma(2.0, x, fma(F, F, 2.0)))))); elseif (F <= 4.3e+92) tmp = t_0; 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[(N[(1.0 / N[Sqrt[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] + N[((-x) / B), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -128000000000.0], N[((-N[(N[Cos[B], $MachinePrecision] * x + 1.0), $MachinePrecision]) / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, -4.4e-164], t$95$0, If[LessEqual[F, 3.2e-32], N[(N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision] + N[(N[(F / B), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 4.3e+92], t$95$0, 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 := \mathsf{fma}\left(F, \frac{\frac{1}{\sqrt{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}}{\sin B}, \frac{-x}{B}\right)\\
\mathbf{if}\;F \leq -128000000000:\\
\;\;\;\;\frac{-\mathsf{fma}\left(\cos B, x, 1\right)}{\sin B}\\
\mathbf{elif}\;F \leq -4.4 \cdot 10^{-164}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;F \leq 3.2 \cdot 10^{-32}:\\
\;\;\;\;\frac{-x}{\tan B} + \frac{F}{B} \cdot \sqrt{\frac{1}{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}\\
\mathbf{elif}\;F \leq 4.3 \cdot 10^{+92}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{1}{B}\\
\end{array}
\end{array}
if F < -1.28e11Initial program 49.5%
Taylor expanded in F around -inf
Applied rewrites99.7%
if -1.28e11 < F < -4.39999999999999975e-164 or 3.2000000000000002e-32 < F < 4.2999999999999998e92Initial program 96.4%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites99.6%
lift-pow.f64N/A
metadata-evalN/A
sqrt-pow1N/A
inv-powN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f6499.7
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6499.7
Applied rewrites99.7%
Taylor expanded in B around 0
Applied rewrites90.1%
if -4.39999999999999975e-164 < F < 3.2000000000000002e-32Initial program 99.6%
Taylor expanded in B around 0
Applied rewrites92.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
*-rgt-identityN/A
lower-/.f6492.2
Applied rewrites92.2%
if 4.2999999999999998e92 < F Initial program 42.0%
Taylor expanded in F around inf
Applied rewrites99.7%
Taylor expanded in B around 0
Applied rewrites81.5%
Final simplification91.4%
(FPCore (F B x)
:precision binary64
(let* ((t_0
(fma
F
(/ (/ 1.0 (sqrt (fma x 2.0 (fma F F 2.0)))) (sin B))
(/ (- x) B))))
(if (<= F -1.45e+14)
(/ (- x -1.0) (- (sin B)))
(if (<= F -4.4e-164)
t_0
(if (<= F 3.2e-32)
(+
(/ (- x) (tan B))
(* (/ F B) (sqrt (/ 1.0 (fma 2.0 x (fma F F 2.0))))))
(if (<= F 4.3e+92) t_0 (+ (* x (/ -1.0 (tan B))) (/ 1.0 B))))))))
double code(double F, double B, double x) {
double t_0 = fma(F, ((1.0 / sqrt(fma(x, 2.0, fma(F, F, 2.0)))) / sin(B)), (-x / B));
double tmp;
if (F <= -1.45e+14) {
tmp = (x - -1.0) / -sin(B);
} else if (F <= -4.4e-164) {
tmp = t_0;
} else if (F <= 3.2e-32) {
tmp = (-x / tan(B)) + ((F / B) * sqrt((1.0 / fma(2.0, x, fma(F, F, 2.0)))));
} else if (F <= 4.3e+92) {
tmp = t_0;
} else {
tmp = (x * (-1.0 / tan(B))) + (1.0 / B);
}
return tmp;
}
function code(F, B, x) t_0 = fma(F, Float64(Float64(1.0 / sqrt(fma(x, 2.0, fma(F, F, 2.0)))) / sin(B)), Float64(Float64(-x) / B)) tmp = 0.0 if (F <= -1.45e+14) tmp = Float64(Float64(x - -1.0) / Float64(-sin(B))); elseif (F <= -4.4e-164) tmp = t_0; elseif (F <= 3.2e-32) tmp = Float64(Float64(Float64(-x) / tan(B)) + Float64(Float64(F / B) * sqrt(Float64(1.0 / fma(2.0, x, fma(F, F, 2.0)))))); elseif (F <= 4.3e+92) tmp = t_0; 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[(N[(1.0 / N[Sqrt[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] + N[((-x) / B), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -1.45e+14], N[(N[(x - -1.0), $MachinePrecision] / (-N[Sin[B], $MachinePrecision])), $MachinePrecision], If[LessEqual[F, -4.4e-164], t$95$0, If[LessEqual[F, 3.2e-32], N[(N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision] + N[(N[(F / B), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 4.3e+92], t$95$0, 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 := \mathsf{fma}\left(F, \frac{\frac{1}{\sqrt{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}}{\sin B}, \frac{-x}{B}\right)\\
\mathbf{if}\;F \leq -1.45 \cdot 10^{+14}:\\
\;\;\;\;\frac{x - -1}{-\sin B}\\
\mathbf{elif}\;F \leq -4.4 \cdot 10^{-164}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;F \leq 3.2 \cdot 10^{-32}:\\
\;\;\;\;\frac{-x}{\tan B} + \frac{F}{B} \cdot \sqrt{\frac{1}{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}\\
\mathbf{elif}\;F \leq 4.3 \cdot 10^{+92}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{1}{B}\\
\end{array}
\end{array}
if F < -1.45e14Initial program 49.5%
Taylor expanded in B around 0
Applied rewrites40.1%
Taylor expanded in F around -inf
Applied rewrites99.7%
Taylor expanded in B around 0
Applied rewrites82.5%
if -1.45e14 < F < -4.39999999999999975e-164 or 3.2000000000000002e-32 < F < 4.2999999999999998e92Initial program 96.4%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites99.6%
lift-pow.f64N/A
metadata-evalN/A
sqrt-pow1N/A
inv-powN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f6499.7
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6499.7
Applied rewrites99.7%
Taylor expanded in B around 0
Applied rewrites90.1%
if -4.39999999999999975e-164 < F < 3.2000000000000002e-32Initial program 99.6%
Taylor expanded in B around 0
Applied rewrites92.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
*-rgt-identityN/A
lower-/.f6492.2
Applied rewrites92.2%
if 4.2999999999999998e92 < F Initial program 42.0%
Taylor expanded in F around inf
Applied rewrites99.7%
Taylor expanded in B around 0
Applied rewrites81.5%
Final simplification87.0%
(FPCore (F B x)
:precision binary64
(let* ((t_0
(fma
F
(/ (/ 1.0 (sqrt (fma x 2.0 (fma F F 2.0)))) (sin B))
(/ (- x) B))))
(if (<= F -1.45e+14)
(/ (- x -1.0) (- (sin B)))
(if (<= F -4.4e-164)
t_0
(if (<= F 3.2e-32)
(- (/ (/ F (sqrt (fma F F (fma 2.0 x 2.0)))) B) (/ x (tan B)))
(if (<= F 4.3e+92) t_0 (+ (* x (/ -1.0 (tan B))) (/ 1.0 B))))))))
double code(double F, double B, double x) {
double t_0 = fma(F, ((1.0 / sqrt(fma(x, 2.0, fma(F, F, 2.0)))) / sin(B)), (-x / B));
double tmp;
if (F <= -1.45e+14) {
tmp = (x - -1.0) / -sin(B);
} else if (F <= -4.4e-164) {
tmp = t_0;
} else if (F <= 3.2e-32) {
tmp = ((F / sqrt(fma(F, F, fma(2.0, x, 2.0)))) / B) - (x / tan(B));
} else if (F <= 4.3e+92) {
tmp = t_0;
} else {
tmp = (x * (-1.0 / tan(B))) + (1.0 / B);
}
return tmp;
}
function code(F, B, x) t_0 = fma(F, Float64(Float64(1.0 / sqrt(fma(x, 2.0, fma(F, F, 2.0)))) / sin(B)), Float64(Float64(-x) / B)) tmp = 0.0 if (F <= -1.45e+14) tmp = Float64(Float64(x - -1.0) / Float64(-sin(B))); elseif (F <= -4.4e-164) tmp = t_0; elseif (F <= 3.2e-32) tmp = Float64(Float64(Float64(F / sqrt(fma(F, F, fma(2.0, x, 2.0)))) / B) - Float64(x / tan(B))); elseif (F <= 4.3e+92) tmp = t_0; 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[(N[(1.0 / N[Sqrt[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] + N[((-x) / B), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -1.45e+14], N[(N[(x - -1.0), $MachinePrecision] / (-N[Sin[B], $MachinePrecision])), $MachinePrecision], If[LessEqual[F, -4.4e-164], t$95$0, If[LessEqual[F, 3.2e-32], N[(N[(N[(F / N[Sqrt[N[(F * F + N[(2.0 * x + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 4.3e+92], t$95$0, 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 := \mathsf{fma}\left(F, \frac{\frac{1}{\sqrt{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}}{\sin B}, \frac{-x}{B}\right)\\
\mathbf{if}\;F \leq -1.45 \cdot 10^{+14}:\\
\;\;\;\;\frac{x - -1}{-\sin B}\\
\mathbf{elif}\;F \leq -4.4 \cdot 10^{-164}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;F \leq 3.2 \cdot 10^{-32}:\\
\;\;\;\;\frac{\frac{F}{\sqrt{\mathsf{fma}\left(F, F, \mathsf{fma}\left(2, x, 2\right)\right)}}}{B} - \frac{x}{\tan B}\\
\mathbf{elif}\;F \leq 4.3 \cdot 10^{+92}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{1}{B}\\
\end{array}
\end{array}
if F < -1.45e14Initial program 49.5%
Taylor expanded in B around 0
Applied rewrites40.1%
Taylor expanded in F around -inf
Applied rewrites99.7%
Taylor expanded in B around 0
Applied rewrites82.5%
if -1.45e14 < F < -4.39999999999999975e-164 or 3.2000000000000002e-32 < F < 4.2999999999999998e92Initial program 96.4%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites99.6%
lift-pow.f64N/A
metadata-evalN/A
sqrt-pow1N/A
inv-powN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f6499.7
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6499.7
Applied rewrites99.7%
Taylor expanded in B around 0
Applied rewrites90.1%
if -4.39999999999999975e-164 < F < 3.2000000000000002e-32Initial program 99.6%
Taylor expanded in B around 0
Applied rewrites92.0%
lift-/.f64N/A
lift-tan.f64N/A
tan-+PI/2-revN/A
lower-tan.f64N/A
lower-+.f64N/A
lower-neg.f64N/A
lower-/.f64N/A
lower-PI.f6410.7
Applied rewrites10.7%
Applied rewrites92.1%
if 4.2999999999999998e92 < F Initial program 42.0%
Taylor expanded in F around inf
Applied rewrites99.7%
Taylor expanded in B around 0
Applied rewrites81.5%
Final simplification87.0%
(FPCore (F B x)
:precision binary64
(if (<= F -2.9e+79)
(/ (- x -1.0) (- (sin B)))
(if (<= F 1.05e-6)
(fma F (/ (/ 1.0 (sqrt (fma x 2.0 (fma F F 2.0)))) B) (/ (- x) (tan B)))
(+ (* x (/ -1.0 (tan B))) (/ 1.0 B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -2.9e+79) {
tmp = (x - -1.0) / -sin(B);
} else if (F <= 1.05e-6) {
tmp = fma(F, ((1.0 / sqrt(fma(x, 2.0, fma(F, F, 2.0)))) / B), (-x / tan(B)));
} else {
tmp = (x * (-1.0 / tan(B))) + (1.0 / B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -2.9e+79) tmp = Float64(Float64(x - -1.0) / Float64(-sin(B))); elseif (F <= 1.05e-6) tmp = fma(F, Float64(Float64(1.0 / sqrt(fma(x, 2.0, fma(F, F, 2.0)))) / B), Float64(Float64(-x) / tan(B))); else tmp = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64(1.0 / B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -2.9e+79], N[(N[(x - -1.0), $MachinePrecision] / (-N[Sin[B], $MachinePrecision])), $MachinePrecision], If[LessEqual[F, 1.05e-6], N[(F * N[(N[(1.0 / N[Sqrt[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision] + N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / B), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -2.9 \cdot 10^{+79}:\\
\;\;\;\;\frac{x - -1}{-\sin B}\\
\mathbf{elif}\;F \leq 1.05 \cdot 10^{-6}:\\
\;\;\;\;\mathsf{fma}\left(F, \frac{\frac{1}{\sqrt{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}}{B}, \frac{-x}{\tan B}\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{1}{B}\\
\end{array}
\end{array}
if F < -2.89999999999999992e79Initial program 42.6%
Taylor expanded in B around 0
Applied rewrites34.9%
Taylor expanded in F around -inf
Applied rewrites99.8%
Taylor expanded in B around 0
Applied rewrites82.8%
if -2.89999999999999992e79 < F < 1.0499999999999999e-6Initial program 99.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites99.6%
lift-pow.f64N/A
metadata-evalN/A
sqrt-pow1N/A
inv-powN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f6499.6
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6499.6
Applied rewrites99.6%
Taylor expanded in B around 0
Applied rewrites85.5%
if 1.0499999999999999e-6 < F Initial program 55.9%
Taylor expanded in F around inf
Applied rewrites97.9%
Taylor expanded in B around 0
Applied rewrites79.1%
Final simplification83.0%
(FPCore (F B x)
:precision binary64
(if (<= F -2.9e+79)
(/ (- x -1.0) (- (sin B)))
(if (<= F 5e+107)
(- (/ (/ F (sqrt (fma F F (fma 2.0 x 2.0)))) B) (/ x (tan B)))
(+ (* x (/ -1.0 (tan B))) (/ 1.0 B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -2.9e+79) {
tmp = (x - -1.0) / -sin(B);
} else if (F <= 5e+107) {
tmp = ((F / sqrt(fma(F, F, fma(2.0, x, 2.0)))) / B) - (x / tan(B));
} else {
tmp = (x * (-1.0 / tan(B))) + (1.0 / B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -2.9e+79) tmp = Float64(Float64(x - -1.0) / Float64(-sin(B))); elseif (F <= 5e+107) tmp = Float64(Float64(Float64(F / sqrt(fma(F, F, fma(2.0, x, 2.0)))) / B) - Float64(x / tan(B))); else tmp = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64(1.0 / B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -2.9e+79], N[(N[(x - -1.0), $MachinePrecision] / (-N[Sin[B], $MachinePrecision])), $MachinePrecision], If[LessEqual[F, 5e+107], N[(N[(N[(F / N[Sqrt[N[(F * F + N[(2.0 * x + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / B), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -2.9 \cdot 10^{+79}:\\
\;\;\;\;\frac{x - -1}{-\sin B}\\
\mathbf{elif}\;F \leq 5 \cdot 10^{+107}:\\
\;\;\;\;\frac{\frac{F}{\sqrt{\mathsf{fma}\left(F, F, \mathsf{fma}\left(2, x, 2\right)\right)}}}{B} - \frac{x}{\tan B}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{1}{B}\\
\end{array}
\end{array}
if F < -2.89999999999999992e79Initial program 42.6%
Taylor expanded in B around 0
Applied rewrites34.9%
Taylor expanded in F around -inf
Applied rewrites99.8%
Taylor expanded in B around 0
Applied rewrites82.8%
if -2.89999999999999992e79 < F < 5.0000000000000002e107Initial program 97.6%
Taylor expanded in B around 0
Applied rewrites81.4%
lift-/.f64N/A
lift-tan.f64N/A
tan-+PI/2-revN/A
lower-tan.f64N/A
lower-+.f64N/A
lower-neg.f64N/A
lower-/.f64N/A
lower-PI.f6421.2
Applied rewrites21.2%
Applied rewrites83.4%
if 5.0000000000000002e107 < F Initial program 39.3%
Taylor expanded in F around inf
Applied rewrites99.7%
Taylor expanded in B around 0
Applied rewrites82.1%
Final simplification83.0%
(FPCore (F B x)
:precision binary64
(if (<= B 0.048)
(/
(-
(fma
(sqrt (/ 1.0 (fma 2.0 x (fma F F 2.0))))
(fma (* (* B B) F) 0.16666666666666666 F)
(* (* 0.3333333333333333 (* B B)) x))
x)
B)
(+
(* x (/ -1.0 (tan B)))
(/ 1.0 (* (fma -0.16666666666666666 (* B B) 1.0) B)))))
double code(double F, double B, double x) {
double tmp;
if (B <= 0.048) {
tmp = (fma(sqrt((1.0 / fma(2.0, x, fma(F, F, 2.0)))), fma(((B * B) * F), 0.16666666666666666, F), ((0.3333333333333333 * (B * B)) * x)) - x) / B;
} else {
tmp = (x * (-1.0 / tan(B))) + (1.0 / (fma(-0.16666666666666666, (B * B), 1.0) * B));
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (B <= 0.048) tmp = Float64(Float64(fma(sqrt(Float64(1.0 / fma(2.0, x, fma(F, F, 2.0)))), fma(Float64(Float64(B * B) * F), 0.16666666666666666, F), Float64(Float64(0.3333333333333333 * Float64(B * B)) * x)) - x) / B); else tmp = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64(1.0 / Float64(fma(-0.16666666666666666, Float64(B * B), 1.0) * B))); end return tmp end
code[F_, B_, x_] := If[LessEqual[B, 0.048], N[(N[(N[(N[Sqrt[N[(1.0 / N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[(N[(B * B), $MachinePrecision] * F), $MachinePrecision] * 0.16666666666666666 + F), $MachinePrecision] + N[(N[(0.3333333333333333 * N[(B * B), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[(-0.16666666666666666 * N[(B * B), $MachinePrecision] + 1.0), $MachinePrecision] * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq 0.048:\\
\;\;\;\;\frac{\mathsf{fma}\left(\sqrt{\frac{1}{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}, \mathsf{fma}\left(\left(B \cdot B\right) \cdot F, 0.16666666666666666, F\right), \left(0.3333333333333333 \cdot \left(B \cdot B\right)\right) \cdot x\right) - x}{B}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{1}{\mathsf{fma}\left(-0.16666666666666666, B \cdot B, 1\right) \cdot B}\\
\end{array}
\end{array}
if B < 0.048000000000000001Initial program 70.8%
Taylor expanded in B around 0
Applied rewrites58.3%
if 0.048000000000000001 < B Initial program 83.8%
Taylor expanded in F around inf
Applied rewrites48.6%
Taylor expanded in B around 0
Applied rewrites49.1%
Final simplification56.1%
(FPCore (F B x)
:precision binary64
(if (<= F -0.22)
(/ (- x -1.0) (- (sin B)))
(if (<= F 5e-10)
(+
(- (/ (fma (* (* B B) x) -0.3333333333333333 x) B))
(* (/ F B) (sqrt (/ 1.0 (fma 2.0 x (fma F F 2.0))))))
(+ (- (/ x B)) (/ 1.0 (sin B))))))
double code(double F, double B, double x) {
double tmp;
if (F <= -0.22) {
tmp = (x - -1.0) / -sin(B);
} else if (F <= 5e-10) {
tmp = -(fma(((B * B) * x), -0.3333333333333333, x) / B) + ((F / B) * sqrt((1.0 / fma(2.0, x, fma(F, F, 2.0)))));
} else {
tmp = -(x / B) + (1.0 / sin(B));
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -0.22) tmp = Float64(Float64(x - -1.0) / Float64(-sin(B))); elseif (F <= 5e-10) tmp = Float64(Float64(-Float64(fma(Float64(Float64(B * B) * x), -0.3333333333333333, x) / B)) + Float64(Float64(F / B) * sqrt(Float64(1.0 / fma(2.0, x, fma(F, F, 2.0)))))); else tmp = Float64(Float64(-Float64(x / B)) + Float64(1.0 / sin(B))); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -0.22], N[(N[(x - -1.0), $MachinePrecision] / (-N[Sin[B], $MachinePrecision])), $MachinePrecision], If[LessEqual[F, 5e-10], N[((-N[(N[(N[(N[(B * B), $MachinePrecision] * x), $MachinePrecision] * -0.3333333333333333 + x), $MachinePrecision] / B), $MachinePrecision]) + N[(N[(F / B), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-N[(x / B), $MachinePrecision]) + N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -0.22:\\
\;\;\;\;\frac{x - -1}{-\sin B}\\
\mathbf{elif}\;F \leq 5 \cdot 10^{-10}:\\
\;\;\;\;\left(-\frac{\mathsf{fma}\left(\left(B \cdot B\right) \cdot x, -0.3333333333333333, x\right)}{B}\right) + \frac{F}{B} \cdot \sqrt{\frac{1}{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}\\
\mathbf{else}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{1}{\sin B}\\
\end{array}
\end{array}
if F < -0.220000000000000001Initial program 52.3%
Taylor expanded in B around 0
Applied rewrites40.7%
Taylor expanded in F around -inf
Applied rewrites98.6%
Taylor expanded in B around 0
Applied rewrites82.3%
if -0.220000000000000001 < F < 5.00000000000000031e-10Initial program 99.5%
Taylor expanded in B around 0
Applied rewrites86.3%
Taylor expanded in B around 0
Applied rewrites52.4%
if 5.00000000000000031e-10 < F Initial program 56.4%
Taylor expanded in F around inf
Applied rewrites96.7%
Taylor expanded in B around 0
Applied rewrites74.2%
Final simplification66.9%
(FPCore (F B x)
:precision binary64
(if (<= B 0.15)
(/
(-
(fma
(sqrt (/ 1.0 (fma 2.0 x (fma F F 2.0))))
(fma (* (* B B) F) 0.16666666666666666 F)
(* (* 0.3333333333333333 (* B B)) x))
x)
B)
(+ (* x (/ -1.0 (tan B))) (/ 1.0 B))))
double code(double F, double B, double x) {
double tmp;
if (B <= 0.15) {
tmp = (fma(sqrt((1.0 / fma(2.0, x, fma(F, F, 2.0)))), fma(((B * B) * F), 0.16666666666666666, F), ((0.3333333333333333 * (B * B)) * x)) - x) / B;
} else {
tmp = (x * (-1.0 / tan(B))) + (1.0 / B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (B <= 0.15) tmp = Float64(Float64(fma(sqrt(Float64(1.0 / fma(2.0, x, fma(F, F, 2.0)))), fma(Float64(Float64(B * B) * F), 0.16666666666666666, F), Float64(Float64(0.3333333333333333 * Float64(B * B)) * x)) - x) / B); else tmp = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64(1.0 / B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[B, 0.15], N[(N[(N[(N[Sqrt[N[(1.0 / N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[(N[(B * B), $MachinePrecision] * F), $MachinePrecision] * 0.16666666666666666 + F), $MachinePrecision] + N[(N[(0.3333333333333333 * N[(B * B), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]), $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}
\mathbf{if}\;B \leq 0.15:\\
\;\;\;\;\frac{\mathsf{fma}\left(\sqrt{\frac{1}{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}, \mathsf{fma}\left(\left(B \cdot B\right) \cdot F, 0.16666666666666666, F\right), \left(0.3333333333333333 \cdot \left(B \cdot B\right)\right) \cdot x\right) - x}{B}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{1}{B}\\
\end{array}
\end{array}
if B < 0.149999999999999994Initial program 70.8%
Taylor expanded in B around 0
Applied rewrites58.3%
if 0.149999999999999994 < B Initial program 83.8%
Taylor expanded in F around inf
Applied rewrites48.6%
Taylor expanded in B around 0
Applied rewrites44.7%
Final simplification55.0%
(FPCore (F B x)
:precision binary64
(if (<= F -0.22)
(/ (- x -1.0) (- (sin B)))
(if (<= F 5e-10)
(+
(- (/ (fma (* (* B B) x) -0.3333333333333333 x) B))
(* (/ F B) (sqrt (/ 1.0 (fma 2.0 x (fma F F 2.0))))))
(/ (- (fma (/ -0.5 F) (/ (fma 2.0 x 2.0) F) 1.0) x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -0.22) {
tmp = (x - -1.0) / -sin(B);
} else if (F <= 5e-10) {
tmp = -(fma(((B * B) * x), -0.3333333333333333, x) / B) + ((F / B) * sqrt((1.0 / fma(2.0, x, fma(F, F, 2.0)))));
} else {
tmp = (fma((-0.5 / F), (fma(2.0, x, 2.0) / F), 1.0) - x) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -0.22) tmp = Float64(Float64(x - -1.0) / Float64(-sin(B))); elseif (F <= 5e-10) tmp = Float64(Float64(-Float64(fma(Float64(Float64(B * B) * x), -0.3333333333333333, x) / B)) + Float64(Float64(F / B) * sqrt(Float64(1.0 / fma(2.0, x, fma(F, F, 2.0)))))); else tmp = Float64(Float64(fma(Float64(-0.5 / F), Float64(fma(2.0, x, 2.0) / F), 1.0) - x) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -0.22], N[(N[(x - -1.0), $MachinePrecision] / (-N[Sin[B], $MachinePrecision])), $MachinePrecision], If[LessEqual[F, 5e-10], N[((-N[(N[(N[(N[(B * B), $MachinePrecision] * x), $MachinePrecision] * -0.3333333333333333 + x), $MachinePrecision] / B), $MachinePrecision]) + N[(N[(F / B), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(-0.5 / F), $MachinePrecision] * N[(N[(2.0 * x + 2.0), $MachinePrecision] / F), $MachinePrecision] + 1.0), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -0.22:\\
\;\;\;\;\frac{x - -1}{-\sin B}\\
\mathbf{elif}\;F \leq 5 \cdot 10^{-10}:\\
\;\;\;\;\left(-\frac{\mathsf{fma}\left(\left(B \cdot B\right) \cdot x, -0.3333333333333333, x\right)}{B}\right) + \frac{F}{B} \cdot \sqrt{\frac{1}{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{-0.5}{F}, \frac{\mathsf{fma}\left(2, x, 2\right)}{F}, 1\right) - x}{B}\\
\end{array}
\end{array}
if F < -0.220000000000000001Initial program 52.3%
Taylor expanded in B around 0
Applied rewrites40.7%
Taylor expanded in F around -inf
Applied rewrites98.6%
Taylor expanded in B around 0
Applied rewrites82.3%
if -0.220000000000000001 < F < 5.00000000000000031e-10Initial program 99.5%
Taylor expanded in B around 0
Applied rewrites86.3%
Taylor expanded in B around 0
Applied rewrites52.4%
if 5.00000000000000031e-10 < F Initial program 56.4%
Taylor expanded in B around 0
Applied rewrites39.0%
Taylor expanded in F around inf
Applied rewrites56.2%
Final simplification61.7%
(FPCore (F B x)
:precision binary64
(if (<= F -6.6e+134)
(/ -1.0 (sin B))
(if (<= F 4.2e+103)
(/ (- (* (sqrt (/ 1.0 (fma 2.0 x (fma F F 2.0)))) F) x) B)
(+ (- (/ x B)) (/ (fma 0.16666666666666666 (* B B) 1.0) B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -6.6e+134) {
tmp = -1.0 / sin(B);
} else if (F <= 4.2e+103) {
tmp = ((sqrt((1.0 / fma(2.0, x, fma(F, F, 2.0)))) * F) - x) / B;
} else {
tmp = -(x / B) + (fma(0.16666666666666666, (B * B), 1.0) / B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -6.6e+134) tmp = Float64(-1.0 / sin(B)); elseif (F <= 4.2e+103) tmp = Float64(Float64(Float64(sqrt(Float64(1.0 / fma(2.0, x, fma(F, F, 2.0)))) * F) - x) / B); else tmp = Float64(Float64(-Float64(x / B)) + Float64(fma(0.16666666666666666, Float64(B * B), 1.0) / B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -6.6e+134], N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 4.2e+103], N[(N[(N[(N[Sqrt[N[(1.0 / N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * F), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[((-N[(x / B), $MachinePrecision]) + N[(N[(0.16666666666666666 * N[(B * B), $MachinePrecision] + 1.0), $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -6.6 \cdot 10^{+134}:\\
\;\;\;\;\frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 4.2 \cdot 10^{+103}:\\
\;\;\;\;\frac{\sqrt{\frac{1}{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}} \cdot F - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{\mathsf{fma}\left(0.16666666666666666, B \cdot B, 1\right)}{B}\\
\end{array}
\end{array}
if F < -6.6e134Initial program 30.7%
Taylor expanded in B around 0
Applied rewrites20.8%
Taylor expanded in F around -inf
Applied rewrites99.7%
Taylor expanded in x around 0
Applied rewrites58.7%
if -6.6e134 < F < 4.2000000000000003e103Initial program 96.1%
Taylor expanded in B around 0
Applied rewrites56.9%
if 4.2000000000000003e103 < F Initial program 39.3%
Taylor expanded in F around inf
Applied rewrites99.7%
Taylor expanded in B around 0
Applied rewrites72.5%
Taylor expanded in B around 0
Applied rewrites54.8%
Final simplification56.8%
(FPCore (F B x)
:precision binary64
(if (<= F -1.85e+77)
(/ (- -1.0 x) B)
(if (<= F 5e-10)
(+
(- (/ (fma (* (* B B) x) -0.3333333333333333 x) B))
(* (/ F B) (sqrt (/ 1.0 (fma 2.0 x (fma F F 2.0))))))
(/ (- (fma (/ -0.5 F) (/ (fma 2.0 x 2.0) F) 1.0) x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1.85e+77) {
tmp = (-1.0 - x) / B;
} else if (F <= 5e-10) {
tmp = -(fma(((B * B) * x), -0.3333333333333333, x) / B) + ((F / B) * sqrt((1.0 / fma(2.0, x, fma(F, F, 2.0)))));
} else {
tmp = (fma((-0.5 / F), (fma(2.0, x, 2.0) / F), 1.0) - x) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -1.85e+77) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 5e-10) tmp = Float64(Float64(-Float64(fma(Float64(Float64(B * B) * x), -0.3333333333333333, x) / B)) + Float64(Float64(F / B) * sqrt(Float64(1.0 / fma(2.0, x, fma(F, F, 2.0)))))); else tmp = Float64(Float64(fma(Float64(-0.5 / F), Float64(fma(2.0, x, 2.0) / F), 1.0) - x) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -1.85e+77], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 5e-10], N[((-N[(N[(N[(N[(B * B), $MachinePrecision] * x), $MachinePrecision] * -0.3333333333333333 + x), $MachinePrecision] / B), $MachinePrecision]) + N[(N[(F / B), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(-0.5 / F), $MachinePrecision] * N[(N[(2.0 * x + 2.0), $MachinePrecision] / F), $MachinePrecision] + 1.0), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.85 \cdot 10^{+77}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 5 \cdot 10^{-10}:\\
\;\;\;\;\left(-\frac{\mathsf{fma}\left(\left(B \cdot B\right) \cdot x, -0.3333333333333333, x\right)}{B}\right) + \frac{F}{B} \cdot \sqrt{\frac{1}{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{-0.5}{F}, \frac{\mathsf{fma}\left(2, x, 2\right)}{F}, 1\right) - x}{B}\\
\end{array}
\end{array}
if F < -1.84999999999999997e77Initial program 42.6%
Taylor expanded in B around 0
Applied rewrites34.9%
Taylor expanded in F around -inf
Applied rewrites55.3%
if -1.84999999999999997e77 < F < 5.00000000000000031e-10Initial program 99.5%
Taylor expanded in B around 0
Applied rewrites86.0%
Taylor expanded in B around 0
Applied rewrites54.2%
if 5.00000000000000031e-10 < F Initial program 56.4%
Taylor expanded in B around 0
Applied rewrites39.0%
Taylor expanded in F around inf
Applied rewrites56.2%
(FPCore (F B x)
:precision binary64
(if (<= F -8.6e+38)
(-
(/
(-
(fma
(fma -0.5 x (fma 0.16666666666666666 x 0.16666666666666666))
(* B B)
x)
-1.0)
B))
(if (<= F 4.2e+103)
(/ (- (* (sqrt (/ 1.0 (fma 2.0 x (fma F F 2.0)))) F) x) B)
(+ (- (/ x B)) (/ (fma 0.16666666666666666 (* B B) 1.0) B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -8.6e+38) {
tmp = -((fma(fma(-0.5, x, fma(0.16666666666666666, x, 0.16666666666666666)), (B * B), x) - -1.0) / B);
} else if (F <= 4.2e+103) {
tmp = ((sqrt((1.0 / fma(2.0, x, fma(F, F, 2.0)))) * F) - x) / B;
} else {
tmp = -(x / B) + (fma(0.16666666666666666, (B * B), 1.0) / B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -8.6e+38) tmp = Float64(-Float64(Float64(fma(fma(-0.5, x, fma(0.16666666666666666, x, 0.16666666666666666)), Float64(B * B), x) - -1.0) / B)); elseif (F <= 4.2e+103) tmp = Float64(Float64(Float64(sqrt(Float64(1.0 / fma(2.0, x, fma(F, F, 2.0)))) * F) - x) / B); else tmp = Float64(Float64(-Float64(x / B)) + Float64(fma(0.16666666666666666, Float64(B * B), 1.0) / B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -8.6e+38], (-N[(N[(N[(N[(-0.5 * x + N[(0.16666666666666666 * x + 0.16666666666666666), $MachinePrecision]), $MachinePrecision] * N[(B * B), $MachinePrecision] + x), $MachinePrecision] - -1.0), $MachinePrecision] / B), $MachinePrecision]), If[LessEqual[F, 4.2e+103], N[(N[(N[(N[Sqrt[N[(1.0 / N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * F), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[((-N[(x / B), $MachinePrecision]) + N[(N[(0.16666666666666666 * N[(B * B), $MachinePrecision] + 1.0), $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -8.6 \cdot 10^{+38}:\\
\;\;\;\;-\frac{\mathsf{fma}\left(\mathsf{fma}\left(-0.5, x, \mathsf{fma}\left(0.16666666666666666, x, 0.16666666666666666\right)\right), B \cdot B, x\right) - -1}{B}\\
\mathbf{elif}\;F \leq 4.2 \cdot 10^{+103}:\\
\;\;\;\;\frac{\sqrt{\frac{1}{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}} \cdot F - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{\mathsf{fma}\left(0.16666666666666666, B \cdot B, 1\right)}{B}\\
\end{array}
\end{array}
if F < -8.5999999999999994e38Initial program 47.1%
Taylor expanded in B around 0
Applied rewrites37.2%
Taylor expanded in F around -inf
Applied rewrites99.7%
Taylor expanded in B around 0
Applied rewrites56.3%
if -8.5999999999999994e38 < F < 4.2000000000000003e103Initial program 97.6%
Taylor expanded in B around 0
Applied rewrites54.5%
if 4.2000000000000003e103 < F Initial program 39.3%
Taylor expanded in F around inf
Applied rewrites99.7%
Taylor expanded in B around 0
Applied rewrites72.5%
Taylor expanded in B around 0
Applied rewrites54.8%
Final simplification55.0%
(FPCore (F B x)
:precision binary64
(if (<= F -2.2)
(-
(/
(-
(fma
(fma -0.5 x (fma 0.16666666666666666 x 0.16666666666666666))
(* B B)
x)
-1.0)
B))
(if (<= F 490000000.0)
(/ (- (* (sqrt (/ 1.0 (fma 2.0 x 2.0))) F) x) B)
(+ (- (/ x B)) (/ (fma 0.16666666666666666 (* B B) 1.0) B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -2.2) {
tmp = -((fma(fma(-0.5, x, fma(0.16666666666666666, x, 0.16666666666666666)), (B * B), x) - -1.0) / B);
} else if (F <= 490000000.0) {
tmp = ((sqrt((1.0 / fma(2.0, x, 2.0))) * F) - x) / B;
} else {
tmp = -(x / B) + (fma(0.16666666666666666, (B * B), 1.0) / B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -2.2) tmp = Float64(-Float64(Float64(fma(fma(-0.5, x, fma(0.16666666666666666, x, 0.16666666666666666)), Float64(B * B), x) - -1.0) / B)); elseif (F <= 490000000.0) tmp = Float64(Float64(Float64(sqrt(Float64(1.0 / fma(2.0, x, 2.0))) * F) - x) / B); else tmp = Float64(Float64(-Float64(x / B)) + Float64(fma(0.16666666666666666, Float64(B * B), 1.0) / B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -2.2], (-N[(N[(N[(N[(-0.5 * x + N[(0.16666666666666666 * x + 0.16666666666666666), $MachinePrecision]), $MachinePrecision] * N[(B * B), $MachinePrecision] + x), $MachinePrecision] - -1.0), $MachinePrecision] / B), $MachinePrecision]), If[LessEqual[F, 490000000.0], N[(N[(N[(N[Sqrt[N[(1.0 / N[(2.0 * x + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * F), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[((-N[(x / B), $MachinePrecision]) + N[(N[(0.16666666666666666 * N[(B * B), $MachinePrecision] + 1.0), $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -2.2:\\
\;\;\;\;-\frac{\mathsf{fma}\left(\mathsf{fma}\left(-0.5, x, \mathsf{fma}\left(0.16666666666666666, x, 0.16666666666666666\right)\right), B \cdot B, x\right) - -1}{B}\\
\mathbf{elif}\;F \leq 490000000:\\
\;\;\;\;\frac{\sqrt{\frac{1}{\mathsf{fma}\left(2, x, 2\right)}} \cdot F - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{\mathsf{fma}\left(0.16666666666666666, B \cdot B, 1\right)}{B}\\
\end{array}
\end{array}
if F < -2.2000000000000002Initial program 51.6%
Taylor expanded in B around 0
Applied rewrites41.3%
Taylor expanded in F around -inf
Applied rewrites99.8%
Taylor expanded in B around 0
Applied rewrites58.7%
if -2.2000000000000002 < F < 4.9e8Initial program 99.5%
Taylor expanded in B around 0
Applied rewrites50.2%
Taylor expanded in F around 0
Applied rewrites49.6%
if 4.9e8 < F Initial program 52.7%
Taylor expanded in F around inf
Applied rewrites99.8%
Taylor expanded in B around 0
Applied rewrites76.7%
Taylor expanded in B around 0
Applied rewrites59.5%
Final simplification54.7%
(FPCore (F B x)
:precision binary64
(if (<= F -1.96e-7)
(-
(/
(-
(fma
(fma -0.5 x (fma 0.16666666666666666 x 0.16666666666666666))
(* B B)
x)
-1.0)
B))
(if (<= F 490000000.0)
(/ (- x) B)
(+ (- (/ x B)) (/ (fma 0.16666666666666666 (* B B) 1.0) B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1.96e-7) {
tmp = -((fma(fma(-0.5, x, fma(0.16666666666666666, x, 0.16666666666666666)), (B * B), x) - -1.0) / B);
} else if (F <= 490000000.0) {
tmp = -x / B;
} else {
tmp = -(x / B) + (fma(0.16666666666666666, (B * B), 1.0) / B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -1.96e-7) tmp = Float64(-Float64(Float64(fma(fma(-0.5, x, fma(0.16666666666666666, x, 0.16666666666666666)), Float64(B * B), x) - -1.0) / B)); elseif (F <= 490000000.0) tmp = Float64(Float64(-x) / B); else tmp = Float64(Float64(-Float64(x / B)) + Float64(fma(0.16666666666666666, Float64(B * B), 1.0) / B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -1.96e-7], (-N[(N[(N[(N[(-0.5 * x + N[(0.16666666666666666 * x + 0.16666666666666666), $MachinePrecision]), $MachinePrecision] * N[(B * B), $MachinePrecision] + x), $MachinePrecision] - -1.0), $MachinePrecision] / B), $MachinePrecision]), If[LessEqual[F, 490000000.0], N[((-x) / B), $MachinePrecision], N[((-N[(x / B), $MachinePrecision]) + N[(N[(0.16666666666666666 * N[(B * B), $MachinePrecision] + 1.0), $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.96 \cdot 10^{-7}:\\
\;\;\;\;-\frac{\mathsf{fma}\left(\mathsf{fma}\left(-0.5, x, \mathsf{fma}\left(0.16666666666666666, x, 0.16666666666666666\right)\right), B \cdot B, x\right) - -1}{B}\\
\mathbf{elif}\;F \leq 490000000:\\
\;\;\;\;\frac{-x}{B}\\
\mathbf{else}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{\mathsf{fma}\left(0.16666666666666666, B \cdot B, 1\right)}{B}\\
\end{array}
\end{array}
if F < -1.9600000000000001e-7Initial program 53.0%
Taylor expanded in B around 0
Applied rewrites41.5%
Taylor expanded in F around -inf
Applied rewrites97.4%
Taylor expanded in B around 0
Applied rewrites57.3%
if -1.9600000000000001e-7 < F < 4.9e8Initial program 99.5%
Taylor expanded in B around 0
Applied rewrites50.2%
Taylor expanded in F around 0
Applied rewrites38.6%
if 4.9e8 < F Initial program 52.7%
Taylor expanded in F around inf
Applied rewrites99.8%
Taylor expanded in B around 0
Applied rewrites76.7%
Taylor expanded in B around 0
Applied rewrites59.5%
Final simplification49.4%
(FPCore (F B x)
:precision binary64
(if (<= F -1.96e-7)
(/ (- -1.0 x) B)
(if (<= F 490000000.0)
(/ (- x) B)
(+ (- (/ x B)) (/ (fma 0.16666666666666666 (* B B) 1.0) B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1.96e-7) {
tmp = (-1.0 - x) / B;
} else if (F <= 490000000.0) {
tmp = -x / B;
} else {
tmp = -(x / B) + (fma(0.16666666666666666, (B * B), 1.0) / B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -1.96e-7) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 490000000.0) tmp = Float64(Float64(-x) / B); else tmp = Float64(Float64(-Float64(x / B)) + Float64(fma(0.16666666666666666, Float64(B * B), 1.0) / B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -1.96e-7], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 490000000.0], N[((-x) / B), $MachinePrecision], N[((-N[(x / B), $MachinePrecision]) + N[(N[(0.16666666666666666 * N[(B * B), $MachinePrecision] + 1.0), $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.96 \cdot 10^{-7}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 490000000:\\
\;\;\;\;\frac{-x}{B}\\
\mathbf{else}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{\mathsf{fma}\left(0.16666666666666666, B \cdot B, 1\right)}{B}\\
\end{array}
\end{array}
if F < -1.9600000000000001e-7Initial program 53.0%
Taylor expanded in B around 0
Applied rewrites41.5%
Taylor expanded in F around -inf
Applied rewrites57.1%
if -1.9600000000000001e-7 < F < 4.9e8Initial program 99.5%
Taylor expanded in B around 0
Applied rewrites50.2%
Taylor expanded in F around 0
Applied rewrites38.6%
if 4.9e8 < F Initial program 52.7%
Taylor expanded in F around inf
Applied rewrites99.8%
Taylor expanded in B around 0
Applied rewrites76.7%
Taylor expanded in B around 0
Applied rewrites59.5%
(FPCore (F B x) :precision binary64 (if (<= F -3.8e-21) (/ (- -1.0 x) B) (if (<= F 1.1e-6) (/ (- x) B) (/ (- 1.0 x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -3.8e-21) {
tmp = (-1.0 - x) / B;
} else if (F <= 1.1e-6) {
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.8d-21)) then
tmp = ((-1.0d0) - x) / b
else if (f <= 1.1d-6) 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.8e-21) {
tmp = (-1.0 - x) / B;
} else if (F <= 1.1e-6) {
tmp = -x / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -3.8e-21: tmp = (-1.0 - x) / B elif F <= 1.1e-6: tmp = -x / B else: tmp = (1.0 - x) / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= -3.8e-21) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 1.1e-6) 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.8e-21) tmp = (-1.0 - x) / B; elseif (F <= 1.1e-6) tmp = -x / B; else tmp = (1.0 - x) / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -3.8e-21], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 1.1e-6], N[((-x) / B), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -3.8 \cdot 10^{-21}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 1.1 \cdot 10^{-6}:\\
\;\;\;\;\frac{-x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < -3.7999999999999998e-21Initial program 54.9%
Taylor expanded in B around 0
Applied rewrites42.7%
Taylor expanded in F around -inf
Applied rewrites57.6%
if -3.7999999999999998e-21 < F < 1.1000000000000001e-6Initial program 99.5%
Taylor expanded in B around 0
Applied rewrites50.5%
Taylor expanded in F around 0
Applied rewrites38.1%
if 1.1000000000000001e-6 < F Initial program 55.3%
Taylor expanded in B around 0
Applied rewrites40.0%
Taylor expanded in F around inf
Applied rewrites57.7%
(FPCore (F B x) :precision binary64 (if (<= F -1.96e-7) (/ (- -1.0 x) B) (/ (- x) B)))
double code(double F, double B, double x) {
double tmp;
if (F <= -1.96e-7) {
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 <= (-1.96d-7)) 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 <= -1.96e-7) {
tmp = (-1.0 - x) / B;
} else {
tmp = -x / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -1.96e-7: tmp = (-1.0 - x) / B else: tmp = -x / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= -1.96e-7) 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 <= -1.96e-7) tmp = (-1.0 - x) / B; else tmp = -x / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -1.96e-7], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], N[((-x) / B), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.96 \cdot 10^{-7}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{-x}{B}\\
\end{array}
\end{array}
if F < -1.9600000000000001e-7Initial program 53.0%
Taylor expanded in B around 0
Applied rewrites41.5%
Taylor expanded in F around -inf
Applied rewrites57.1%
if -1.9600000000000001e-7 < F Initial program 82.0%
Taylor expanded in B around 0
Applied rewrites46.7%
Taylor expanded in F around 0
Applied rewrites33.6%
(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 74.0%
Taylor expanded in B around 0
Applied rewrites45.2%
Taylor expanded in F around 0
Applied rewrites33.3%
herbie shell --seed 2025022
(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))))))