
(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 24 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 -5e+17)
(+ t_0 (/ -1.0 (sin B)))
(if (<= F 1.15e+24)
(+ t_0 (* (/ F (sin B)) (pow (+ (fma F F 2.0) (* 2.0 x)) -0.5)))
(/ (- 1.0 (* (cos B) x)) (sin B))))))
double code(double F, double B, double x) {
double t_0 = -x / tan(B);
double tmp;
if (F <= -5e+17) {
tmp = t_0 + (-1.0 / sin(B));
} else if (F <= 1.15e+24) {
tmp = t_0 + ((F / sin(B)) * pow((fma(F, F, 2.0) + (2.0 * x)), -0.5));
} else {
tmp = (1.0 - (cos(B) * x)) / sin(B);
}
return tmp;
}
function code(F, B, x) t_0 = Float64(Float64(-x) / tan(B)) tmp = 0.0 if (F <= -5e+17) tmp = Float64(t_0 + Float64(-1.0 / sin(B))); elseif (F <= 1.15e+24) tmp = Float64(t_0 + Float64(Float64(F / sin(B)) * (Float64(fma(F, F, 2.0) + Float64(2.0 * x)) ^ -0.5))); else tmp = Float64(Float64(1.0 - Float64(cos(B) * x)) / sin(B)); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -5e+17], N[(t$95$0 + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.15e+24], N[(t$95$0 + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(F * F + 2.0), $MachinePrecision] + N[(2.0 * x), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-x}{\tan B}\\
\mathbf{if}\;F \leq -5 \cdot 10^{+17}:\\
\;\;\;\;t\_0 + \frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 1.15 \cdot 10^{+24}:\\
\;\;\;\;t\_0 + \frac{F}{\sin B} \cdot {\left(\mathsf{fma}\left(F, F, 2\right) + 2 \cdot x\right)}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - \cos B \cdot x}{\sin B}\\
\end{array}
\end{array}
if F < -5e17Initial program 51.0%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6451.0
Applied rewrites51.0%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6499.9
Applied rewrites99.9%
if -5e17 < F < 1.15e24Initial program 99.4%
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-*.f64N/A
lower-fma.f6499.7
lift-neg.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-eval99.7
Applied rewrites99.7%
if 1.15e24 < F Initial program 48.0%
Taylor expanded in F around inf
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
Final simplification99.7%
(FPCore (F B x)
:precision binary64
(if (<= F -400000000.0)
(+ (/ (- x) (tan B)) (/ -1.0 (sin B)))
(if (<= F 2e+24)
(+
(* x (/ -1.0 (tan B)))
(/ (* F (pow (fma 2.0 x (fma F F 2.0)) -0.5)) (sin B)))
(/ (- 1.0 (* (cos B) x)) (sin B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -400000000.0) {
tmp = (-x / tan(B)) + (-1.0 / sin(B));
} else if (F <= 2e+24) {
tmp = (x * (-1.0 / tan(B))) + ((F * pow(fma(2.0, x, fma(F, F, 2.0)), -0.5)) / sin(B));
} else {
tmp = (1.0 - (cos(B) * x)) / sin(B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -400000000.0) tmp = Float64(Float64(Float64(-x) / tan(B)) + Float64(-1.0 / sin(B))); elseif (F <= 2e+24) tmp = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64(Float64(F * (fma(2.0, x, fma(F, F, 2.0)) ^ -0.5)) / sin(B))); else tmp = Float64(Float64(1.0 - Float64(cos(B) * x)) / sin(B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -400000000.0], N[(N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision] + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 2e+24], N[(N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(F * N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -400000000:\\
\;\;\;\;\frac{-x}{\tan B} + \frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 2 \cdot 10^{+24}:\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{F \cdot {\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - \cos B \cdot x}{\sin B}\\
\end{array}
\end{array}
if F < -4e8Initial program 51.0%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6451.0
Applied rewrites51.0%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6499.9
Applied rewrites99.9%
if -4e8 < F < 2e24Initial program 99.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 rewrites99.5%
if 2e24 < F Initial program 48.0%
Taylor expanded in F around inf
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
Final simplification99.7%
(FPCore (F B x)
:precision binary64
(if (<= F -400000000.0)
(+ (/ (- x) (tan B)) (/ -1.0 (sin B)))
(if (<= F 1.5e+24)
(+
(* x (/ -1.0 (tan B)))
(* (/ F (sin B)) (/ 1.0 (sqrt (+ 2.0 (fma 2.0 x (* F F)))))))
(/ (- 1.0 (* (cos B) x)) (sin B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -400000000.0) {
tmp = (-x / tan(B)) + (-1.0 / sin(B));
} else if (F <= 1.5e+24) {
tmp = (x * (-1.0 / tan(B))) + ((F / sin(B)) * (1.0 / sqrt((2.0 + fma(2.0, x, (F * F))))));
} else {
tmp = (1.0 - (cos(B) * x)) / sin(B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -400000000.0) tmp = Float64(Float64(Float64(-x) / tan(B)) + Float64(-1.0 / sin(B))); elseif (F <= 1.5e+24) tmp = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64(Float64(F / sin(B)) * Float64(1.0 / sqrt(Float64(2.0 + fma(2.0, x, Float64(F * F))))))); else tmp = Float64(Float64(1.0 - Float64(cos(B) * x)) / sin(B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -400000000.0], N[(N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision] + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.5e+24], N[(N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[Sqrt[N[(2.0 + N[(2.0 * x + N[(F * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -400000000:\\
\;\;\;\;\frac{-x}{\tan B} + \frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 1.5 \cdot 10^{+24}:\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{F}{\sin B} \cdot \frac{1}{\sqrt{2 + \mathsf{fma}\left(2, x, F \cdot F\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - \cos B \cdot x}{\sin B}\\
\end{array}
\end{array}
if F < -4e8Initial program 51.0%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6451.0
Applied rewrites51.0%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6499.9
Applied rewrites99.9%
if -4e8 < F < 1.49999999999999997e24Initial program 99.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 rewrites99.5%
Taylor expanded in B around inf
lower-*.f64N/A
lift-sin.f64N/A
lift-/.f64N/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
pow2N/A
lower-+.f64N/A
lift-fma.f64N/A
lift-*.f6499.5
Applied rewrites99.5%
if 1.49999999999999997e24 < F Initial program 48.0%
Taylor expanded in F around inf
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
Final simplification99.6%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ (- x) (tan B))))
(if (<= F -3.8e-28)
(+ t_0 (/ -1.0 (sin B)))
(if (<= F 1.15e+24)
(+ t_0 (* (/ F B) (pow (sqrt (+ 2.0 (fma 2.0 x (* F F)))) -1.0)))
(/ (- 1.0 (* (cos B) x)) (sin B))))))
double code(double F, double B, double x) {
double t_0 = -x / tan(B);
double tmp;
if (F <= -3.8e-28) {
tmp = t_0 + (-1.0 / sin(B));
} else if (F <= 1.15e+24) {
tmp = t_0 + ((F / B) * pow(sqrt((2.0 + fma(2.0, x, (F * F)))), -1.0));
} else {
tmp = (1.0 - (cos(B) * x)) / sin(B);
}
return tmp;
}
function code(F, B, x) t_0 = Float64(Float64(-x) / tan(B)) tmp = 0.0 if (F <= -3.8e-28) tmp = Float64(t_0 + Float64(-1.0 / sin(B))); elseif (F <= 1.15e+24) tmp = Float64(t_0 + Float64(Float64(F / B) * (sqrt(Float64(2.0 + fma(2.0, x, Float64(F * F)))) ^ -1.0))); else tmp = Float64(Float64(1.0 - Float64(cos(B) * x)) / sin(B)); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -3.8e-28], N[(t$95$0 + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.15e+24], N[(t$95$0 + N[(N[(F / B), $MachinePrecision] * N[Power[N[Sqrt[N[(2.0 + N[(2.0 * x + N[(F * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], -1.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-x}{\tan B}\\
\mathbf{if}\;F \leq -3.8 \cdot 10^{-28}:\\
\;\;\;\;t\_0 + \frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 1.15 \cdot 10^{+24}:\\
\;\;\;\;t\_0 + \frac{F}{B} \cdot {\left(\sqrt{2 + \mathsf{fma}\left(2, x, F \cdot F\right)}\right)}^{-1}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - \cos B \cdot x}{\sin B}\\
\end{array}
\end{array}
if F < -3.80000000000000009e-28Initial program 54.1%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6454.2
Applied rewrites54.2%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6497.1
Applied rewrites97.1%
if -3.80000000000000009e-28 < F < 1.15e24Initial program 99.4%
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%
Taylor expanded in B around 0
sqrt-divN/A
metadata-evalN/A
pow2N/A
lower-*.f64N/A
lower-/.f64N/A
inv-powN/A
lower-pow.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-+.f64N/A
lift-sqrt.f6490.6
Applied rewrites90.6%
if 1.15e24 < F Initial program 48.0%
Taylor expanded in F around inf
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
Final simplification94.7%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (sqrt (+ 2.0 (fma 2.0 x (* F F))))) (t_1 (* x (/ -1.0 (tan B)))))
(if (<= F -1.35e+154)
(+
t_1
(/
-1.0
(*
B
(+
1.0
(*
(* B B)
(- (* 0.008333333333333333 (* B B)) 0.16666666666666666))))))
(if (<= F -9.8e-29)
(+ (- (/ x B)) (/ F (* (sin B) t_0)))
(if (<= F 1.15e+24)
(+ t_1 (* (/ F B) (/ 1.0 t_0)))
(/ (- 1.0 (* (cos B) x)) (sin B)))))))
double code(double F, double B, double x) {
double t_0 = sqrt((2.0 + fma(2.0, x, (F * F))));
double t_1 = x * (-1.0 / tan(B));
double tmp;
if (F <= -1.35e+154) {
tmp = t_1 + (-1.0 / (B * (1.0 + ((B * B) * ((0.008333333333333333 * (B * B)) - 0.16666666666666666)))));
} else if (F <= -9.8e-29) {
tmp = -(x / B) + (F / (sin(B) * t_0));
} else if (F <= 1.15e+24) {
tmp = t_1 + ((F / B) * (1.0 / t_0));
} else {
tmp = (1.0 - (cos(B) * x)) / sin(B);
}
return tmp;
}
function code(F, B, x) t_0 = sqrt(Float64(2.0 + fma(2.0, x, Float64(F * F)))) t_1 = Float64(x * Float64(-1.0 / tan(B))) tmp = 0.0 if (F <= -1.35e+154) tmp = Float64(t_1 + Float64(-1.0 / Float64(B * Float64(1.0 + Float64(Float64(B * B) * Float64(Float64(0.008333333333333333 * Float64(B * B)) - 0.16666666666666666)))))); elseif (F <= -9.8e-29) tmp = Float64(Float64(-Float64(x / B)) + Float64(F / Float64(sin(B) * t_0))); elseif (F <= 1.15e+24) tmp = Float64(t_1 + Float64(Float64(F / B) * Float64(1.0 / t_0))); else tmp = Float64(Float64(1.0 - Float64(cos(B) * x)) / sin(B)); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[Sqrt[N[(2.0 + N[(2.0 * x + N[(F * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -1.35e+154], N[(t$95$1 + N[(-1.0 / N[(B * N[(1.0 + N[(N[(B * B), $MachinePrecision] * N[(N[(0.008333333333333333 * N[(B * B), $MachinePrecision]), $MachinePrecision] - 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, -9.8e-29], N[((-N[(x / B), $MachinePrecision]) + N[(F / N[(N[Sin[B], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.15e+24], N[(t$95$1 + N[(N[(F / B), $MachinePrecision] * N[(1.0 / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{2 + \mathsf{fma}\left(2, x, F \cdot F\right)}\\
t_1 := x \cdot \frac{-1}{\tan B}\\
\mathbf{if}\;F \leq -1.35 \cdot 10^{+154}:\\
\;\;\;\;t\_1 + \frac{-1}{B \cdot \left(1 + \left(B \cdot B\right) \cdot \left(0.008333333333333333 \cdot \left(B \cdot B\right) - 0.16666666666666666\right)\right)}\\
\mathbf{elif}\;F \leq -9.8 \cdot 10^{-29}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{F}{\sin B \cdot t\_0}\\
\mathbf{elif}\;F \leq 1.15 \cdot 10^{+24}:\\
\;\;\;\;t\_1 + \frac{F}{B} \cdot \frac{1}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - \cos B \cdot x}{\sin B}\\
\end{array}
\end{array}
if F < -1.35000000000000003e154Initial program 31.8%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6499.9
Applied rewrites99.9%
Taylor expanded in B around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f6481.7
Applied rewrites81.7%
if -1.35000000000000003e154 < F < -9.7999999999999997e-29Initial program 81.0%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6493.7
Applied rewrites93.7%
Taylor expanded in B around 0
lower-/.f6491.0
Applied rewrites91.0%
Taylor expanded in B around inf
lower-*.f64N/A
lower-/.f64N/A
lift-sin.f64N/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
pow2N/A
lower-+.f64N/A
lift-fma.f64N/A
lift-*.f6478.1
Applied rewrites78.1%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-/.f64N/A
lift-sqrt.f64N/A
lift-+.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lift-sin.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-+.f64N/A
lift-sqrt.f6496.9
Applied rewrites96.9%
if -9.7999999999999997e-29 < F < 1.15e24Initial program 99.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 rewrites99.5%
Taylor expanded in B around 0
lower-*.f64N/A
lower-/.f64N/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
pow2N/A
lower-+.f64N/A
lift-fma.f64N/A
lift-*.f6490.4
Applied rewrites90.4%
if 1.15e24 < F Initial program 48.0%
Taylor expanded in F around inf
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
Final simplification92.0%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (sqrt (+ 2.0 (fma 2.0 x (* F F)))))
(t_1 (* x (/ -1.0 (tan B))))
(t_2 (- (/ x B))))
(if (<= F -1.35e+154)
(+
t_1
(/
-1.0
(*
B
(+
1.0
(*
(* B B)
(- (* 0.008333333333333333 (* B B)) 0.16666666666666666))))))
(if (<= F -9.8e-29)
(+ t_2 (/ F (* (sin B) t_0)))
(if (<= F 7.5e+25)
(+ t_1 (* (/ F B) (/ 1.0 t_0)))
(+ t_2 (pow (sin B) -1.0)))))))
double code(double F, double B, double x) {
double t_0 = sqrt((2.0 + fma(2.0, x, (F * F))));
double t_1 = x * (-1.0 / tan(B));
double t_2 = -(x / B);
double tmp;
if (F <= -1.35e+154) {
tmp = t_1 + (-1.0 / (B * (1.0 + ((B * B) * ((0.008333333333333333 * (B * B)) - 0.16666666666666666)))));
} else if (F <= -9.8e-29) {
tmp = t_2 + (F / (sin(B) * t_0));
} else if (F <= 7.5e+25) {
tmp = t_1 + ((F / B) * (1.0 / t_0));
} else {
tmp = t_2 + pow(sin(B), -1.0);
}
return tmp;
}
function code(F, B, x) t_0 = sqrt(Float64(2.0 + fma(2.0, x, Float64(F * F)))) t_1 = Float64(x * Float64(-1.0 / tan(B))) t_2 = Float64(-Float64(x / B)) tmp = 0.0 if (F <= -1.35e+154) tmp = Float64(t_1 + Float64(-1.0 / Float64(B * Float64(1.0 + Float64(Float64(B * B) * Float64(Float64(0.008333333333333333 * Float64(B * B)) - 0.16666666666666666)))))); elseif (F <= -9.8e-29) tmp = Float64(t_2 + Float64(F / Float64(sin(B) * t_0))); elseif (F <= 7.5e+25) tmp = Float64(t_1 + Float64(Float64(F / B) * Float64(1.0 / t_0))); else tmp = Float64(t_2 + (sin(B) ^ -1.0)); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[Sqrt[N[(2.0 + N[(2.0 * x + N[(F * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = (-N[(x / B), $MachinePrecision])}, If[LessEqual[F, -1.35e+154], N[(t$95$1 + N[(-1.0 / N[(B * N[(1.0 + N[(N[(B * B), $MachinePrecision] * N[(N[(0.008333333333333333 * N[(B * B), $MachinePrecision]), $MachinePrecision] - 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, -9.8e-29], N[(t$95$2 + N[(F / N[(N[Sin[B], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 7.5e+25], N[(t$95$1 + N[(N[(F / B), $MachinePrecision] * N[(1.0 / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$2 + N[Power[N[Sin[B], $MachinePrecision], -1.0], $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{2 + \mathsf{fma}\left(2, x, F \cdot F\right)}\\
t_1 := x \cdot \frac{-1}{\tan B}\\
t_2 := -\frac{x}{B}\\
\mathbf{if}\;F \leq -1.35 \cdot 10^{+154}:\\
\;\;\;\;t\_1 + \frac{-1}{B \cdot \left(1 + \left(B \cdot B\right) \cdot \left(0.008333333333333333 \cdot \left(B \cdot B\right) - 0.16666666666666666\right)\right)}\\
\mathbf{elif}\;F \leq -9.8 \cdot 10^{-29}:\\
\;\;\;\;t\_2 + \frac{F}{\sin B \cdot t\_0}\\
\mathbf{elif}\;F \leq 7.5 \cdot 10^{+25}:\\
\;\;\;\;t\_1 + \frac{F}{B} \cdot \frac{1}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;t\_2 + {\sin B}^{-1}\\
\end{array}
\end{array}
if F < -1.35000000000000003e154Initial program 31.8%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6499.9
Applied rewrites99.9%
Taylor expanded in B around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f6481.7
Applied rewrites81.7%
if -1.35000000000000003e154 < F < -9.7999999999999997e-29Initial program 81.0%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6493.7
Applied rewrites93.7%
Taylor expanded in B around 0
lower-/.f6491.0
Applied rewrites91.0%
Taylor expanded in B around inf
lower-*.f64N/A
lower-/.f64N/A
lift-sin.f64N/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
pow2N/A
lower-+.f64N/A
lift-fma.f64N/A
lift-*.f6478.1
Applied rewrites78.1%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-/.f64N/A
lift-sqrt.f64N/A
lift-+.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lift-sin.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-+.f64N/A
lift-sqrt.f6496.9
Applied rewrites96.9%
if -9.7999999999999997e-29 < F < 7.49999999999999993e25Initial program 99.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 rewrites99.5%
Taylor expanded in B around 0
lower-*.f64N/A
lower-/.f64N/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
pow2N/A
lower-+.f64N/A
lift-fma.f64N/A
lift-*.f6490.4
Applied rewrites90.4%
if 7.49999999999999993e25 < F Initial program 48.0%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6441.8
Applied rewrites41.8%
Taylor expanded in B around 0
lower-/.f6423.9
Applied rewrites23.9%
Taylor expanded in F around inf
inv-powN/A
lower-pow.f64N/A
lift-sin.f6480.9
Applied rewrites80.9%
Final simplification87.7%
(FPCore (F B x)
:precision binary64
(if (<= F -3.8e-28)
(+ (/ (- x) (tan B)) (/ -1.0 (sin B)))
(if (<= F 1.15e+24)
(+
(* x (/ -1.0 (tan B)))
(* (/ F B) (/ 1.0 (sqrt (+ 2.0 (fma 2.0 x (* F F)))))))
(/ (- 1.0 (* (cos B) x)) (sin B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -3.8e-28) {
tmp = (-x / tan(B)) + (-1.0 / sin(B));
} else if (F <= 1.15e+24) {
tmp = (x * (-1.0 / tan(B))) + ((F / B) * (1.0 / sqrt((2.0 + fma(2.0, x, (F * F))))));
} else {
tmp = (1.0 - (cos(B) * x)) / sin(B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -3.8e-28) tmp = Float64(Float64(Float64(-x) / tan(B)) + Float64(-1.0 / sin(B))); elseif (F <= 1.15e+24) tmp = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64(Float64(F / B) * Float64(1.0 / sqrt(Float64(2.0 + fma(2.0, x, Float64(F * F))))))); else tmp = Float64(Float64(1.0 - Float64(cos(B) * x)) / sin(B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -3.8e-28], N[(N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision] + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.15e+24], N[(N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(F / B), $MachinePrecision] * N[(1.0 / N[Sqrt[N[(2.0 + N[(2.0 * x + N[(F * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -3.8 \cdot 10^{-28}:\\
\;\;\;\;\frac{-x}{\tan B} + \frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 1.15 \cdot 10^{+24}:\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{F}{B} \cdot \frac{1}{\sqrt{2 + \mathsf{fma}\left(2, x, F \cdot F\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - \cos B \cdot x}{\sin B}\\
\end{array}
\end{array}
if F < -3.80000000000000009e-28Initial program 54.1%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6454.2
Applied rewrites54.2%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6497.1
Applied rewrites97.1%
if -3.80000000000000009e-28 < F < 1.15e24Initial program 99.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 rewrites99.5%
Taylor expanded in B around 0
lower-*.f64N/A
lower-/.f64N/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
pow2N/A
lower-+.f64N/A
lift-fma.f64N/A
lift-*.f6490.4
Applied rewrites90.4%
if 1.15e24 < F Initial program 48.0%
Taylor expanded in F around inf
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
Final simplification94.6%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (* (cos B) x)))
(if (<= F -3.8e-28)
(/ (- -1.0 t_0) (sin B))
(if (<= F 1.15e+24)
(+
(* x (/ -1.0 (tan B)))
(* (/ F B) (/ 1.0 (sqrt (+ 2.0 (fma 2.0 x (* F F)))))))
(/ (- 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.8e-28) {
tmp = (-1.0 - t_0) / sin(B);
} else if (F <= 1.15e+24) {
tmp = (x * (-1.0 / tan(B))) + ((F / B) * (1.0 / sqrt((2.0 + fma(2.0, x, (F * F))))));
} else {
tmp = (1.0 - t_0) / sin(B);
}
return tmp;
}
function code(F, B, x) t_0 = Float64(cos(B) * x) tmp = 0.0 if (F <= -3.8e-28) tmp = Float64(Float64(-1.0 - t_0) / sin(B)); elseif (F <= 1.15e+24) tmp = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64(Float64(F / B) * Float64(1.0 / sqrt(Float64(2.0 + fma(2.0, x, Float64(F * F))))))); else tmp = Float64(Float64(1.0 - t_0) / sin(B)); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[F, -3.8e-28], N[(N[(-1.0 - t$95$0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.15e+24], N[(N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(F / B), $MachinePrecision] * N[(1.0 / N[Sqrt[N[(2.0 + N[(2.0 * x + N[(F * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - t$95$0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos B \cdot x\\
\mathbf{if}\;F \leq -3.8 \cdot 10^{-28}:\\
\;\;\;\;\frac{-1 - t\_0}{\sin B}\\
\mathbf{elif}\;F \leq 1.15 \cdot 10^{+24}:\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{F}{B} \cdot \frac{1}{\sqrt{2 + \mathsf{fma}\left(2, x, F \cdot F\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - t\_0}{\sin B}\\
\end{array}
\end{array}
if F < -3.80000000000000009e-28Initial program 54.1%
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.f6497.1
Applied rewrites97.1%
if -3.80000000000000009e-28 < F < 1.15e24Initial program 99.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 rewrites99.5%
Taylor expanded in B around 0
lower-*.f64N/A
lower-/.f64N/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
pow2N/A
lower-+.f64N/A
lift-fma.f64N/A
lift-*.f6490.4
Applied rewrites90.4%
if 1.15e24 < F Initial program 48.0%
Taylor expanded in F around inf
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
Final simplification94.6%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (sqrt (+ 2.0 (fma 2.0 x (* F F)))))
(t_1 (* x (/ -1.0 (tan B))))
(t_2 (+ (- (/ x B)) (/ F (* (sin B) t_0)))))
(if (<= F -1.35e+154)
(+
t_1
(/
-1.0
(*
B
(+
1.0
(*
(* B B)
(- (* 0.008333333333333333 (* B B)) 0.16666666666666666))))))
(if (<= F -9.8e-29)
t_2
(if (<= F 8.2e-61)
(+ t_1 (* (/ F B) (/ 1.0 t_0)))
(if (<= F 2.7e+159)
t_2
(/ (- (+ 1.0 (* -0.5 (/ (+ 2.0 (* 2.0 x)) (* F F)))) x) B)))))))
double code(double F, double B, double x) {
double t_0 = sqrt((2.0 + fma(2.0, x, (F * F))));
double t_1 = x * (-1.0 / tan(B));
double t_2 = -(x / B) + (F / (sin(B) * t_0));
double tmp;
if (F <= -1.35e+154) {
tmp = t_1 + (-1.0 / (B * (1.0 + ((B * B) * ((0.008333333333333333 * (B * B)) - 0.16666666666666666)))));
} else if (F <= -9.8e-29) {
tmp = t_2;
} else if (F <= 8.2e-61) {
tmp = t_1 + ((F / B) * (1.0 / t_0));
} else if (F <= 2.7e+159) {
tmp = t_2;
} else {
tmp = ((1.0 + (-0.5 * ((2.0 + (2.0 * x)) / (F * F)))) - x) / B;
}
return tmp;
}
function code(F, B, x) t_0 = sqrt(Float64(2.0 + fma(2.0, x, Float64(F * F)))) t_1 = Float64(x * Float64(-1.0 / tan(B))) t_2 = Float64(Float64(-Float64(x / B)) + Float64(F / Float64(sin(B) * t_0))) tmp = 0.0 if (F <= -1.35e+154) tmp = Float64(t_1 + Float64(-1.0 / Float64(B * Float64(1.0 + Float64(Float64(B * B) * Float64(Float64(0.008333333333333333 * Float64(B * B)) - 0.16666666666666666)))))); elseif (F <= -9.8e-29) tmp = t_2; elseif (F <= 8.2e-61) tmp = Float64(t_1 + Float64(Float64(F / B) * Float64(1.0 / t_0))); elseif (F <= 2.7e+159) tmp = t_2; else tmp = Float64(Float64(Float64(1.0 + Float64(-0.5 * Float64(Float64(2.0 + Float64(2.0 * x)) / Float64(F * F)))) - x) / B); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[Sqrt[N[(2.0 + N[(2.0 * x + N[(F * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[((-N[(x / B), $MachinePrecision]) + N[(F / N[(N[Sin[B], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -1.35e+154], N[(t$95$1 + N[(-1.0 / N[(B * N[(1.0 + N[(N[(B * B), $MachinePrecision] * N[(N[(0.008333333333333333 * N[(B * B), $MachinePrecision]), $MachinePrecision] - 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, -9.8e-29], t$95$2, If[LessEqual[F, 8.2e-61], N[(t$95$1 + N[(N[(F / B), $MachinePrecision] * N[(1.0 / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 2.7e+159], t$95$2, N[(N[(N[(1.0 + N[(-0.5 * N[(N[(2.0 + N[(2.0 * x), $MachinePrecision]), $MachinePrecision] / N[(F * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{2 + \mathsf{fma}\left(2, x, F \cdot F\right)}\\
t_1 := x \cdot \frac{-1}{\tan B}\\
t_2 := \left(-\frac{x}{B}\right) + \frac{F}{\sin B \cdot t\_0}\\
\mathbf{if}\;F \leq -1.35 \cdot 10^{+154}:\\
\;\;\;\;t\_1 + \frac{-1}{B \cdot \left(1 + \left(B \cdot B\right) \cdot \left(0.008333333333333333 \cdot \left(B \cdot B\right) - 0.16666666666666666\right)\right)}\\
\mathbf{elif}\;F \leq -9.8 \cdot 10^{-29}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;F \leq 8.2 \cdot 10^{-61}:\\
\;\;\;\;t\_1 + \frac{F}{B} \cdot \frac{1}{t\_0}\\
\mathbf{elif}\;F \leq 2.7 \cdot 10^{+159}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 + -0.5 \cdot \frac{2 + 2 \cdot x}{F \cdot F}\right) - x}{B}\\
\end{array}
\end{array}
if F < -1.35000000000000003e154Initial program 31.8%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6499.9
Applied rewrites99.9%
Taylor expanded in B around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f6481.7
Applied rewrites81.7%
if -1.35000000000000003e154 < F < -9.7999999999999997e-29 or 8.19999999999999998e-61 < F < 2.70000000000000008e159Initial program 82.4%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6462.2
Applied rewrites62.2%
Taylor expanded in B around 0
lower-/.f6454.8
Applied rewrites54.8%
Taylor expanded in B around inf
lower-*.f64N/A
lower-/.f64N/A
lift-sin.f64N/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
pow2N/A
lower-+.f64N/A
lift-fma.f64N/A
lift-*.f6473.9
Applied rewrites73.9%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-/.f64N/A
lift-sqrt.f64N/A
lift-+.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lift-sin.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-+.f64N/A
lift-sqrt.f6489.9
Applied rewrites89.9%
if -9.7999999999999997e-29 < F < 8.19999999999999998e-61Initial program 99.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 rewrites99.5%
Taylor expanded in B around 0
lower-*.f64N/A
lower-/.f64N/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
pow2N/A
lower-+.f64N/A
lift-fma.f64N/A
lift-*.f6491.7
Applied rewrites91.7%
if 2.70000000000000008e159 < F Initial program 27.9%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites28.0%
Taylor expanded in F around inf
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f6461.8
Applied rewrites61.8%
Final simplification85.7%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (* x (/ -1.0 (tan B)))))
(if (<= x -2.5e-99)
(+ t_0 (/ -1.0 (* B (+ 1.0 (* -0.16666666666666666 (* B B))))))
(if (<= x 9e-39)
(+ (- (/ x B)) (* (/ F (sin B)) (/ 1.0 (sqrt (+ 2.0 (* F F))))))
(+ t_0 (/ -1.0 B))))))
double code(double F, double B, double x) {
double t_0 = x * (-1.0 / tan(B));
double tmp;
if (x <= -2.5e-99) {
tmp = t_0 + (-1.0 / (B * (1.0 + (-0.16666666666666666 * (B * B)))));
} else if (x <= 9e-39) {
tmp = -(x / B) + ((F / sin(B)) * (1.0 / sqrt((2.0 + (F * F)))));
} else {
tmp = t_0 + (-1.0 / 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 * ((-1.0d0) / tan(b))
if (x <= (-2.5d-99)) then
tmp = t_0 + ((-1.0d0) / (b * (1.0d0 + ((-0.16666666666666666d0) * (b * b)))))
else if (x <= 9d-39) then
tmp = -(x / b) + ((f / sin(b)) * (1.0d0 / sqrt((2.0d0 + (f * f)))))
else
tmp = t_0 + ((-1.0d0) / b)
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double t_0 = x * (-1.0 / Math.tan(B));
double tmp;
if (x <= -2.5e-99) {
tmp = t_0 + (-1.0 / (B * (1.0 + (-0.16666666666666666 * (B * B)))));
} else if (x <= 9e-39) {
tmp = -(x / B) + ((F / Math.sin(B)) * (1.0 / Math.sqrt((2.0 + (F * F)))));
} else {
tmp = t_0 + (-1.0 / B);
}
return tmp;
}
def code(F, B, x): t_0 = x * (-1.0 / math.tan(B)) tmp = 0 if x <= -2.5e-99: tmp = t_0 + (-1.0 / (B * (1.0 + (-0.16666666666666666 * (B * B))))) elif x <= 9e-39: tmp = -(x / B) + ((F / math.sin(B)) * (1.0 / math.sqrt((2.0 + (F * F))))) else: tmp = t_0 + (-1.0 / B) return tmp
function code(F, B, x) t_0 = Float64(x * Float64(-1.0 / tan(B))) tmp = 0.0 if (x <= -2.5e-99) tmp = Float64(t_0 + Float64(-1.0 / Float64(B * Float64(1.0 + Float64(-0.16666666666666666 * Float64(B * B)))))); elseif (x <= 9e-39) tmp = Float64(Float64(-Float64(x / B)) + Float64(Float64(F / sin(B)) * Float64(1.0 / sqrt(Float64(2.0 + Float64(F * F)))))); else tmp = Float64(t_0 + Float64(-1.0 / B)); end return tmp end
function tmp_2 = code(F, B, x) t_0 = x * (-1.0 / tan(B)); tmp = 0.0; if (x <= -2.5e-99) tmp = t_0 + (-1.0 / (B * (1.0 + (-0.16666666666666666 * (B * B))))); elseif (x <= 9e-39) tmp = -(x / B) + ((F / sin(B)) * (1.0 / sqrt((2.0 + (F * F))))); else tmp = t_0 + (-1.0 / B); end tmp_2 = tmp; end
code[F_, B_, x_] := Block[{t$95$0 = N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.5e-99], N[(t$95$0 + N[(-1.0 / N[(B * N[(1.0 + N[(-0.16666666666666666 * N[(B * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 9e-39], N[((-N[(x / B), $MachinePrecision]) + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[Sqrt[N[(2.0 + N[(F * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(-1.0 / B), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \frac{-1}{\tan B}\\
\mathbf{if}\;x \leq -2.5 \cdot 10^{-99}:\\
\;\;\;\;t\_0 + \frac{-1}{B \cdot \left(1 + -0.16666666666666666 \cdot \left(B \cdot B\right)\right)}\\
\mathbf{elif}\;x \leq 9 \cdot 10^{-39}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{F}{\sin B} \cdot \frac{1}{\sqrt{2 + F \cdot F}}\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \frac{-1}{B}\\
\end{array}
\end{array}
if x < -2.49999999999999985e-99Initial program 66.0%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6467.2
Applied rewrites67.2%
Taylor expanded in B around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f6471.1
Applied rewrites71.1%
if -2.49999999999999985e-99 < x < 9.0000000000000002e-39Initial program 71.8%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6430.6
Applied rewrites30.6%
Taylor expanded in B around 0
lower-/.f6430.6
Applied rewrites30.6%
Taylor expanded in B around inf
lower-*.f64N/A
lower-/.f64N/A
lift-sin.f64N/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
pow2N/A
lower-+.f64N/A
lift-fma.f64N/A
lift-*.f6465.2
Applied rewrites65.2%
Taylor expanded in F around inf
pow2N/A
lift-*.f6465.2
Applied rewrites65.2%
if 9.0000000000000002e-39 < x Initial program 80.7%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6491.1
Applied rewrites91.1%
Taylor expanded in B around 0
Applied rewrites92.4%
Final simplification76.5%
(FPCore (F B x) :precision binary64 (if (or (<= x -0.018) (not (<= x 4e-32))) (+ (* x (/ -1.0 (tan B))) (/ -1.0 B)) (+ (- (/ x B)) (/ F (* (sin B) (sqrt (+ 2.0 (fma 2.0 x (* F F)))))))))
double code(double F, double B, double x) {
double tmp;
if ((x <= -0.018) || !(x <= 4e-32)) {
tmp = (x * (-1.0 / tan(B))) + (-1.0 / B);
} else {
tmp = -(x / B) + (F / (sin(B) * sqrt((2.0 + fma(2.0, x, (F * F))))));
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if ((x <= -0.018) || !(x <= 4e-32)) tmp = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64(-1.0 / B)); else tmp = Float64(Float64(-Float64(x / B)) + Float64(F / Float64(sin(B) * sqrt(Float64(2.0 + fma(2.0, x, Float64(F * F))))))); end return tmp end
code[F_, B_, x_] := If[Or[LessEqual[x, -0.018], N[Not[LessEqual[x, 4e-32]], $MachinePrecision]], N[(N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-1.0 / B), $MachinePrecision]), $MachinePrecision], N[((-N[(x / B), $MachinePrecision]) + N[(F / N[(N[Sin[B], $MachinePrecision] * N[Sqrt[N[(2.0 + N[(2.0 * x + N[(F * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.018 \lor \neg \left(x \leq 4 \cdot 10^{-32}\right):\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{-1}{B}\\
\mathbf{else}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{F}{\sin B \cdot \sqrt{2 + \mathsf{fma}\left(2, x, F \cdot F\right)}}\\
\end{array}
\end{array}
if x < -0.0179999999999999986 or 4.00000000000000022e-32 < x Initial program 79.8%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6493.0
Applied rewrites93.0%
Taylor expanded in B around 0
Applied rewrites95.8%
if -0.0179999999999999986 < x < 4.00000000000000022e-32Initial program 69.1%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6433.5
Applied rewrites33.5%
Taylor expanded in B around 0
lower-/.f6433.5
Applied rewrites33.5%
Taylor expanded in B around inf
lower-*.f64N/A
lower-/.f64N/A
lift-sin.f64N/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
pow2N/A
lower-+.f64N/A
lift-fma.f64N/A
lift-*.f6459.4
Applied rewrites59.4%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-/.f64N/A
lift-sqrt.f64N/A
lift-+.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lift-sin.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-+.f64N/A
lift-sqrt.f6465.6
Applied rewrites65.6%
Final simplification79.3%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ 1.0 (sqrt (+ 2.0 (fma 2.0 x (* F F)))))))
(if (<= B 1.2)
(/
(-
(fma
F
t_0
(*
(* B B)
(fma 0.16666666666666666 (* F t_0) (* 0.3333333333333333 x))))
x)
B)
(+
(* x (/ -1.0 (tan B)))
(/ -1.0 (* B (+ 1.0 (* -0.16666666666666666 (* B B)))))))))
double code(double F, double B, double x) {
double t_0 = 1.0 / sqrt((2.0 + fma(2.0, x, (F * F))));
double tmp;
if (B <= 1.2) {
tmp = (fma(F, t_0, ((B * B) * fma(0.16666666666666666, (F * t_0), (0.3333333333333333 * x)))) - x) / B;
} else {
tmp = (x * (-1.0 / tan(B))) + (-1.0 / (B * (1.0 + (-0.16666666666666666 * (B * B)))));
}
return tmp;
}
function code(F, B, x) t_0 = Float64(1.0 / sqrt(Float64(2.0 + fma(2.0, x, Float64(F * F))))) tmp = 0.0 if (B <= 1.2) tmp = Float64(Float64(fma(F, t_0, Float64(Float64(B * B) * fma(0.16666666666666666, Float64(F * t_0), Float64(0.3333333333333333 * x)))) - x) / B); else tmp = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64(-1.0 / Float64(B * Float64(1.0 + Float64(-0.16666666666666666 * Float64(B * B)))))); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(1.0 / N[Sqrt[N[(2.0 + N[(2.0 * x + N[(F * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, 1.2], N[(N[(N[(F * t$95$0 + N[(N[(B * B), $MachinePrecision] * N[(0.16666666666666666 * N[(F * t$95$0), $MachinePrecision] + N[(0.3333333333333333 * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-1.0 / N[(B * N[(1.0 + N[(-0.16666666666666666 * N[(B * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{\sqrt{2 + \mathsf{fma}\left(2, x, F \cdot F\right)}}\\
\mathbf{if}\;B \leq 1.2:\\
\;\;\;\;\frac{\mathsf{fma}\left(F, t\_0, \left(B \cdot B\right) \cdot \mathsf{fma}\left(0.16666666666666666, F \cdot t\_0, 0.3333333333333333 \cdot x\right)\right) - x}{B}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{-1}{B \cdot \left(1 + -0.16666666666666666 \cdot \left(B \cdot B\right)\right)}\\
\end{array}
\end{array}
if B < 1.19999999999999996Initial program 69.0%
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 rewrites82.6%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites60.5%
if 1.19999999999999996 < B Initial program 90.9%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6459.4
Applied rewrites59.4%
Taylor expanded in B around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f6461.5
Applied rewrites61.5%
Final simplification60.7%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ 1.0 (sqrt (+ 2.0 (fma 2.0 x (* F F)))))))
(if (<= B 1.2)
(/
(-
(fma
F
t_0
(*
(* B B)
(fma 0.16666666666666666 (* F t_0) (* 0.3333333333333333 x))))
x)
B)
(+ (* x (/ -1.0 (tan B))) (/ -1.0 B)))))
double code(double F, double B, double x) {
double t_0 = 1.0 / sqrt((2.0 + fma(2.0, x, (F * F))));
double tmp;
if (B <= 1.2) {
tmp = (fma(F, t_0, ((B * B) * fma(0.16666666666666666, (F * t_0), (0.3333333333333333 * x)))) - x) / B;
} else {
tmp = (x * (-1.0 / tan(B))) + (-1.0 / B);
}
return tmp;
}
function code(F, B, x) t_0 = Float64(1.0 / sqrt(Float64(2.0 + fma(2.0, x, Float64(F * F))))) tmp = 0.0 if (B <= 1.2) tmp = Float64(Float64(fma(F, t_0, Float64(Float64(B * B) * fma(0.16666666666666666, Float64(F * t_0), Float64(0.3333333333333333 * 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_] := Block[{t$95$0 = N[(1.0 / N[Sqrt[N[(2.0 + N[(2.0 * x + N[(F * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, 1.2], N[(N[(N[(F * t$95$0 + N[(N[(B * B), $MachinePrecision] * N[(0.16666666666666666 * N[(F * t$95$0), $MachinePrecision] + N[(0.3333333333333333 * x), $MachinePrecision]), $MachinePrecision]), $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}
t_0 := \frac{1}{\sqrt{2 + \mathsf{fma}\left(2, x, F \cdot F\right)}}\\
\mathbf{if}\;B \leq 1.2:\\
\;\;\;\;\frac{\mathsf{fma}\left(F, t\_0, \left(B \cdot B\right) \cdot \mathsf{fma}\left(0.16666666666666666, F \cdot t\_0, 0.3333333333333333 \cdot x\right)\right) - x}{B}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{-1}{B}\\
\end{array}
\end{array}
if B < 1.19999999999999996Initial program 69.0%
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 rewrites82.6%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites60.5%
if 1.19999999999999996 < B Initial program 90.9%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6459.4
Applied rewrites59.4%
Taylor expanded in B around 0
Applied rewrites56.8%
Final simplification59.6%
(FPCore (F B x)
:precision binary64
(if (<= F -2.9e-25)
(+ (- (/ x B)) (/ -1.0 (sin B)))
(if (<= F 2.7e+159)
(/
(-
(fma
(* 0.3333333333333333 x)
(* B B)
(* (sqrt (/ 1.0 (+ (fma 2.0 x (* F F)) 2.0))) F))
x)
B)
(/ (- (+ 1.0 (* -0.5 (/ (+ 2.0 (* 2.0 x)) (* F F)))) x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -2.9e-25) {
tmp = -(x / B) + (-1.0 / sin(B));
} else if (F <= 2.7e+159) {
tmp = (fma((0.3333333333333333 * x), (B * B), (sqrt((1.0 / (fma(2.0, x, (F * F)) + 2.0))) * F)) - x) / B;
} else {
tmp = ((1.0 + (-0.5 * ((2.0 + (2.0 * x)) / (F * F)))) - x) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -2.9e-25) tmp = Float64(Float64(-Float64(x / B)) + Float64(-1.0 / sin(B))); elseif (F <= 2.7e+159) tmp = Float64(Float64(fma(Float64(0.3333333333333333 * x), Float64(B * B), Float64(sqrt(Float64(1.0 / Float64(fma(2.0, x, Float64(F * F)) + 2.0))) * F)) - x) / B); else tmp = Float64(Float64(Float64(1.0 + Float64(-0.5 * Float64(Float64(2.0 + Float64(2.0 * x)) / Float64(F * F)))) - x) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -2.9e-25], N[((-N[(x / B), $MachinePrecision]) + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 2.7e+159], N[(N[(N[(N[(0.3333333333333333 * x), $MachinePrecision] * N[(B * B), $MachinePrecision] + N[(N[Sqrt[N[(1.0 / N[(N[(2.0 * x + N[(F * F), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(N[(1.0 + N[(-0.5 * N[(N[(2.0 + N[(2.0 * x), $MachinePrecision]), $MachinePrecision] / N[(F * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -2.9 \cdot 10^{-25}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 2.7 \cdot 10^{+159}:\\
\;\;\;\;\frac{\mathsf{fma}\left(0.3333333333333333 \cdot x, B \cdot B, \sqrt{\frac{1}{\mathsf{fma}\left(2, x, F \cdot F\right) + 2}} \cdot F\right) - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 + -0.5 \cdot \frac{2 + 2 \cdot x}{F \cdot F}\right) - x}{B}\\
\end{array}
\end{array}
if F < -2.9000000000000001e-25Initial program 53.6%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6498.2
Applied rewrites98.2%
Taylor expanded in B around 0
lower-/.f6481.8
Applied rewrites81.8%
if -2.9000000000000001e-25 < F < 2.70000000000000008e159Initial program 94.8%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites55.6%
Taylor expanded in F around -inf
lower-/.f6454.2
Applied rewrites54.2%
lift-pow.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
unpow-1N/A
lower-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-+.f6454.2
Applied rewrites54.2%
Taylor expanded in F around 0
lift-*.f6455.7
Applied rewrites55.7%
if 2.70000000000000008e159 < F Initial program 27.9%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites28.0%
Taylor expanded in F around inf
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f6461.8
Applied rewrites61.8%
Final simplification64.2%
(FPCore (F B x)
:precision binary64
(if (<= F -2.9e-25)
(/ (- (- (* 0.5 (/ 2.0 (* F F))) 1.0) x) B)
(if (<= F 2.7e+159)
(/
(-
(fma
(* 0.3333333333333333 x)
(* B B)
(* (sqrt (/ 1.0 (+ (fma 2.0 x (* F F)) 2.0))) F))
x)
B)
(/ (- (+ 1.0 (* -0.5 (/ (+ 2.0 (* 2.0 x)) (* F F)))) x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -2.9e-25) {
tmp = (((0.5 * (2.0 / (F * F))) - 1.0) - x) / B;
} else if (F <= 2.7e+159) {
tmp = (fma((0.3333333333333333 * x), (B * B), (sqrt((1.0 / (fma(2.0, x, (F * F)) + 2.0))) * F)) - x) / B;
} else {
tmp = ((1.0 + (-0.5 * ((2.0 + (2.0 * x)) / (F * F)))) - x) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -2.9e-25) tmp = Float64(Float64(Float64(Float64(0.5 * Float64(2.0 / Float64(F * F))) - 1.0) - x) / B); elseif (F <= 2.7e+159) tmp = Float64(Float64(fma(Float64(0.3333333333333333 * x), Float64(B * B), Float64(sqrt(Float64(1.0 / Float64(fma(2.0, x, Float64(F * F)) + 2.0))) * F)) - x) / B); else tmp = Float64(Float64(Float64(1.0 + Float64(-0.5 * Float64(Float64(2.0 + Float64(2.0 * x)) / Float64(F * F)))) - x) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -2.9e-25], N[(N[(N[(N[(0.5 * N[(2.0 / N[(F * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 2.7e+159], N[(N[(N[(N[(0.3333333333333333 * x), $MachinePrecision] * N[(B * B), $MachinePrecision] + N[(N[Sqrt[N[(1.0 / N[(N[(2.0 * x + N[(F * F), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(N[(1.0 + N[(-0.5 * N[(N[(2.0 + N[(2.0 * x), $MachinePrecision]), $MachinePrecision] / N[(F * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -2.9 \cdot 10^{-25}:\\
\;\;\;\;\frac{\left(0.5 \cdot \frac{2}{F \cdot F} - 1\right) - x}{B}\\
\mathbf{elif}\;F \leq 2.7 \cdot 10^{+159}:\\
\;\;\;\;\frac{\mathsf{fma}\left(0.3333333333333333 \cdot x, B \cdot B, \sqrt{\frac{1}{\mathsf{fma}\left(2, x, F \cdot F\right) + 2}} \cdot F\right) - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 + -0.5 \cdot \frac{2 + 2 \cdot x}{F \cdot F}\right) - x}{B}\\
\end{array}
\end{array}
if F < -2.9000000000000001e-25Initial program 53.6%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites41.0%
Taylor expanded in F around -inf
metadata-evalN/A
lower--.f64N/A
lower-*.f64N/A
metadata-evalN/A
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f6456.9
Applied rewrites56.9%
Taylor expanded in x around 0
Applied rewrites59.5%
if -2.9000000000000001e-25 < F < 2.70000000000000008e159Initial program 94.8%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites55.6%
Taylor expanded in F around -inf
lower-/.f6454.2
Applied rewrites54.2%
lift-pow.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
unpow-1N/A
lower-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-+.f6454.2
Applied rewrites54.2%
Taylor expanded in F around 0
lift-*.f6455.7
Applied rewrites55.7%
if 2.70000000000000008e159 < F Initial program 27.9%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites28.0%
Taylor expanded in F around inf
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f6461.8
Applied rewrites61.8%
Final simplification57.6%
(FPCore (F B x)
:precision binary64
(if (<= F -3.8e-28)
(/ (- (- (* 0.5 (/ 2.0 (* F F))) 1.0) x) B)
(if (<= F 6.4e+56)
(+ (- (/ x B)) (* (/ F B) (/ 1.0 (sqrt (+ 2.0 (fma 2.0 x (* F F)))))))
(/
(-
(+ 1.0 (* (* B B) (+ 0.16666666666666666 (* 0.3333333333333333 x))))
x)
B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -3.8e-28) {
tmp = (((0.5 * (2.0 / (F * F))) - 1.0) - x) / B;
} else if (F <= 6.4e+56) {
tmp = -(x / B) + ((F / B) * (1.0 / sqrt((2.0 + fma(2.0, x, (F * F))))));
} else {
tmp = ((1.0 + ((B * B) * (0.16666666666666666 + (0.3333333333333333 * x)))) - x) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -3.8e-28) tmp = Float64(Float64(Float64(Float64(0.5 * Float64(2.0 / Float64(F * F))) - 1.0) - x) / B); elseif (F <= 6.4e+56) tmp = Float64(Float64(-Float64(x / B)) + Float64(Float64(F / B) * Float64(1.0 / sqrt(Float64(2.0 + fma(2.0, x, Float64(F * F))))))); else tmp = Float64(Float64(Float64(1.0 + Float64(Float64(B * B) * Float64(0.16666666666666666 + Float64(0.3333333333333333 * x)))) - x) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -3.8e-28], N[(N[(N[(N[(0.5 * N[(2.0 / N[(F * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 6.4e+56], N[((-N[(x / B), $MachinePrecision]) + N[(N[(F / B), $MachinePrecision] * N[(1.0 / N[Sqrt[N[(2.0 + N[(2.0 * x + N[(F * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 + N[(N[(B * B), $MachinePrecision] * N[(0.16666666666666666 + N[(0.3333333333333333 * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -3.8 \cdot 10^{-28}:\\
\;\;\;\;\frac{\left(0.5 \cdot \frac{2}{F \cdot F} - 1\right) - x}{B}\\
\mathbf{elif}\;F \leq 6.4 \cdot 10^{+56}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{F}{B} \cdot \frac{1}{\sqrt{2 + \mathsf{fma}\left(2, x, F \cdot F\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 + \left(B \cdot B\right) \cdot \left(0.16666666666666666 + 0.3333333333333333 \cdot x\right)\right) - x}{B}\\
\end{array}
\end{array}
if F < -3.80000000000000009e-28Initial program 54.1%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites40.5%
Taylor expanded in F around -inf
metadata-evalN/A
lower--.f64N/A
lower-*.f64N/A
metadata-evalN/A
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f6456.2
Applied rewrites56.2%
Taylor expanded in x around 0
Applied rewrites58.8%
if -3.80000000000000009e-28 < F < 6.40000000000000007e56Initial program 99.4%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6445.8
Applied rewrites45.8%
Taylor expanded in B around 0
lower-/.f6424.5
Applied rewrites24.5%
Taylor expanded in B around 0
lower-*.f64N/A
lower-/.f64N/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
pow2N/A
lower-+.f64N/A
lift-fma.f64N/A
lift-*.f6456.8
Applied rewrites56.8%
if 6.40000000000000007e56 < F Initial program 47.1%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites37.6%
Taylor expanded in F around inf
lower-+.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lower-+.f64N/A
lift-*.f6456.9
Applied rewrites56.9%
Final simplification57.4%
(FPCore (F B x)
:precision binary64
(if (<= F -3.8e-28)
(/ (- (- (* 0.5 (/ 2.0 (* F F))) 1.0) x) B)
(if (<= F 1.9e+94)
(/ (- (* (sqrt (/ 1.0 (+ (fma 2.0 x (* F F)) 2.0))) F) x) B)
(/
(-
(+ 1.0 (* (* B B) (+ 0.16666666666666666 (* 0.3333333333333333 x))))
x)
B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -3.8e-28) {
tmp = (((0.5 * (2.0 / (F * F))) - 1.0) - x) / B;
} else if (F <= 1.9e+94) {
tmp = ((sqrt((1.0 / (fma(2.0, x, (F * F)) + 2.0))) * F) - x) / B;
} else {
tmp = ((1.0 + ((B * B) * (0.16666666666666666 + (0.3333333333333333 * x)))) - x) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -3.8e-28) tmp = Float64(Float64(Float64(Float64(0.5 * Float64(2.0 / Float64(F * F))) - 1.0) - x) / B); elseif (F <= 1.9e+94) tmp = Float64(Float64(Float64(sqrt(Float64(1.0 / Float64(fma(2.0, x, Float64(F * F)) + 2.0))) * F) - x) / B); else tmp = Float64(Float64(Float64(1.0 + Float64(Float64(B * B) * Float64(0.16666666666666666 + Float64(0.3333333333333333 * x)))) - x) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -3.8e-28], N[(N[(N[(N[(0.5 * N[(2.0 / N[(F * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 1.9e+94], N[(N[(N[(N[Sqrt[N[(1.0 / N[(N[(2.0 * x + N[(F * F), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * F), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(N[(1.0 + N[(N[(B * B), $MachinePrecision] * N[(0.16666666666666666 + N[(0.3333333333333333 * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -3.8 \cdot 10^{-28}:\\
\;\;\;\;\frac{\left(0.5 \cdot \frac{2}{F \cdot F} - 1\right) - x}{B}\\
\mathbf{elif}\;F \leq 1.9 \cdot 10^{+94}:\\
\;\;\;\;\frac{\sqrt{\frac{1}{\mathsf{fma}\left(2, x, F \cdot F\right) + 2}} \cdot F - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 + \left(B \cdot B\right) \cdot \left(0.16666666666666666 + 0.3333333333333333 \cdot x\right)\right) - x}{B}\\
\end{array}
\end{array}
if F < -3.80000000000000009e-28Initial program 54.1%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites40.5%
Taylor expanded in F around -inf
metadata-evalN/A
lower--.f64N/A
lower-*.f64N/A
metadata-evalN/A
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f6456.2
Applied rewrites56.2%
Taylor expanded in x around 0
Applied rewrites58.8%
if -3.80000000000000009e-28 < F < 1.8999999999999998e94Initial program 98.7%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites56.1%
lift-pow.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
unpow-1N/A
lower-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-+.f6456.1
Applied rewrites56.1%
if 1.8999999999999998e94 < F Initial program 39.5%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites35.7%
Taylor expanded in F around inf
lower-+.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lower-+.f64N/A
lift-*.f6458.6
Applied rewrites58.6%
Final simplification57.4%
(FPCore (F B x)
:precision binary64
(if (<= F -2.9e-25)
(/ (- (- (* 0.5 (/ 2.0 (* F F))) 1.0) x) B)
(if (<= F 1.2)
(/ (* x (- (* 0.3333333333333333 (* B B)) 1.0)) B)
(/ (- (+ 1.0 (* -0.5 (/ (+ 2.0 (* 2.0 x)) (* F F)))) x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -2.9e-25) {
tmp = (((0.5 * (2.0 / (F * F))) - 1.0) - x) / B;
} else if (F <= 1.2) {
tmp = (x * ((0.3333333333333333 * (B * B)) - 1.0)) / B;
} else {
tmp = ((1.0 + (-0.5 * ((2.0 + (2.0 * x)) / (F * F)))) - 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.9d-25)) then
tmp = (((0.5d0 * (2.0d0 / (f * f))) - 1.0d0) - x) / b
else if (f <= 1.2d0) then
tmp = (x * ((0.3333333333333333d0 * (b * b)) - 1.0d0)) / b
else
tmp = ((1.0d0 + ((-0.5d0) * ((2.0d0 + (2.0d0 * x)) / (f * f)))) - x) / b
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -2.9e-25) {
tmp = (((0.5 * (2.0 / (F * F))) - 1.0) - x) / B;
} else if (F <= 1.2) {
tmp = (x * ((0.3333333333333333 * (B * B)) - 1.0)) / B;
} else {
tmp = ((1.0 + (-0.5 * ((2.0 + (2.0 * x)) / (F * F)))) - x) / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -2.9e-25: tmp = (((0.5 * (2.0 / (F * F))) - 1.0) - x) / B elif F <= 1.2: tmp = (x * ((0.3333333333333333 * (B * B)) - 1.0)) / B else: tmp = ((1.0 + (-0.5 * ((2.0 + (2.0 * x)) / (F * F)))) - x) / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= -2.9e-25) tmp = Float64(Float64(Float64(Float64(0.5 * Float64(2.0 / Float64(F * F))) - 1.0) - x) / B); elseif (F <= 1.2) tmp = Float64(Float64(x * Float64(Float64(0.3333333333333333 * Float64(B * B)) - 1.0)) / B); else tmp = Float64(Float64(Float64(1.0 + Float64(-0.5 * Float64(Float64(2.0 + Float64(2.0 * x)) / Float64(F * F)))) - x) / B); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -2.9e-25) tmp = (((0.5 * (2.0 / (F * F))) - 1.0) - x) / B; elseif (F <= 1.2) tmp = (x * ((0.3333333333333333 * (B * B)) - 1.0)) / B; else tmp = ((1.0 + (-0.5 * ((2.0 + (2.0 * x)) / (F * F)))) - x) / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -2.9e-25], N[(N[(N[(N[(0.5 * N[(2.0 / N[(F * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 1.2], N[(N[(x * N[(N[(0.3333333333333333 * N[(B * B), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision], N[(N[(N[(1.0 + N[(-0.5 * N[(N[(2.0 + N[(2.0 * x), $MachinePrecision]), $MachinePrecision] / N[(F * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -2.9 \cdot 10^{-25}:\\
\;\;\;\;\frac{\left(0.5 \cdot \frac{2}{F \cdot F} - 1\right) - x}{B}\\
\mathbf{elif}\;F \leq 1.2:\\
\;\;\;\;\frac{x \cdot \left(0.3333333333333333 \cdot \left(B \cdot B\right) - 1\right)}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 + -0.5 \cdot \frac{2 + 2 \cdot x}{F \cdot F}\right) - x}{B}\\
\end{array}
\end{array}
if F < -2.9000000000000001e-25Initial program 53.6%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites41.0%
Taylor expanded in F around -inf
metadata-evalN/A
lower--.f64N/A
lower-*.f64N/A
metadata-evalN/A
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f6456.9
Applied rewrites56.9%
Taylor expanded in x around 0
Applied rewrites59.5%
if -2.9000000000000001e-25 < F < 1.19999999999999996Initial program 99.4%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites56.0%
Taylor expanded in x around inf
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f6439.7
Applied rewrites39.7%
if 1.19999999999999996 < F Initial program 53.5%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites40.8%
Taylor expanded in F around inf
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f6457.8
Applied rewrites57.8%
Final simplification50.2%
(FPCore (F B x)
:precision binary64
(if (<= F -2.9e-25)
(/ (- (- (* 0.5 (/ 2.0 (* F F))) 1.0) x) B)
(if (<= F 1.1e-110)
(/ (* x (- (* 0.3333333333333333 (* B B)) 1.0)) B)
(/ (- 1.0 x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -2.9e-25) {
tmp = (((0.5 * (2.0 / (F * F))) - 1.0) - x) / B;
} else if (F <= 1.1e-110) {
tmp = (x * ((0.3333333333333333 * (B * B)) - 1.0)) / 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.9d-25)) then
tmp = (((0.5d0 * (2.0d0 / (f * f))) - 1.0d0) - x) / b
else if (f <= 1.1d-110) then
tmp = (x * ((0.3333333333333333d0 * (b * b)) - 1.0d0)) / 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.9e-25) {
tmp = (((0.5 * (2.0 / (F * F))) - 1.0) - x) / B;
} else if (F <= 1.1e-110) {
tmp = (x * ((0.3333333333333333 * (B * B)) - 1.0)) / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -2.9e-25: tmp = (((0.5 * (2.0 / (F * F))) - 1.0) - x) / B elif F <= 1.1e-110: tmp = (x * ((0.3333333333333333 * (B * B)) - 1.0)) / B else: tmp = (1.0 - x) / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= -2.9e-25) tmp = Float64(Float64(Float64(Float64(0.5 * Float64(2.0 / Float64(F * F))) - 1.0) - x) / B); elseif (F <= 1.1e-110) tmp = Float64(Float64(x * Float64(Float64(0.3333333333333333 * Float64(B * B)) - 1.0)) / 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.9e-25) tmp = (((0.5 * (2.0 / (F * F))) - 1.0) - x) / B; elseif (F <= 1.1e-110) tmp = (x * ((0.3333333333333333 * (B * B)) - 1.0)) / B; else tmp = (1.0 - x) / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -2.9e-25], N[(N[(N[(N[(0.5 * N[(2.0 / N[(F * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 1.1e-110], N[(N[(x * N[(N[(0.3333333333333333 * N[(B * B), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -2.9 \cdot 10^{-25}:\\
\;\;\;\;\frac{\left(0.5 \cdot \frac{2}{F \cdot F} - 1\right) - x}{B}\\
\mathbf{elif}\;F \leq 1.1 \cdot 10^{-110}:\\
\;\;\;\;\frac{x \cdot \left(0.3333333333333333 \cdot \left(B \cdot B\right) - 1\right)}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < -2.9000000000000001e-25Initial program 53.6%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites41.0%
Taylor expanded in F around -inf
metadata-evalN/A
lower--.f64N/A
lower-*.f64N/A
metadata-evalN/A
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f6456.9
Applied rewrites56.9%
Taylor expanded in x around 0
Applied rewrites59.5%
if -2.9000000000000001e-25 < F < 1.1e-110Initial program 99.4%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites53.6%
Taylor expanded in x around inf
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f6443.3
Applied rewrites43.3%
if 1.1e-110 < F Initial program 66.1%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites47.5%
Taylor expanded in F around inf
Applied rewrites49.2%
Final simplification50.2%
(FPCore (F B x)
:precision binary64
(if (<= F -31000.0)
(- (/ -1.0 B) (/ x B))
(if (<= F 1.1e-110)
(/ (* x (- (* 0.3333333333333333 (* B B)) 1.0)) B)
(/ (- 1.0 x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -31000.0) {
tmp = (-1.0 / B) - (x / B);
} else if (F <= 1.1e-110) {
tmp = (x * ((0.3333333333333333 * (B * B)) - 1.0)) / 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 <= (-31000.0d0)) then
tmp = ((-1.0d0) / b) - (x / b)
else if (f <= 1.1d-110) then
tmp = (x * ((0.3333333333333333d0 * (b * b)) - 1.0d0)) / 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 <= -31000.0) {
tmp = (-1.0 / B) - (x / B);
} else if (F <= 1.1e-110) {
tmp = (x * ((0.3333333333333333 * (B * B)) - 1.0)) / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -31000.0: tmp = (-1.0 / B) - (x / B) elif F <= 1.1e-110: tmp = (x * ((0.3333333333333333 * (B * B)) - 1.0)) / B else: tmp = (1.0 - x) / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= -31000.0) tmp = Float64(Float64(-1.0 / B) - Float64(x / B)); elseif (F <= 1.1e-110) tmp = Float64(Float64(x * Float64(Float64(0.3333333333333333 * Float64(B * B)) - 1.0)) / 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 <= -31000.0) tmp = (-1.0 / B) - (x / B); elseif (F <= 1.1e-110) tmp = (x * ((0.3333333333333333 * (B * B)) - 1.0)) / B; else tmp = (1.0 - x) / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -31000.0], N[(N[(-1.0 / B), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.1e-110], N[(N[(x * N[(N[(0.3333333333333333 * N[(B * B), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -31000:\\
\;\;\;\;\frac{-1}{B} - \frac{x}{B}\\
\mathbf{elif}\;F \leq 1.1 \cdot 10^{-110}:\\
\;\;\;\;\frac{x \cdot \left(0.3333333333333333 \cdot \left(B \cdot B\right) - 1\right)}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < -31000Initial program 51.0%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites40.4%
Taylor expanded in F around -inf
Applied rewrites59.9%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lift-/.f6459.9
Applied rewrites59.9%
if -31000 < F < 1.1e-110Initial program 99.4%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites53.5%
Taylor expanded in x around inf
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f6443.6
Applied rewrites43.6%
if 1.1e-110 < F Initial program 66.1%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites47.5%
Taylor expanded in F around inf
Applied rewrites49.2%
Final simplification50.2%
(FPCore (F B x) :precision binary64 (if (<= F -1.15e-38) (- (/ -1.0 B) (/ x B)) (if (<= F 7.6e-75) (/ (- x) B) (/ (- 1.0 x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1.15e-38) {
tmp = (-1.0 / B) - (x / B);
} else if (F <= 7.6e-75) {
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 <= (-1.15d-38)) then
tmp = ((-1.0d0) / b) - (x / b)
else if (f <= 7.6d-75) 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 <= -1.15e-38) {
tmp = (-1.0 / B) - (x / B);
} else if (F <= 7.6e-75) {
tmp = -x / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -1.15e-38: tmp = (-1.0 / B) - (x / B) elif F <= 7.6e-75: tmp = -x / B else: tmp = (1.0 - x) / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= -1.15e-38) tmp = Float64(Float64(-1.0 / B) - Float64(x / B)); elseif (F <= 7.6e-75) 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 <= -1.15e-38) tmp = (-1.0 / B) - (x / B); elseif (F <= 7.6e-75) tmp = -x / B; else tmp = (1.0 - x) / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -1.15e-38], N[(N[(-1.0 / B), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 7.6e-75], N[((-x) / B), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.15 \cdot 10^{-38}:\\
\;\;\;\;\frac{-1}{B} - \frac{x}{B}\\
\mathbf{elif}\;F \leq 7.6 \cdot 10^{-75}:\\
\;\;\;\;\frac{-x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < -1.15000000000000001e-38Initial program 56.4%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites41.0%
Taylor expanded in F around -inf
Applied rewrites57.2%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lift-/.f6457.2
Applied rewrites57.2%
if -1.15000000000000001e-38 < F < 7.59999999999999987e-75Initial program 99.4%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites56.2%
Taylor expanded in F around 0
lower-*.f6442.5
Applied rewrites42.5%
if 7.59999999999999987e-75 < F Initial program 61.6%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites43.9%
Taylor expanded in F around inf
Applied rewrites51.7%
Final simplification50.0%
(FPCore (F B x) :precision binary64 (if (<= F -1.15e-38) (/ (- -1.0 x) B) (if (<= F 7.6e-75) (/ (- x) B) (/ (- 1.0 x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1.15e-38) {
tmp = (-1.0 - x) / B;
} else if (F <= 7.6e-75) {
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 <= (-1.15d-38)) then
tmp = ((-1.0d0) - x) / b
else if (f <= 7.6d-75) 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 <= -1.15e-38) {
tmp = (-1.0 - x) / B;
} else if (F <= 7.6e-75) {
tmp = -x / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -1.15e-38: tmp = (-1.0 - x) / B elif F <= 7.6e-75: tmp = -x / B else: tmp = (1.0 - x) / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= -1.15e-38) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 7.6e-75) 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 <= -1.15e-38) tmp = (-1.0 - x) / B; elseif (F <= 7.6e-75) tmp = -x / B; else tmp = (1.0 - x) / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -1.15e-38], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 7.6e-75], N[((-x) / B), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.15 \cdot 10^{-38}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 7.6 \cdot 10^{-75}:\\
\;\;\;\;\frac{-x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < -1.15000000000000001e-38Initial program 56.4%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites41.0%
Taylor expanded in F around -inf
Applied rewrites57.2%
if -1.15000000000000001e-38 < F < 7.59999999999999987e-75Initial program 99.4%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites56.2%
Taylor expanded in F around 0
lower-*.f6442.5
Applied rewrites42.5%
if 7.59999999999999987e-75 < F Initial program 61.6%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites43.9%
Taylor expanded in F around inf
Applied rewrites51.7%
Final simplification50.0%
(FPCore (F B x) :precision binary64 (if (<= F 8.5e-292) (/ (- -1.0 x) B) (/ (- 1.0 x) B)))
double code(double F, double B, double x) {
double tmp;
if (F <= 8.5e-292) {
tmp = (-1.0 - 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 <= 8.5d-292) then
tmp = ((-1.0d0) - 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 <= 8.5e-292) {
tmp = (-1.0 - x) / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= 8.5e-292: tmp = (-1.0 - x) / B else: tmp = (1.0 - x) / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= 8.5e-292) tmp = Float64(Float64(-1.0 - 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 <= 8.5e-292) tmp = (-1.0 - x) / B; else tmp = (1.0 - x) / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, 8.5e-292], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq 8.5 \cdot 10^{-292}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < 8.50000000000000066e-292Initial program 73.6%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites50.1%
Taylor expanded in F around -inf
Applied rewrites46.6%
if 8.50000000000000066e-292 < F Initial program 74.3%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites44.6%
Taylor expanded in F around inf
Applied rewrites40.4%
Final simplification43.7%
(FPCore (F B x) :precision binary64 (/ (- -1.0 x) B))
double code(double F, double B, double x) {
return (-1.0 - 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 = ((-1.0d0) - x) / b
end function
public static double code(double F, double B, double x) {
return (-1.0 - x) / B;
}
def code(F, B, x): return (-1.0 - x) / B
function code(F, B, x) return Float64(Float64(-1.0 - x) / B) end
function tmp = code(F, B, x) tmp = (-1.0 - x) / B; end
code[F_, B_, x_] := N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision]
\begin{array}{l}
\\
\frac{-1 - x}{B}
\end{array}
Initial program 74.0%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites47.5%
Taylor expanded in F around -inf
Applied rewrites35.0%
Final simplification35.0%
herbie shell --seed 2025051
(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))))))