
(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 -4.3e+40)
(+ t_0 (/ -1.0 (sin B)))
(if (<= F 2.6e-18)
(+
t_0
(* (/ F (sin B)) (pow (+ (+ (* F F) 2.0) (* 2.0 x)) (/ -1.0 2.0))))
(+ (* x (/ -1.0 (tan B))) (/ 1.0 (sin B)))))))
double code(double F, double B, double x) {
double t_0 = -x / tan(B);
double tmp;
if (F <= -4.3e+40) {
tmp = t_0 + (-1.0 / sin(B));
} else if (F <= 2.6e-18) {
tmp = t_0 + ((F / sin(B)) * pow((((F * F) + 2.0) + (2.0 * x)), (-1.0 / 2.0)));
} else {
tmp = (x * (-1.0 / tan(B))) + (1.0 / sin(B));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: tmp
t_0 = -x / tan(b)
if (f <= (-4.3d+40)) then
tmp = t_0 + ((-1.0d0) / sin(b))
else if (f <= 2.6d-18) then
tmp = t_0 + ((f / sin(b)) * ((((f * f) + 2.0d0) + (2.0d0 * x)) ** ((-1.0d0) / 2.0d0)))
else
tmp = (x * ((-1.0d0) / tan(b))) + (1.0d0 / sin(b))
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double t_0 = -x / Math.tan(B);
double tmp;
if (F <= -4.3e+40) {
tmp = t_0 + (-1.0 / Math.sin(B));
} else if (F <= 2.6e-18) {
tmp = t_0 + ((F / Math.sin(B)) * Math.pow((((F * F) + 2.0) + (2.0 * x)), (-1.0 / 2.0)));
} else {
tmp = (x * (-1.0 / Math.tan(B))) + (1.0 / Math.sin(B));
}
return tmp;
}
def code(F, B, x): t_0 = -x / math.tan(B) tmp = 0 if F <= -4.3e+40: tmp = t_0 + (-1.0 / math.sin(B)) elif F <= 2.6e-18: tmp = t_0 + ((F / math.sin(B)) * math.pow((((F * F) + 2.0) + (2.0 * x)), (-1.0 / 2.0))) else: tmp = (x * (-1.0 / math.tan(B))) + (1.0 / math.sin(B)) return tmp
function code(F, B, x) t_0 = Float64(Float64(-x) / tan(B)) tmp = 0.0 if (F <= -4.3e+40) tmp = Float64(t_0 + Float64(-1.0 / sin(B))); elseif (F <= 2.6e-18) tmp = Float64(t_0 + Float64(Float64(F / sin(B)) * (Float64(Float64(Float64(F * F) + 2.0) + Float64(2.0 * x)) ^ Float64(-1.0 / 2.0)))); else tmp = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64(1.0 / sin(B))); end return tmp end
function tmp_2 = code(F, B, x) t_0 = -x / tan(B); tmp = 0.0; if (F <= -4.3e+40) tmp = t_0 + (-1.0 / sin(B)); elseif (F <= 2.6e-18) tmp = t_0 + ((F / sin(B)) * ((((F * F) + 2.0) + (2.0 * x)) ^ (-1.0 / 2.0))); else tmp = (x * (-1.0 / tan(B))) + (1.0 / sin(B)); end tmp_2 = tmp; end
code[F_, B_, x_] := Block[{t$95$0 = N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -4.3e+40], N[(t$95$0 + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 2.6e-18], N[(t$95$0 + 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], N[(N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-x}{\tan B}\\
\mathbf{if}\;F \leq -4.3 \cdot 10^{+40}:\\
\;\;\;\;t\_0 + \frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 2.6 \cdot 10^{-18}:\\
\;\;\;\;t\_0 + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(\frac{-1}{2}\right)}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{1}{\sin B}\\
\end{array}
\end{array}
if F < -4.3000000000000002e40Initial program 46.2%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6446.2
Applied rewrites46.2%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6499.9
Applied rewrites99.9%
if -4.3000000000000002e40 < F < 2.6e-18Initial program 99.5%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6499.7
Applied rewrites99.7%
if 2.6e-18 < F Initial program 56.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 rewrites71.4%
Taylor expanded in F around inf
Applied rewrites99.8%
Final simplification99.8%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (* x (/ -1.0 (tan B)))))
(if (<= F -4.3e+40)
(+ (/ (- x) (tan B)) (/ -1.0 (sin B)))
(if (<= F 2.6e-18)
(+ t_0 (* (/ 1.0 (sqrt (+ (+ (* 2.0 x) 2.0) (* F F)))) (/ F (sin B))))
(+ t_0 (/ 1.0 (sin B)))))))
double code(double F, double B, double x) {
double t_0 = x * (-1.0 / tan(B));
double tmp;
if (F <= -4.3e+40) {
tmp = (-x / tan(B)) + (-1.0 / sin(B));
} else if (F <= 2.6e-18) {
tmp = t_0 + ((1.0 / sqrt((((2.0 * x) + 2.0) + (F * F)))) * (F / sin(B)));
} else {
tmp = t_0 + (1.0 / sin(B));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: tmp
t_0 = x * ((-1.0d0) / tan(b))
if (f <= (-4.3d+40)) then
tmp = (-x / tan(b)) + ((-1.0d0) / sin(b))
else if (f <= 2.6d-18) then
tmp = t_0 + ((1.0d0 / sqrt((((2.0d0 * x) + 2.0d0) + (f * f)))) * (f / sin(b)))
else
tmp = t_0 + (1.0d0 / sin(b))
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double t_0 = x * (-1.0 / Math.tan(B));
double tmp;
if (F <= -4.3e+40) {
tmp = (-x / Math.tan(B)) + (-1.0 / Math.sin(B));
} else if (F <= 2.6e-18) {
tmp = t_0 + ((1.0 / Math.sqrt((((2.0 * x) + 2.0) + (F * F)))) * (F / Math.sin(B)));
} else {
tmp = t_0 + (1.0 / Math.sin(B));
}
return tmp;
}
def code(F, B, x): t_0 = x * (-1.0 / math.tan(B)) tmp = 0 if F <= -4.3e+40: tmp = (-x / math.tan(B)) + (-1.0 / math.sin(B)) elif F <= 2.6e-18: tmp = t_0 + ((1.0 / math.sqrt((((2.0 * x) + 2.0) + (F * F)))) * (F / math.sin(B))) else: tmp = t_0 + (1.0 / math.sin(B)) return tmp
function code(F, B, x) t_0 = Float64(x * Float64(-1.0 / tan(B))) tmp = 0.0 if (F <= -4.3e+40) tmp = Float64(Float64(Float64(-x) / tan(B)) + Float64(-1.0 / sin(B))); elseif (F <= 2.6e-18) tmp = Float64(t_0 + Float64(Float64(1.0 / sqrt(Float64(Float64(Float64(2.0 * x) + 2.0) + Float64(F * F)))) * Float64(F / sin(B)))); else tmp = Float64(t_0 + Float64(1.0 / sin(B))); end return tmp end
function tmp_2 = code(F, B, x) t_0 = x * (-1.0 / tan(B)); tmp = 0.0; if (F <= -4.3e+40) tmp = (-x / tan(B)) + (-1.0 / sin(B)); elseif (F <= 2.6e-18) tmp = t_0 + ((1.0 / sqrt((((2.0 * x) + 2.0) + (F * F)))) * (F / sin(B))); else tmp = t_0 + (1.0 / sin(B)); end tmp_2 = tmp; end
code[F_, B_, x_] := Block[{t$95$0 = N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -4.3e+40], N[(N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision] + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 2.6e-18], N[(t$95$0 + N[(N[(1.0 / N[Sqrt[N[(N[(N[(2.0 * x), $MachinePrecision] + 2.0), $MachinePrecision] + N[(F * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \frac{-1}{\tan B}\\
\mathbf{if}\;F \leq -4.3 \cdot 10^{+40}:\\
\;\;\;\;\frac{-x}{\tan B} + \frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 2.6 \cdot 10^{-18}:\\
\;\;\;\;t\_0 + \frac{1}{\sqrt{\left(2 \cdot x + 2\right) + F \cdot F}} \cdot \frac{F}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \frac{1}{\sin B}\\
\end{array}
\end{array}
if F < -4.3000000000000002e40Initial program 46.2%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6446.2
Applied rewrites46.2%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6499.9
Applied rewrites99.9%
if -4.3000000000000002e40 < F < 2.6e-18Initial program 99.5%
Taylor expanded in B around inf
*-commutativeN/A
lower-*.f64N/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
associate-+r+N/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-/.f6499.5
Applied rewrites99.5%
if 2.6e-18 < F Initial program 56.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 rewrites71.4%
Taylor expanded in F around inf
Applied rewrites99.8%
Final simplification99.7%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ (- x) (tan B))))
(if (<= F -3.3e+44)
(+ t_0 (/ -1.0 (sin B)))
(if (<= F 2.6e-18)
(+ t_0 (/ (/ F (sin B)) (sqrt (- (+ (* F F) 2.0) (* -2.0 x)))))
(+ (* x (/ -1.0 (tan B))) (/ 1.0 (sin B)))))))
double code(double F, double B, double x) {
double t_0 = -x / tan(B);
double tmp;
if (F <= -3.3e+44) {
tmp = t_0 + (-1.0 / sin(B));
} else if (F <= 2.6e-18) {
tmp = t_0 + ((F / sin(B)) / sqrt((((F * F) + 2.0) - (-2.0 * x))));
} else {
tmp = (x * (-1.0 / tan(B))) + (1.0 / sin(B));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: tmp
t_0 = -x / tan(b)
if (f <= (-3.3d+44)) then
tmp = t_0 + ((-1.0d0) / sin(b))
else if (f <= 2.6d-18) then
tmp = t_0 + ((f / sin(b)) / sqrt((((f * f) + 2.0d0) - ((-2.0d0) * x))))
else
tmp = (x * ((-1.0d0) / tan(b))) + (1.0d0 / sin(b))
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double t_0 = -x / Math.tan(B);
double tmp;
if (F <= -3.3e+44) {
tmp = t_0 + (-1.0 / Math.sin(B));
} else if (F <= 2.6e-18) {
tmp = t_0 + ((F / Math.sin(B)) / Math.sqrt((((F * F) + 2.0) - (-2.0 * x))));
} else {
tmp = (x * (-1.0 / Math.tan(B))) + (1.0 / Math.sin(B));
}
return tmp;
}
def code(F, B, x): t_0 = -x / math.tan(B) tmp = 0 if F <= -3.3e+44: tmp = t_0 + (-1.0 / math.sin(B)) elif F <= 2.6e-18: tmp = t_0 + ((F / math.sin(B)) / math.sqrt((((F * F) + 2.0) - (-2.0 * x)))) else: tmp = (x * (-1.0 / math.tan(B))) + (1.0 / math.sin(B)) return tmp
function code(F, B, x) t_0 = Float64(Float64(-x) / tan(B)) tmp = 0.0 if (F <= -3.3e+44) tmp = Float64(t_0 + Float64(-1.0 / sin(B))); elseif (F <= 2.6e-18) tmp = Float64(t_0 + Float64(Float64(F / sin(B)) / sqrt(Float64(Float64(Float64(F * F) + 2.0) - Float64(-2.0 * x))))); else tmp = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64(1.0 / sin(B))); end return tmp end
function tmp_2 = code(F, B, x) t_0 = -x / tan(B); tmp = 0.0; if (F <= -3.3e+44) tmp = t_0 + (-1.0 / sin(B)); elseif (F <= 2.6e-18) tmp = t_0 + ((F / sin(B)) / sqrt((((F * F) + 2.0) - (-2.0 * x)))); else tmp = (x * (-1.0 / tan(B))) + (1.0 / sin(B)); end tmp_2 = tmp; end
code[F_, B_, x_] := Block[{t$95$0 = N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -3.3e+44], N[(t$95$0 + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 2.6e-18], N[(t$95$0 + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(N[(N[(F * F), $MachinePrecision] + 2.0), $MachinePrecision] - N[(-2.0 * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-x}{\tan B}\\
\mathbf{if}\;F \leq -3.3 \cdot 10^{+44}:\\
\;\;\;\;t\_0 + \frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 2.6 \cdot 10^{-18}:\\
\;\;\;\;t\_0 + \frac{\frac{F}{\sin B}}{\sqrt{\left(F \cdot F + 2\right) - -2 \cdot x}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{1}{\sin B}\\
\end{array}
\end{array}
if F < -3.30000000000000013e44Initial program 44.0%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6444.0
Applied rewrites44.0%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6499.8
Applied rewrites99.8%
if -3.30000000000000013e44 < F < 2.6e-18Initial program 99.5%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6499.7
Applied rewrites99.7%
Taylor expanded in B around inf
sqrt-divN/A
metadata-evalN/A
associate-+r+N/A
+-commutativeN/A
pow2N/A
+-commutativeN/A
pow2N/A
associate-+r+N/A
pow2N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites99.7%
if 2.6e-18 < F Initial program 56.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 rewrites71.4%
Taylor expanded in F around inf
Applied rewrites99.8%
Final simplification99.7%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ (- x) (tan B))))
(if (<= F -80000000000000.0)
(+ t_0 (/ -1.0 (sin B)))
(if (<= F 5e-22)
(+ t_0 (* (pow (sqrt (- (+ (* F F) 2.0) (* -2.0 x))) -1.0) (/ F B)))
(+ (* x (/ -1.0 (tan B))) (/ 1.0 (sin B)))))))
double code(double F, double B, double x) {
double t_0 = -x / tan(B);
double tmp;
if (F <= -80000000000000.0) {
tmp = t_0 + (-1.0 / sin(B));
} else if (F <= 5e-22) {
tmp = t_0 + (pow(sqrt((((F * F) + 2.0) - (-2.0 * x))), -1.0) * (F / B));
} else {
tmp = (x * (-1.0 / tan(B))) + (1.0 / sin(B));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: tmp
t_0 = -x / tan(b)
if (f <= (-80000000000000.0d0)) then
tmp = t_0 + ((-1.0d0) / sin(b))
else if (f <= 5d-22) then
tmp = t_0 + ((sqrt((((f * f) + 2.0d0) - ((-2.0d0) * x))) ** (-1.0d0)) * (f / b))
else
tmp = (x * ((-1.0d0) / tan(b))) + (1.0d0 / sin(b))
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double t_0 = -x / Math.tan(B);
double tmp;
if (F <= -80000000000000.0) {
tmp = t_0 + (-1.0 / Math.sin(B));
} else if (F <= 5e-22) {
tmp = t_0 + (Math.pow(Math.sqrt((((F * F) + 2.0) - (-2.0 * x))), -1.0) * (F / B));
} else {
tmp = (x * (-1.0 / Math.tan(B))) + (1.0 / Math.sin(B));
}
return tmp;
}
def code(F, B, x): t_0 = -x / math.tan(B) tmp = 0 if F <= -80000000000000.0: tmp = t_0 + (-1.0 / math.sin(B)) elif F <= 5e-22: tmp = t_0 + (math.pow(math.sqrt((((F * F) + 2.0) - (-2.0 * x))), -1.0) * (F / B)) else: tmp = (x * (-1.0 / math.tan(B))) + (1.0 / math.sin(B)) return tmp
function code(F, B, x) t_0 = Float64(Float64(-x) / tan(B)) tmp = 0.0 if (F <= -80000000000000.0) tmp = Float64(t_0 + Float64(-1.0 / sin(B))); elseif (F <= 5e-22) tmp = Float64(t_0 + Float64((sqrt(Float64(Float64(Float64(F * F) + 2.0) - Float64(-2.0 * x))) ^ -1.0) * Float64(F / B))); else tmp = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64(1.0 / sin(B))); end return tmp end
function tmp_2 = code(F, B, x) t_0 = -x / tan(B); tmp = 0.0; if (F <= -80000000000000.0) tmp = t_0 + (-1.0 / sin(B)); elseif (F <= 5e-22) tmp = t_0 + ((sqrt((((F * F) + 2.0) - (-2.0 * x))) ^ -1.0) * (F / B)); else tmp = (x * (-1.0 / tan(B))) + (1.0 / sin(B)); end tmp_2 = tmp; end
code[F_, B_, x_] := Block[{t$95$0 = N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -80000000000000.0], N[(t$95$0 + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 5e-22], N[(t$95$0 + N[(N[Power[N[Sqrt[N[(N[(N[(F * F), $MachinePrecision] + 2.0), $MachinePrecision] - N[(-2.0 * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], -1.0], $MachinePrecision] * N[(F / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-x}{\tan B}\\
\mathbf{if}\;F \leq -80000000000000:\\
\;\;\;\;t\_0 + \frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 5 \cdot 10^{-22}:\\
\;\;\;\;t\_0 + {\left(\sqrt{\left(F \cdot F + 2\right) - -2 \cdot x}\right)}^{-1} \cdot \frac{F}{B}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{1}{\sin B}\\
\end{array}
\end{array}
if F < -8e13Initial program 51.9%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6451.9
Applied rewrites51.9%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6499.8
Applied rewrites99.8%
if -8e13 < F < 4.99999999999999954e-22Initial program 99.5%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6499.7
Applied rewrites99.7%
Taylor expanded in B around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites84.4%
if 4.99999999999999954e-22 < F Initial program 56.7%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites71.8%
Taylor expanded in F around inf
Applied rewrites98.4%
Final simplification93.1%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (* x (/ -1.0 (tan B)))))
(if (<= F -80000000000000.0)
(+ (/ (- x) (tan B)) (/ -1.0 (sin B)))
(if (<= F 5e-22)
(+ t_0 (* (/ F B) (/ 1.0 (sqrt (+ (+ (* 2.0 x) 2.0) (* F F))))))
(+ t_0 (/ 1.0 (sin B)))))))
double code(double F, double B, double x) {
double t_0 = x * (-1.0 / tan(B));
double tmp;
if (F <= -80000000000000.0) {
tmp = (-x / tan(B)) + (-1.0 / sin(B));
} else if (F <= 5e-22) {
tmp = t_0 + ((F / B) * (1.0 / sqrt((((2.0 * x) + 2.0) + (F * F)))));
} else {
tmp = t_0 + (1.0 / sin(B));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: tmp
t_0 = x * ((-1.0d0) / tan(b))
if (f <= (-80000000000000.0d0)) then
tmp = (-x / tan(b)) + ((-1.0d0) / sin(b))
else if (f <= 5d-22) then
tmp = t_0 + ((f / b) * (1.0d0 / sqrt((((2.0d0 * x) + 2.0d0) + (f * f)))))
else
tmp = t_0 + (1.0d0 / sin(b))
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double t_0 = x * (-1.0 / Math.tan(B));
double tmp;
if (F <= -80000000000000.0) {
tmp = (-x / Math.tan(B)) + (-1.0 / Math.sin(B));
} else if (F <= 5e-22) {
tmp = t_0 + ((F / B) * (1.0 / Math.sqrt((((2.0 * x) + 2.0) + (F * F)))));
} else {
tmp = t_0 + (1.0 / Math.sin(B));
}
return tmp;
}
def code(F, B, x): t_0 = x * (-1.0 / math.tan(B)) tmp = 0 if F <= -80000000000000.0: tmp = (-x / math.tan(B)) + (-1.0 / math.sin(B)) elif F <= 5e-22: tmp = t_0 + ((F / B) * (1.0 / math.sqrt((((2.0 * x) + 2.0) + (F * F))))) else: tmp = t_0 + (1.0 / math.sin(B)) return tmp
function code(F, B, x) t_0 = Float64(x * Float64(-1.0 / tan(B))) tmp = 0.0 if (F <= -80000000000000.0) tmp = Float64(Float64(Float64(-x) / tan(B)) + Float64(-1.0 / sin(B))); elseif (F <= 5e-22) tmp = Float64(t_0 + Float64(Float64(F / B) * Float64(1.0 / sqrt(Float64(Float64(Float64(2.0 * x) + 2.0) + Float64(F * F)))))); else tmp = Float64(t_0 + Float64(1.0 / sin(B))); end return tmp end
function tmp_2 = code(F, B, x) t_0 = x * (-1.0 / tan(B)); tmp = 0.0; if (F <= -80000000000000.0) tmp = (-x / tan(B)) + (-1.0 / sin(B)); elseif (F <= 5e-22) tmp = t_0 + ((F / B) * (1.0 / sqrt((((2.0 * x) + 2.0) + (F * F))))); else tmp = t_0 + (1.0 / sin(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[F, -80000000000000.0], N[(N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision] + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 5e-22], N[(t$95$0 + N[(N[(F / B), $MachinePrecision] * N[(1.0 / N[Sqrt[N[(N[(N[(2.0 * x), $MachinePrecision] + 2.0), $MachinePrecision] + N[(F * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \frac{-1}{\tan B}\\
\mathbf{if}\;F \leq -80000000000000:\\
\;\;\;\;\frac{-x}{\tan B} + \frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 5 \cdot 10^{-22}:\\
\;\;\;\;t\_0 + \frac{F}{B} \cdot \frac{1}{\sqrt{\left(2 \cdot x + 2\right) + F \cdot F}}\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \frac{1}{\sin B}\\
\end{array}
\end{array}
if F < -8e13Initial program 51.9%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6451.9
Applied rewrites51.9%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6499.8
Applied rewrites99.8%
if -8e13 < F < 4.99999999999999954e-22Initial program 99.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
associate-+r+N/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f6484.3
Applied rewrites84.3%
if 4.99999999999999954e-22 < F Initial program 56.7%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites71.8%
Taylor expanded in F around inf
Applied rewrites98.4%
Final simplification93.0%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (* x (/ -1.0 (tan B)))))
(if (<= F -80000000000000.0)
(+ t_0 (/ -1.0 (sin B)))
(if (<= F 5e-22)
(+ t_0 (* (/ F B) (/ 1.0 (sqrt (+ (+ (* 2.0 x) 2.0) (* F F))))))
(+ t_0 (/ 1.0 (sin B)))))))
double code(double F, double B, double x) {
double t_0 = x * (-1.0 / tan(B));
double tmp;
if (F <= -80000000000000.0) {
tmp = t_0 + (-1.0 / sin(B));
} else if (F <= 5e-22) {
tmp = t_0 + ((F / B) * (1.0 / sqrt((((2.0 * x) + 2.0) + (F * F)))));
} else {
tmp = t_0 + (1.0 / sin(B));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: tmp
t_0 = x * ((-1.0d0) / tan(b))
if (f <= (-80000000000000.0d0)) then
tmp = t_0 + ((-1.0d0) / sin(b))
else if (f <= 5d-22) then
tmp = t_0 + ((f / b) * (1.0d0 / sqrt((((2.0d0 * x) + 2.0d0) + (f * f)))))
else
tmp = t_0 + (1.0d0 / sin(b))
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double t_0 = x * (-1.0 / Math.tan(B));
double tmp;
if (F <= -80000000000000.0) {
tmp = t_0 + (-1.0 / Math.sin(B));
} else if (F <= 5e-22) {
tmp = t_0 + ((F / B) * (1.0 / Math.sqrt((((2.0 * x) + 2.0) + (F * F)))));
} else {
tmp = t_0 + (1.0 / Math.sin(B));
}
return tmp;
}
def code(F, B, x): t_0 = x * (-1.0 / math.tan(B)) tmp = 0 if F <= -80000000000000.0: tmp = t_0 + (-1.0 / math.sin(B)) elif F <= 5e-22: tmp = t_0 + ((F / B) * (1.0 / math.sqrt((((2.0 * x) + 2.0) + (F * F))))) else: tmp = t_0 + (1.0 / math.sin(B)) return tmp
function code(F, B, x) t_0 = Float64(x * Float64(-1.0 / tan(B))) tmp = 0.0 if (F <= -80000000000000.0) tmp = Float64(t_0 + Float64(-1.0 / sin(B))); elseif (F <= 5e-22) tmp = Float64(t_0 + Float64(Float64(F / B) * Float64(1.0 / sqrt(Float64(Float64(Float64(2.0 * x) + 2.0) + Float64(F * F)))))); else tmp = Float64(t_0 + Float64(1.0 / sin(B))); end return tmp end
function tmp_2 = code(F, B, x) t_0 = x * (-1.0 / tan(B)); tmp = 0.0; if (F <= -80000000000000.0) tmp = t_0 + (-1.0 / sin(B)); elseif (F <= 5e-22) tmp = t_0 + ((F / B) * (1.0 / sqrt((((2.0 * x) + 2.0) + (F * F))))); else tmp = t_0 + (1.0 / sin(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[F, -80000000000000.0], N[(t$95$0 + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 5e-22], N[(t$95$0 + N[(N[(F / B), $MachinePrecision] * N[(1.0 / N[Sqrt[N[(N[(N[(2.0 * x), $MachinePrecision] + 2.0), $MachinePrecision] + N[(F * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \frac{-1}{\tan B}\\
\mathbf{if}\;F \leq -80000000000000:\\
\;\;\;\;t\_0 + \frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 5 \cdot 10^{-22}:\\
\;\;\;\;t\_0 + \frac{F}{B} \cdot \frac{1}{\sqrt{\left(2 \cdot x + 2\right) + F \cdot F}}\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \frac{1}{\sin B}\\
\end{array}
\end{array}
if F < -8e13Initial program 51.9%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6499.8
Applied rewrites99.8%
if -8e13 < F < 4.99999999999999954e-22Initial program 99.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
associate-+r+N/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f6484.3
Applied rewrites84.3%
if 4.99999999999999954e-22 < F Initial program 56.7%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites71.8%
Taylor expanded in F around inf
Applied rewrites98.4%
Final simplification93.0%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (* x (/ -1.0 (tan B)))))
(if (<= F -80000000000000.0)
(+ t_0 (/ -1.0 (sin B)))
(if (<= F 5e-22)
(+ t_0 (* (/ F B) (/ 1.0 (sqrt (+ (+ (* 2.0 x) 2.0) (* F F))))))
(/ (- 1.0 (* (cos B) x)) (sin B))))))
double code(double F, double B, double x) {
double t_0 = x * (-1.0 / tan(B));
double tmp;
if (F <= -80000000000000.0) {
tmp = t_0 + (-1.0 / sin(B));
} else if (F <= 5e-22) {
tmp = t_0 + ((F / B) * (1.0 / sqrt((((2.0 * x) + 2.0) + (F * F)))));
} else {
tmp = (1.0 - (cos(B) * x)) / sin(B);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: tmp
t_0 = x * ((-1.0d0) / tan(b))
if (f <= (-80000000000000.0d0)) then
tmp = t_0 + ((-1.0d0) / sin(b))
else if (f <= 5d-22) then
tmp = t_0 + ((f / b) * (1.0d0 / sqrt((((2.0d0 * x) + 2.0d0) + (f * f)))))
else
tmp = (1.0d0 - (cos(b) * x)) / sin(b)
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double t_0 = x * (-1.0 / Math.tan(B));
double tmp;
if (F <= -80000000000000.0) {
tmp = t_0 + (-1.0 / Math.sin(B));
} else if (F <= 5e-22) {
tmp = t_0 + ((F / B) * (1.0 / Math.sqrt((((2.0 * x) + 2.0) + (F * F)))));
} else {
tmp = (1.0 - (Math.cos(B) * x)) / Math.sin(B);
}
return tmp;
}
def code(F, B, x): t_0 = x * (-1.0 / math.tan(B)) tmp = 0 if F <= -80000000000000.0: tmp = t_0 + (-1.0 / math.sin(B)) elif F <= 5e-22: tmp = t_0 + ((F / B) * (1.0 / math.sqrt((((2.0 * x) + 2.0) + (F * F))))) else: tmp = (1.0 - (math.cos(B) * x)) / math.sin(B) return tmp
function code(F, B, x) t_0 = Float64(x * Float64(-1.0 / tan(B))) tmp = 0.0 if (F <= -80000000000000.0) tmp = Float64(t_0 + Float64(-1.0 / sin(B))); elseif (F <= 5e-22) tmp = Float64(t_0 + Float64(Float64(F / B) * Float64(1.0 / sqrt(Float64(Float64(Float64(2.0 * x) + 2.0) + Float64(F * F)))))); else tmp = Float64(Float64(1.0 - Float64(cos(B) * x)) / sin(B)); end return tmp end
function tmp_2 = code(F, B, x) t_0 = x * (-1.0 / tan(B)); tmp = 0.0; if (F <= -80000000000000.0) tmp = t_0 + (-1.0 / sin(B)); elseif (F <= 5e-22) tmp = t_0 + ((F / B) * (1.0 / sqrt((((2.0 * x) + 2.0) + (F * F))))); else tmp = (1.0 - (cos(B) * x)) / sin(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[F, -80000000000000.0], N[(t$95$0 + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 5e-22], N[(t$95$0 + N[(N[(F / B), $MachinePrecision] * N[(1.0 / N[Sqrt[N[(N[(N[(2.0 * x), $MachinePrecision] + 2.0), $MachinePrecision] + N[(F * F), $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}
t_0 := x \cdot \frac{-1}{\tan B}\\
\mathbf{if}\;F \leq -80000000000000:\\
\;\;\;\;t\_0 + \frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 5 \cdot 10^{-22}:\\
\;\;\;\;t\_0 + \frac{F}{B} \cdot \frac{1}{\sqrt{\left(2 \cdot x + 2\right) + F \cdot F}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - \cos B \cdot x}{\sin B}\\
\end{array}
\end{array}
if F < -8e13Initial program 51.9%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6499.8
Applied rewrites99.8%
if -8e13 < F < 4.99999999999999954e-22Initial program 99.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
associate-+r+N/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f6484.3
Applied rewrites84.3%
if 4.99999999999999954e-22 < F Initial program 56.7%
Taylor expanded in F around inf
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6498.3
Applied rewrites98.3%
Final simplification93.0%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (* (cos B) x)))
(if (<= F -80000000000000.0)
(/ (- -1.0 t_0) (sin B))
(if (<= F 5e-22)
(+
(* x (/ -1.0 (tan B)))
(* (/ F B) (/ 1.0 (sqrt (+ (+ (* 2.0 x) 2.0) (* 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 <= -80000000000000.0) {
tmp = (-1.0 - t_0) / sin(B);
} else if (F <= 5e-22) {
tmp = (x * (-1.0 / tan(B))) + ((F / B) * (1.0 / sqrt((((2.0 * x) + 2.0) + (F * F)))));
} else {
tmp = (1.0 - t_0) / sin(B);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: tmp
t_0 = cos(b) * x
if (f <= (-80000000000000.0d0)) then
tmp = ((-1.0d0) - t_0) / sin(b)
else if (f <= 5d-22) then
tmp = (x * ((-1.0d0) / tan(b))) + ((f / b) * (1.0d0 / sqrt((((2.0d0 * x) + 2.0d0) + (f * f)))))
else
tmp = (1.0d0 - t_0) / sin(b)
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double t_0 = Math.cos(B) * x;
double tmp;
if (F <= -80000000000000.0) {
tmp = (-1.0 - t_0) / Math.sin(B);
} else if (F <= 5e-22) {
tmp = (x * (-1.0 / Math.tan(B))) + ((F / B) * (1.0 / Math.sqrt((((2.0 * x) + 2.0) + (F * F)))));
} else {
tmp = (1.0 - t_0) / Math.sin(B);
}
return tmp;
}
def code(F, B, x): t_0 = math.cos(B) * x tmp = 0 if F <= -80000000000000.0: tmp = (-1.0 - t_0) / math.sin(B) elif F <= 5e-22: tmp = (x * (-1.0 / math.tan(B))) + ((F / B) * (1.0 / math.sqrt((((2.0 * x) + 2.0) + (F * F))))) else: tmp = (1.0 - t_0) / math.sin(B) return tmp
function code(F, B, x) t_0 = Float64(cos(B) * x) tmp = 0.0 if (F <= -80000000000000.0) tmp = Float64(Float64(-1.0 - t_0) / sin(B)); elseif (F <= 5e-22) tmp = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64(Float64(F / B) * Float64(1.0 / sqrt(Float64(Float64(Float64(2.0 * x) + 2.0) + Float64(F * F)))))); else tmp = Float64(Float64(1.0 - t_0) / sin(B)); end return tmp end
function tmp_2 = code(F, B, x) t_0 = cos(B) * x; tmp = 0.0; if (F <= -80000000000000.0) tmp = (-1.0 - t_0) / sin(B); elseif (F <= 5e-22) tmp = (x * (-1.0 / tan(B))) + ((F / B) * (1.0 / sqrt((((2.0 * x) + 2.0) + (F * F))))); else tmp = (1.0 - t_0) / sin(B); end tmp_2 = tmp; end
code[F_, B_, x_] := Block[{t$95$0 = N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[F, -80000000000000.0], N[(N[(-1.0 - t$95$0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 5e-22], N[(N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(F / B), $MachinePrecision] * N[(1.0 / N[Sqrt[N[(N[(N[(2.0 * x), $MachinePrecision] + 2.0), $MachinePrecision] + N[(F * F), $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 -80000000000000:\\
\;\;\;\;\frac{-1 - t\_0}{\sin B}\\
\mathbf{elif}\;F \leq 5 \cdot 10^{-22}:\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{F}{B} \cdot \frac{1}{\sqrt{\left(2 \cdot x + 2\right) + F \cdot F}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - t\_0}{\sin B}\\
\end{array}
\end{array}
if F < -8e13Initial program 51.9%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6499.8
Applied rewrites99.8%
if -8e13 < F < 4.99999999999999954e-22Initial program 99.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
associate-+r+N/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f6484.3
Applied rewrites84.3%
if 4.99999999999999954e-22 < F Initial program 56.7%
Taylor expanded in F around inf
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6498.3
Applied rewrites98.3%
Final simplification93.0%
(FPCore (F B x)
:precision binary64
(if (<= F -80000000000000.0)
(/ (- -1.0 x) (sin B))
(if (<= F 5e-22)
(+
(* x (/ -1.0 (tan B)))
(* (/ F B) (/ 1.0 (sqrt (+ (+ (* 2.0 x) 2.0) (* F F))))))
(/ (- 1.0 (* (cos B) x)) (sin B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -80000000000000.0) {
tmp = (-1.0 - x) / sin(B);
} else if (F <= 5e-22) {
tmp = (x * (-1.0 / tan(B))) + ((F / B) * (1.0 / sqrt((((2.0 * x) + 2.0) + (F * F)))));
} else {
tmp = (1.0 - (cos(B) * x)) / sin(B);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: tmp
if (f <= (-80000000000000.0d0)) then
tmp = ((-1.0d0) - x) / sin(b)
else if (f <= 5d-22) then
tmp = (x * ((-1.0d0) / tan(b))) + ((f / b) * (1.0d0 / sqrt((((2.0d0 * x) + 2.0d0) + (f * f)))))
else
tmp = (1.0d0 - (cos(b) * x)) / sin(b)
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -80000000000000.0) {
tmp = (-1.0 - x) / Math.sin(B);
} else if (F <= 5e-22) {
tmp = (x * (-1.0 / Math.tan(B))) + ((F / B) * (1.0 / Math.sqrt((((2.0 * x) + 2.0) + (F * F)))));
} else {
tmp = (1.0 - (Math.cos(B) * x)) / Math.sin(B);
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -80000000000000.0: tmp = (-1.0 - x) / math.sin(B) elif F <= 5e-22: tmp = (x * (-1.0 / math.tan(B))) + ((F / B) * (1.0 / math.sqrt((((2.0 * x) + 2.0) + (F * F))))) else: tmp = (1.0 - (math.cos(B) * x)) / math.sin(B) return tmp
function code(F, B, x) tmp = 0.0 if (F <= -80000000000000.0) tmp = Float64(Float64(-1.0 - x) / sin(B)); elseif (F <= 5e-22) tmp = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64(Float64(F / B) * Float64(1.0 / sqrt(Float64(Float64(Float64(2.0 * x) + 2.0) + Float64(F * F)))))); else tmp = Float64(Float64(1.0 - Float64(cos(B) * x)) / sin(B)); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -80000000000000.0) tmp = (-1.0 - x) / sin(B); elseif (F <= 5e-22) tmp = (x * (-1.0 / tan(B))) + ((F / B) * (1.0 / sqrt((((2.0 * x) + 2.0) + (F * F))))); else tmp = (1.0 - (cos(B) * x)) / sin(B); end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -80000000000000.0], N[(N[(-1.0 - x), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 5e-22], N[(N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(F / B), $MachinePrecision] * N[(1.0 / N[Sqrt[N[(N[(N[(2.0 * x), $MachinePrecision] + 2.0), $MachinePrecision] + N[(F * F), $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 -80000000000000:\\
\;\;\;\;\frac{-1 - x}{\sin B}\\
\mathbf{elif}\;F \leq 5 \cdot 10^{-22}:\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{F}{B} \cdot \frac{1}{\sqrt{\left(2 \cdot x + 2\right) + F \cdot F}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - \cos B \cdot x}{\sin B}\\
\end{array}
\end{array}
if F < -8e13Initial program 51.9%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6499.8
Applied rewrites99.8%
Taylor expanded in B around 0
Applied rewrites84.7%
if -8e13 < F < 4.99999999999999954e-22Initial program 99.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
associate-+r+N/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f6484.3
Applied rewrites84.3%
if 4.99999999999999954e-22 < F Initial program 56.7%
Taylor expanded in F around inf
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6498.3
Applied rewrites98.3%
Final simplification88.0%
(FPCore (F B x)
:precision binary64
(if (<= F -80000000000000.0)
(/ (- -1.0 x) (sin B))
(if (<= F 1.6e-7)
(+
(* x (/ -1.0 (tan B)))
(* (/ F B) (/ 1.0 (sqrt (+ (+ (* 2.0 x) 2.0) (* F F))))))
(+ (- (/ x B)) (pow (sin B) -1.0)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -80000000000000.0) {
tmp = (-1.0 - x) / sin(B);
} else if (F <= 1.6e-7) {
tmp = (x * (-1.0 / tan(B))) + ((F / B) * (1.0 / sqrt((((2.0 * x) + 2.0) + (F * F)))));
} else {
tmp = -(x / B) + pow(sin(B), -1.0);
}
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 <= (-80000000000000.0d0)) then
tmp = ((-1.0d0) - x) / sin(b)
else if (f <= 1.6d-7) then
tmp = (x * ((-1.0d0) / tan(b))) + ((f / b) * (1.0d0 / sqrt((((2.0d0 * x) + 2.0d0) + (f * f)))))
else
tmp = -(x / b) + (sin(b) ** (-1.0d0))
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -80000000000000.0) {
tmp = (-1.0 - x) / Math.sin(B);
} else if (F <= 1.6e-7) {
tmp = (x * (-1.0 / Math.tan(B))) + ((F / B) * (1.0 / Math.sqrt((((2.0 * x) + 2.0) + (F * F)))));
} else {
tmp = -(x / B) + Math.pow(Math.sin(B), -1.0);
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -80000000000000.0: tmp = (-1.0 - x) / math.sin(B) elif F <= 1.6e-7: tmp = (x * (-1.0 / math.tan(B))) + ((F / B) * (1.0 / math.sqrt((((2.0 * x) + 2.0) + (F * F))))) else: tmp = -(x / B) + math.pow(math.sin(B), -1.0) return tmp
function code(F, B, x) tmp = 0.0 if (F <= -80000000000000.0) tmp = Float64(Float64(-1.0 - x) / sin(B)); elseif (F <= 1.6e-7) tmp = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64(Float64(F / B) * Float64(1.0 / sqrt(Float64(Float64(Float64(2.0 * x) + 2.0) + Float64(F * F)))))); else tmp = Float64(Float64(-Float64(x / B)) + (sin(B) ^ -1.0)); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -80000000000000.0) tmp = (-1.0 - x) / sin(B); elseif (F <= 1.6e-7) tmp = (x * (-1.0 / tan(B))) + ((F / B) * (1.0 / sqrt((((2.0 * x) + 2.0) + (F * F))))); else tmp = -(x / B) + (sin(B) ^ -1.0); end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -80000000000000.0], N[(N[(-1.0 - x), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.6e-7], N[(N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(F / B), $MachinePrecision] * N[(1.0 / N[Sqrt[N[(N[(N[(2.0 * x), $MachinePrecision] + 2.0), $MachinePrecision] + N[(F * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-N[(x / B), $MachinePrecision]) + N[Power[N[Sin[B], $MachinePrecision], -1.0], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -80000000000000:\\
\;\;\;\;\frac{-1 - x}{\sin B}\\
\mathbf{elif}\;F \leq 1.6 \cdot 10^{-7}:\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{F}{B} \cdot \frac{1}{\sqrt{\left(2 \cdot x + 2\right) + F \cdot F}}\\
\mathbf{else}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + {\sin B}^{-1}\\
\end{array}
\end{array}
if F < -8e13Initial program 51.9%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6499.8
Applied rewrites99.8%
Taylor expanded in B around 0
Applied rewrites84.7%
if -8e13 < F < 1.6e-7Initial program 99.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
associate-+r+N/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f6484.0
Applied rewrites84.0%
if 1.6e-7 < F Initial program 53.9%
Taylor expanded in B around 0
lower-/.f6431.1
Applied rewrites31.1%
Taylor expanded in F around inf
inv-powN/A
lower-pow.f64N/A
lift-sin.f6476.7
Applied rewrites76.7%
Final simplification82.4%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (- (/ x B))))
(if (<= F -80000000000000.0)
(/ (- -1.0 x) (sin B))
(if (<= F 7.5e-98)
(+
(* x (/ -1.0 (tan B)))
(* (/ F B) (/ 1.0 (sqrt (+ (+ (* 2.0 x) 2.0) (* F F))))))
(if (<= F 4.5e+222)
(+ t_0 (/ F (* (sin B) (sqrt (- (+ (* F F) 2.0) (* -2.0 x))))))
(+
t_0
(*
(/ F (sin B))
(/ (+ 1.0 (* -0.5 (/ (+ 2.0 (* 2.0 x)) (* F F)))) F))))))))
double code(double F, double B, double x) {
double t_0 = -(x / B);
double tmp;
if (F <= -80000000000000.0) {
tmp = (-1.0 - x) / sin(B);
} else if (F <= 7.5e-98) {
tmp = (x * (-1.0 / tan(B))) + ((F / B) * (1.0 / sqrt((((2.0 * x) + 2.0) + (F * F)))));
} else if (F <= 4.5e+222) {
tmp = t_0 + (F / (sin(B) * sqrt((((F * F) + 2.0) - (-2.0 * x)))));
} else {
tmp = t_0 + ((F / sin(B)) * ((1.0 + (-0.5 * ((2.0 + (2.0 * x)) / (F * F)))) / F));
}
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 / b)
if (f <= (-80000000000000.0d0)) then
tmp = ((-1.0d0) - x) / sin(b)
else if (f <= 7.5d-98) then
tmp = (x * ((-1.0d0) / tan(b))) + ((f / b) * (1.0d0 / sqrt((((2.0d0 * x) + 2.0d0) + (f * f)))))
else if (f <= 4.5d+222) then
tmp = t_0 + (f / (sin(b) * sqrt((((f * f) + 2.0d0) - ((-2.0d0) * x)))))
else
tmp = t_0 + ((f / sin(b)) * ((1.0d0 + ((-0.5d0) * ((2.0d0 + (2.0d0 * x)) / (f * f)))) / f))
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double t_0 = -(x / B);
double tmp;
if (F <= -80000000000000.0) {
tmp = (-1.0 - x) / Math.sin(B);
} else if (F <= 7.5e-98) {
tmp = (x * (-1.0 / Math.tan(B))) + ((F / B) * (1.0 / Math.sqrt((((2.0 * x) + 2.0) + (F * F)))));
} else if (F <= 4.5e+222) {
tmp = t_0 + (F / (Math.sin(B) * Math.sqrt((((F * F) + 2.0) - (-2.0 * x)))));
} else {
tmp = t_0 + ((F / Math.sin(B)) * ((1.0 + (-0.5 * ((2.0 + (2.0 * x)) / (F * F)))) / F));
}
return tmp;
}
def code(F, B, x): t_0 = -(x / B) tmp = 0 if F <= -80000000000000.0: tmp = (-1.0 - x) / math.sin(B) elif F <= 7.5e-98: tmp = (x * (-1.0 / math.tan(B))) + ((F / B) * (1.0 / math.sqrt((((2.0 * x) + 2.0) + (F * F))))) elif F <= 4.5e+222: tmp = t_0 + (F / (math.sin(B) * math.sqrt((((F * F) + 2.0) - (-2.0 * x))))) else: tmp = t_0 + ((F / math.sin(B)) * ((1.0 + (-0.5 * ((2.0 + (2.0 * x)) / (F * F)))) / F)) return tmp
function code(F, B, x) t_0 = Float64(-Float64(x / B)) tmp = 0.0 if (F <= -80000000000000.0) tmp = Float64(Float64(-1.0 - x) / sin(B)); elseif (F <= 7.5e-98) tmp = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64(Float64(F / B) * Float64(1.0 / sqrt(Float64(Float64(Float64(2.0 * x) + 2.0) + Float64(F * F)))))); elseif (F <= 4.5e+222) tmp = Float64(t_0 + Float64(F / Float64(sin(B) * sqrt(Float64(Float64(Float64(F * F) + 2.0) - Float64(-2.0 * x)))))); else tmp = Float64(t_0 + Float64(Float64(F / sin(B)) * Float64(Float64(1.0 + Float64(-0.5 * Float64(Float64(2.0 + Float64(2.0 * x)) / Float64(F * F)))) / F))); end return tmp end
function tmp_2 = code(F, B, x) t_0 = -(x / B); tmp = 0.0; if (F <= -80000000000000.0) tmp = (-1.0 - x) / sin(B); elseif (F <= 7.5e-98) tmp = (x * (-1.0 / tan(B))) + ((F / B) * (1.0 / sqrt((((2.0 * x) + 2.0) + (F * F))))); elseif (F <= 4.5e+222) tmp = t_0 + (F / (sin(B) * sqrt((((F * F) + 2.0) - (-2.0 * x))))); else tmp = t_0 + ((F / sin(B)) * ((1.0 + (-0.5 * ((2.0 + (2.0 * x)) / (F * F)))) / F)); end tmp_2 = tmp; end
code[F_, B_, x_] := Block[{t$95$0 = (-N[(x / B), $MachinePrecision])}, If[LessEqual[F, -80000000000000.0], N[(N[(-1.0 - x), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 7.5e-98], N[(N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(F / B), $MachinePrecision] * N[(1.0 / N[Sqrt[N[(N[(N[(2.0 * x), $MachinePrecision] + 2.0), $MachinePrecision] + N[(F * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 4.5e+222], N[(t$95$0 + N[(F / N[(N[Sin[B], $MachinePrecision] * N[Sqrt[N[(N[(N[(F * F), $MachinePrecision] + 2.0), $MachinePrecision] - N[(-2.0 * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[(-0.5 * N[(N[(2.0 + N[(2.0 * x), $MachinePrecision]), $MachinePrecision] / N[(F * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -\frac{x}{B}\\
\mathbf{if}\;F \leq -80000000000000:\\
\;\;\;\;\frac{-1 - x}{\sin B}\\
\mathbf{elif}\;F \leq 7.5 \cdot 10^{-98}:\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{F}{B} \cdot \frac{1}{\sqrt{\left(2 \cdot x + 2\right) + F \cdot F}}\\
\mathbf{elif}\;F \leq 4.5 \cdot 10^{+222}:\\
\;\;\;\;t\_0 + \frac{F}{\sin B \cdot \sqrt{\left(F \cdot F + 2\right) - -2 \cdot x}}\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \frac{F}{\sin B} \cdot \frac{1 + -0.5 \cdot \frac{2 + 2 \cdot x}{F \cdot F}}{F}\\
\end{array}
\end{array}
if F < -8e13Initial program 51.9%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6499.8
Applied rewrites99.8%
Taylor expanded in B around 0
Applied rewrites84.7%
if -8e13 < F < 7.5000000000000006e-98Initial program 99.6%
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
associate-+r+N/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f6485.7
Applied rewrites85.7%
if 7.5000000000000006e-98 < F < 4.49999999999999989e222Initial program 74.9%
Taylor expanded in B around 0
lower-/.f6454.9
Applied rewrites54.9%
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
lower-+.f64N/A
lower-+.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f6454.9
Applied rewrites54.9%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-/.f64N/A
lift-sqrt.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lift-sin.f64N/A
pow2N/A
lower-sqrt.f64N/A
Applied rewrites72.5%
if 4.49999999999999989e222 < F Initial program 27.1%
Taylor expanded in B around 0
lower-/.f642.6
Applied rewrites2.6%
Taylor expanded in F around inf
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f6460.7
Applied rewrites60.7%
Final simplification80.5%
(FPCore (F B x)
:precision binary64
(if (<= F -80000000000000.0)
(/ (- -1.0 x) (sin B))
(if (or (<= F 7.5e-98) (not (<= F 1.5e+196)))
(+
(* x (/ -1.0 (tan B)))
(* (/ F B) (/ 1.0 (sqrt (+ (+ (* 2.0 x) 2.0) (* F F))))))
(+ (- (/ x B)) (/ F (* (sin B) (sqrt (- (+ (* F F) 2.0) (* -2.0 x)))))))))
double code(double F, double B, double x) {
double tmp;
if (F <= -80000000000000.0) {
tmp = (-1.0 - x) / sin(B);
} else if ((F <= 7.5e-98) || !(F <= 1.5e+196)) {
tmp = (x * (-1.0 / tan(B))) + ((F / B) * (1.0 / sqrt((((2.0 * x) + 2.0) + (F * F)))));
} else {
tmp = -(x / B) + (F / (sin(B) * sqrt((((F * F) + 2.0) - (-2.0 * x)))));
}
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 <= (-80000000000000.0d0)) then
tmp = ((-1.0d0) - x) / sin(b)
else if ((f <= 7.5d-98) .or. (.not. (f <= 1.5d+196))) then
tmp = (x * ((-1.0d0) / tan(b))) + ((f / b) * (1.0d0 / sqrt((((2.0d0 * x) + 2.0d0) + (f * f)))))
else
tmp = -(x / b) + (f / (sin(b) * sqrt((((f * f) + 2.0d0) - ((-2.0d0) * x)))))
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -80000000000000.0) {
tmp = (-1.0 - x) / Math.sin(B);
} else if ((F <= 7.5e-98) || !(F <= 1.5e+196)) {
tmp = (x * (-1.0 / Math.tan(B))) + ((F / B) * (1.0 / Math.sqrt((((2.0 * x) + 2.0) + (F * F)))));
} else {
tmp = -(x / B) + (F / (Math.sin(B) * Math.sqrt((((F * F) + 2.0) - (-2.0 * x)))));
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -80000000000000.0: tmp = (-1.0 - x) / math.sin(B) elif (F <= 7.5e-98) or not (F <= 1.5e+196): tmp = (x * (-1.0 / math.tan(B))) + ((F / B) * (1.0 / math.sqrt((((2.0 * x) + 2.0) + (F * F))))) else: tmp = -(x / B) + (F / (math.sin(B) * math.sqrt((((F * F) + 2.0) - (-2.0 * x))))) return tmp
function code(F, B, x) tmp = 0.0 if (F <= -80000000000000.0) tmp = Float64(Float64(-1.0 - x) / sin(B)); elseif ((F <= 7.5e-98) || !(F <= 1.5e+196)) tmp = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64(Float64(F / B) * Float64(1.0 / sqrt(Float64(Float64(Float64(2.0 * x) + 2.0) + Float64(F * F)))))); else tmp = Float64(Float64(-Float64(x / B)) + Float64(F / Float64(sin(B) * sqrt(Float64(Float64(Float64(F * F) + 2.0) - Float64(-2.0 * x)))))); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -80000000000000.0) tmp = (-1.0 - x) / sin(B); elseif ((F <= 7.5e-98) || ~((F <= 1.5e+196))) tmp = (x * (-1.0 / tan(B))) + ((F / B) * (1.0 / sqrt((((2.0 * x) + 2.0) + (F * F))))); else tmp = -(x / B) + (F / (sin(B) * sqrt((((F * F) + 2.0) - (-2.0 * x))))); end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -80000000000000.0], N[(N[(-1.0 - x), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[F, 7.5e-98], N[Not[LessEqual[F, 1.5e+196]], $MachinePrecision]], N[(N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(F / B), $MachinePrecision] * N[(1.0 / N[Sqrt[N[(N[(N[(2.0 * x), $MachinePrecision] + 2.0), $MachinePrecision] + N[(F * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-N[(x / B), $MachinePrecision]) + N[(F / N[(N[Sin[B], $MachinePrecision] * N[Sqrt[N[(N[(N[(F * F), $MachinePrecision] + 2.0), $MachinePrecision] - N[(-2.0 * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -80000000000000:\\
\;\;\;\;\frac{-1 - x}{\sin B}\\
\mathbf{elif}\;F \leq 7.5 \cdot 10^{-98} \lor \neg \left(F \leq 1.5 \cdot 10^{+196}\right):\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{F}{B} \cdot \frac{1}{\sqrt{\left(2 \cdot x + 2\right) + F \cdot F}}\\
\mathbf{else}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{F}{\sin B \cdot \sqrt{\left(F \cdot F + 2\right) - -2 \cdot x}}\\
\end{array}
\end{array}
if F < -8e13Initial program 51.9%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6499.8
Applied rewrites99.8%
Taylor expanded in B around 0
Applied rewrites84.7%
if -8e13 < F < 7.5000000000000006e-98 or 1.4999999999999999e196 < F Initial program 85.1%
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
associate-+r+N/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f6474.2
Applied rewrites74.2%
if 7.5000000000000006e-98 < F < 1.4999999999999999e196Initial program 78.2%
Taylor expanded in B around 0
lower-/.f6461.1
Applied rewrites61.1%
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
lower-+.f64N/A
lower-+.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f6461.2
Applied rewrites61.2%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-/.f64N/A
lift-sqrt.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lift-sin.f64N/A
pow2N/A
lower-sqrt.f64N/A
Applied rewrites78.8%
Final simplification78.5%
(FPCore (F B x)
:precision binary64
(if (<= F -1.9e+35)
(/ (- -1.0 x) (sin B))
(if (<= F 3e+116)
(+ (- (/ x B)) (* (/ F (sin B)) (/ 1.0 (sqrt (+ 2.0 (* F F))))))
(/ (- (+ 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 <= -1.9e+35) {
tmp = (-1.0 - x) / sin(B);
} else if (F <= 3e+116) {
tmp = -(x / B) + ((F / sin(B)) * (1.0 / sqrt((2.0 + (F * F)))));
} 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 <= (-1.9d+35)) then
tmp = ((-1.0d0) - x) / sin(b)
else if (f <= 3d+116) then
tmp = -(x / b) + ((f / sin(b)) * (1.0d0 / sqrt((2.0d0 + (f * f)))))
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 <= -1.9e+35) {
tmp = (-1.0 - x) / Math.sin(B);
} else if (F <= 3e+116) {
tmp = -(x / B) + ((F / Math.sin(B)) * (1.0 / Math.sqrt((2.0 + (F * F)))));
} 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 <= -1.9e+35: tmp = (-1.0 - x) / math.sin(B) elif F <= 3e+116: tmp = -(x / B) + ((F / math.sin(B)) * (1.0 / math.sqrt((2.0 + (F * F))))) 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 <= -1.9e+35) tmp = Float64(Float64(-1.0 - x) / sin(B)); elseif (F <= 3e+116) tmp = Float64(Float64(-Float64(x / B)) + Float64(Float64(F / sin(B)) * Float64(1.0 / sqrt(Float64(2.0 + Float64(F * F)))))); 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 <= -1.9e+35) tmp = (-1.0 - x) / sin(B); elseif (F <= 3e+116) tmp = -(x / B) + ((F / sin(B)) * (1.0 / sqrt((2.0 + (F * F))))); 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, -1.9e+35], N[(N[(-1.0 - x), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 3e+116], 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[(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 -1.9 \cdot 10^{+35}:\\
\;\;\;\;\frac{-1 - x}{\sin B}\\
\mathbf{elif}\;F \leq 3 \cdot 10^{+116}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{F}{\sin B} \cdot \frac{1}{\sqrt{2 + F \cdot F}}\\
\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.9e35Initial program 48.9%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6499.8
Applied rewrites99.8%
Taylor expanded in B around 0
Applied rewrites83.8%
if -1.9e35 < F < 2.9999999999999999e116Initial program 96.8%
Taylor expanded in B around 0
lower-/.f6467.0
Applied rewrites67.0%
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
lower-+.f64N/A
lower-+.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f6467.0
Applied rewrites67.0%
Taylor expanded in F around inf
pow2N/A
lift-*.f6467.0
Applied rewrites67.0%
if 2.9999999999999999e116 < F Initial program 31.6%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites24.9%
Taylor expanded in F around inf
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f6435.5
Applied rewrites35.5%
Final simplification67.7%
(FPCore (F B x) :precision binary64 (if (<= F -3.2e+35) (/ (- -1.0 x) (sin B)) (+ (- (/ x B)) (/ F (* (sin B) (sqrt (- (+ (* F F) 2.0) (* -2.0 x))))))))
double code(double F, double B, double x) {
double tmp;
if (F <= -3.2e+35) {
tmp = (-1.0 - x) / sin(B);
} else {
tmp = -(x / B) + (F / (sin(B) * sqrt((((F * F) + 2.0) - (-2.0 * x)))));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: tmp
if (f <= (-3.2d+35)) then
tmp = ((-1.0d0) - x) / sin(b)
else
tmp = -(x / b) + (f / (sin(b) * sqrt((((f * f) + 2.0d0) - ((-2.0d0) * x)))))
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -3.2e+35) {
tmp = (-1.0 - x) / Math.sin(B);
} else {
tmp = -(x / B) + (F / (Math.sin(B) * Math.sqrt((((F * F) + 2.0) - (-2.0 * x)))));
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -3.2e+35: tmp = (-1.0 - x) / math.sin(B) else: tmp = -(x / B) + (F / (math.sin(B) * math.sqrt((((F * F) + 2.0) - (-2.0 * x))))) return tmp
function code(F, B, x) tmp = 0.0 if (F <= -3.2e+35) tmp = Float64(Float64(-1.0 - x) / sin(B)); else tmp = Float64(Float64(-Float64(x / B)) + Float64(F / Float64(sin(B) * sqrt(Float64(Float64(Float64(F * F) + 2.0) - Float64(-2.0 * x)))))); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -3.2e+35) tmp = (-1.0 - x) / sin(B); else tmp = -(x / B) + (F / (sin(B) * sqrt((((F * F) + 2.0) - (-2.0 * x))))); end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -3.2e+35], N[(N[(-1.0 - x), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], N[((-N[(x / B), $MachinePrecision]) + N[(F / N[(N[Sin[B], $MachinePrecision] * N[Sqrt[N[(N[(N[(F * F), $MachinePrecision] + 2.0), $MachinePrecision] - N[(-2.0 * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -3.2 \cdot 10^{+35}:\\
\;\;\;\;\frac{-1 - x}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{F}{\sin B \cdot \sqrt{\left(F \cdot F + 2\right) - -2 \cdot x}}\\
\end{array}
\end{array}
if F < -3.19999999999999983e35Initial program 48.9%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6499.8
Applied rewrites99.8%
Taylor expanded in B around 0
Applied rewrites83.8%
if -3.19999999999999983e35 < F Initial program 83.5%
Taylor expanded in B around 0
lower-/.f6455.0
Applied rewrites55.0%
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
lower-+.f64N/A
lower-+.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f6455.0
Applied rewrites55.0%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-/.f64N/A
lift-sqrt.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lift-sin.f64N/A
pow2N/A
lower-sqrt.f64N/A
Applied rewrites60.6%
Final simplification67.8%
(FPCore (F B x)
:precision binary64
(if (<= F -1.26)
(/ (- -1.0 x) (sin B))
(if (<= F 6.8e-12)
(+ (- (/ x B)) (/ F (* (sin B) (sqrt (+ (* 2.0 x) 2.0)))))
(/ (- 1.0 x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1.26) {
tmp = (-1.0 - x) / sin(B);
} else if (F <= 6.8e-12) {
tmp = -(x / B) + (F / (sin(B) * sqrt(((2.0 * x) + 2.0))));
} 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.26d0)) then
tmp = ((-1.0d0) - x) / sin(b)
else if (f <= 6.8d-12) then
tmp = -(x / b) + (f / (sin(b) * sqrt(((2.0d0 * x) + 2.0d0))))
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.26) {
tmp = (-1.0 - x) / Math.sin(B);
} else if (F <= 6.8e-12) {
tmp = -(x / B) + (F / (Math.sin(B) * Math.sqrt(((2.0 * x) + 2.0))));
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -1.26: tmp = (-1.0 - x) / math.sin(B) elif F <= 6.8e-12: tmp = -(x / B) + (F / (math.sin(B) * math.sqrt(((2.0 * x) + 2.0)))) else: tmp = (1.0 - x) / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= -1.26) tmp = Float64(Float64(-1.0 - x) / sin(B)); elseif (F <= 6.8e-12) tmp = Float64(Float64(-Float64(x / B)) + Float64(F / Float64(sin(B) * sqrt(Float64(Float64(2.0 * x) + 2.0))))); 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.26) tmp = (-1.0 - x) / sin(B); elseif (F <= 6.8e-12) tmp = -(x / B) + (F / (sin(B) * sqrt(((2.0 * x) + 2.0)))); else tmp = (1.0 - x) / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -1.26], N[(N[(-1.0 - x), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 6.8e-12], N[((-N[(x / B), $MachinePrecision]) + N[(F / N[(N[Sin[B], $MachinePrecision] * N[Sqrt[N[(N[(2.0 * x), $MachinePrecision] + 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.26:\\
\;\;\;\;\frac{-1 - x}{\sin B}\\
\mathbf{elif}\;F \leq 6.8 \cdot 10^{-12}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{F}{\sin B \cdot \sqrt{2 \cdot x + 2}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < -1.26000000000000001Initial program 53.0%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6499.2
Applied rewrites99.2%
Taylor expanded in B around 0
Applied rewrites84.5%
if -1.26000000000000001 < F < 6.8000000000000001e-12Initial program 99.5%
Taylor expanded in B around 0
lower-/.f6466.5
Applied rewrites66.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
lower-+.f64N/A
lower-+.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f6466.4
Applied rewrites66.4%
Taylor expanded in F around 0
lift-*.f6466.4
Applied rewrites66.4%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-/.f64N/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lift-sin.f6466.5
lift-+.f64N/A
+-commutativeN/A
lower-+.f6466.5
Applied rewrites66.5%
if 6.8000000000000001e-12 < F Initial program 54.6%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites38.8%
Taylor expanded in F around inf
Applied rewrites44.8%
Final simplification67.2%
(FPCore (F B x) :precision binary64 (if (<= F -80000000000000.0) (/ (- -1.0 x) (sin B)) (/ (- (* (/ 1.0 (sqrt (+ 2.0 (* F F)))) F) x) B)))
double code(double F, double B, double x) {
double tmp;
if (F <= -80000000000000.0) {
tmp = (-1.0 - x) / sin(B);
} else {
tmp = (((1.0 / sqrt((2.0 + (F * 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 <= (-80000000000000.0d0)) then
tmp = ((-1.0d0) - x) / sin(b)
else
tmp = (((1.0d0 / sqrt((2.0d0 + (f * f)))) * f) - x) / b
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -80000000000000.0) {
tmp = (-1.0 - x) / Math.sin(B);
} else {
tmp = (((1.0 / Math.sqrt((2.0 + (F * F)))) * F) - x) / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -80000000000000.0: tmp = (-1.0 - x) / math.sin(B) else: tmp = (((1.0 / math.sqrt((2.0 + (F * F)))) * F) - x) / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= -80000000000000.0) tmp = Float64(Float64(-1.0 - x) / sin(B)); else tmp = Float64(Float64(Float64(Float64(1.0 / sqrt(Float64(2.0 + Float64(F * F)))) * F) - x) / B); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -80000000000000.0) tmp = (-1.0 - x) / sin(B); else tmp = (((1.0 / sqrt((2.0 + (F * F)))) * F) - x) / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -80000000000000.0], N[(N[(-1.0 - x), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(1.0 / N[Sqrt[N[(2.0 + N[(F * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * F), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -80000000000000:\\
\;\;\;\;\frac{-1 - x}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{\sqrt{2 + F \cdot F}} \cdot F - x}{B}\\
\end{array}
\end{array}
if F < -8e13Initial program 51.9%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6499.8
Applied rewrites99.8%
Taylor expanded in B around 0
Applied rewrites84.7%
if -8e13 < F Initial program 83.1%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites47.1%
Taylor expanded in x around 0
Applied rewrites47.1%
Final simplification59.4%
(FPCore (F B x) :precision binary64 (if (<= F -80000000000000.0) (/ -1.0 (sin B)) (/ (- (* (/ 1.0 (sqrt (+ 2.0 (* F F)))) F) x) B)))
double code(double F, double B, double x) {
double tmp;
if (F <= -80000000000000.0) {
tmp = -1.0 / sin(B);
} else {
tmp = (((1.0 / sqrt((2.0 + (F * 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 <= (-80000000000000.0d0)) then
tmp = (-1.0d0) / sin(b)
else
tmp = (((1.0d0 / sqrt((2.0d0 + (f * f)))) * f) - x) / b
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -80000000000000.0) {
tmp = -1.0 / Math.sin(B);
} else {
tmp = (((1.0 / Math.sqrt((2.0 + (F * F)))) * F) - x) / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -80000000000000.0: tmp = -1.0 / math.sin(B) else: tmp = (((1.0 / math.sqrt((2.0 + (F * F)))) * F) - x) / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= -80000000000000.0) tmp = Float64(-1.0 / sin(B)); else tmp = Float64(Float64(Float64(Float64(1.0 / sqrt(Float64(2.0 + Float64(F * F)))) * F) - x) / B); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -80000000000000.0) tmp = -1.0 / sin(B); else tmp = (((1.0 / sqrt((2.0 + (F * F)))) * F) - x) / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -80000000000000.0], N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(1.0 / N[Sqrt[N[(2.0 + N[(F * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * F), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -80000000000000:\\
\;\;\;\;\frac{-1}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{\sqrt{2 + F \cdot F}} \cdot F - x}{B}\\
\end{array}
\end{array}
if F < -8e13Initial program 51.9%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6499.8
Applied rewrites99.8%
Taylor expanded in x around 0
lower-/.f64N/A
lift-sin.f6467.5
Applied rewrites67.5%
if -8e13 < F Initial program 83.1%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites47.1%
Taylor expanded in x around 0
Applied rewrites47.1%
(FPCore (F B x) :precision binary64 (if (<= F -2.5e+33) (+ (- (/ x B)) (/ -1.0 (* B (+ (* -0.16666666666666666 (* B B)) 1.0)))) (/ (- (* (/ 1.0 (sqrt (+ 2.0 (* F F)))) F) x) B)))
double code(double F, double B, double x) {
double tmp;
if (F <= -2.5e+33) {
tmp = -(x / B) + (-1.0 / (B * ((-0.16666666666666666 * (B * B)) + 1.0)));
} else {
tmp = (((1.0 / sqrt((2.0 + (F * 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.5d+33)) then
tmp = -(x / b) + ((-1.0d0) / (b * (((-0.16666666666666666d0) * (b * b)) + 1.0d0)))
else
tmp = (((1.0d0 / sqrt((2.0d0 + (f * 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.5e+33) {
tmp = -(x / B) + (-1.0 / (B * ((-0.16666666666666666 * (B * B)) + 1.0)));
} else {
tmp = (((1.0 / Math.sqrt((2.0 + (F * F)))) * F) - x) / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -2.5e+33: tmp = -(x / B) + (-1.0 / (B * ((-0.16666666666666666 * (B * B)) + 1.0))) else: tmp = (((1.0 / math.sqrt((2.0 + (F * F)))) * F) - x) / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= -2.5e+33) tmp = Float64(Float64(-Float64(x / B)) + Float64(-1.0 / Float64(B * Float64(Float64(-0.16666666666666666 * Float64(B * B)) + 1.0)))); else tmp = Float64(Float64(Float64(Float64(1.0 / sqrt(Float64(2.0 + Float64(F * F)))) * F) - x) / B); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -2.5e+33) tmp = -(x / B) + (-1.0 / (B * ((-0.16666666666666666 * (B * B)) + 1.0))); else tmp = (((1.0 / sqrt((2.0 + (F * F)))) * F) - x) / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -2.5e+33], N[((-N[(x / B), $MachinePrecision]) + N[(-1.0 / N[(B * N[(N[(-0.16666666666666666 * N[(B * B), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(1.0 / N[Sqrt[N[(2.0 + N[(F * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * F), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -2.5 \cdot 10^{+33}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{-1}{B \cdot \left(-0.16666666666666666 \cdot \left(B \cdot B\right) + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{\sqrt{2 + F \cdot F}} \cdot F - x}{B}\\
\end{array}
\end{array}
if F < -2.49999999999999986e33Initial program 50.1%
Taylor expanded in B around 0
lower-/.f6433.5
Applied rewrites33.5%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6483.4
Applied rewrites83.4%
Taylor expanded in B around 0
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6457.1
Applied rewrites57.1%
if -2.49999999999999986e33 < F Initial program 83.4%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites46.4%
Taylor expanded in x around 0
Applied rewrites46.4%
(FPCore (F B x) :precision binary64 (if (<= F -1.86) (/ (- (- (* 0.5 (/ (+ 2.0 (* 2.0 x)) (* F F))) 1.0) x) B) (if (<= F 2.6e-18) (/ (- (* (/ 1.0 (sqrt 2.0)) F) x) B) (/ (- 1.0 x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1.86) {
tmp = (((0.5 * ((2.0 + (2.0 * x)) / (F * F))) - 1.0) - x) / B;
} else if (F <= 2.6e-18) {
tmp = (((1.0 / sqrt(2.0)) * F) - 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.86d0)) then
tmp = (((0.5d0 * ((2.0d0 + (2.0d0 * x)) / (f * f))) - 1.0d0) - x) / b
else if (f <= 2.6d-18) then
tmp = (((1.0d0 / sqrt(2.0d0)) * f) - 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.86) {
tmp = (((0.5 * ((2.0 + (2.0 * x)) / (F * F))) - 1.0) - x) / B;
} else if (F <= 2.6e-18) {
tmp = (((1.0 / Math.sqrt(2.0)) * F) - x) / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -1.86: tmp = (((0.5 * ((2.0 + (2.0 * x)) / (F * F))) - 1.0) - x) / B elif F <= 2.6e-18: tmp = (((1.0 / math.sqrt(2.0)) * F) - x) / B else: tmp = (1.0 - x) / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= -1.86) tmp = Float64(Float64(Float64(Float64(0.5 * Float64(Float64(2.0 + Float64(2.0 * x)) / Float64(F * F))) - 1.0) - x) / B); elseif (F <= 2.6e-18) tmp = Float64(Float64(Float64(Float64(1.0 / sqrt(2.0)) * F) - 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.86) tmp = (((0.5 * ((2.0 + (2.0 * x)) / (F * F))) - 1.0) - x) / B; elseif (F <= 2.6e-18) tmp = (((1.0 / sqrt(2.0)) * F) - x) / B; else tmp = (1.0 - x) / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -1.86], N[(N[(N[(N[(0.5 * N[(N[(2.0 + N[(2.0 * x), $MachinePrecision]), $MachinePrecision] / N[(F * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 2.6e-18], N[(N[(N[(N[(1.0 / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] * F), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.86:\\
\;\;\;\;\frac{\left(0.5 \cdot \frac{2 + 2 \cdot x}{F \cdot F} - 1\right) - x}{B}\\
\mathbf{elif}\;F \leq 2.6 \cdot 10^{-18}:\\
\;\;\;\;\frac{\frac{1}{\sqrt{2}} \cdot F - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < -1.8600000000000001Initial program 53.0%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites37.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
lift-*.f64N/A
pow2N/A
lift-*.f6456.0
Applied rewrites56.0%
if -1.8600000000000001 < F < 2.6e-18Initial program 99.5%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites51.0%
Taylor expanded in F around 0
lower-+.f64N/A
lift-*.f6451.0
Applied rewrites51.0%
Taylor expanded in x around 0
Applied rewrites51.0%
if 2.6e-18 < F Initial program 56.0%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites39.2%
Taylor expanded in F around inf
Applied rewrites45.0%
Final simplification51.2%
(FPCore (F B x) :precision binary64 (if (<= F -1.7) (+ (- (/ x B)) (/ -1.0 (* B (+ (* -0.16666666666666666 (* B B)) 1.0)))) (if (<= F 2.6e-18) (/ (- (* (/ 1.0 (sqrt 2.0)) F) x) B) (/ (- 1.0 x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1.7) {
tmp = -(x / B) + (-1.0 / (B * ((-0.16666666666666666 * (B * B)) + 1.0)));
} else if (F <= 2.6e-18) {
tmp = (((1.0 / sqrt(2.0)) * F) - 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.7d0)) then
tmp = -(x / b) + ((-1.0d0) / (b * (((-0.16666666666666666d0) * (b * b)) + 1.0d0)))
else if (f <= 2.6d-18) then
tmp = (((1.0d0 / sqrt(2.0d0)) * f) - 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.7) {
tmp = -(x / B) + (-1.0 / (B * ((-0.16666666666666666 * (B * B)) + 1.0)));
} else if (F <= 2.6e-18) {
tmp = (((1.0 / Math.sqrt(2.0)) * F) - x) / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -1.7: tmp = -(x / B) + (-1.0 / (B * ((-0.16666666666666666 * (B * B)) + 1.0))) elif F <= 2.6e-18: tmp = (((1.0 / math.sqrt(2.0)) * F) - x) / B else: tmp = (1.0 - x) / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= -1.7) tmp = Float64(Float64(-Float64(x / B)) + Float64(-1.0 / Float64(B * Float64(Float64(-0.16666666666666666 * Float64(B * B)) + 1.0)))); elseif (F <= 2.6e-18) tmp = Float64(Float64(Float64(Float64(1.0 / sqrt(2.0)) * F) - 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.7) tmp = -(x / B) + (-1.0 / (B * ((-0.16666666666666666 * (B * B)) + 1.0))); elseif (F <= 2.6e-18) tmp = (((1.0 / sqrt(2.0)) * F) - x) / B; else tmp = (1.0 - x) / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -1.7], N[((-N[(x / B), $MachinePrecision]) + N[(-1.0 / N[(B * N[(N[(-0.16666666666666666 * N[(B * B), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 2.6e-18], N[(N[(N[(N[(1.0 / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] * F), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.7:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{-1}{B \cdot \left(-0.16666666666666666 \cdot \left(B \cdot B\right) + 1\right)}\\
\mathbf{elif}\;F \leq 2.6 \cdot 10^{-18}:\\
\;\;\;\;\frac{\frac{1}{\sqrt{2}} \cdot F - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < -1.69999999999999996Initial program 53.0%
Taylor expanded in B around 0
lower-/.f6437.4
Applied rewrites37.4%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6483.8
Applied rewrites83.8%
Taylor expanded in B around 0
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6455.7
Applied rewrites55.7%
if -1.69999999999999996 < F < 2.6e-18Initial program 99.5%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites51.0%
Taylor expanded in F around 0
lower-+.f64N/A
lift-*.f6451.0
Applied rewrites51.0%
Taylor expanded in x around 0
Applied rewrites51.0%
if 2.6e-18 < F Initial program 56.0%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites39.2%
Taylor expanded in F around inf
Applied rewrites45.0%
Final simplification51.1%
(FPCore (F B x) :precision binary64 (if (<= F -1.55e-13) (/ (/ (- (* -1.0 -1.0) (* x x)) (+ -1.0 x)) B) (if (<= F 2.6e-18) (/ (- (* (/ 1.0 (sqrt 2.0)) F) x) B) (/ (- 1.0 x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1.55e-13) {
tmp = (((-1.0 * -1.0) - (x * x)) / (-1.0 + x)) / B;
} else if (F <= 2.6e-18) {
tmp = (((1.0 / sqrt(2.0)) * F) - 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.55d-13)) then
tmp = ((((-1.0d0) * (-1.0d0)) - (x * x)) / ((-1.0d0) + x)) / b
else if (f <= 2.6d-18) then
tmp = (((1.0d0 / sqrt(2.0d0)) * f) - 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.55e-13) {
tmp = (((-1.0 * -1.0) - (x * x)) / (-1.0 + x)) / B;
} else if (F <= 2.6e-18) {
tmp = (((1.0 / Math.sqrt(2.0)) * F) - x) / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -1.55e-13: tmp = (((-1.0 * -1.0) - (x * x)) / (-1.0 + x)) / B elif F <= 2.6e-18: tmp = (((1.0 / math.sqrt(2.0)) * F) - x) / B else: tmp = (1.0 - x) / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= -1.55e-13) tmp = Float64(Float64(Float64(Float64(-1.0 * -1.0) - Float64(x * x)) / Float64(-1.0 + x)) / B); elseif (F <= 2.6e-18) tmp = Float64(Float64(Float64(Float64(1.0 / sqrt(2.0)) * F) - 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.55e-13) tmp = (((-1.0 * -1.0) - (x * x)) / (-1.0 + x)) / B; elseif (F <= 2.6e-18) tmp = (((1.0 / sqrt(2.0)) * F) - x) / B; else tmp = (1.0 - x) / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -1.55e-13], N[(N[(N[(N[(-1.0 * -1.0), $MachinePrecision] - N[(x * x), $MachinePrecision]), $MachinePrecision] / N[(-1.0 + x), $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 2.6e-18], N[(N[(N[(N[(1.0 / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] * F), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.55 \cdot 10^{-13}:\\
\;\;\;\;\frac{\frac{-1 \cdot -1 - x \cdot x}{-1 + x}}{B}\\
\mathbf{elif}\;F \leq 2.6 \cdot 10^{-18}:\\
\;\;\;\;\frac{\frac{1}{\sqrt{2}} \cdot F - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < -1.55e-13Initial program 54.6%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites37.5%
Taylor expanded in F around -inf
Applied rewrites55.0%
lift--.f64N/A
flip--N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-+.f6455.1
Applied rewrites55.1%
if -1.55e-13 < F < 2.6e-18Initial program 99.5%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites51.4%
Taylor expanded in F around 0
lower-+.f64N/A
lift-*.f6451.4
Applied rewrites51.4%
Taylor expanded in x around 0
Applied rewrites51.4%
if 2.6e-18 < F Initial program 56.0%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites39.2%
Taylor expanded in F around inf
Applied rewrites45.0%
Final simplification51.1%
(FPCore (F B x) :precision binary64 (if (<= F -3.9e-168) (/ (- -1.0 x) B) (if (<= F 3.3e-102) (/ (- x) B) (/ (- 1.0 x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -3.9e-168) {
tmp = (-1.0 - x) / B;
} else if (F <= 3.3e-102) {
tmp = -x / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: tmp
if (f <= (-3.9d-168)) then
tmp = ((-1.0d0) - x) / b
else if (f <= 3.3d-102) then
tmp = -x / b
else
tmp = (1.0d0 - x) / b
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -3.9e-168) {
tmp = (-1.0 - x) / B;
} else if (F <= 3.3e-102) {
tmp = -x / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -3.9e-168: tmp = (-1.0 - x) / B elif F <= 3.3e-102: tmp = -x / B else: tmp = (1.0 - x) / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= -3.9e-168) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 3.3e-102) tmp = Float64(Float64(-x) / B); else tmp = Float64(Float64(1.0 - x) / B); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -3.9e-168) tmp = (-1.0 - x) / B; elseif (F <= 3.3e-102) tmp = -x / B; else tmp = (1.0 - x) / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -3.9e-168], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 3.3e-102], N[((-x) / B), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -3.9 \cdot 10^{-168}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 3.3 \cdot 10^{-102}:\\
\;\;\;\;\frac{-x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < -3.90000000000000012e-168Initial program 63.5%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites37.8%
Taylor expanded in F around -inf
Applied rewrites47.9%
if -3.90000000000000012e-168 < F < 3.3e-102Initial program 99.6%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites54.0%
Taylor expanded in F around -inf
Applied rewrites25.7%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f6446.1
Applied rewrites46.1%
if 3.3e-102 < F Initial program 62.8%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites42.4%
Taylor expanded in F around inf
Applied rewrites40.2%
(FPCore (F B x) :precision binary64 (if (<= F -3.9e-168) (/ (- -1.0 x) B) (/ (- x) B)))
double code(double F, double B, double x) {
double tmp;
if (F <= -3.9e-168) {
tmp = (-1.0 - x) / B;
} else {
tmp = -x / B;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: tmp
if (f <= (-3.9d-168)) then
tmp = ((-1.0d0) - x) / b
else
tmp = -x / b
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -3.9e-168) {
tmp = (-1.0 - x) / B;
} else {
tmp = -x / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -3.9e-168: tmp = (-1.0 - x) / B else: tmp = -x / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= -3.9e-168) tmp = Float64(Float64(-1.0 - x) / B); else tmp = Float64(Float64(-x) / B); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -3.9e-168) tmp = (-1.0 - x) / B; else tmp = -x / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -3.9e-168], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], N[((-x) / B), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -3.9 \cdot 10^{-168}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{-x}{B}\\
\end{array}
\end{array}
if F < -3.90000000000000012e-168Initial program 63.5%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites37.8%
Taylor expanded in F around -inf
Applied rewrites47.9%
if -3.90000000000000012e-168 < F Initial program 80.0%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites47.8%
Taylor expanded in F around -inf
Applied rewrites24.8%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f6434.5
Applied rewrites34.5%
(FPCore (F B x) :precision binary64 (/ (- x) B))
double code(double F, double B, double x) {
return -x / B;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
code = -x / b
end function
public static double code(double F, double B, double x) {
return -x / B;
}
def code(F, B, x): return -x / B
function code(F, B, x) return Float64(Float64(-x) / B) end
function tmp = code(F, B, x) tmp = -x / B; end
code[F_, B_, x_] := N[((-x) / B), $MachinePrecision]
\begin{array}{l}
\\
\frac{-x}{B}
\end{array}
Initial program 72.8%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites43.5%
Taylor expanded in F around -inf
Applied rewrites34.8%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f6427.5
Applied rewrites27.5%
herbie shell --seed 2025058
(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))))))