
(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 -8.5e+51)
(+ t_0 (/ -1.0 (sin B)))
(if (<= F 7.5e-6)
(fma F (/ (pow (fma 2.0 x (fma F F 2.0)) -0.5) (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 <= -8.5e+51) {
tmp = t_0 + (-1.0 / sin(B));
} else if (F <= 7.5e-6) {
tmp = fma(F, (pow(fma(2.0, x, fma(F, F, 2.0)), -0.5) / 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 <= -8.5e+51) tmp = Float64(t_0 + Float64(-1.0 / sin(B))); elseif (F <= 7.5e-6) tmp = fma(F, Float64((fma(2.0, x, fma(F, F, 2.0)) ^ -0.5) / 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, -8.5e+51], N[(t$95$0 + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 7.5e-6], N[(F * N[(N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $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 -8.5 \cdot 10^{+51}:\\
\;\;\;\;t\_0 + \frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 7.5 \cdot 10^{-6}:\\
\;\;\;\;\mathsf{fma}\left(F, \frac{{\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{\sin B}, t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \frac{1}{\sin B}\\
\end{array}
\end{array}
if F < -8.4999999999999999e51Initial program 49.8%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6499.9
Applied rewrites99.9%
if -8.4999999999999999e51 < F < 7.50000000000000019e-6Initial program 99.5%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites99.5%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6499.7
Applied rewrites99.7%
lift-+.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
lift-sin.f64N/A
+-commutativeN/A
associate-/l*N/A
associate-*r/N/A
Applied rewrites99.8%
if 7.50000000000000019e-6 < F Initial program 71.4%
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 rewrites78.5%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6478.7
Applied rewrites78.7%
Taylor expanded in F around inf
Applied rewrites99.8%
Final simplification99.8%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ (- x) (tan B))))
(if (<= F -60000.0)
(+ t_0 (/ -1.0 (sin B)))
(if (<= F 7.5e-6)
(fma F (/ (pow (fma 2.0 x 2.0) -0.5) (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 <= -60000.0) {
tmp = t_0 + (-1.0 / sin(B));
} else if (F <= 7.5e-6) {
tmp = fma(F, (pow(fma(2.0, x, 2.0), -0.5) / 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 <= -60000.0) tmp = Float64(t_0 + Float64(-1.0 / sin(B))); elseif (F <= 7.5e-6) tmp = fma(F, Float64((fma(2.0, x, 2.0) ^ -0.5) / 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, -60000.0], N[(t$95$0 + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 7.5e-6], N[(F * N[(N[Power[N[(2.0 * x + 2.0), $MachinePrecision], -0.5], $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 -60000:\\
\;\;\;\;t\_0 + \frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 7.5 \cdot 10^{-6}:\\
\;\;\;\;\mathsf{fma}\left(F, \frac{{\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{-0.5}}{\sin B}, t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \frac{1}{\sin B}\\
\end{array}
\end{array}
if F < -6e4Initial program 57.7%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6499.8
Applied rewrites99.8%
if -6e4 < F < 7.50000000000000019e-6Initial program 99.5%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites99.5%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6499.7
Applied rewrites99.7%
lift-+.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
lift-sin.f64N/A
+-commutativeN/A
associate-/l*N/A
associate-*r/N/A
Applied rewrites99.8%
Taylor expanded in F around 0
Applied rewrites99.7%
if 7.50000000000000019e-6 < F Initial program 71.4%
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 rewrites78.5%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6478.7
Applied rewrites78.7%
Taylor expanded in F around inf
Applied rewrites99.8%
Final simplification99.8%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ (- x) (tan B))))
(if (<= F -1e+47)
(+ t_0 (/ -1.0 (sin B)))
(if (<= F 7.5e-6)
(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+47) {
tmp = t_0 + (-1.0 / sin(B));
} else if (F <= 7.5e-6) {
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+47) tmp = Float64(t_0 + Float64(-1.0 / sin(B))); elseif (F <= 7.5e-6) 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+47], N[(t$95$0 + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 7.5e-6], 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^{+47}:\\
\;\;\;\;t\_0 + \frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 7.5 \cdot 10^{-6}:\\
\;\;\;\;\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 < -1e47Initial program 50.6%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6499.9
Applied rewrites99.9%
if -1e47 < F < 7.50000000000000019e-6Initial program 99.5%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites99.5%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6499.7
Applied rewrites99.7%
lift-+.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
lift-sin.f64N/A
+-commutativeN/A
associate-/l*N/A
associate-*r/N/A
Applied rewrites99.8%
lift-pow.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
pow2N/A
associate-+r+N/A
pow2N/A
metadata-evalN/A
sqrt-pow1N/A
unpow-1N/A
+-commutativeN/A
pow2N/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
+-commutativeN/A
associate-+r+N/A
pow2N/A
lower-sqrt.f64N/A
Applied rewrites99.7%
if 7.50000000000000019e-6 < F Initial program 71.4%
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 rewrites78.5%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6478.7
Applied rewrites78.7%
Taylor expanded in F around inf
Applied rewrites99.8%
Final simplification99.8%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ (- x) (tan B))))
(if (<= F -62000.0)
(+ t_0 (/ -1.0 (sin B)))
(if (<= F 7.5e-6)
(fma F (/ (pow (fma 2.0 x (fma F F 2.0)) -0.5) 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 <= -62000.0) {
tmp = t_0 + (-1.0 / sin(B));
} else if (F <= 7.5e-6) {
tmp = fma(F, (pow(fma(2.0, x, fma(F, F, 2.0)), -0.5) / 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 <= -62000.0) tmp = Float64(t_0 + Float64(-1.0 / sin(B))); elseif (F <= 7.5e-6) tmp = fma(F, Float64((fma(2.0, x, fma(F, F, 2.0)) ^ -0.5) / 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, -62000.0], N[(t$95$0 + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 7.5e-6], N[(F * N[(N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] / B), $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 -62000:\\
\;\;\;\;t\_0 + \frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 7.5 \cdot 10^{-6}:\\
\;\;\;\;\mathsf{fma}\left(F, \frac{{\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{B}, t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \frac{1}{\sin B}\\
\end{array}
\end{array}
if F < -62000Initial program 57.7%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6499.8
Applied rewrites99.8%
if -62000 < F < 7.50000000000000019e-6Initial program 99.5%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites99.5%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6499.7
Applied rewrites99.7%
lift-+.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
lift-sin.f64N/A
+-commutativeN/A
associate-/l*N/A
associate-*r/N/A
Applied rewrites99.8%
Taylor expanded in B around 0
Applied rewrites88.0%
if 7.50000000000000019e-6 < F Initial program 71.4%
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 rewrites78.5%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6478.7
Applied rewrites78.7%
Taylor expanded in F around inf
Applied rewrites99.8%
Final simplification94.6%
(FPCore (F B x)
:precision binary64
(if (<= F -3.7e-48)
(+ (/ (- x) (tan B)) (/ -1.0 (sin B)))
(if (<= F 2.9e-12)
(/ (* (cos B) (- x)) (sin B))
(+ (* x (/ -1.0 (tan B))) (/ 1.0 (sin B))))))
double code(double F, double B, double x) {
double tmp;
if (F <= -3.7e-48) {
tmp = (-x / tan(B)) + (-1.0 / sin(B));
} else if (F <= 2.9e-12) {
tmp = (cos(B) * -x) / sin(B);
} else {
tmp = (x * (-1.0 / tan(B))) + (1.0 / sin(B));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: tmp
if (f <= (-3.7d-48)) then
tmp = (-x / tan(b)) + ((-1.0d0) / sin(b))
else if (f <= 2.9d-12) then
tmp = (cos(b) * -x) / sin(b)
else
tmp = (x * ((-1.0d0) / tan(b))) + (1.0d0 / sin(b))
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -3.7e-48) {
tmp = (-x / Math.tan(B)) + (-1.0 / Math.sin(B));
} else if (F <= 2.9e-12) {
tmp = (Math.cos(B) * -x) / Math.sin(B);
} else {
tmp = (x * (-1.0 / Math.tan(B))) + (1.0 / Math.sin(B));
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -3.7e-48: tmp = (-x / math.tan(B)) + (-1.0 / math.sin(B)) elif F <= 2.9e-12: tmp = (math.cos(B) * -x) / math.sin(B) else: tmp = (x * (-1.0 / math.tan(B))) + (1.0 / math.sin(B)) return tmp
function code(F, B, x) tmp = 0.0 if (F <= -3.7e-48) tmp = Float64(Float64(Float64(-x) / tan(B)) + Float64(-1.0 / sin(B))); elseif (F <= 2.9e-12) tmp = Float64(Float64(cos(B) * Float64(-x)) / sin(B)); else tmp = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64(1.0 / sin(B))); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -3.7e-48) tmp = (-x / tan(B)) + (-1.0 / sin(B)); elseif (F <= 2.9e-12) tmp = (cos(B) * -x) / sin(B); else tmp = (x * (-1.0 / tan(B))) + (1.0 / sin(B)); end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -3.7e-48], N[(N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision] + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 2.9e-12], N[(N[(N[Cos[B], $MachinePrecision] * (-x)), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -3.7 \cdot 10^{-48}:\\
\;\;\;\;\frac{-x}{\tan B} + \frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 2.9 \cdot 10^{-12}:\\
\;\;\;\;\frac{\cos B \cdot \left(-x\right)}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{1}{\sin B}\\
\end{array}
\end{array}
if F < -3.6999999999999998e-48Initial program 61.8%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6494.2
Applied rewrites94.2%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6494.3
Applied rewrites94.3%
if -3.6999999999999998e-48 < F < 2.9000000000000002e-12Initial program 99.5%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6477.8
Applied rewrites77.8%
if 2.9000000000000002e-12 < F Initial program 71.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 rewrites78.9%
Taylor expanded in F around inf
*-commutative98.4
pow298.4
associate-+r+98.4
pow298.4
metadata-eval98.4
sqrt-pow198.4
Applied rewrites98.4%
Final simplification88.7%
(FPCore (F B x)
:precision binary64
(if (<= F -3.7e-48)
(/ (- -1.0 (* (cos B) x)) (sin B))
(if (<= F 2.9e-12)
(/ (* (cos B) (- x)) (sin B))
(+ (* x (/ -1.0 (tan B))) (/ 1.0 (sin B))))))
double code(double F, double B, double x) {
double tmp;
if (F <= -3.7e-48) {
tmp = (-1.0 - (cos(B) * x)) / sin(B);
} else if (F <= 2.9e-12) {
tmp = (cos(B) * -x) / sin(B);
} else {
tmp = (x * (-1.0 / tan(B))) + (1.0 / sin(B));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: tmp
if (f <= (-3.7d-48)) then
tmp = ((-1.0d0) - (cos(b) * x)) / sin(b)
else if (f <= 2.9d-12) then
tmp = (cos(b) * -x) / sin(b)
else
tmp = (x * ((-1.0d0) / tan(b))) + (1.0d0 / sin(b))
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -3.7e-48) {
tmp = (-1.0 - (Math.cos(B) * x)) / Math.sin(B);
} else if (F <= 2.9e-12) {
tmp = (Math.cos(B) * -x) / Math.sin(B);
} else {
tmp = (x * (-1.0 / Math.tan(B))) + (1.0 / Math.sin(B));
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -3.7e-48: tmp = (-1.0 - (math.cos(B) * x)) / math.sin(B) elif F <= 2.9e-12: tmp = (math.cos(B) * -x) / math.sin(B) else: tmp = (x * (-1.0 / math.tan(B))) + (1.0 / math.sin(B)) return tmp
function code(F, B, x) tmp = 0.0 if (F <= -3.7e-48) tmp = Float64(Float64(-1.0 - Float64(cos(B) * x)) / sin(B)); elseif (F <= 2.9e-12) tmp = Float64(Float64(cos(B) * Float64(-x)) / sin(B)); else tmp = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64(1.0 / sin(B))); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -3.7e-48) tmp = (-1.0 - (cos(B) * x)) / sin(B); elseif (F <= 2.9e-12) tmp = (cos(B) * -x) / sin(B); else tmp = (x * (-1.0 / tan(B))) + (1.0 / sin(B)); end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -3.7e-48], N[(N[(-1.0 - N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 2.9e-12], N[(N[(N[Cos[B], $MachinePrecision] * (-x)), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -3.7 \cdot 10^{-48}:\\
\;\;\;\;\frac{-1 - \cos B \cdot x}{\sin B}\\
\mathbf{elif}\;F \leq 2.9 \cdot 10^{-12}:\\
\;\;\;\;\frac{\cos B \cdot \left(-x\right)}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{1}{\sin B}\\
\end{array}
\end{array}
if F < -3.6999999999999998e-48Initial program 61.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.f6494.2
Applied rewrites94.2%
if -3.6999999999999998e-48 < F < 2.9000000000000002e-12Initial program 99.5%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6477.8
Applied rewrites77.8%
if 2.9000000000000002e-12 < F Initial program 71.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 rewrites78.9%
Taylor expanded in F around inf
*-commutative98.4
pow298.4
associate-+r+98.4
pow298.4
metadata-eval98.4
sqrt-pow198.4
Applied rewrites98.4%
Final simplification88.7%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ (- x) (tan B))))
(if (<= F -3.7e-48)
(+ t_0 (/ -1.0 (sin B)))
(if (<= F 2.9e-12)
(/ (* (cos B) (- x)) (sin B))
(+ t_0 (/ 1.0 (sin B)))))))
double code(double F, double B, double x) {
double t_0 = -x / tan(B);
double tmp;
if (F <= -3.7e-48) {
tmp = t_0 + (-1.0 / sin(B));
} else if (F <= 2.9e-12) {
tmp = (cos(B) * -x) / sin(B);
} else {
tmp = t_0 + (1.0 / sin(B));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: tmp
t_0 = -x / tan(b)
if (f <= (-3.7d-48)) then
tmp = t_0 + ((-1.0d0) / sin(b))
else if (f <= 2.9d-12) then
tmp = (cos(b) * -x) / sin(b)
else
tmp = t_0 + (1.0d0 / sin(b))
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double t_0 = -x / Math.tan(B);
double tmp;
if (F <= -3.7e-48) {
tmp = t_0 + (-1.0 / Math.sin(B));
} else if (F <= 2.9e-12) {
tmp = (Math.cos(B) * -x) / Math.sin(B);
} else {
tmp = t_0 + (1.0 / Math.sin(B));
}
return tmp;
}
def code(F, B, x): t_0 = -x / math.tan(B) tmp = 0 if F <= -3.7e-48: tmp = t_0 + (-1.0 / math.sin(B)) elif F <= 2.9e-12: tmp = (math.cos(B) * -x) / math.sin(B) else: tmp = t_0 + (1.0 / math.sin(B)) return tmp
function code(F, B, x) t_0 = Float64(Float64(-x) / tan(B)) tmp = 0.0 if (F <= -3.7e-48) tmp = Float64(t_0 + Float64(-1.0 / sin(B))); elseif (F <= 2.9e-12) tmp = Float64(Float64(cos(B) * Float64(-x)) / sin(B)); else tmp = Float64(t_0 + Float64(1.0 / sin(B))); end return tmp end
function tmp_2 = code(F, B, x) t_0 = -x / tan(B); tmp = 0.0; if (F <= -3.7e-48) tmp = t_0 + (-1.0 / sin(B)); elseif (F <= 2.9e-12) tmp = (cos(B) * -x) / sin(B); else tmp = t_0 + (1.0 / sin(B)); end tmp_2 = tmp; end
code[F_, B_, x_] := Block[{t$95$0 = N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -3.7e-48], N[(t$95$0 + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 2.9e-12], N[(N[(N[Cos[B], $MachinePrecision] * (-x)), $MachinePrecision] / N[Sin[B], $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 -3.7 \cdot 10^{-48}:\\
\;\;\;\;t\_0 + \frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 2.9 \cdot 10^{-12}:\\
\;\;\;\;\frac{\cos B \cdot \left(-x\right)}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \frac{1}{\sin B}\\
\end{array}
\end{array}
if F < -3.6999999999999998e-48Initial program 61.8%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6494.2
Applied rewrites94.2%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6494.3
Applied rewrites94.3%
if -3.6999999999999998e-48 < F < 2.9000000000000002e-12Initial program 99.5%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6477.8
Applied rewrites77.8%
if 2.9000000000000002e-12 < F Initial program 71.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 rewrites78.9%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6479.0
Applied rewrites79.0%
Taylor expanded in F around inf
Applied rewrites98.5%
Final simplification88.7%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (* (cos B) x)))
(if (<= F -3.7e-48)
(/ (- -1.0 t_0) (sin B))
(if (<= F 2.9e-12)
(/ (* (cos B) (- x)) (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 <= -3.7e-48) {
tmp = (-1.0 - t_0) / sin(B);
} else if (F <= 2.9e-12) {
tmp = (cos(B) * -x) / sin(B);
} else {
tmp = (1.0 - t_0) / sin(B);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: tmp
t_0 = cos(b) * x
if (f <= (-3.7d-48)) then
tmp = ((-1.0d0) - t_0) / sin(b)
else if (f <= 2.9d-12) then
tmp = (cos(b) * -x) / sin(b)
else
tmp = (1.0d0 - t_0) / sin(b)
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double t_0 = Math.cos(B) * x;
double tmp;
if (F <= -3.7e-48) {
tmp = (-1.0 - t_0) / Math.sin(B);
} else if (F <= 2.9e-12) {
tmp = (Math.cos(B) * -x) / Math.sin(B);
} else {
tmp = (1.0 - t_0) / Math.sin(B);
}
return tmp;
}
def code(F, B, x): t_0 = math.cos(B) * x tmp = 0 if F <= -3.7e-48: tmp = (-1.0 - t_0) / math.sin(B) elif F <= 2.9e-12: tmp = (math.cos(B) * -x) / math.sin(B) else: tmp = (1.0 - t_0) / math.sin(B) return tmp
function code(F, B, x) t_0 = Float64(cos(B) * x) tmp = 0.0 if (F <= -3.7e-48) tmp = Float64(Float64(-1.0 - t_0) / sin(B)); elseif (F <= 2.9e-12) tmp = Float64(Float64(cos(B) * Float64(-x)) / sin(B)); else tmp = Float64(Float64(1.0 - t_0) / sin(B)); end return tmp end
function tmp_2 = code(F, B, x) t_0 = cos(B) * x; tmp = 0.0; if (F <= -3.7e-48) tmp = (-1.0 - t_0) / sin(B); elseif (F <= 2.9e-12) tmp = (cos(B) * -x) / sin(B); else tmp = (1.0 - t_0) / sin(B); end tmp_2 = tmp; end
code[F_, B_, x_] := Block[{t$95$0 = N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[F, -3.7e-48], N[(N[(-1.0 - t$95$0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 2.9e-12], N[(N[(N[Cos[B], $MachinePrecision] * (-x)), $MachinePrecision] / N[Sin[B], $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 -3.7 \cdot 10^{-48}:\\
\;\;\;\;\frac{-1 - t\_0}{\sin B}\\
\mathbf{elif}\;F \leq 2.9 \cdot 10^{-12}:\\
\;\;\;\;\frac{\cos B \cdot \left(-x\right)}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - t\_0}{\sin B}\\
\end{array}
\end{array}
if F < -3.6999999999999998e-48Initial program 61.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.f6494.2
Applied rewrites94.2%
if -3.6999999999999998e-48 < F < 2.9000000000000002e-12Initial program 99.5%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6477.8
Applied rewrites77.8%
if 2.9000000000000002e-12 < F Initial program 71.8%
Taylor expanded in F around inf
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6498.3
Applied rewrites98.3%
Final simplification88.6%
(FPCore (F B x)
:precision binary64
(if (<= F -1.15e-17)
(+ (- (/ x B)) (/ -1.0 (sin B)))
(if (<= F 2.9e-12)
(/ (* (cos B) (- x)) (sin B))
(/ (- 1.0 (* (cos B) x)) (sin B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1.15e-17) {
tmp = -(x / B) + (-1.0 / sin(B));
} else if (F <= 2.9e-12) {
tmp = (cos(B) * -x) / sin(B);
} else {
tmp = (1.0 - (cos(B) * x)) / sin(B);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: tmp
if (f <= (-1.15d-17)) then
tmp = -(x / b) + ((-1.0d0) / sin(b))
else if (f <= 2.9d-12) then
tmp = (cos(b) * -x) / sin(b)
else
tmp = (1.0d0 - (cos(b) * x)) / sin(b)
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -1.15e-17) {
tmp = -(x / B) + (-1.0 / Math.sin(B));
} else if (F <= 2.9e-12) {
tmp = (Math.cos(B) * -x) / Math.sin(B);
} else {
tmp = (1.0 - (Math.cos(B) * x)) / Math.sin(B);
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -1.15e-17: tmp = -(x / B) + (-1.0 / math.sin(B)) elif F <= 2.9e-12: tmp = (math.cos(B) * -x) / math.sin(B) else: tmp = (1.0 - (math.cos(B) * x)) / math.sin(B) return tmp
function code(F, B, x) tmp = 0.0 if (F <= -1.15e-17) tmp = Float64(Float64(-Float64(x / B)) + Float64(-1.0 / sin(B))); elseif (F <= 2.9e-12) tmp = Float64(Float64(cos(B) * Float64(-x)) / sin(B)); else tmp = Float64(Float64(1.0 - Float64(cos(B) * x)) / sin(B)); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -1.15e-17) tmp = -(x / B) + (-1.0 / sin(B)); elseif (F <= 2.9e-12) tmp = (cos(B) * -x) / sin(B); else tmp = (1.0 - (cos(B) * x)) / sin(B); end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -1.15e-17], N[((-N[(x / B), $MachinePrecision]) + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 2.9e-12], N[(N[(N[Cos[B], $MachinePrecision] * (-x)), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.15 \cdot 10^{-17}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 2.9 \cdot 10^{-12}:\\
\;\;\;\;\frac{\cos B \cdot \left(-x\right)}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - \cos B \cdot x}{\sin B}\\
\end{array}
\end{array}
if F < -1.15000000000000004e-17Initial program 58.8%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6498.5
Applied rewrites98.5%
Taylor expanded in B around 0
lower-/.f6477.5
Applied rewrites77.5%
if -1.15000000000000004e-17 < F < 2.9000000000000002e-12Initial program 99.5%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6475.4
Applied rewrites75.4%
if 2.9000000000000002e-12 < F Initial program 71.8%
Taylor expanded in F around inf
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6498.3
Applied rewrites98.3%
Final simplification82.2%
(FPCore (F B x) :precision binary64 (if (or (<= x -6.8e-102) (not (<= x 3.5e-82))) (/ (* (cos B) (- x)) (sin B)) (* (/ 1.0 (sqrt (fma F F 2.0))) (/ F (sin B)))))
double code(double F, double B, double x) {
double tmp;
if ((x <= -6.8e-102) || !(x <= 3.5e-82)) {
tmp = (cos(B) * -x) / sin(B);
} else {
tmp = (1.0 / sqrt(fma(F, F, 2.0))) * (F / sin(B));
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if ((x <= -6.8e-102) || !(x <= 3.5e-82)) tmp = Float64(Float64(cos(B) * Float64(-x)) / sin(B)); else tmp = Float64(Float64(1.0 / sqrt(fma(F, F, 2.0))) * Float64(F / sin(B))); end return tmp end
code[F_, B_, x_] := If[Or[LessEqual[x, -6.8e-102], N[Not[LessEqual[x, 3.5e-82]], $MachinePrecision]], N[(N[(N[Cos[B], $MachinePrecision] * (-x)), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[Sqrt[N[(F * F + 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.8 \cdot 10^{-102} \lor \neg \left(x \leq 3.5 \cdot 10^{-82}\right):\\
\;\;\;\;\frac{\cos B \cdot \left(-x\right)}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{\mathsf{fma}\left(F, F, 2\right)}} \cdot \frac{F}{\sin B}\\
\end{array}
\end{array}
if x < -6.80000000000000026e-102 or 3.4999999999999999e-82 < x Initial program 82.4%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6488.4
Applied rewrites88.4%
if -6.80000000000000026e-102 < x < 3.4999999999999999e-82Initial program 75.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 rewrites78.6%
Taylor expanded in x around 0
*-commutativeN/A
associate-*r/N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
+-commutativeN/A
pow2N/A
lift-fma.f64N/A
lift-sin.f64N/A
lift-/.f6459.0
Applied rewrites59.0%
lift-pow.f64N/A
lift-fma.f64N/A
lower-sqrt.f64N/A
unpow-1N/A
pow2N/A
+-commutativeN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
+-commutativeN/A
pow2N/A
lift-fma.f6458.9
Applied rewrites58.9%
Final simplification77.7%
(FPCore (F B x)
:precision binary64
(if (<= x -6.8e-102)
(* (/ (- (cos B)) (sin B)) x)
(if (<= x 3.5e-82)
(* (/ 1.0 (sqrt (fma F F 2.0))) (/ F (sin B)))
(/ (* (cos B) (- x)) (sin B)))))
double code(double F, double B, double x) {
double tmp;
if (x <= -6.8e-102) {
tmp = (-cos(B) / sin(B)) * x;
} else if (x <= 3.5e-82) {
tmp = (1.0 / sqrt(fma(F, F, 2.0))) * (F / sin(B));
} else {
tmp = (cos(B) * -x) / sin(B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (x <= -6.8e-102) tmp = Float64(Float64(Float64(-cos(B)) / sin(B)) * x); elseif (x <= 3.5e-82) tmp = Float64(Float64(1.0 / sqrt(fma(F, F, 2.0))) * Float64(F / sin(B))); else tmp = Float64(Float64(cos(B) * Float64(-x)) / sin(B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[x, -6.8e-102], N[(N[((-N[Cos[B], $MachinePrecision]) / N[Sin[B], $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[x, 3.5e-82], N[(N[(1.0 / N[Sqrt[N[(F * F + 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Cos[B], $MachinePrecision] * (-x)), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.8 \cdot 10^{-102}:\\
\;\;\;\;\frac{-\cos B}{\sin B} \cdot x\\
\mathbf{elif}\;x \leq 3.5 \cdot 10^{-82}:\\
\;\;\;\;\frac{1}{\sqrt{\mathsf{fma}\left(F, F, 2\right)}} \cdot \frac{F}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;\frac{\cos B \cdot \left(-x\right)}{\sin B}\\
\end{array}
\end{array}
if x < -6.80000000000000026e-102Initial program 84.1%
Taylor expanded in x around inf
Applied rewrites25.4%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f64N/A
lift-cos.f64N/A
lift-sin.f64N/A
lift-/.f6489.0
Applied rewrites89.0%
if -6.80000000000000026e-102 < x < 3.4999999999999999e-82Initial program 75.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 rewrites78.6%
Taylor expanded in x around 0
*-commutativeN/A
associate-*r/N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
+-commutativeN/A
pow2N/A
lift-fma.f64N/A
lift-sin.f64N/A
lift-/.f6459.0
Applied rewrites59.0%
lift-pow.f64N/A
lift-fma.f64N/A
lower-sqrt.f64N/A
unpow-1N/A
pow2N/A
+-commutativeN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
+-commutativeN/A
pow2N/A
lift-fma.f6458.9
Applied rewrites58.9%
if 3.4999999999999999e-82 < x Initial program 81.6%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6488.2
Applied rewrites88.2%
Final simplification77.7%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ (- (* (sqrt (/ 1.0 (fma 2.0 x (fma F F 2.0)))) F) x) B))
(t_1 (+ (* x (/ -1.0 (tan B))) (/ -1.0 B))))
(if (<= x -8.6e-13)
t_1
(if (<= x -4.5e-112)
t_0
(if (<= x 1.95e-157)
(* (/ 1.0 (sqrt (fma F F 2.0))) (/ F (sin B)))
(if (<= x 7.5) t_0 t_1))))))
double code(double F, double B, double x) {
double t_0 = ((sqrt((1.0 / fma(2.0, x, fma(F, F, 2.0)))) * F) - x) / B;
double t_1 = (x * (-1.0 / tan(B))) + (-1.0 / B);
double tmp;
if (x <= -8.6e-13) {
tmp = t_1;
} else if (x <= -4.5e-112) {
tmp = t_0;
} else if (x <= 1.95e-157) {
tmp = (1.0 / sqrt(fma(F, F, 2.0))) * (F / sin(B));
} else if (x <= 7.5) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
function code(F, B, x) t_0 = Float64(Float64(Float64(sqrt(Float64(1.0 / fma(2.0, x, fma(F, F, 2.0)))) * F) - x) / B) t_1 = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64(-1.0 / B)) tmp = 0.0 if (x <= -8.6e-13) tmp = t_1; elseif (x <= -4.5e-112) tmp = t_0; elseif (x <= 1.95e-157) tmp = Float64(Float64(1.0 / sqrt(fma(F, F, 2.0))) * Float64(F / sin(B))); elseif (x <= 7.5) tmp = t_0; else tmp = t_1; end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = 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]}, Block[{t$95$1 = N[(N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-1.0 / B), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -8.6e-13], t$95$1, If[LessEqual[x, -4.5e-112], t$95$0, If[LessEqual[x, 1.95e-157], N[(N[(1.0 / N[Sqrt[N[(F * F + 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 7.5], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\sqrt{\frac{1}{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}} \cdot F - x}{B}\\
t_1 := x \cdot \frac{-1}{\tan B} + \frac{-1}{B}\\
\mathbf{if}\;x \leq -8.6 \cdot 10^{-13}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -4.5 \cdot 10^{-112}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 1.95 \cdot 10^{-157}:\\
\;\;\;\;\frac{1}{\sqrt{\mathsf{fma}\left(F, F, 2\right)}} \cdot \frac{F}{\sin B}\\
\mathbf{elif}\;x \leq 7.5:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -8.5999999999999997e-13 or 7.5 < x Initial program 84.0%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6494.5
Applied rewrites94.5%
Taylor expanded in B around 0
Applied rewrites96.2%
if -8.5999999999999997e-13 < x < -4.50000000000000012e-112 or 1.94999999999999999e-157 < x < 7.5Initial program 76.9%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites55.6%
lift-pow.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
unpow-1N/A
lower-/.f64N/A
pow2N/A
associate-+r+N/A
pow2N/A
lift-fma.f64N/A
lift-fma.f6455.6
Applied rewrites55.6%
if -4.50000000000000012e-112 < x < 1.94999999999999999e-157Initial program 74.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 rewrites77.8%
Taylor expanded in x around 0
*-commutativeN/A
associate-*r/N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
+-commutativeN/A
pow2N/A
lift-fma.f64N/A
lift-sin.f64N/A
lift-/.f6462.1
Applied rewrites62.1%
lift-pow.f64N/A
lift-fma.f64N/A
lower-sqrt.f64N/A
unpow-1N/A
pow2N/A
+-commutativeN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
+-commutativeN/A
pow2N/A
lift-fma.f6462.1
Applied rewrites62.1%
Final simplification77.3%
(FPCore (F B x)
:precision binary64
(if (<= B 1.3e-10)
(/ (- (* (sqrt (/ 1.0 (fma 2.0 x (fma F F 2.0)))) F) x) B)
(+
(/ (- x) (tan B))
(/ -1.0 (* (fma (* B B) -0.16666666666666666 1.0) B)))))
double code(double F, double B, double x) {
double tmp;
if (B <= 1.3e-10) {
tmp = ((sqrt((1.0 / fma(2.0, x, fma(F, F, 2.0)))) * F) - x) / B;
} else {
tmp = (-x / tan(B)) + (-1.0 / (fma((B * B), -0.16666666666666666, 1.0) * B));
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (B <= 1.3e-10) 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) / tan(B)) + Float64(-1.0 / Float64(fma(Float64(B * B), -0.16666666666666666, 1.0) * B))); end return tmp end
code[F_, B_, x_] := If[LessEqual[B, 1.3e-10], 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) / 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}
\mathbf{if}\;B \leq 1.3 \cdot 10^{-10}:\\
\;\;\;\;\frac{\sqrt{\frac{1}{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}} \cdot F - 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 < 1.29999999999999991e-10Initial program 76.4%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites65.0%
lift-pow.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
unpow-1N/A
lower-/.f64N/A
pow2N/A
associate-+r+N/A
pow2N/A
lift-fma.f64N/A
lift-fma.f6465.0
Applied rewrites65.0%
if 1.29999999999999991e-10 < B Initial program 89.6%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6457.5
Applied rewrites57.5%
Taylor expanded in B around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6457.2
Applied rewrites57.2%
metadata-eval57.2
metadata-eval57.2
Applied rewrites57.3%
(FPCore (F B x) :precision binary64 (if (<= B 1.3e-10) (/ (- (* (sqrt (/ 1.0 (fma 2.0 x (fma F F 2.0)))) F) x) B) (+ (* x (/ -1.0 (tan B))) (/ -1.0 B))))
double code(double F, double B, double x) {
double tmp;
if (B <= 1.3e-10) {
tmp = ((sqrt((1.0 / fma(2.0, x, fma(F, F, 2.0)))) * F) - x) / B;
} else {
tmp = (x * (-1.0 / tan(B))) + (-1.0 / B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (B <= 1.3e-10) tmp = Float64(Float64(Float64(sqrt(Float64(1.0 / fma(2.0, x, fma(F, F, 2.0)))) * F) - 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, 1.3e-10], 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 * 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 1.3 \cdot 10^{-10}:\\
\;\;\;\;\frac{\sqrt{\frac{1}{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}} \cdot F - x}{B}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{-1}{B}\\
\end{array}
\end{array}
if B < 1.29999999999999991e-10Initial program 76.4%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites65.0%
lift-pow.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
unpow-1N/A
lower-/.f64N/A
pow2N/A
associate-+r+N/A
pow2N/A
lift-fma.f64N/A
lift-fma.f6465.0
Applied rewrites65.0%
if 1.29999999999999991e-10 < B Initial program 89.6%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6457.5
Applied rewrites57.5%
Taylor expanded in B around 0
Applied rewrites55.4%
Final simplification62.5%
(FPCore (F B x)
:precision binary64
(if (<= F -7.8e+24)
(+ (- (/ x B)) (/ -1.0 (sin B)))
(if (<= F 9.8e+154)
(/ (- (* (sqrt (/ 1.0 (fma 2.0 x (fma F F 2.0)))) F) x) B)
(/ 1.0 (sin B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -7.8e+24) {
tmp = -(x / B) + (-1.0 / sin(B));
} else if (F <= 9.8e+154) {
tmp = ((sqrt((1.0 / fma(2.0, x, fma(F, F, 2.0)))) * F) - x) / B;
} else {
tmp = 1.0 / sin(B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -7.8e+24) tmp = Float64(Float64(-Float64(x / B)) + Float64(-1.0 / sin(B))); elseif (F <= 9.8e+154) tmp = Float64(Float64(Float64(sqrt(Float64(1.0 / fma(2.0, x, fma(F, F, 2.0)))) * F) - x) / B); else tmp = Float64(1.0 / sin(B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -7.8e+24], N[((-N[(x / B), $MachinePrecision]) + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 9.8e+154], 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[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -7.8 \cdot 10^{+24}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 9.8 \cdot 10^{+154}:\\
\;\;\;\;\frac{\sqrt{\frac{1}{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}} \cdot F - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B}\\
\end{array}
\end{array}
if F < -7.7999999999999995e24Initial program 56.6%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
Taylor expanded in B around 0
lower-/.f6477.5
Applied rewrites77.5%
if -7.7999999999999995e24 < F < 9.8000000000000003e154Initial program 98.3%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites59.5%
lift-pow.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
unpow-1N/A
lower-/.f64N/A
pow2N/A
associate-+r+N/A
pow2N/A
lift-fma.f64N/A
lift-fma.f6459.5
Applied rewrites59.5%
if 9.8000000000000003e154 < F Initial program 39.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 rewrites50.3%
Taylor expanded in x around 0
*-commutativeN/A
associate-*r/N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
+-commutativeN/A
pow2N/A
lift-fma.f64N/A
lift-sin.f64N/A
lift-/.f642.2
Applied rewrites2.2%
Taylor expanded in F around inf
inv-powN/A
lower-pow.f64N/A
lift-sin.f6449.7
Applied rewrites49.7%
lift-pow.f64N/A
lift-sin.f64N/A
inv-powN/A
lower-/.f64N/A
lift-sin.f6449.7
Applied rewrites49.7%
Final simplification63.5%
(FPCore (F B x) :precision binary64 (if (<= B 39000000000000.0) (/ (- (* (sqrt (/ 1.0 (fma 2.0 x (fma F F 2.0)))) F) x) B) (if (<= B 9e+54) (/ 1.0 (sin B)) (/ -1.0 (sin B)))))
double code(double F, double B, double x) {
double tmp;
if (B <= 39000000000000.0) {
tmp = ((sqrt((1.0 / fma(2.0, x, fma(F, F, 2.0)))) * F) - x) / B;
} else if (B <= 9e+54) {
tmp = 1.0 / sin(B);
} else {
tmp = -1.0 / sin(B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (B <= 39000000000000.0) tmp = Float64(Float64(Float64(sqrt(Float64(1.0 / fma(2.0, x, fma(F, F, 2.0)))) * F) - x) / B); elseif (B <= 9e+54) tmp = Float64(1.0 / sin(B)); else tmp = Float64(-1.0 / sin(B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[B, 39000000000000.0], 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], If[LessEqual[B, 9e+54], N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq 39000000000000:\\
\;\;\;\;\frac{\sqrt{\frac{1}{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}} \cdot F - x}{B}\\
\mathbf{elif}\;B \leq 9 \cdot 10^{+54}:\\
\;\;\;\;\frac{1}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;\frac{-1}{\sin B}\\
\end{array}
\end{array}
if B < 3.9e13Initial program 77.2%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites63.5%
lift-pow.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
unpow-1N/A
lower-/.f64N/A
pow2N/A
associate-+r+N/A
pow2N/A
lift-fma.f64N/A
lift-fma.f6463.5
Applied rewrites63.5%
if 3.9e13 < B < 8.99999999999999968e54Initial program 87.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 rewrites87.3%
Taylor expanded in x around 0
*-commutativeN/A
associate-*r/N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
+-commutativeN/A
pow2N/A
lift-fma.f64N/A
lift-sin.f64N/A
lift-/.f6438.6
Applied rewrites38.6%
Taylor expanded in F around inf
inv-powN/A
lower-pow.f64N/A
lift-sin.f6441.9
Applied rewrites41.9%
lift-pow.f64N/A
lift-sin.f64N/A
inv-powN/A
lower-/.f64N/A
lift-sin.f6441.9
Applied rewrites41.9%
if 8.99999999999999968e54 < B Initial program 88.6%
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 rewrites88.5%
Taylor expanded in x around 0
*-commutativeN/A
associate-*r/N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
+-commutativeN/A
pow2N/A
lift-fma.f64N/A
lift-sin.f64N/A
lift-/.f6431.8
Applied rewrites31.8%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6417.3
Applied rewrites17.3%
Final simplification53.6%
(FPCore (F B x) :precision binary64 (if (<= B 880.0) (/ (- (* (sqrt (/ 1.0 (fma 2.0 x (fma F F 2.0)))) F) x) B) (/ -1.0 (sin B))))
double code(double F, double B, double x) {
double tmp;
if (B <= 880.0) {
tmp = ((sqrt((1.0 / fma(2.0, x, fma(F, F, 2.0)))) * F) - x) / B;
} else {
tmp = -1.0 / sin(B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (B <= 880.0) tmp = Float64(Float64(Float64(sqrt(Float64(1.0 / fma(2.0, x, fma(F, F, 2.0)))) * F) - x) / B); else tmp = Float64(-1.0 / sin(B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[B, 880.0], 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[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq 880:\\
\;\;\;\;\frac{\sqrt{\frac{1}{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}} \cdot F - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{-1}{\sin B}\\
\end{array}
\end{array}
if B < 880Initial program 76.9%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites64.4%
lift-pow.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
unpow-1N/A
lower-/.f64N/A
pow2N/A
associate-+r+N/A
pow2N/A
lift-fma.f64N/A
lift-fma.f6464.4
Applied rewrites64.4%
if 880 < B Initial program 88.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 rewrites88.9%
Taylor expanded in x around 0
*-commutativeN/A
associate-*r/N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
+-commutativeN/A
pow2N/A
lift-fma.f64N/A
lift-sin.f64N/A
lift-/.f6431.2
Applied rewrites31.2%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6414.5
Applied rewrites14.5%
Final simplification52.3%
(FPCore (F B x)
:precision binary64
(if (<= F -8.8e+35)
(+ (* (- x) (/ (fma -0.3333333333333333 (* B B) 1.0) B)) (/ -1.0 B))
(if (<= F 9.8e+154)
(/ (- (* (sqrt (/ 1.0 (fma 2.0 x (fma F F 2.0)))) F) x) B)
(/ (/ (- 1.0 (* x x)) (+ 1.0 x)) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -8.8e+35) {
tmp = (-x * (fma(-0.3333333333333333, (B * B), 1.0) / B)) + (-1.0 / B);
} else if (F <= 9.8e+154) {
tmp = ((sqrt((1.0 / fma(2.0, x, fma(F, F, 2.0)))) * F) - x) / B;
} else {
tmp = ((1.0 - (x * x)) / (1.0 + x)) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -8.8e+35) tmp = Float64(Float64(Float64(-x) * Float64(fma(-0.3333333333333333, Float64(B * B), 1.0) / B)) + Float64(-1.0 / B)); elseif (F <= 9.8e+154) 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(1.0 - Float64(x * x)) / Float64(1.0 + x)) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -8.8e+35], N[(N[((-x) * N[(N[(-0.3333333333333333 * N[(B * B), $MachinePrecision] + 1.0), $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision] + N[(-1.0 / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 9.8e+154], 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[(N[(1.0 - N[(x * x), $MachinePrecision]), $MachinePrecision] / N[(1.0 + x), $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -8.8 \cdot 10^{+35}:\\
\;\;\;\;\left(-x\right) \cdot \frac{\mathsf{fma}\left(-0.3333333333333333, B \cdot B, 1\right)}{B} + \frac{-1}{B}\\
\mathbf{elif}\;F \leq 9.8 \cdot 10^{+154}:\\
\;\;\;\;\frac{\sqrt{\frac{1}{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}} \cdot F - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 - x \cdot x}{1 + x}}{B}\\
\end{array}
\end{array}
if F < -8.7999999999999994e35Initial program 54.8%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
Taylor expanded in B around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6478.0
Applied rewrites78.0%
Taylor expanded in B around 0
lower-/.f64N/A
+-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6455.9
Applied rewrites55.9%
Taylor expanded in B around 0
Applied rewrites56.2%
if -8.7999999999999994e35 < F < 9.8000000000000003e154Initial program 98.3%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites59.0%
lift-pow.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
unpow-1N/A
lower-/.f64N/A
pow2N/A
associate-+r+N/A
pow2N/A
lift-fma.f64N/A
lift-fma.f6459.0
Applied rewrites59.0%
if 9.8000000000000003e154 < F Initial program 39.9%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites15.2%
Taylor expanded in F around inf
lower--.f6435.2
Applied rewrites35.2%
lift--.f64N/A
flip--N/A
lower-/.f64N/A
metadata-evalN/A
lower--.f64N/A
lower-*.f64N/A
lower-+.f6435.3
Applied rewrites35.3%
Final simplification55.5%
(FPCore (F B x) :precision binary64 (if (<= F -1e-46) (+ (* (- x) (/ (fma -0.3333333333333333 (* B B) 1.0) B)) (/ -1.0 B)) (if (<= F 9.6e-94) (/ (- x) B) (/ (- 1.0 x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1e-46) {
tmp = (-x * (fma(-0.3333333333333333, (B * B), 1.0) / B)) + (-1.0 / B);
} else if (F <= 9.6e-94) {
tmp = -x / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -1e-46) tmp = Float64(Float64(Float64(-x) * Float64(fma(-0.3333333333333333, Float64(B * B), 1.0) / B)) + Float64(-1.0 / B)); elseif (F <= 9.6e-94) tmp = Float64(Float64(-x) / B); else tmp = Float64(Float64(1.0 - x) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -1e-46], N[(N[((-x) * N[(N[(-0.3333333333333333 * N[(B * B), $MachinePrecision] + 1.0), $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision] + N[(-1.0 / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 9.6e-94], N[((-x) / B), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1 \cdot 10^{-46}:\\
\;\;\;\;\left(-x\right) \cdot \frac{\mathsf{fma}\left(-0.3333333333333333, B \cdot B, 1\right)}{B} + \frac{-1}{B}\\
\mathbf{elif}\;F \leq 9.6 \cdot 10^{-94}:\\
\;\;\;\;\frac{-x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < -1.00000000000000002e-46Initial program 61.3%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6495.2
Applied rewrites95.2%
Taylor expanded in B around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6474.4
Applied rewrites74.4%
Taylor expanded in B around 0
lower-/.f64N/A
+-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6454.3
Applied rewrites54.3%
Taylor expanded in B around 0
Applied rewrites54.5%
if -1.00000000000000002e-46 < F < 9.6e-94Initial program 99.5%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites56.3%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f6447.4
Applied rewrites47.4%
if 9.6e-94 < F Initial program 75.9%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites45.1%
Taylor expanded in F around inf
lower--.f6447.7
Applied rewrites47.7%
Final simplification49.8%
(FPCore (F B x) :precision binary64 (if (<= F -2.7e-48) (/ (- -1.0 x) B) (if (<= F 9.6e-94) (/ (- x) B) (/ (- 1.0 x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -2.7e-48) {
tmp = (-1.0 - x) / B;
} else if (F <= 9.6e-94) {
tmp = -x / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: tmp
if (f <= (-2.7d-48)) then
tmp = ((-1.0d0) - x) / b
else if (f <= 9.6d-94) then
tmp = -x / b
else
tmp = (1.0d0 - x) / b
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -2.7e-48) {
tmp = (-1.0 - x) / B;
} else if (F <= 9.6e-94) {
tmp = -x / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -2.7e-48: tmp = (-1.0 - x) / B elif F <= 9.6e-94: tmp = -x / B else: tmp = (1.0 - x) / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= -2.7e-48) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 9.6e-94) tmp = Float64(Float64(-x) / B); else tmp = Float64(Float64(1.0 - x) / B); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -2.7e-48) tmp = (-1.0 - x) / B; elseif (F <= 9.6e-94) tmp = -x / B; else tmp = (1.0 - x) / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -2.7e-48], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 9.6e-94], N[((-x) / B), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -2.7 \cdot 10^{-48}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 9.6 \cdot 10^{-94}:\\
\;\;\;\;\frac{-x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < -2.70000000000000011e-48Initial program 61.8%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites46.0%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
lower-+.f6453.4
Applied rewrites53.4%
if -2.70000000000000011e-48 < F < 9.6e-94Initial program 99.5%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites56.9%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f6447.9
Applied rewrites47.9%
if 9.6e-94 < F Initial program 75.9%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites45.1%
Taylor expanded in F around inf
lower--.f6447.7
Applied rewrites47.7%
Final simplification49.6%
(FPCore (F B x) :precision binary64 (if (<= F 9.6e-94) (/ (- x) B) (/ (- 1.0 x) B)))
double code(double F, double B, double x) {
double tmp;
if (F <= 9.6e-94) {
tmp = -x / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: tmp
if (f <= 9.6d-94) then
tmp = -x / b
else
tmp = (1.0d0 - x) / b
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= 9.6e-94) {
tmp = -x / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= 9.6e-94: tmp = -x / B else: tmp = (1.0 - x) / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= 9.6e-94) tmp = Float64(Float64(-x) / B); else tmp = Float64(Float64(1.0 - x) / B); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= 9.6e-94) tmp = -x / B; else tmp = (1.0 - x) / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, 9.6e-94], N[((-x) / B), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq 9.6 \cdot 10^{-94}:\\
\;\;\;\;\frac{-x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < 9.6e-94Initial program 81.6%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites51.8%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f6441.4
Applied rewrites41.4%
if 9.6e-94 < F Initial program 75.9%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites45.1%
Taylor expanded in F around inf
lower--.f6447.7
Applied rewrites47.7%
(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 79.8%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites49.6%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f6437.3
Applied rewrites37.3%
(FPCore (F B x) :precision binary64 (/ 1.0 B))
double code(double F, double B, double x) {
return 1.0 / B;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
code = 1.0d0 / b
end function
public static double code(double F, double B, double x) {
return 1.0 / B;
}
def code(F, B, x): return 1.0 / B
function code(F, B, x) return Float64(1.0 / B) end
function tmp = code(F, B, x) tmp = 1.0 / B; end
code[F_, B_, x_] := N[(1.0 / B), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{B}
\end{array}
Initial program 79.8%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites49.6%
Taylor expanded in F around inf
lower--.f6434.5
Applied rewrites34.5%
Taylor expanded in x around 0
Applied rewrites8.5%
herbie shell --seed 2025066
(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))))))