
(FPCore (F B x) :precision binary64 (+ (- (* x (/ 1 (tan B)))) (* (/ F (sin B)) (pow (+ (+ (* F F) 2) (* 2 x)) (- (/ 1 2))))))
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 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(N[(F * F), $MachinePrecision] + 2), $MachinePrecision] + N[(2 * x), $MachinePrecision]), $MachinePrecision], (-N[(1 / 2), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\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)}
Herbie found 24 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (F B x) :precision binary64 (+ (- (* x (/ 1 (tan B)))) (* (/ F (sin B)) (pow (+ (+ (* F F) 2) (* 2 x)) (- (/ 1 2))))))
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 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(N[(F * F), $MachinePrecision] + 2), $MachinePrecision] + N[(2 * x), $MachinePrecision]), $MachinePrecision], (-N[(1 / 2), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\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)}
(FPCore (F B x)
:precision binary64
(let* ((t_0 (* (/ (- x) (sin B)) (cos B))))
(if (<=
F
-55000000000000002149535471559930195366881323454633330127876789695579674068438989725630022088130560)
(* (/ -1 (sin B)) (* (/ (+ 1 (* (cos B) x)) F) F))
(if (<= F 2)
(+ t_0 (* (/ (pow (- (+ x x) (- -2 (* F F))) -1/2) (sin B)) F))
(+ t_0 (/ 1 (sin B)))))))double code(double F, double B, double x) {
double t_0 = (-x / sin(B)) * cos(B);
double tmp;
if (F <= -5.5e+97) {
tmp = (-1.0 / sin(B)) * (((1.0 + (cos(B) * x)) / F) * F);
} else if (F <= 2.0) {
tmp = t_0 + ((pow(((x + x) - (-2.0 - (F * F))), -0.5) / sin(B)) * 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 / sin(b)) * cos(b)
if (f <= (-5.5d+97)) then
tmp = ((-1.0d0) / sin(b)) * (((1.0d0 + (cos(b) * x)) / f) * f)
else if (f <= 2.0d0) then
tmp = t_0 + (((((x + x) - ((-2.0d0) - (f * f))) ** (-0.5d0)) / sin(b)) * 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 / Math.sin(B)) * Math.cos(B);
double tmp;
if (F <= -5.5e+97) {
tmp = (-1.0 / Math.sin(B)) * (((1.0 + (Math.cos(B) * x)) / F) * F);
} else if (F <= 2.0) {
tmp = t_0 + ((Math.pow(((x + x) - (-2.0 - (F * F))), -0.5) / Math.sin(B)) * F);
} else {
tmp = t_0 + (1.0 / Math.sin(B));
}
return tmp;
}
def code(F, B, x): t_0 = (-x / math.sin(B)) * math.cos(B) tmp = 0 if F <= -5.5e+97: tmp = (-1.0 / math.sin(B)) * (((1.0 + (math.cos(B) * x)) / F) * F) elif F <= 2.0: tmp = t_0 + ((math.pow(((x + x) - (-2.0 - (F * F))), -0.5) / math.sin(B)) * F) else: tmp = t_0 + (1.0 / math.sin(B)) return tmp
function code(F, B, x) t_0 = Float64(Float64(Float64(-x) / sin(B)) * cos(B)) tmp = 0.0 if (F <= -5.5e+97) tmp = Float64(Float64(-1.0 / sin(B)) * Float64(Float64(Float64(1.0 + Float64(cos(B) * x)) / F) * F)); elseif (F <= 2.0) tmp = Float64(t_0 + Float64(Float64((Float64(Float64(x + x) - Float64(-2.0 - Float64(F * F))) ^ -0.5) / sin(B)) * 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 / sin(B)) * cos(B); tmp = 0.0; if (F <= -5.5e+97) tmp = (-1.0 / sin(B)) * (((1.0 + (cos(B) * x)) / F) * F); elseif (F <= 2.0) tmp = t_0 + (((((x + x) - (-2.0 - (F * F))) ^ -0.5) / sin(B)) * F); else tmp = t_0 + (1.0 / sin(B)); end tmp_2 = tmp; end
code[F_, B_, x_] := Block[{t$95$0 = N[(N[((-x) / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Cos[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -55000000000000002149535471559930195366881323454633330127876789695579674068438989725630022088130560], N[(N[(-1 / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(1 + N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / F), $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 2], N[(t$95$0 + N[(N[(N[Power[N[(N[(x + x), $MachinePrecision] - N[(-2 - N[(F * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -1/2], $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(1 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \frac{-x}{\sin B} \cdot \cos B\\
\mathbf{if}\;F \leq -55000000000000002149535471559930195366881323454633330127876789695579674068438989725630022088130560:\\
\;\;\;\;\frac{-1}{\sin B} \cdot \left(\frac{1 + \cos B \cdot x}{F} \cdot F\right)\\
\mathbf{elif}\;F \leq 2:\\
\;\;\;\;t\_0 + \frac{{\left(\left(x + x\right) - \left(-2 - F \cdot F\right)\right)}^{\frac{-1}{2}}}{\sin B} \cdot F\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \frac{1}{\sin B}\\
\end{array}
if F < -5.5000000000000002e97Initial program 76.9%
lift-+.f64N/A
add-flipN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
distribute-neg-frac2N/A
sub-to-fractionN/A
lower-/.f64N/A
Applied rewrites85.1%
Taylor expanded in F around -inf
lower-*.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-/.f6451.4%
Applied rewrites51.4%
Applied rewrites51.4%
if -5.5000000000000002e97 < F < 2Initial program 76.9%
lift-*.f64N/A
lift-/.f64N/A
mult-flipN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites85.0%
lift-neg.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
lift-tan.f64N/A
mult-flip-revN/A
distribute-frac-negN/A
lift-neg.f64N/A
lift-tan.f64N/A
tan-quotN/A
lift-sin.f64N/A
lift-cos.f64N/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f6485.1%
Applied rewrites85.1%
if 2 < F Initial program 76.9%
lift-*.f64N/A
lift-/.f64N/A
mult-flipN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites85.0%
lift-neg.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
lift-tan.f64N/A
mult-flip-revN/A
distribute-frac-negN/A
lift-neg.f64N/A
lift-tan.f64N/A
tan-quotN/A
lift-sin.f64N/A
lift-cos.f64N/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f6485.1%
Applied rewrites85.1%
Taylor expanded in F around inf
lower-/.f64N/A
lower-sin.f6456.5%
Applied rewrites56.5%
(FPCore (F B x)
:precision binary64
(if (<= F -152000000000000005562493165312671744)
(* (/ -1 (sin B)) (* (/ (+ 1 (* (cos B) x)) F) F))
(if (<= F 1750)
(-
(* (pow (- (+ x x) (- -2 (* F F))) -1/2) (/ F (sin B)))
(/ x (tan B)))
(+ (* (/ (- x) (sin B)) (cos B)) (/ 1 (sin B))))))double code(double F, double B, double x) {
double tmp;
if (F <= -1.52e+35) {
tmp = (-1.0 / sin(B)) * (((1.0 + (cos(B) * x)) / F) * F);
} else if (F <= 1750.0) {
tmp = (pow(((x + x) - (-2.0 - (F * F))), -0.5) * (F / sin(B))) - (x / tan(B));
} else {
tmp = ((-x / sin(B)) * cos(B)) + (1.0 / sin(B));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: tmp
if (f <= (-1.52d+35)) then
tmp = ((-1.0d0) / sin(b)) * (((1.0d0 + (cos(b) * x)) / f) * f)
else if (f <= 1750.0d0) then
tmp = ((((x + x) - ((-2.0d0) - (f * f))) ** (-0.5d0)) * (f / sin(b))) - (x / tan(b))
else
tmp = ((-x / sin(b)) * cos(b)) + (1.0d0 / sin(b))
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -1.52e+35) {
tmp = (-1.0 / Math.sin(B)) * (((1.0 + (Math.cos(B) * x)) / F) * F);
} else if (F <= 1750.0) {
tmp = (Math.pow(((x + x) - (-2.0 - (F * F))), -0.5) * (F / Math.sin(B))) - (x / Math.tan(B));
} else {
tmp = ((-x / Math.sin(B)) * Math.cos(B)) + (1.0 / Math.sin(B));
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -1.52e+35: tmp = (-1.0 / math.sin(B)) * (((1.0 + (math.cos(B) * x)) / F) * F) elif F <= 1750.0: tmp = (math.pow(((x + x) - (-2.0 - (F * F))), -0.5) * (F / math.sin(B))) - (x / math.tan(B)) else: tmp = ((-x / math.sin(B)) * math.cos(B)) + (1.0 / math.sin(B)) return tmp
function code(F, B, x) tmp = 0.0 if (F <= -1.52e+35) tmp = Float64(Float64(-1.0 / sin(B)) * Float64(Float64(Float64(1.0 + Float64(cos(B) * x)) / F) * F)); elseif (F <= 1750.0) tmp = Float64(Float64((Float64(Float64(x + x) - Float64(-2.0 - Float64(F * F))) ^ -0.5) * Float64(F / sin(B))) - Float64(x / tan(B))); else tmp = Float64(Float64(Float64(Float64(-x) / sin(B)) * cos(B)) + Float64(1.0 / sin(B))); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -1.52e+35) tmp = (-1.0 / sin(B)) * (((1.0 + (cos(B) * x)) / F) * F); elseif (F <= 1750.0) tmp = ((((x + x) - (-2.0 - (F * F))) ^ -0.5) * (F / sin(B))) - (x / tan(B)); else tmp = ((-x / sin(B)) * cos(B)) + (1.0 / sin(B)); end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -152000000000000005562493165312671744], N[(N[(-1 / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(1 + N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / F), $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1750], N[(N[(N[Power[N[(N[(x + x), $MachinePrecision] - N[(-2 - N[(F * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -1/2], $MachinePrecision] * N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[((-x) / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Cos[B], $MachinePrecision]), $MachinePrecision] + N[(1 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;F \leq -152000000000000005562493165312671744:\\
\;\;\;\;\frac{-1}{\sin B} \cdot \left(\frac{1 + \cos B \cdot x}{F} \cdot F\right)\\
\mathbf{elif}\;F \leq 1750:\\
\;\;\;\;{\left(\left(x + x\right) - \left(-2 - F \cdot F\right)\right)}^{\frac{-1}{2}} \cdot \frac{F}{\sin B} - \frac{x}{\tan B}\\
\mathbf{else}:\\
\;\;\;\;\frac{-x}{\sin B} \cdot \cos B + \frac{1}{\sin B}\\
\end{array}
if F < -1.5200000000000001e35Initial program 76.9%
lift-+.f64N/A
add-flipN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
distribute-neg-frac2N/A
sub-to-fractionN/A
lower-/.f64N/A
Applied rewrites85.1%
Taylor expanded in F around -inf
lower-*.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-/.f6451.4%
Applied rewrites51.4%
Applied rewrites51.4%
if -1.5200000000000001e35 < F < 1750Initial program 76.9%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6476.9%
Applied rewrites77.0%
if 1750 < F Initial program 76.9%
lift-*.f64N/A
lift-/.f64N/A
mult-flipN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites85.0%
lift-neg.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
lift-tan.f64N/A
mult-flip-revN/A
distribute-frac-negN/A
lift-neg.f64N/A
lift-tan.f64N/A
tan-quotN/A
lift-sin.f64N/A
lift-cos.f64N/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f6485.1%
Applied rewrites85.1%
Taylor expanded in F around inf
lower-/.f64N/A
lower-sin.f6456.5%
Applied rewrites56.5%
(FPCore (F B x)
:precision binary64
(if (<= F -100000000000000004764729344)
(/ (+ 1 (* x (cos B))) (- (sin B)))
(if (<= F 2)
(/
(- (* (pow (- (+ x x) (- -2 (* F F))) -1/2) F) (* (cos B) x))
(sin B))
(+ (* (/ (- x) (sin B)) (cos B)) (/ 1 (sin B))))))double code(double F, double B, double x) {
double tmp;
if (F <= -1e+26) {
tmp = (1.0 + (x * cos(B))) / -sin(B);
} else if (F <= 2.0) {
tmp = ((pow(((x + x) - (-2.0 - (F * F))), -0.5) * F) - (cos(B) * x)) / sin(B);
} else {
tmp = ((-x / sin(B)) * cos(B)) + (1.0 / sin(B));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: tmp
if (f <= (-1d+26)) then
tmp = (1.0d0 + (x * cos(b))) / -sin(b)
else if (f <= 2.0d0) then
tmp = (((((x + x) - ((-2.0d0) - (f * f))) ** (-0.5d0)) * f) - (cos(b) * x)) / sin(b)
else
tmp = ((-x / sin(b)) * cos(b)) + (1.0d0 / sin(b))
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -1e+26) {
tmp = (1.0 + (x * Math.cos(B))) / -Math.sin(B);
} else if (F <= 2.0) {
tmp = ((Math.pow(((x + x) - (-2.0 - (F * F))), -0.5) * F) - (Math.cos(B) * x)) / Math.sin(B);
} else {
tmp = ((-x / Math.sin(B)) * Math.cos(B)) + (1.0 / Math.sin(B));
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -1e+26: tmp = (1.0 + (x * math.cos(B))) / -math.sin(B) elif F <= 2.0: tmp = ((math.pow(((x + x) - (-2.0 - (F * F))), -0.5) * F) - (math.cos(B) * x)) / math.sin(B) else: tmp = ((-x / math.sin(B)) * math.cos(B)) + (1.0 / math.sin(B)) return tmp
function code(F, B, x) tmp = 0.0 if (F <= -1e+26) tmp = Float64(Float64(1.0 + Float64(x * cos(B))) / Float64(-sin(B))); elseif (F <= 2.0) tmp = Float64(Float64(Float64((Float64(Float64(x + x) - Float64(-2.0 - Float64(F * F))) ^ -0.5) * F) - Float64(cos(B) * x)) / sin(B)); else tmp = Float64(Float64(Float64(Float64(-x) / sin(B)) * cos(B)) + Float64(1.0 / sin(B))); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -1e+26) tmp = (1.0 + (x * cos(B))) / -sin(B); elseif (F <= 2.0) tmp = (((((x + x) - (-2.0 - (F * F))) ^ -0.5) * F) - (cos(B) * x)) / sin(B); else tmp = ((-x / sin(B)) * cos(B)) + (1.0 / sin(B)); end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -100000000000000004764729344], N[(N[(1 + N[(x * N[Cos[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / (-N[Sin[B], $MachinePrecision])), $MachinePrecision], If[LessEqual[F, 2], N[(N[(N[(N[Power[N[(N[(x + x), $MachinePrecision] - N[(-2 - N[(F * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -1/2], $MachinePrecision] * F), $MachinePrecision] - N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], N[(N[(N[((-x) / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Cos[B], $MachinePrecision]), $MachinePrecision] + N[(1 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;F \leq -100000000000000004764729344:\\
\;\;\;\;\frac{1 + x \cdot \cos B}{-\sin B}\\
\mathbf{elif}\;F \leq 2:\\
\;\;\;\;\frac{{\left(\left(x + x\right) - \left(-2 - F \cdot F\right)\right)}^{\frac{-1}{2}} \cdot F - \cos B \cdot x}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;\frac{-x}{\sin B} \cdot \cos B + \frac{1}{\sin B}\\
\end{array}
if F < -1e26Initial program 76.9%
lift-+.f64N/A
add-flipN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
distribute-neg-frac2N/A
sub-to-fractionN/A
lower-/.f64N/A
Applied rewrites85.1%
Taylor expanded in F around -inf
lower-*.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-/.f6451.4%
Applied rewrites51.4%
Taylor expanded in F around -inf
lower-+.f64N/A
lower-*.f64N/A
lower-cos.f6455.8%
Applied rewrites55.8%
if -1e26 < F < 2Initial program 76.9%
lift-+.f64N/A
add-flipN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
distribute-neg-frac2N/A
sub-to-fractionN/A
lower-/.f64N/A
Applied rewrites85.1%
Applied rewrites85.1%
if 2 < F Initial program 76.9%
lift-*.f64N/A
lift-/.f64N/A
mult-flipN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites85.0%
lift-neg.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
lift-tan.f64N/A
mult-flip-revN/A
distribute-frac-negN/A
lift-neg.f64N/A
lift-tan.f64N/A
tan-quotN/A
lift-sin.f64N/A
lift-cos.f64N/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f6485.1%
Applied rewrites85.1%
Taylor expanded in F around inf
lower-/.f64N/A
lower-sin.f6456.5%
Applied rewrites56.5%
(FPCore (F B x)
:precision binary64
(if (<= F -2050338190066411/19342813113834066795298816)
(/ (+ 1 (* x (cos B))) (- (sin B)))
(if (<= F 2)
(/ (- (* (pow (- (+ x x) -2) -1/2) F) (* (cos B) x)) (sin B))
(+ (* (/ (- x) (sin B)) (cos B)) (/ 1 (sin B))))))double code(double F, double B, double x) {
double tmp;
if (F <= -1.06e-10) {
tmp = (1.0 + (x * cos(B))) / -sin(B);
} else if (F <= 2.0) {
tmp = ((pow(((x + x) - -2.0), -0.5) * F) - (cos(B) * x)) / sin(B);
} else {
tmp = ((-x / sin(B)) * cos(B)) + (1.0 / sin(B));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: tmp
if (f <= (-1.06d-10)) then
tmp = (1.0d0 + (x * cos(b))) / -sin(b)
else if (f <= 2.0d0) then
tmp = (((((x + x) - (-2.0d0)) ** (-0.5d0)) * f) - (cos(b) * x)) / sin(b)
else
tmp = ((-x / sin(b)) * cos(b)) + (1.0d0 / sin(b))
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -1.06e-10) {
tmp = (1.0 + (x * Math.cos(B))) / -Math.sin(B);
} else if (F <= 2.0) {
tmp = ((Math.pow(((x + x) - -2.0), -0.5) * F) - (Math.cos(B) * x)) / Math.sin(B);
} else {
tmp = ((-x / Math.sin(B)) * Math.cos(B)) + (1.0 / Math.sin(B));
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -1.06e-10: tmp = (1.0 + (x * math.cos(B))) / -math.sin(B) elif F <= 2.0: tmp = ((math.pow(((x + x) - -2.0), -0.5) * F) - (math.cos(B) * x)) / math.sin(B) else: tmp = ((-x / math.sin(B)) * math.cos(B)) + (1.0 / math.sin(B)) return tmp
function code(F, B, x) tmp = 0.0 if (F <= -1.06e-10) tmp = Float64(Float64(1.0 + Float64(x * cos(B))) / Float64(-sin(B))); elseif (F <= 2.0) tmp = Float64(Float64(Float64((Float64(Float64(x + x) - -2.0) ^ -0.5) * F) - Float64(cos(B) * x)) / sin(B)); else tmp = Float64(Float64(Float64(Float64(-x) / sin(B)) * cos(B)) + Float64(1.0 / sin(B))); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -1.06e-10) tmp = (1.0 + (x * cos(B))) / -sin(B); elseif (F <= 2.0) tmp = (((((x + x) - -2.0) ^ -0.5) * F) - (cos(B) * x)) / sin(B); else tmp = ((-x / sin(B)) * cos(B)) + (1.0 / sin(B)); end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -2050338190066411/19342813113834066795298816], N[(N[(1 + N[(x * N[Cos[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / (-N[Sin[B], $MachinePrecision])), $MachinePrecision], If[LessEqual[F, 2], N[(N[(N[(N[Power[N[(N[(x + x), $MachinePrecision] - -2), $MachinePrecision], -1/2], $MachinePrecision] * F), $MachinePrecision] - N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], N[(N[(N[((-x) / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Cos[B], $MachinePrecision]), $MachinePrecision] + N[(1 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;F \leq \frac{-2050338190066411}{19342813113834066795298816}:\\
\;\;\;\;\frac{1 + x \cdot \cos B}{-\sin B}\\
\mathbf{elif}\;F \leq 2:\\
\;\;\;\;\frac{{\left(\left(x + x\right) - -2\right)}^{\frac{-1}{2}} \cdot F - \cos B \cdot x}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;\frac{-x}{\sin B} \cdot \cos B + \frac{1}{\sin B}\\
\end{array}
if F < -1.06e-10Initial program 76.9%
lift-+.f64N/A
add-flipN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
distribute-neg-frac2N/A
sub-to-fractionN/A
lower-/.f64N/A
Applied rewrites85.1%
Taylor expanded in F around -inf
lower-*.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-/.f6451.4%
Applied rewrites51.4%
Taylor expanded in F around -inf
lower-+.f64N/A
lower-*.f64N/A
lower-cos.f6455.8%
Applied rewrites55.8%
if -1.06e-10 < F < 2Initial program 76.9%
lift-+.f64N/A
add-flipN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
distribute-neg-frac2N/A
sub-to-fractionN/A
lower-/.f64N/A
Applied rewrites85.1%
Applied rewrites85.1%
Taylor expanded in F around 0
Applied rewrites55.6%
if 2 < F Initial program 76.9%
lift-*.f64N/A
lift-/.f64N/A
mult-flipN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites85.0%
lift-neg.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
lift-tan.f64N/A
mult-flip-revN/A
distribute-frac-negN/A
lift-neg.f64N/A
lift-tan.f64N/A
tan-quotN/A
lift-sin.f64N/A
lift-cos.f64N/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f6485.1%
Applied rewrites85.1%
Taylor expanded in F around inf
lower-/.f64N/A
lower-sin.f6456.5%
Applied rewrites56.5%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (* (cos B) x)))
(if (<= F -2050338190066411/19342813113834066795298816)
(/ (+ 1 (* x (cos B))) (- (sin B)))
(if (<= F 2)
(/ (- (* (pow (- (+ x x) -2) -1/2) F) t_0) (sin B))
(/ (- 1 t_0) (sin B))))))double code(double F, double B, double x) {
double t_0 = cos(B) * x;
double tmp;
if (F <= -1.06e-10) {
tmp = (1.0 + (x * cos(B))) / -sin(B);
} else if (F <= 2.0) {
tmp = ((pow(((x + x) - -2.0), -0.5) * F) - t_0) / sin(B);
} else {
tmp = (1.0 - t_0) / sin(B);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: tmp
t_0 = cos(b) * x
if (f <= (-1.06d-10)) then
tmp = (1.0d0 + (x * cos(b))) / -sin(b)
else if (f <= 2.0d0) then
tmp = (((((x + x) - (-2.0d0)) ** (-0.5d0)) * f) - t_0) / sin(b)
else
tmp = (1.0d0 - t_0) / sin(b)
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double t_0 = Math.cos(B) * x;
double tmp;
if (F <= -1.06e-10) {
tmp = (1.0 + (x * Math.cos(B))) / -Math.sin(B);
} else if (F <= 2.0) {
tmp = ((Math.pow(((x + x) - -2.0), -0.5) * F) - t_0) / Math.sin(B);
} else {
tmp = (1.0 - t_0) / Math.sin(B);
}
return tmp;
}
def code(F, B, x): t_0 = math.cos(B) * x tmp = 0 if F <= -1.06e-10: tmp = (1.0 + (x * math.cos(B))) / -math.sin(B) elif F <= 2.0: tmp = ((math.pow(((x + x) - -2.0), -0.5) * F) - t_0) / math.sin(B) else: tmp = (1.0 - t_0) / math.sin(B) return tmp
function code(F, B, x) t_0 = Float64(cos(B) * x) tmp = 0.0 if (F <= -1.06e-10) tmp = Float64(Float64(1.0 + Float64(x * cos(B))) / Float64(-sin(B))); elseif (F <= 2.0) tmp = Float64(Float64(Float64((Float64(Float64(x + x) - -2.0) ^ -0.5) * F) - t_0) / sin(B)); else tmp = Float64(Float64(1.0 - t_0) / sin(B)); end return tmp end
function tmp_2 = code(F, B, x) t_0 = cos(B) * x; tmp = 0.0; if (F <= -1.06e-10) tmp = (1.0 + (x * cos(B))) / -sin(B); elseif (F <= 2.0) tmp = (((((x + x) - -2.0) ^ -0.5) * F) - t_0) / sin(B); else tmp = (1.0 - t_0) / sin(B); end tmp_2 = tmp; end
code[F_, B_, x_] := Block[{t$95$0 = N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[F, -2050338190066411/19342813113834066795298816], N[(N[(1 + N[(x * N[Cos[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / (-N[Sin[B], $MachinePrecision])), $MachinePrecision], If[LessEqual[F, 2], N[(N[(N[(N[Power[N[(N[(x + x), $MachinePrecision] - -2), $MachinePrecision], -1/2], $MachinePrecision] * F), $MachinePrecision] - t$95$0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], N[(N[(1 - t$95$0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \cos B \cdot x\\
\mathbf{if}\;F \leq \frac{-2050338190066411}{19342813113834066795298816}:\\
\;\;\;\;\frac{1 + x \cdot \cos B}{-\sin B}\\
\mathbf{elif}\;F \leq 2:\\
\;\;\;\;\frac{{\left(\left(x + x\right) - -2\right)}^{\frac{-1}{2}} \cdot F - t\_0}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - t\_0}{\sin B}\\
\end{array}
if F < -1.06e-10Initial program 76.9%
lift-+.f64N/A
add-flipN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
distribute-neg-frac2N/A
sub-to-fractionN/A
lower-/.f64N/A
Applied rewrites85.1%
Taylor expanded in F around -inf
lower-*.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-/.f6451.4%
Applied rewrites51.4%
Taylor expanded in F around -inf
lower-+.f64N/A
lower-*.f64N/A
lower-cos.f6455.8%
Applied rewrites55.8%
if -1.06e-10 < F < 2Initial program 76.9%
lift-+.f64N/A
add-flipN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
distribute-neg-frac2N/A
sub-to-fractionN/A
lower-/.f64N/A
Applied rewrites85.1%
Applied rewrites85.1%
Taylor expanded in F around 0
Applied rewrites55.6%
if 2 < F Initial program 76.9%
lift-+.f64N/A
add-flipN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
distribute-neg-frac2N/A
sub-to-fractionN/A
lower-/.f64N/A
Applied rewrites85.1%
Applied rewrites85.1%
Taylor expanded in F around inf
Applied rewrites56.5%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (* (cos B) x)))
(if (<=
F
-14000000000000000718667586864996145195776999603682877405921280)
(* (/ -1 (sin B)) (* (/ (+ 1 t_0) F) F))
(if (<=
F
-7742953005213299/266998379490113760299377713271194014325338065294581596243380200977777465722580068752870260867072)
(+
(- (/ x B))
(/ (/ (pow (- (+ x x) (- -2 (* F F))) -1/2) (sin B)) (/ 1 F)))
(if (<= F 713053462628379/158456325028528675187087900672)
(+
(/ 1 (/ (tan B) (- x)))
(* (/ F B) (pow (+ (+ (* F F) 2) (* 2 x)) (- (/ 1 2)))))
(/ (- 1 t_0) (sin B)))))))double code(double F, double B, double x) {
double t_0 = cos(B) * x;
double tmp;
if (F <= -1.4e+61) {
tmp = (-1.0 / sin(B)) * (((1.0 + t_0) / F) * F);
} else if (F <= -2.9e-80) {
tmp = -(x / B) + ((pow(((x + x) - (-2.0 - (F * F))), -0.5) / sin(B)) / (1.0 / F));
} else if (F <= 4.5e-15) {
tmp = (1.0 / (tan(B) / -x)) + ((F / B) * pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
} 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 <= (-1.4d+61)) then
tmp = ((-1.0d0) / sin(b)) * (((1.0d0 + t_0) / f) * f)
else if (f <= (-2.9d-80)) then
tmp = -(x / b) + (((((x + x) - ((-2.0d0) - (f * f))) ** (-0.5d0)) / sin(b)) / (1.0d0 / f))
else if (f <= 4.5d-15) then
tmp = (1.0d0 / (tan(b) / -x)) + ((f / b) * ((((f * f) + 2.0d0) + (2.0d0 * x)) ** -(1.0d0 / 2.0d0)))
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 <= -1.4e+61) {
tmp = (-1.0 / Math.sin(B)) * (((1.0 + t_0) / F) * F);
} else if (F <= -2.9e-80) {
tmp = -(x / B) + ((Math.pow(((x + x) - (-2.0 - (F * F))), -0.5) / Math.sin(B)) / (1.0 / F));
} else if (F <= 4.5e-15) {
tmp = (1.0 / (Math.tan(B) / -x)) + ((F / B) * Math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
} 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 <= -1.4e+61: tmp = (-1.0 / math.sin(B)) * (((1.0 + t_0) / F) * F) elif F <= -2.9e-80: tmp = -(x / B) + ((math.pow(((x + x) - (-2.0 - (F * F))), -0.5) / math.sin(B)) / (1.0 / F)) elif F <= 4.5e-15: tmp = (1.0 / (math.tan(B) / -x)) + ((F / B) * math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0))) 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 <= -1.4e+61) tmp = Float64(Float64(-1.0 / sin(B)) * Float64(Float64(Float64(1.0 + t_0) / F) * F)); elseif (F <= -2.9e-80) tmp = Float64(Float64(-Float64(x / B)) + Float64(Float64((Float64(Float64(x + x) - Float64(-2.0 - Float64(F * F))) ^ -0.5) / sin(B)) / Float64(1.0 / F))); elseif (F <= 4.5e-15) tmp = Float64(Float64(1.0 / Float64(tan(B) / Float64(-x))) + Float64(Float64(F / B) * (Float64(Float64(Float64(F * F) + 2.0) + Float64(2.0 * x)) ^ Float64(-Float64(1.0 / 2.0))))); 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 <= -1.4e+61) tmp = (-1.0 / sin(B)) * (((1.0 + t_0) / F) * F); elseif (F <= -2.9e-80) tmp = -(x / B) + (((((x + x) - (-2.0 - (F * F))) ^ -0.5) / sin(B)) / (1.0 / F)); elseif (F <= 4.5e-15) tmp = (1.0 / (tan(B) / -x)) + ((F / B) * ((((F * F) + 2.0) + (2.0 * x)) ^ -(1.0 / 2.0))); 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, -14000000000000000718667586864996145195776999603682877405921280], N[(N[(-1 / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(1 + t$95$0), $MachinePrecision] / F), $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, -7742953005213299/266998379490113760299377713271194014325338065294581596243380200977777465722580068752870260867072], N[((-N[(x / B), $MachinePrecision]) + N[(N[(N[Power[N[(N[(x + x), $MachinePrecision] - N[(-2 - N[(F * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -1/2], $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] / N[(1 / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 713053462628379/158456325028528675187087900672], N[(N[(1 / N[(N[Tan[B], $MachinePrecision] / (-x)), $MachinePrecision]), $MachinePrecision] + N[(N[(F / B), $MachinePrecision] * N[Power[N[(N[(N[(F * F), $MachinePrecision] + 2), $MachinePrecision] + N[(2 * x), $MachinePrecision]), $MachinePrecision], (-N[(1 / 2), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1 - t$95$0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := \cos B \cdot x\\
\mathbf{if}\;F \leq -14000000000000000718667586864996145195776999603682877405921280:\\
\;\;\;\;\frac{-1}{\sin B} \cdot \left(\frac{1 + t\_0}{F} \cdot F\right)\\
\mathbf{elif}\;F \leq \frac{-7742953005213299}{266998379490113760299377713271194014325338065294581596243380200977777465722580068752870260867072}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{\frac{{\left(\left(x + x\right) - \left(-2 - F \cdot F\right)\right)}^{\frac{-1}{2}}}{\sin B}}{\frac{1}{F}}\\
\mathbf{elif}\;F \leq \frac{713053462628379}{158456325028528675187087900672}:\\
\;\;\;\;\frac{1}{\frac{\tan B}{-x}} + \frac{F}{B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - t\_0}{\sin B}\\
\end{array}
if F < -1.4000000000000001e61Initial program 76.9%
lift-+.f64N/A
add-flipN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
distribute-neg-frac2N/A
sub-to-fractionN/A
lower-/.f64N/A
Applied rewrites85.1%
Taylor expanded in F around -inf
lower-*.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-/.f6451.4%
Applied rewrites51.4%
Applied rewrites51.4%
if -1.4000000000000001e61 < F < -2.9e-80Initial program 76.9%
Taylor expanded in B around 0
lower-/.f6449.2%
Applied rewrites49.2%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
div-flip-revN/A
lift-/.f64N/A
mult-flip-revN/A
lift-/.f64N/A
mult-flipN/A
associate-/r*N/A
Applied rewrites57.3%
if -2.9e-80 < F < 4.4999999999999998e-15Initial program 76.9%
Taylor expanded in B around 0
lower-/.f6462.4%
Applied rewrites62.4%
lift-neg.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
lift-tan.f64N/A
mult-flip-revN/A
distribute-frac-negN/A
lift-neg.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6462.4%
Applied rewrites62.4%
if 4.4999999999999998e-15 < F Initial program 76.9%
lift-+.f64N/A
add-flipN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
distribute-neg-frac2N/A
sub-to-fractionN/A
lower-/.f64N/A
Applied rewrites85.1%
Applied rewrites85.1%
Taylor expanded in F around inf
Applied rewrites56.5%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (* (cos B) x)))
(if (<=
F
-14000000000000000718667586864996145195776999603682877405921280)
(* (/ -1 (sin B)) (* (/ (+ 1 t_0) F) F))
(if (<=
F
-7742953005213299/266998379490113760299377713271194014325338065294581596243380200977777465722580068752870260867072)
(+
(- (/ x B))
(/ (/ (pow (- (+ x x) (- -2 (* F F))) -1/2) (sin B)) (/ 1 F)))
(if (<= F 713053462628379/158456325028528675187087900672)
(+
(- (* x (/ 1 (tan B))))
(* (/ F B) (pow (+ (+ (* F F) 2) (* 2 x)) (- (/ 1 2)))))
(/ (- 1 t_0) (sin B)))))))double code(double F, double B, double x) {
double t_0 = cos(B) * x;
double tmp;
if (F <= -1.4e+61) {
tmp = (-1.0 / sin(B)) * (((1.0 + t_0) / F) * F);
} else if (F <= -2.9e-80) {
tmp = -(x / B) + ((pow(((x + x) - (-2.0 - (F * F))), -0.5) / sin(B)) / (1.0 / F));
} else if (F <= 4.5e-15) {
tmp = -(x * (1.0 / tan(B))) + ((F / B) * pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
} 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 <= (-1.4d+61)) then
tmp = ((-1.0d0) / sin(b)) * (((1.0d0 + t_0) / f) * f)
else if (f <= (-2.9d-80)) then
tmp = -(x / b) + (((((x + x) - ((-2.0d0) - (f * f))) ** (-0.5d0)) / sin(b)) / (1.0d0 / f))
else if (f <= 4.5d-15) then
tmp = -(x * (1.0d0 / tan(b))) + ((f / b) * ((((f * f) + 2.0d0) + (2.0d0 * x)) ** -(1.0d0 / 2.0d0)))
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 <= -1.4e+61) {
tmp = (-1.0 / Math.sin(B)) * (((1.0 + t_0) / F) * F);
} else if (F <= -2.9e-80) {
tmp = -(x / B) + ((Math.pow(((x + x) - (-2.0 - (F * F))), -0.5) / Math.sin(B)) / (1.0 / F));
} else if (F <= 4.5e-15) {
tmp = -(x * (1.0 / Math.tan(B))) + ((F / B) * Math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
} 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 <= -1.4e+61: tmp = (-1.0 / math.sin(B)) * (((1.0 + t_0) / F) * F) elif F <= -2.9e-80: tmp = -(x / B) + ((math.pow(((x + x) - (-2.0 - (F * F))), -0.5) / math.sin(B)) / (1.0 / F)) elif F <= 4.5e-15: tmp = -(x * (1.0 / math.tan(B))) + ((F / B) * math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0))) 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 <= -1.4e+61) tmp = Float64(Float64(-1.0 / sin(B)) * Float64(Float64(Float64(1.0 + t_0) / F) * F)); elseif (F <= -2.9e-80) tmp = Float64(Float64(-Float64(x / B)) + Float64(Float64((Float64(Float64(x + x) - Float64(-2.0 - Float64(F * F))) ^ -0.5) / sin(B)) / Float64(1.0 / F))); elseif (F <= 4.5e-15) tmp = Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(Float64(F / B) * (Float64(Float64(Float64(F * F) + 2.0) + Float64(2.0 * x)) ^ Float64(-Float64(1.0 / 2.0))))); 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 <= -1.4e+61) tmp = (-1.0 / sin(B)) * (((1.0 + t_0) / F) * F); elseif (F <= -2.9e-80) tmp = -(x / B) + (((((x + x) - (-2.0 - (F * F))) ^ -0.5) / sin(B)) / (1.0 / F)); elseif (F <= 4.5e-15) tmp = -(x * (1.0 / tan(B))) + ((F / B) * ((((F * F) + 2.0) + (2.0 * x)) ^ -(1.0 / 2.0))); 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, -14000000000000000718667586864996145195776999603682877405921280], N[(N[(-1 / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(1 + t$95$0), $MachinePrecision] / F), $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, -7742953005213299/266998379490113760299377713271194014325338065294581596243380200977777465722580068752870260867072], N[((-N[(x / B), $MachinePrecision]) + N[(N[(N[Power[N[(N[(x + x), $MachinePrecision] - N[(-2 - N[(F * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -1/2], $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] / N[(1 / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 713053462628379/158456325028528675187087900672], N[((-N[(x * N[(1 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(N[(F / B), $MachinePrecision] * N[Power[N[(N[(N[(F * F), $MachinePrecision] + 2), $MachinePrecision] + N[(2 * x), $MachinePrecision]), $MachinePrecision], (-N[(1 / 2), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1 - t$95$0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := \cos B \cdot x\\
\mathbf{if}\;F \leq -14000000000000000718667586864996145195776999603682877405921280:\\
\;\;\;\;\frac{-1}{\sin B} \cdot \left(\frac{1 + t\_0}{F} \cdot F\right)\\
\mathbf{elif}\;F \leq \frac{-7742953005213299}{266998379490113760299377713271194014325338065294581596243380200977777465722580068752870260867072}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{\frac{{\left(\left(x + x\right) - \left(-2 - F \cdot F\right)\right)}^{\frac{-1}{2}}}{\sin B}}{\frac{1}{F}}\\
\mathbf{elif}\;F \leq \frac{713053462628379}{158456325028528675187087900672}:\\
\;\;\;\;\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - t\_0}{\sin B}\\
\end{array}
if F < -1.4000000000000001e61Initial program 76.9%
lift-+.f64N/A
add-flipN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
distribute-neg-frac2N/A
sub-to-fractionN/A
lower-/.f64N/A
Applied rewrites85.1%
Taylor expanded in F around -inf
lower-*.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-/.f6451.4%
Applied rewrites51.4%
Applied rewrites51.4%
if -1.4000000000000001e61 < F < -2.9e-80Initial program 76.9%
Taylor expanded in B around 0
lower-/.f6449.2%
Applied rewrites49.2%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
div-flip-revN/A
lift-/.f64N/A
mult-flip-revN/A
lift-/.f64N/A
mult-flipN/A
associate-/r*N/A
Applied rewrites57.3%
if -2.9e-80 < F < 4.4999999999999998e-15Initial program 76.9%
Taylor expanded in B around 0
lower-/.f6462.4%
Applied rewrites62.4%
if 4.4999999999999998e-15 < F Initial program 76.9%
lift-+.f64N/A
add-flipN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
distribute-neg-frac2N/A
sub-to-fractionN/A
lower-/.f64N/A
Applied rewrites85.1%
Applied rewrites85.1%
Taylor expanded in F around inf
Applied rewrites56.5%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (* (cos B) x))
(t_1 (- (/ x B)))
(t_2 (pow (- (+ x x) (- -2 (* F F))) -1/2))
(t_3 (* t_2 F)))
(if (<=
F
-14000000000000000718667586864996145195776999603682877405921280)
(* (/ -1 (sin B)) (* (/ (+ 1 t_0) F) F))
(if (<=
F
-1196547670217613/1087770609288739018116276647019455748771006705104961378712461595034426490595025393129804804639189577049885346787832834079429794483512744426310696916513970896780966442670885312576979206144)
(+ t_1 (/ (/ t_2 (sin B)) (/ 1 F)))
(if (<=
F
7256757823367339/93035356709837681990313447409664580397266094167976711716030745495121828878514934185752454491361736391777602765602070775492429008462675968)
(/ (- (* (/ (- x) (tan B)) (* -1 B)) t_3) (* -1 B))
(if (<= F 713053462628379/158456325028528675187087900672)
(+ t_1 (* (/ 1 (sin B)) t_3))
(/ (- 1 t_0) (sin B))))))))double code(double F, double B, double x) {
double t_0 = cos(B) * x;
double t_1 = -(x / B);
double t_2 = pow(((x + x) - (-2.0 - (F * F))), -0.5);
double t_3 = t_2 * F;
double tmp;
if (F <= -1.4e+61) {
tmp = (-1.0 / sin(B)) * (((1.0 + t_0) / F) * F);
} else if (F <= -1.1e-171) {
tmp = t_1 + ((t_2 / sin(B)) / (1.0 / F));
} else if (F <= 7.8e-122) {
tmp = (((-x / tan(B)) * (-1.0 * B)) - t_3) / (-1.0 * B);
} else if (F <= 4.5e-15) {
tmp = t_1 + ((1.0 / sin(B)) * t_3);
} 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) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = cos(b) * x
t_1 = -(x / b)
t_2 = ((x + x) - ((-2.0d0) - (f * f))) ** (-0.5d0)
t_3 = t_2 * f
if (f <= (-1.4d+61)) then
tmp = ((-1.0d0) / sin(b)) * (((1.0d0 + t_0) / f) * f)
else if (f <= (-1.1d-171)) then
tmp = t_1 + ((t_2 / sin(b)) / (1.0d0 / f))
else if (f <= 7.8d-122) then
tmp = (((-x / tan(b)) * ((-1.0d0) * b)) - t_3) / ((-1.0d0) * b)
else if (f <= 4.5d-15) then
tmp = t_1 + ((1.0d0 / sin(b)) * t_3)
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 t_1 = -(x / B);
double t_2 = Math.pow(((x + x) - (-2.0 - (F * F))), -0.5);
double t_3 = t_2 * F;
double tmp;
if (F <= -1.4e+61) {
tmp = (-1.0 / Math.sin(B)) * (((1.0 + t_0) / F) * F);
} else if (F <= -1.1e-171) {
tmp = t_1 + ((t_2 / Math.sin(B)) / (1.0 / F));
} else if (F <= 7.8e-122) {
tmp = (((-x / Math.tan(B)) * (-1.0 * B)) - t_3) / (-1.0 * B);
} else if (F <= 4.5e-15) {
tmp = t_1 + ((1.0 / Math.sin(B)) * t_3);
} else {
tmp = (1.0 - t_0) / Math.sin(B);
}
return tmp;
}
def code(F, B, x): t_0 = math.cos(B) * x t_1 = -(x / B) t_2 = math.pow(((x + x) - (-2.0 - (F * F))), -0.5) t_3 = t_2 * F tmp = 0 if F <= -1.4e+61: tmp = (-1.0 / math.sin(B)) * (((1.0 + t_0) / F) * F) elif F <= -1.1e-171: tmp = t_1 + ((t_2 / math.sin(B)) / (1.0 / F)) elif F <= 7.8e-122: tmp = (((-x / math.tan(B)) * (-1.0 * B)) - t_3) / (-1.0 * B) elif F <= 4.5e-15: tmp = t_1 + ((1.0 / math.sin(B)) * t_3) else: tmp = (1.0 - t_0) / math.sin(B) return tmp
function code(F, B, x) t_0 = Float64(cos(B) * x) t_1 = Float64(-Float64(x / B)) t_2 = Float64(Float64(x + x) - Float64(-2.0 - Float64(F * F))) ^ -0.5 t_3 = Float64(t_2 * F) tmp = 0.0 if (F <= -1.4e+61) tmp = Float64(Float64(-1.0 / sin(B)) * Float64(Float64(Float64(1.0 + t_0) / F) * F)); elseif (F <= -1.1e-171) tmp = Float64(t_1 + Float64(Float64(t_2 / sin(B)) / Float64(1.0 / F))); elseif (F <= 7.8e-122) tmp = Float64(Float64(Float64(Float64(Float64(-x) / tan(B)) * Float64(-1.0 * B)) - t_3) / Float64(-1.0 * B)); elseif (F <= 4.5e-15) tmp = Float64(t_1 + Float64(Float64(1.0 / sin(B)) * t_3)); 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; t_1 = -(x / B); t_2 = ((x + x) - (-2.0 - (F * F))) ^ -0.5; t_3 = t_2 * F; tmp = 0.0; if (F <= -1.4e+61) tmp = (-1.0 / sin(B)) * (((1.0 + t_0) / F) * F); elseif (F <= -1.1e-171) tmp = t_1 + ((t_2 / sin(B)) / (1.0 / F)); elseif (F <= 7.8e-122) tmp = (((-x / tan(B)) * (-1.0 * B)) - t_3) / (-1.0 * B); elseif (F <= 4.5e-15) tmp = t_1 + ((1.0 / sin(B)) * t_3); 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]}, Block[{t$95$1 = (-N[(x / B), $MachinePrecision])}, Block[{t$95$2 = N[Power[N[(N[(x + x), $MachinePrecision] - N[(-2 - N[(F * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -1/2], $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 * F), $MachinePrecision]}, If[LessEqual[F, -14000000000000000718667586864996145195776999603682877405921280], N[(N[(-1 / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(1 + t$95$0), $MachinePrecision] / F), $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, -1196547670217613/1087770609288739018116276647019455748771006705104961378712461595034426490595025393129804804639189577049885346787832834079429794483512744426310696916513970896780966442670885312576979206144], N[(t$95$1 + N[(N[(t$95$2 / N[Sin[B], $MachinePrecision]), $MachinePrecision] / N[(1 / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 7256757823367339/93035356709837681990313447409664580397266094167976711716030745495121828878514934185752454491361736391777602765602070775492429008462675968], N[(N[(N[(N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision] * N[(-1 * B), $MachinePrecision]), $MachinePrecision] - t$95$3), $MachinePrecision] / N[(-1 * B), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 713053462628379/158456325028528675187087900672], N[(t$95$1 + N[(N[(1 / N[Sin[B], $MachinePrecision]), $MachinePrecision] * t$95$3), $MachinePrecision]), $MachinePrecision], N[(N[(1 - t$95$0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
t_0 := \cos B \cdot x\\
t_1 := -\frac{x}{B}\\
t_2 := {\left(\left(x + x\right) - \left(-2 - F \cdot F\right)\right)}^{\frac{-1}{2}}\\
t_3 := t\_2 \cdot F\\
\mathbf{if}\;F \leq -14000000000000000718667586864996145195776999603682877405921280:\\
\;\;\;\;\frac{-1}{\sin B} \cdot \left(\frac{1 + t\_0}{F} \cdot F\right)\\
\mathbf{elif}\;F \leq \frac{-1196547670217613}{1087770609288739018116276647019455748771006705104961378712461595034426490595025393129804804639189577049885346787832834079429794483512744426310696916513970896780966442670885312576979206144}:\\
\;\;\;\;t\_1 + \frac{\frac{t\_2}{\sin B}}{\frac{1}{F}}\\
\mathbf{elif}\;F \leq \frac{7256757823367339}{93035356709837681990313447409664580397266094167976711716030745495121828878514934185752454491361736391777602765602070775492429008462675968}:\\
\;\;\;\;\frac{\frac{-x}{\tan B} \cdot \left(-1 \cdot B\right) - t\_3}{-1 \cdot B}\\
\mathbf{elif}\;F \leq \frac{713053462628379}{158456325028528675187087900672}:\\
\;\;\;\;t\_1 + \frac{1}{\sin B} \cdot t\_3\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - t\_0}{\sin B}\\
\end{array}
if F < -1.4000000000000001e61Initial program 76.9%
lift-+.f64N/A
add-flipN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
distribute-neg-frac2N/A
sub-to-fractionN/A
lower-/.f64N/A
Applied rewrites85.1%
Taylor expanded in F around -inf
lower-*.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-/.f6451.4%
Applied rewrites51.4%
Applied rewrites51.4%
if -1.4000000000000001e61 < F < -1.1000000000000001e-171Initial program 76.9%
Taylor expanded in B around 0
lower-/.f6449.2%
Applied rewrites49.2%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
div-flip-revN/A
lift-/.f64N/A
mult-flip-revN/A
lift-/.f64N/A
mult-flipN/A
associate-/r*N/A
Applied rewrites57.3%
if -1.1000000000000001e-171 < F < 7.7999999999999998e-122Initial program 76.9%
lift-+.f64N/A
add-flipN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
distribute-neg-frac2N/A
sub-to-fractionN/A
lower-/.f64N/A
Applied rewrites85.1%
Taylor expanded in B around 0
lower-*.f6448.9%
Applied rewrites48.9%
Taylor expanded in B around 0
lower-*.f6460.9%
Applied rewrites60.9%
if 7.7999999999999998e-122 < F < 4.4999999999999998e-15Initial program 76.9%
Taylor expanded in B around 0
lower-/.f6449.2%
Applied rewrites49.2%
Applied rewrites57.3%
if 4.4999999999999998e-15 < F Initial program 76.9%
lift-+.f64N/A
add-flipN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
distribute-neg-frac2N/A
sub-to-fractionN/A
lower-/.f64N/A
Applied rewrites85.1%
Applied rewrites85.1%
Taylor expanded in F around inf
Applied rewrites56.5%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (* (cos B) x))
(t_1 (- (/ x B)))
(t_2 (pow (- (+ x x) (- -2 (* F F))) -1/2))
(t_3 (* t_2 F)))
(if (<= F -130000000000000003301073569777188864)
(* (/ -1 (sin B)) (* (/ (+ 1 t_0) F) F))
(if (<=
F
-1196547670217613/1087770609288739018116276647019455748771006705104961378712461595034426490595025393129804804639189577049885346787832834079429794483512744426310696916513970896780966442670885312576979206144)
(+ t_1 (/ t_2 (/ (sin B) F)))
(if (<=
F
7256757823367339/93035356709837681990313447409664580397266094167976711716030745495121828878514934185752454491361736391777602765602070775492429008462675968)
(/ (- (* (/ (- x) (tan B)) (* -1 B)) t_3) (* -1 B))
(if (<= F 713053462628379/158456325028528675187087900672)
(+ t_1 (* (/ 1 (sin B)) t_3))
(/ (- 1 t_0) (sin B))))))))double code(double F, double B, double x) {
double t_0 = cos(B) * x;
double t_1 = -(x / B);
double t_2 = pow(((x + x) - (-2.0 - (F * F))), -0.5);
double t_3 = t_2 * F;
double tmp;
if (F <= -1.3e+35) {
tmp = (-1.0 / sin(B)) * (((1.0 + t_0) / F) * F);
} else if (F <= -1.1e-171) {
tmp = t_1 + (t_2 / (sin(B) / F));
} else if (F <= 7.8e-122) {
tmp = (((-x / tan(B)) * (-1.0 * B)) - t_3) / (-1.0 * B);
} else if (F <= 4.5e-15) {
tmp = t_1 + ((1.0 / sin(B)) * t_3);
} 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) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = cos(b) * x
t_1 = -(x / b)
t_2 = ((x + x) - ((-2.0d0) - (f * f))) ** (-0.5d0)
t_3 = t_2 * f
if (f <= (-1.3d+35)) then
tmp = ((-1.0d0) / sin(b)) * (((1.0d0 + t_0) / f) * f)
else if (f <= (-1.1d-171)) then
tmp = t_1 + (t_2 / (sin(b) / f))
else if (f <= 7.8d-122) then
tmp = (((-x / tan(b)) * ((-1.0d0) * b)) - t_3) / ((-1.0d0) * b)
else if (f <= 4.5d-15) then
tmp = t_1 + ((1.0d0 / sin(b)) * t_3)
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 t_1 = -(x / B);
double t_2 = Math.pow(((x + x) - (-2.0 - (F * F))), -0.5);
double t_3 = t_2 * F;
double tmp;
if (F <= -1.3e+35) {
tmp = (-1.0 / Math.sin(B)) * (((1.0 + t_0) / F) * F);
} else if (F <= -1.1e-171) {
tmp = t_1 + (t_2 / (Math.sin(B) / F));
} else if (F <= 7.8e-122) {
tmp = (((-x / Math.tan(B)) * (-1.0 * B)) - t_3) / (-1.0 * B);
} else if (F <= 4.5e-15) {
tmp = t_1 + ((1.0 / Math.sin(B)) * t_3);
} else {
tmp = (1.0 - t_0) / Math.sin(B);
}
return tmp;
}
def code(F, B, x): t_0 = math.cos(B) * x t_1 = -(x / B) t_2 = math.pow(((x + x) - (-2.0 - (F * F))), -0.5) t_3 = t_2 * F tmp = 0 if F <= -1.3e+35: tmp = (-1.0 / math.sin(B)) * (((1.0 + t_0) / F) * F) elif F <= -1.1e-171: tmp = t_1 + (t_2 / (math.sin(B) / F)) elif F <= 7.8e-122: tmp = (((-x / math.tan(B)) * (-1.0 * B)) - t_3) / (-1.0 * B) elif F <= 4.5e-15: tmp = t_1 + ((1.0 / math.sin(B)) * t_3) else: tmp = (1.0 - t_0) / math.sin(B) return tmp
function code(F, B, x) t_0 = Float64(cos(B) * x) t_1 = Float64(-Float64(x / B)) t_2 = Float64(Float64(x + x) - Float64(-2.0 - Float64(F * F))) ^ -0.5 t_3 = Float64(t_2 * F) tmp = 0.0 if (F <= -1.3e+35) tmp = Float64(Float64(-1.0 / sin(B)) * Float64(Float64(Float64(1.0 + t_0) / F) * F)); elseif (F <= -1.1e-171) tmp = Float64(t_1 + Float64(t_2 / Float64(sin(B) / F))); elseif (F <= 7.8e-122) tmp = Float64(Float64(Float64(Float64(Float64(-x) / tan(B)) * Float64(-1.0 * B)) - t_3) / Float64(-1.0 * B)); elseif (F <= 4.5e-15) tmp = Float64(t_1 + Float64(Float64(1.0 / sin(B)) * t_3)); 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; t_1 = -(x / B); t_2 = ((x + x) - (-2.0 - (F * F))) ^ -0.5; t_3 = t_2 * F; tmp = 0.0; if (F <= -1.3e+35) tmp = (-1.0 / sin(B)) * (((1.0 + t_0) / F) * F); elseif (F <= -1.1e-171) tmp = t_1 + (t_2 / (sin(B) / F)); elseif (F <= 7.8e-122) tmp = (((-x / tan(B)) * (-1.0 * B)) - t_3) / (-1.0 * B); elseif (F <= 4.5e-15) tmp = t_1 + ((1.0 / sin(B)) * t_3); 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]}, Block[{t$95$1 = (-N[(x / B), $MachinePrecision])}, Block[{t$95$2 = N[Power[N[(N[(x + x), $MachinePrecision] - N[(-2 - N[(F * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -1/2], $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 * F), $MachinePrecision]}, If[LessEqual[F, -130000000000000003301073569777188864], N[(N[(-1 / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(1 + t$95$0), $MachinePrecision] / F), $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, -1196547670217613/1087770609288739018116276647019455748771006705104961378712461595034426490595025393129804804639189577049885346787832834079429794483512744426310696916513970896780966442670885312576979206144], N[(t$95$1 + N[(t$95$2 / N[(N[Sin[B], $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 7256757823367339/93035356709837681990313447409664580397266094167976711716030745495121828878514934185752454491361736391777602765602070775492429008462675968], N[(N[(N[(N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision] * N[(-1 * B), $MachinePrecision]), $MachinePrecision] - t$95$3), $MachinePrecision] / N[(-1 * B), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 713053462628379/158456325028528675187087900672], N[(t$95$1 + N[(N[(1 / N[Sin[B], $MachinePrecision]), $MachinePrecision] * t$95$3), $MachinePrecision]), $MachinePrecision], N[(N[(1 - t$95$0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
t_0 := \cos B \cdot x\\
t_1 := -\frac{x}{B}\\
t_2 := {\left(\left(x + x\right) - \left(-2 - F \cdot F\right)\right)}^{\frac{-1}{2}}\\
t_3 := t\_2 \cdot F\\
\mathbf{if}\;F \leq -130000000000000003301073569777188864:\\
\;\;\;\;\frac{-1}{\sin B} \cdot \left(\frac{1 + t\_0}{F} \cdot F\right)\\
\mathbf{elif}\;F \leq \frac{-1196547670217613}{1087770609288739018116276647019455748771006705104961378712461595034426490595025393129804804639189577049885346787832834079429794483512744426310696916513970896780966442670885312576979206144}:\\
\;\;\;\;t\_1 + \frac{t\_2}{\frac{\sin B}{F}}\\
\mathbf{elif}\;F \leq \frac{7256757823367339}{93035356709837681990313447409664580397266094167976711716030745495121828878514934185752454491361736391777602765602070775492429008462675968}:\\
\;\;\;\;\frac{\frac{-x}{\tan B} \cdot \left(-1 \cdot B\right) - t\_3}{-1 \cdot B}\\
\mathbf{elif}\;F \leq \frac{713053462628379}{158456325028528675187087900672}:\\
\;\;\;\;t\_1 + \frac{1}{\sin B} \cdot t\_3\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - t\_0}{\sin B}\\
\end{array}
if F < -1.3e35Initial program 76.9%
lift-+.f64N/A
add-flipN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
distribute-neg-frac2N/A
sub-to-fractionN/A
lower-/.f64N/A
Applied rewrites85.1%
Taylor expanded in F around -inf
lower-*.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-/.f6451.4%
Applied rewrites51.4%
Applied rewrites51.4%
if -1.3e35 < F < -1.1000000000000001e-171Initial program 76.9%
Taylor expanded in B around 0
lower-/.f6449.2%
Applied rewrites49.2%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
div-flip-revN/A
lift-/.f64N/A
mult-flip-revN/A
lower-/.f6450.1%
Applied rewrites50.1%
if -1.1000000000000001e-171 < F < 7.7999999999999998e-122Initial program 76.9%
lift-+.f64N/A
add-flipN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
distribute-neg-frac2N/A
sub-to-fractionN/A
lower-/.f64N/A
Applied rewrites85.1%
Taylor expanded in B around 0
lower-*.f6448.9%
Applied rewrites48.9%
Taylor expanded in B around 0
lower-*.f6460.9%
Applied rewrites60.9%
if 7.7999999999999998e-122 < F < 4.4999999999999998e-15Initial program 76.9%
Taylor expanded in B around 0
lower-/.f6449.2%
Applied rewrites49.2%
Applied rewrites57.3%
if 4.4999999999999998e-15 < F Initial program 76.9%
lift-+.f64N/A
add-flipN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
distribute-neg-frac2N/A
sub-to-fractionN/A
lower-/.f64N/A
Applied rewrites85.1%
Applied rewrites85.1%
Taylor expanded in F around inf
Applied rewrites56.5%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (* (cos B) x))
(t_1 (- (/ x B)))
(t_2 (pow (- (+ x x) (- -2 (* F F))) -1/2)))
(if (<= F -130000000000000003301073569777188864)
(* (/ -1 (sin B)) (* (/ (+ 1 t_0) F) F))
(if (<=
F
-3548786815231963/4327788799063369698118367518036104040602397294887907509272254128346512609744690048814426160231687683233172643784762398137404191207445999921156415311568401014033503715319849649510248592805285405106374515984066055406780647774220793764564147394699562815402300054714269682368512)
(+ t_1 (/ t_2 (/ (sin B) F)))
(if (<=
F
7256757823367339/93035356709837681990313447409664580397266094167976711716030745495121828878514934185752454491361736391777602765602070775492429008462675968)
(/ (- x) (tan B))
(if (<= F 713053462628379/158456325028528675187087900672)
(+ t_1 (* (/ 1 (sin B)) (* t_2 F)))
(/ (- 1 t_0) (sin B))))))))double code(double F, double B, double x) {
double t_0 = cos(B) * x;
double t_1 = -(x / B);
double t_2 = pow(((x + x) - (-2.0 - (F * F))), -0.5);
double tmp;
if (F <= -1.3e+35) {
tmp = (-1.0 / sin(B)) * (((1.0 + t_0) / F) * F);
} else if (F <= -8.2e-259) {
tmp = t_1 + (t_2 / (sin(B) / F));
} else if (F <= 7.8e-122) {
tmp = -x / tan(B);
} else if (F <= 4.5e-15) {
tmp = t_1 + ((1.0 / sin(B)) * (t_2 * 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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = cos(b) * x
t_1 = -(x / b)
t_2 = ((x + x) - ((-2.0d0) - (f * f))) ** (-0.5d0)
if (f <= (-1.3d+35)) then
tmp = ((-1.0d0) / sin(b)) * (((1.0d0 + t_0) / f) * f)
else if (f <= (-8.2d-259)) then
tmp = t_1 + (t_2 / (sin(b) / f))
else if (f <= 7.8d-122) then
tmp = -x / tan(b)
else if (f <= 4.5d-15) then
tmp = t_1 + ((1.0d0 / sin(b)) * (t_2 * 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 t_1 = -(x / B);
double t_2 = Math.pow(((x + x) - (-2.0 - (F * F))), -0.5);
double tmp;
if (F <= -1.3e+35) {
tmp = (-1.0 / Math.sin(B)) * (((1.0 + t_0) / F) * F);
} else if (F <= -8.2e-259) {
tmp = t_1 + (t_2 / (Math.sin(B) / F));
} else if (F <= 7.8e-122) {
tmp = -x / Math.tan(B);
} else if (F <= 4.5e-15) {
tmp = t_1 + ((1.0 / Math.sin(B)) * (t_2 * F));
} else {
tmp = (1.0 - t_0) / Math.sin(B);
}
return tmp;
}
def code(F, B, x): t_0 = math.cos(B) * x t_1 = -(x / B) t_2 = math.pow(((x + x) - (-2.0 - (F * F))), -0.5) tmp = 0 if F <= -1.3e+35: tmp = (-1.0 / math.sin(B)) * (((1.0 + t_0) / F) * F) elif F <= -8.2e-259: tmp = t_1 + (t_2 / (math.sin(B) / F)) elif F <= 7.8e-122: tmp = -x / math.tan(B) elif F <= 4.5e-15: tmp = t_1 + ((1.0 / math.sin(B)) * (t_2 * F)) else: tmp = (1.0 - t_0) / math.sin(B) return tmp
function code(F, B, x) t_0 = Float64(cos(B) * x) t_1 = Float64(-Float64(x / B)) t_2 = Float64(Float64(x + x) - Float64(-2.0 - Float64(F * F))) ^ -0.5 tmp = 0.0 if (F <= -1.3e+35) tmp = Float64(Float64(-1.0 / sin(B)) * Float64(Float64(Float64(1.0 + t_0) / F) * F)); elseif (F <= -8.2e-259) tmp = Float64(t_1 + Float64(t_2 / Float64(sin(B) / F))); elseif (F <= 7.8e-122) tmp = Float64(Float64(-x) / tan(B)); elseif (F <= 4.5e-15) tmp = Float64(t_1 + Float64(Float64(1.0 / sin(B)) * Float64(t_2 * 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; t_1 = -(x / B); t_2 = ((x + x) - (-2.0 - (F * F))) ^ -0.5; tmp = 0.0; if (F <= -1.3e+35) tmp = (-1.0 / sin(B)) * (((1.0 + t_0) / F) * F); elseif (F <= -8.2e-259) tmp = t_1 + (t_2 / (sin(B) / F)); elseif (F <= 7.8e-122) tmp = -x / tan(B); elseif (F <= 4.5e-15) tmp = t_1 + ((1.0 / sin(B)) * (t_2 * 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]}, Block[{t$95$1 = (-N[(x / B), $MachinePrecision])}, Block[{t$95$2 = N[Power[N[(N[(x + x), $MachinePrecision] - N[(-2 - N[(F * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -1/2], $MachinePrecision]}, If[LessEqual[F, -130000000000000003301073569777188864], N[(N[(-1 / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(1 + t$95$0), $MachinePrecision] / F), $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, -3548786815231963/4327788799063369698118367518036104040602397294887907509272254128346512609744690048814426160231687683233172643784762398137404191207445999921156415311568401014033503715319849649510248592805285405106374515984066055406780647774220793764564147394699562815402300054714269682368512], N[(t$95$1 + N[(t$95$2 / N[(N[Sin[B], $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 7256757823367339/93035356709837681990313447409664580397266094167976711716030745495121828878514934185752454491361736391777602765602070775492429008462675968], N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 713053462628379/158456325028528675187087900672], N[(t$95$1 + N[(N[(1 / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[(t$95$2 * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1 - t$95$0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
t_0 := \cos B \cdot x\\
t_1 := -\frac{x}{B}\\
t_2 := {\left(\left(x + x\right) - \left(-2 - F \cdot F\right)\right)}^{\frac{-1}{2}}\\
\mathbf{if}\;F \leq -130000000000000003301073569777188864:\\
\;\;\;\;\frac{-1}{\sin B} \cdot \left(\frac{1 + t\_0}{F} \cdot F\right)\\
\mathbf{elif}\;F \leq \frac{-3548786815231963}{4327788799063369698118367518036104040602397294887907509272254128346512609744690048814426160231687683233172643784762398137404191207445999921156415311568401014033503715319849649510248592805285405106374515984066055406780647774220793764564147394699562815402300054714269682368512}:\\
\;\;\;\;t\_1 + \frac{t\_2}{\frac{\sin B}{F}}\\
\mathbf{elif}\;F \leq \frac{7256757823367339}{93035356709837681990313447409664580397266094167976711716030745495121828878514934185752454491361736391777602765602070775492429008462675968}:\\
\;\;\;\;\frac{-x}{\tan B}\\
\mathbf{elif}\;F \leq \frac{713053462628379}{158456325028528675187087900672}:\\
\;\;\;\;t\_1 + \frac{1}{\sin B} \cdot \left(t\_2 \cdot F\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - t\_0}{\sin B}\\
\end{array}
if F < -1.3e35Initial program 76.9%
lift-+.f64N/A
add-flipN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
distribute-neg-frac2N/A
sub-to-fractionN/A
lower-/.f64N/A
Applied rewrites85.1%
Taylor expanded in F around -inf
lower-*.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-/.f6451.4%
Applied rewrites51.4%
Applied rewrites51.4%
if -1.3e35 < F < -8.1999999999999996e-259Initial program 76.9%
Taylor expanded in B around 0
lower-/.f6449.2%
Applied rewrites49.2%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
div-flip-revN/A
lift-/.f64N/A
mult-flip-revN/A
lower-/.f6450.1%
Applied rewrites50.1%
if -8.1999999999999996e-259 < F < 7.7999999999999998e-122Initial program 76.9%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6455.8%
Applied rewrites55.8%
lift-*.f64N/A
metadata-evalN/A
distribute-lft-neg-outN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
div-flip-revN/A
lift-sin.f64N/A
lift-cos.f64N/A
tan-quotN/A
lift-tan.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-*l*N/A
*-lft-identityN/A
*-commutativeN/A
Applied rewrites55.9%
if 7.7999999999999998e-122 < F < 4.4999999999999998e-15Initial program 76.9%
Taylor expanded in B around 0
lower-/.f6449.2%
Applied rewrites49.2%
Applied rewrites57.3%
if 4.4999999999999998e-15 < F Initial program 76.9%
lift-+.f64N/A
add-flipN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
distribute-neg-frac2N/A
sub-to-fractionN/A
lower-/.f64N/A
Applied rewrites85.1%
Applied rewrites85.1%
Taylor expanded in F around inf
Applied rewrites56.5%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (* (cos B) x))
(t_1 (pow (- (+ x x) (- -2 (* F F))) -1/2)))
(if (<=
F
-86000000000000002621014052368016515123921215154871214834341745017896304640)
(* (/ -1 (sin B)) (* (/ (+ 1 t_0) F) F))
(if (<=
F
-3548786815231963/4327788799063369698118367518036104040602397294887907509272254128346512609744690048814426160231687683233172643784762398137404191207445999921156415311568401014033503715319849649510248592805285405106374515984066055406780647774220793764564147394699562815402300054714269682368512)
(- (* (/ t_1 (sin B)) F) (/ x B))
(if (<=
F
7256757823367339/93035356709837681990313447409664580397266094167976711716030745495121828878514934185752454491361736391777602765602070775492429008462675968)
(/ (- x) (tan B))
(if (<= F 713053462628379/158456325028528675187087900672)
(+ (- (/ x B)) (* (/ 1 (sin B)) (* t_1 F)))
(/ (- 1 t_0) (sin B))))))))double code(double F, double B, double x) {
double t_0 = cos(B) * x;
double t_1 = pow(((x + x) - (-2.0 - (F * F))), -0.5);
double tmp;
if (F <= -8.6e+73) {
tmp = (-1.0 / sin(B)) * (((1.0 + t_0) / F) * F);
} else if (F <= -8.2e-259) {
tmp = ((t_1 / sin(B)) * F) - (x / B);
} else if (F <= 7.8e-122) {
tmp = -x / tan(B);
} else if (F <= 4.5e-15) {
tmp = -(x / B) + ((1.0 / sin(B)) * (t_1 * 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) :: t_1
real(8) :: tmp
t_0 = cos(b) * x
t_1 = ((x + x) - ((-2.0d0) - (f * f))) ** (-0.5d0)
if (f <= (-8.6d+73)) then
tmp = ((-1.0d0) / sin(b)) * (((1.0d0 + t_0) / f) * f)
else if (f <= (-8.2d-259)) then
tmp = ((t_1 / sin(b)) * f) - (x / b)
else if (f <= 7.8d-122) then
tmp = -x / tan(b)
else if (f <= 4.5d-15) then
tmp = -(x / b) + ((1.0d0 / sin(b)) * (t_1 * 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 t_1 = Math.pow(((x + x) - (-2.0 - (F * F))), -0.5);
double tmp;
if (F <= -8.6e+73) {
tmp = (-1.0 / Math.sin(B)) * (((1.0 + t_0) / F) * F);
} else if (F <= -8.2e-259) {
tmp = ((t_1 / Math.sin(B)) * F) - (x / B);
} else if (F <= 7.8e-122) {
tmp = -x / Math.tan(B);
} else if (F <= 4.5e-15) {
tmp = -(x / B) + ((1.0 / Math.sin(B)) * (t_1 * F));
} else {
tmp = (1.0 - t_0) / Math.sin(B);
}
return tmp;
}
def code(F, B, x): t_0 = math.cos(B) * x t_1 = math.pow(((x + x) - (-2.0 - (F * F))), -0.5) tmp = 0 if F <= -8.6e+73: tmp = (-1.0 / math.sin(B)) * (((1.0 + t_0) / F) * F) elif F <= -8.2e-259: tmp = ((t_1 / math.sin(B)) * F) - (x / B) elif F <= 7.8e-122: tmp = -x / math.tan(B) elif F <= 4.5e-15: tmp = -(x / B) + ((1.0 / math.sin(B)) * (t_1 * F)) else: tmp = (1.0 - t_0) / math.sin(B) return tmp
function code(F, B, x) t_0 = Float64(cos(B) * x) t_1 = Float64(Float64(x + x) - Float64(-2.0 - Float64(F * F))) ^ -0.5 tmp = 0.0 if (F <= -8.6e+73) tmp = Float64(Float64(-1.0 / sin(B)) * Float64(Float64(Float64(1.0 + t_0) / F) * F)); elseif (F <= -8.2e-259) tmp = Float64(Float64(Float64(t_1 / sin(B)) * F) - Float64(x / B)); elseif (F <= 7.8e-122) tmp = Float64(Float64(-x) / tan(B)); elseif (F <= 4.5e-15) tmp = Float64(Float64(-Float64(x / B)) + Float64(Float64(1.0 / sin(B)) * Float64(t_1 * 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; t_1 = ((x + x) - (-2.0 - (F * F))) ^ -0.5; tmp = 0.0; if (F <= -8.6e+73) tmp = (-1.0 / sin(B)) * (((1.0 + t_0) / F) * F); elseif (F <= -8.2e-259) tmp = ((t_1 / sin(B)) * F) - (x / B); elseif (F <= 7.8e-122) tmp = -x / tan(B); elseif (F <= 4.5e-15) tmp = -(x / B) + ((1.0 / sin(B)) * (t_1 * 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]}, Block[{t$95$1 = N[Power[N[(N[(x + x), $MachinePrecision] - N[(-2 - N[(F * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -1/2], $MachinePrecision]}, If[LessEqual[F, -86000000000000002621014052368016515123921215154871214834341745017896304640], N[(N[(-1 / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(1 + t$95$0), $MachinePrecision] / F), $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, -3548786815231963/4327788799063369698118367518036104040602397294887907509272254128346512609744690048814426160231687683233172643784762398137404191207445999921156415311568401014033503715319849649510248592805285405106374515984066055406780647774220793764564147394699562815402300054714269682368512], N[(N[(N[(t$95$1 / N[Sin[B], $MachinePrecision]), $MachinePrecision] * F), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 7256757823367339/93035356709837681990313447409664580397266094167976711716030745495121828878514934185752454491361736391777602765602070775492429008462675968], N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 713053462628379/158456325028528675187087900672], N[((-N[(x / B), $MachinePrecision]) + N[(N[(1 / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[(t$95$1 * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1 - t$95$0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
t_0 := \cos B \cdot x\\
t_1 := {\left(\left(x + x\right) - \left(-2 - F \cdot F\right)\right)}^{\frac{-1}{2}}\\
\mathbf{if}\;F \leq -86000000000000002621014052368016515123921215154871214834341745017896304640:\\
\;\;\;\;\frac{-1}{\sin B} \cdot \left(\frac{1 + t\_0}{F} \cdot F\right)\\
\mathbf{elif}\;F \leq \frac{-3548786815231963}{4327788799063369698118367518036104040602397294887907509272254128346512609744690048814426160231687683233172643784762398137404191207445999921156415311568401014033503715319849649510248592805285405106374515984066055406780647774220793764564147394699562815402300054714269682368512}:\\
\;\;\;\;\frac{t\_1}{\sin B} \cdot F - \frac{x}{B}\\
\mathbf{elif}\;F \leq \frac{7256757823367339}{93035356709837681990313447409664580397266094167976711716030745495121828878514934185752454491361736391777602765602070775492429008462675968}:\\
\;\;\;\;\frac{-x}{\tan B}\\
\mathbf{elif}\;F \leq \frac{713053462628379}{158456325028528675187087900672}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{1}{\sin B} \cdot \left(t\_1 \cdot F\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - t\_0}{\sin B}\\
\end{array}
if F < -8.6000000000000003e73Initial program 76.9%
lift-+.f64N/A
add-flipN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
distribute-neg-frac2N/A
sub-to-fractionN/A
lower-/.f64N/A
Applied rewrites85.1%
Taylor expanded in F around -inf
lower-*.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-/.f6451.4%
Applied rewrites51.4%
Applied rewrites51.4%
if -8.6000000000000003e73 < F < -8.1999999999999996e-259Initial program 76.9%
Taylor expanded in B around 0
lower-/.f6449.2%
Applied rewrites49.2%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6449.2%
Applied rewrites49.2%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
associate-*l/N/A
lift-/.f64N/A
lift-*.f6457.3%
Applied rewrites57.3%
if -8.1999999999999996e-259 < F < 7.7999999999999998e-122Initial program 76.9%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6455.8%
Applied rewrites55.8%
lift-*.f64N/A
metadata-evalN/A
distribute-lft-neg-outN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
div-flip-revN/A
lift-sin.f64N/A
lift-cos.f64N/A
tan-quotN/A
lift-tan.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-*l*N/A
*-lft-identityN/A
*-commutativeN/A
Applied rewrites55.9%
if 7.7999999999999998e-122 < F < 4.4999999999999998e-15Initial program 76.9%
Taylor expanded in B around 0
lower-/.f6449.2%
Applied rewrites49.2%
Applied rewrites57.3%
if 4.4999999999999998e-15 < F Initial program 76.9%
lift-+.f64N/A
add-flipN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
distribute-neg-frac2N/A
sub-to-fractionN/A
lower-/.f64N/A
Applied rewrites85.1%
Applied rewrites85.1%
Taylor expanded in F around inf
Applied rewrites56.5%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (* (cos B) x))
(t_1 (pow (- (+ x x) (- -2 (* F F))) -1/2)))
(if (<=
F
-86000000000000002621014052368016515123921215154871214834341745017896304640)
(* (/ -1 (sin B)) (* (/ (+ 1 t_0) F) F))
(if (<=
F
-3548786815231963/4327788799063369698118367518036104040602397294887907509272254128346512609744690048814426160231687683233172643784762398137404191207445999921156415311568401014033503715319849649510248592805285405106374515984066055406780647774220793764564147394699562815402300054714269682368512)
(- (* (/ t_1 (sin B)) F) (/ x B))
(if (<=
F
5470679174164527/14396524142538228424993723224595141948383030778566133225922417832357880258148761185020930195532450742879746914027266864394266451377581759004827248578768524336431104)
(/ (- x) (tan B))
(if (<= F 713053462628379/158456325028528675187087900672)
(- (* t_1 (* (/ 1 (sin B)) F)) (/ x B))
(/ (- 1 t_0) (sin B))))))))double code(double F, double B, double x) {
double t_0 = cos(B) * x;
double t_1 = pow(((x + x) - (-2.0 - (F * F))), -0.5);
double tmp;
if (F <= -8.6e+73) {
tmp = (-1.0 / sin(B)) * (((1.0 + t_0) / F) * F);
} else if (F <= -8.2e-259) {
tmp = ((t_1 / sin(B)) * F) - (x / B);
} else if (F <= 3.8e-148) {
tmp = -x / tan(B);
} else if (F <= 4.5e-15) {
tmp = (t_1 * ((1.0 / sin(B)) * F)) - (x / B);
} else {
tmp = (1.0 - t_0) / sin(B);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = cos(b) * x
t_1 = ((x + x) - ((-2.0d0) - (f * f))) ** (-0.5d0)
if (f <= (-8.6d+73)) then
tmp = ((-1.0d0) / sin(b)) * (((1.0d0 + t_0) / f) * f)
else if (f <= (-8.2d-259)) then
tmp = ((t_1 / sin(b)) * f) - (x / b)
else if (f <= 3.8d-148) then
tmp = -x / tan(b)
else if (f <= 4.5d-15) then
tmp = (t_1 * ((1.0d0 / sin(b)) * f)) - (x / b)
else
tmp = (1.0d0 - t_0) / sin(b)
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double t_0 = Math.cos(B) * x;
double t_1 = Math.pow(((x + x) - (-2.0 - (F * F))), -0.5);
double tmp;
if (F <= -8.6e+73) {
tmp = (-1.0 / Math.sin(B)) * (((1.0 + t_0) / F) * F);
} else if (F <= -8.2e-259) {
tmp = ((t_1 / Math.sin(B)) * F) - (x / B);
} else if (F <= 3.8e-148) {
tmp = -x / Math.tan(B);
} else if (F <= 4.5e-15) {
tmp = (t_1 * ((1.0 / Math.sin(B)) * F)) - (x / B);
} else {
tmp = (1.0 - t_0) / Math.sin(B);
}
return tmp;
}
def code(F, B, x): t_0 = math.cos(B) * x t_1 = math.pow(((x + x) - (-2.0 - (F * F))), -0.5) tmp = 0 if F <= -8.6e+73: tmp = (-1.0 / math.sin(B)) * (((1.0 + t_0) / F) * F) elif F <= -8.2e-259: tmp = ((t_1 / math.sin(B)) * F) - (x / B) elif F <= 3.8e-148: tmp = -x / math.tan(B) elif F <= 4.5e-15: tmp = (t_1 * ((1.0 / math.sin(B)) * F)) - (x / B) else: tmp = (1.0 - t_0) / math.sin(B) return tmp
function code(F, B, x) t_0 = Float64(cos(B) * x) t_1 = Float64(Float64(x + x) - Float64(-2.0 - Float64(F * F))) ^ -0.5 tmp = 0.0 if (F <= -8.6e+73) tmp = Float64(Float64(-1.0 / sin(B)) * Float64(Float64(Float64(1.0 + t_0) / F) * F)); elseif (F <= -8.2e-259) tmp = Float64(Float64(Float64(t_1 / sin(B)) * F) - Float64(x / B)); elseif (F <= 3.8e-148) tmp = Float64(Float64(-x) / tan(B)); elseif (F <= 4.5e-15) tmp = Float64(Float64(t_1 * Float64(Float64(1.0 / sin(B)) * F)) - Float64(x / B)); else tmp = Float64(Float64(1.0 - t_0) / sin(B)); end return tmp end
function tmp_2 = code(F, B, x) t_0 = cos(B) * x; t_1 = ((x + x) - (-2.0 - (F * F))) ^ -0.5; tmp = 0.0; if (F <= -8.6e+73) tmp = (-1.0 / sin(B)) * (((1.0 + t_0) / F) * F); elseif (F <= -8.2e-259) tmp = ((t_1 / sin(B)) * F) - (x / B); elseif (F <= 3.8e-148) tmp = -x / tan(B); elseif (F <= 4.5e-15) tmp = (t_1 * ((1.0 / sin(B)) * F)) - (x / B); else tmp = (1.0 - t_0) / sin(B); end tmp_2 = tmp; end
code[F_, B_, x_] := Block[{t$95$0 = N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]}, Block[{t$95$1 = N[Power[N[(N[(x + x), $MachinePrecision] - N[(-2 - N[(F * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -1/2], $MachinePrecision]}, If[LessEqual[F, -86000000000000002621014052368016515123921215154871214834341745017896304640], N[(N[(-1 / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(1 + t$95$0), $MachinePrecision] / F), $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, -3548786815231963/4327788799063369698118367518036104040602397294887907509272254128346512609744690048814426160231687683233172643784762398137404191207445999921156415311568401014033503715319849649510248592805285405106374515984066055406780647774220793764564147394699562815402300054714269682368512], N[(N[(N[(t$95$1 / N[Sin[B], $MachinePrecision]), $MachinePrecision] * F), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 5470679174164527/14396524142538228424993723224595141948383030778566133225922417832357880258148761185020930195532450742879746914027266864394266451377581759004827248578768524336431104], N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 713053462628379/158456325028528675187087900672], N[(N[(t$95$1 * N[(N[(1 / N[Sin[B], $MachinePrecision]), $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision], N[(N[(1 - t$95$0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
t_0 := \cos B \cdot x\\
t_1 := {\left(\left(x + x\right) - \left(-2 - F \cdot F\right)\right)}^{\frac{-1}{2}}\\
\mathbf{if}\;F \leq -86000000000000002621014052368016515123921215154871214834341745017896304640:\\
\;\;\;\;\frac{-1}{\sin B} \cdot \left(\frac{1 + t\_0}{F} \cdot F\right)\\
\mathbf{elif}\;F \leq \frac{-3548786815231963}{4327788799063369698118367518036104040602397294887907509272254128346512609744690048814426160231687683233172643784762398137404191207445999921156415311568401014033503715319849649510248592805285405106374515984066055406780647774220793764564147394699562815402300054714269682368512}:\\
\;\;\;\;\frac{t\_1}{\sin B} \cdot F - \frac{x}{B}\\
\mathbf{elif}\;F \leq \frac{5470679174164527}{14396524142538228424993723224595141948383030778566133225922417832357880258148761185020930195532450742879746914027266864394266451377581759004827248578768524336431104}:\\
\;\;\;\;\frac{-x}{\tan B}\\
\mathbf{elif}\;F \leq \frac{713053462628379}{158456325028528675187087900672}:\\
\;\;\;\;t\_1 \cdot \left(\frac{1}{\sin B} \cdot F\right) - \frac{x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - t\_0}{\sin B}\\
\end{array}
if F < -8.6000000000000003e73Initial program 76.9%
lift-+.f64N/A
add-flipN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
distribute-neg-frac2N/A
sub-to-fractionN/A
lower-/.f64N/A
Applied rewrites85.1%
Taylor expanded in F around -inf
lower-*.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-/.f6451.4%
Applied rewrites51.4%
Applied rewrites51.4%
if -8.6000000000000003e73 < F < -8.1999999999999996e-259Initial program 76.9%
Taylor expanded in B around 0
lower-/.f6449.2%
Applied rewrites49.2%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6449.2%
Applied rewrites49.2%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
associate-*l/N/A
lift-/.f64N/A
lift-*.f6457.3%
Applied rewrites57.3%
if -8.1999999999999996e-259 < F < 3.8000000000000001e-148Initial program 76.9%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6455.8%
Applied rewrites55.8%
lift-*.f64N/A
metadata-evalN/A
distribute-lft-neg-outN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
div-flip-revN/A
lift-sin.f64N/A
lift-cos.f64N/A
tan-quotN/A
lift-tan.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-*l*N/A
*-lft-identityN/A
*-commutativeN/A
Applied rewrites55.9%
if 3.8000000000000001e-148 < F < 4.4999999999999998e-15Initial program 76.9%
Taylor expanded in B around 0
lower-/.f6449.2%
Applied rewrites49.2%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6449.2%
Applied rewrites49.2%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6449.2%
Applied rewrites49.2%
if 4.4999999999999998e-15 < F Initial program 76.9%
lift-+.f64N/A
add-flipN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
distribute-neg-frac2N/A
sub-to-fractionN/A
lower-/.f64N/A
Applied rewrites85.1%
Applied rewrites85.1%
Taylor expanded in F around inf
Applied rewrites56.5%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (* (cos B) x)))
(if (<=
F
-86000000000000002621014052368016515123921215154871214834341745017896304640)
(* (/ -1 (sin B)) (* (/ (+ 1 t_0) F) F))
(if (<=
F
-3548786815231963/4327788799063369698118367518036104040602397294887907509272254128346512609744690048814426160231687683233172643784762398137404191207445999921156415311568401014033503715319849649510248592805285405106374515984066055406780647774220793764564147394699562815402300054714269682368512)
(-
(* (/ (pow (- (+ x x) (- -2 (* F F))) -1/2) (sin B)) F)
(/ x B))
(if (<=
F
7256757823367339/93035356709837681990313447409664580397266094167976711716030745495121828878514934185752454491361736391777602765602070775492429008462675968)
(/ (- x) (tan B))
(if (<= F 713053462628379/158456325028528675187087900672)
(+ (- (/ x B)) (/ (* F (pow (+ 2 (* 2 x)) -1/2)) (sin B)))
(/ (- 1 t_0) (sin B))))))))double code(double F, double B, double x) {
double t_0 = cos(B) * x;
double tmp;
if (F <= -8.6e+73) {
tmp = (-1.0 / sin(B)) * (((1.0 + t_0) / F) * F);
} else if (F <= -8.2e-259) {
tmp = ((pow(((x + x) - (-2.0 - (F * F))), -0.5) / sin(B)) * F) - (x / B);
} else if (F <= 7.8e-122) {
tmp = -x / tan(B);
} else if (F <= 4.5e-15) {
tmp = -(x / B) + ((F * pow((2.0 + (2.0 * x)), -0.5)) / sin(B));
} else {
tmp = (1.0 - t_0) / sin(B);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: tmp
t_0 = cos(b) * x
if (f <= (-8.6d+73)) then
tmp = ((-1.0d0) / sin(b)) * (((1.0d0 + t_0) / f) * f)
else if (f <= (-8.2d-259)) then
tmp = (((((x + x) - ((-2.0d0) - (f * f))) ** (-0.5d0)) / sin(b)) * f) - (x / b)
else if (f <= 7.8d-122) then
tmp = -x / tan(b)
else if (f <= 4.5d-15) then
tmp = -(x / b) + ((f * ((2.0d0 + (2.0d0 * x)) ** (-0.5d0))) / sin(b))
else
tmp = (1.0d0 - t_0) / sin(b)
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double t_0 = Math.cos(B) * x;
double tmp;
if (F <= -8.6e+73) {
tmp = (-1.0 / Math.sin(B)) * (((1.0 + t_0) / F) * F);
} else if (F <= -8.2e-259) {
tmp = ((Math.pow(((x + x) - (-2.0 - (F * F))), -0.5) / Math.sin(B)) * F) - (x / B);
} else if (F <= 7.8e-122) {
tmp = -x / Math.tan(B);
} else if (F <= 4.5e-15) {
tmp = -(x / B) + ((F * Math.pow((2.0 + (2.0 * x)), -0.5)) / Math.sin(B));
} else {
tmp = (1.0 - t_0) / Math.sin(B);
}
return tmp;
}
def code(F, B, x): t_0 = math.cos(B) * x tmp = 0 if F <= -8.6e+73: tmp = (-1.0 / math.sin(B)) * (((1.0 + t_0) / F) * F) elif F <= -8.2e-259: tmp = ((math.pow(((x + x) - (-2.0 - (F * F))), -0.5) / math.sin(B)) * F) - (x / B) elif F <= 7.8e-122: tmp = -x / math.tan(B) elif F <= 4.5e-15: tmp = -(x / B) + ((F * math.pow((2.0 + (2.0 * x)), -0.5)) / math.sin(B)) else: tmp = (1.0 - t_0) / math.sin(B) return tmp
function code(F, B, x) t_0 = Float64(cos(B) * x) tmp = 0.0 if (F <= -8.6e+73) tmp = Float64(Float64(-1.0 / sin(B)) * Float64(Float64(Float64(1.0 + t_0) / F) * F)); elseif (F <= -8.2e-259) tmp = Float64(Float64(Float64((Float64(Float64(x + x) - Float64(-2.0 - Float64(F * F))) ^ -0.5) / sin(B)) * F) - Float64(x / B)); elseif (F <= 7.8e-122) tmp = Float64(Float64(-x) / tan(B)); elseif (F <= 4.5e-15) tmp = Float64(Float64(-Float64(x / B)) + Float64(Float64(F * (Float64(2.0 + Float64(2.0 * x)) ^ -0.5)) / sin(B))); else tmp = Float64(Float64(1.0 - t_0) / sin(B)); end return tmp end
function tmp_2 = code(F, B, x) t_0 = cos(B) * x; tmp = 0.0; if (F <= -8.6e+73) tmp = (-1.0 / sin(B)) * (((1.0 + t_0) / F) * F); elseif (F <= -8.2e-259) tmp = (((((x + x) - (-2.0 - (F * F))) ^ -0.5) / sin(B)) * F) - (x / B); elseif (F <= 7.8e-122) tmp = -x / tan(B); elseif (F <= 4.5e-15) tmp = -(x / B) + ((F * ((2.0 + (2.0 * x)) ^ -0.5)) / sin(B)); else tmp = (1.0 - t_0) / sin(B); end tmp_2 = tmp; end
code[F_, B_, x_] := Block[{t$95$0 = N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[F, -86000000000000002621014052368016515123921215154871214834341745017896304640], N[(N[(-1 / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(1 + t$95$0), $MachinePrecision] / F), $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, -3548786815231963/4327788799063369698118367518036104040602397294887907509272254128346512609744690048814426160231687683233172643784762398137404191207445999921156415311568401014033503715319849649510248592805285405106374515984066055406780647774220793764564147394699562815402300054714269682368512], N[(N[(N[(N[Power[N[(N[(x + x), $MachinePrecision] - N[(-2 - N[(F * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -1/2], $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] * F), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 7256757823367339/93035356709837681990313447409664580397266094167976711716030745495121828878514934185752454491361736391777602765602070775492429008462675968], N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 713053462628379/158456325028528675187087900672], N[((-N[(x / B), $MachinePrecision]) + N[(N[(F * N[Power[N[(2 + N[(2 * x), $MachinePrecision]), $MachinePrecision], -1/2], $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1 - t$95$0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
t_0 := \cos B \cdot x\\
\mathbf{if}\;F \leq -86000000000000002621014052368016515123921215154871214834341745017896304640:\\
\;\;\;\;\frac{-1}{\sin B} \cdot \left(\frac{1 + t\_0}{F} \cdot F\right)\\
\mathbf{elif}\;F \leq \frac{-3548786815231963}{4327788799063369698118367518036104040602397294887907509272254128346512609744690048814426160231687683233172643784762398137404191207445999921156415311568401014033503715319849649510248592805285405106374515984066055406780647774220793764564147394699562815402300054714269682368512}:\\
\;\;\;\;\frac{{\left(\left(x + x\right) - \left(-2 - F \cdot F\right)\right)}^{\frac{-1}{2}}}{\sin B} \cdot F - \frac{x}{B}\\
\mathbf{elif}\;F \leq \frac{7256757823367339}{93035356709837681990313447409664580397266094167976711716030745495121828878514934185752454491361736391777602765602070775492429008462675968}:\\
\;\;\;\;\frac{-x}{\tan B}\\
\mathbf{elif}\;F \leq \frac{713053462628379}{158456325028528675187087900672}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{F \cdot {\left(2 + 2 \cdot x\right)}^{\frac{-1}{2}}}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - t\_0}{\sin B}\\
\end{array}
if F < -8.6000000000000003e73Initial program 76.9%
lift-+.f64N/A
add-flipN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
distribute-neg-frac2N/A
sub-to-fractionN/A
lower-/.f64N/A
Applied rewrites85.1%
Taylor expanded in F around -inf
lower-*.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-/.f6451.4%
Applied rewrites51.4%
Applied rewrites51.4%
if -8.6000000000000003e73 < F < -8.1999999999999996e-259Initial program 76.9%
Taylor expanded in B around 0
lower-/.f6449.2%
Applied rewrites49.2%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6449.2%
Applied rewrites49.2%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
associate-*l/N/A
lift-/.f64N/A
lift-*.f6457.3%
Applied rewrites57.3%
if -8.1999999999999996e-259 < F < 7.7999999999999998e-122Initial program 76.9%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6455.8%
Applied rewrites55.8%
lift-*.f64N/A
metadata-evalN/A
distribute-lft-neg-outN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
div-flip-revN/A
lift-sin.f64N/A
lift-cos.f64N/A
tan-quotN/A
lift-tan.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-*l*N/A
*-lft-identityN/A
*-commutativeN/A
Applied rewrites55.9%
if 7.7999999999999998e-122 < F < 4.4999999999999998e-15Initial program 76.9%
Taylor expanded in B around 0
lower-/.f6449.2%
Applied rewrites49.2%
Taylor expanded in F around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-+.f64N/A
lower-*.f64N/A
metadata-evalN/A
metadata-evalN/A
lower-sin.f6435.7%
Applied rewrites35.7%
if 4.4999999999999998e-15 < F Initial program 76.9%
lift-+.f64N/A
add-flipN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
distribute-neg-frac2N/A
sub-to-fractionN/A
lower-/.f64N/A
Applied rewrites85.1%
Applied rewrites85.1%
Taylor expanded in F around inf
Applied rewrites56.5%
(FPCore (F B x)
:precision binary64
(let* ((t_0
(+ (- (/ x B)) (/ (* F (pow (+ 2 (* 2 x)) -1/2)) (sin B)))))
(if (<=
F
-6284457040522883/1461501637330902918203684832716283019655932542976)
(/ (+ 1 (* x (cos B))) (- (sin B)))
(if (<=
F
-3548786815231963/4327788799063369698118367518036104040602397294887907509272254128346512609744690048814426160231687683233172643784762398137404191207445999921156415311568401014033503715319849649510248592805285405106374515984066055406780647774220793764564147394699562815402300054714269682368512)
t_0
(if (<=
F
7256757823367339/93035356709837681990313447409664580397266094167976711716030745495121828878514934185752454491361736391777602765602070775492429008462675968)
(/ (- x) (tan B))
(if (<= F 713053462628379/158456325028528675187087900672)
t_0
(/ (- 1 (* (cos B) x)) (sin B))))))))double code(double F, double B, double x) {
double t_0 = -(x / B) + ((F * pow((2.0 + (2.0 * x)), -0.5)) / sin(B));
double tmp;
if (F <= -4.3e-33) {
tmp = (1.0 + (x * cos(B))) / -sin(B);
} else if (F <= -8.2e-259) {
tmp = t_0;
} else if (F <= 7.8e-122) {
tmp = -x / tan(B);
} else if (F <= 4.5e-15) {
tmp = t_0;
} 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 / b) + ((f * ((2.0d0 + (2.0d0 * x)) ** (-0.5d0))) / sin(b))
if (f <= (-4.3d-33)) then
tmp = (1.0d0 + (x * cos(b))) / -sin(b)
else if (f <= (-8.2d-259)) then
tmp = t_0
else if (f <= 7.8d-122) then
tmp = -x / tan(b)
else if (f <= 4.5d-15) then
tmp = t_0
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 / B) + ((F * Math.pow((2.0 + (2.0 * x)), -0.5)) / Math.sin(B));
double tmp;
if (F <= -4.3e-33) {
tmp = (1.0 + (x * Math.cos(B))) / -Math.sin(B);
} else if (F <= -8.2e-259) {
tmp = t_0;
} else if (F <= 7.8e-122) {
tmp = -x / Math.tan(B);
} else if (F <= 4.5e-15) {
tmp = t_0;
} else {
tmp = (1.0 - (Math.cos(B) * x)) / Math.sin(B);
}
return tmp;
}
def code(F, B, x): t_0 = -(x / B) + ((F * math.pow((2.0 + (2.0 * x)), -0.5)) / math.sin(B)) tmp = 0 if F <= -4.3e-33: tmp = (1.0 + (x * math.cos(B))) / -math.sin(B) elif F <= -8.2e-259: tmp = t_0 elif F <= 7.8e-122: tmp = -x / math.tan(B) elif F <= 4.5e-15: tmp = t_0 else: tmp = (1.0 - (math.cos(B) * x)) / math.sin(B) return tmp
function code(F, B, x) t_0 = Float64(Float64(-Float64(x / B)) + Float64(Float64(F * (Float64(2.0 + Float64(2.0 * x)) ^ -0.5)) / sin(B))) tmp = 0.0 if (F <= -4.3e-33) tmp = Float64(Float64(1.0 + Float64(x * cos(B))) / Float64(-sin(B))); elseif (F <= -8.2e-259) tmp = t_0; elseif (F <= 7.8e-122) tmp = Float64(Float64(-x) / tan(B)); elseif (F <= 4.5e-15) tmp = t_0; 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 / B) + ((F * ((2.0 + (2.0 * x)) ^ -0.5)) / sin(B)); tmp = 0.0; if (F <= -4.3e-33) tmp = (1.0 + (x * cos(B))) / -sin(B); elseif (F <= -8.2e-259) tmp = t_0; elseif (F <= 7.8e-122) tmp = -x / tan(B); elseif (F <= 4.5e-15) tmp = t_0; else tmp = (1.0 - (cos(B) * x)) / sin(B); end tmp_2 = tmp; end
code[F_, B_, x_] := Block[{t$95$0 = N[((-N[(x / B), $MachinePrecision]) + N[(N[(F * N[Power[N[(2 + N[(2 * x), $MachinePrecision]), $MachinePrecision], -1/2], $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -6284457040522883/1461501637330902918203684832716283019655932542976], N[(N[(1 + N[(x * N[Cos[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / (-N[Sin[B], $MachinePrecision])), $MachinePrecision], If[LessEqual[F, -3548786815231963/4327788799063369698118367518036104040602397294887907509272254128346512609744690048814426160231687683233172643784762398137404191207445999921156415311568401014033503715319849649510248592805285405106374515984066055406780647774220793764564147394699562815402300054714269682368512], t$95$0, If[LessEqual[F, 7256757823367339/93035356709837681990313447409664580397266094167976711716030745495121828878514934185752454491361736391777602765602070775492429008462675968], N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 713053462628379/158456325028528675187087900672], t$95$0, N[(N[(1 - N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
t_0 := \left(-\frac{x}{B}\right) + \frac{F \cdot {\left(2 + 2 \cdot x\right)}^{\frac{-1}{2}}}{\sin B}\\
\mathbf{if}\;F \leq \frac{-6284457040522883}{1461501637330902918203684832716283019655932542976}:\\
\;\;\;\;\frac{1 + x \cdot \cos B}{-\sin B}\\
\mathbf{elif}\;F \leq \frac{-3548786815231963}{4327788799063369698118367518036104040602397294887907509272254128346512609744690048814426160231687683233172643784762398137404191207445999921156415311568401014033503715319849649510248592805285405106374515984066055406780647774220793764564147394699562815402300054714269682368512}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;F \leq \frac{7256757823367339}{93035356709837681990313447409664580397266094167976711716030745495121828878514934185752454491361736391777602765602070775492429008462675968}:\\
\;\;\;\;\frac{-x}{\tan B}\\
\mathbf{elif}\;F \leq \frac{713053462628379}{158456325028528675187087900672}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - \cos B \cdot x}{\sin B}\\
\end{array}
if F < -4.3000000000000003e-33Initial program 76.9%
lift-+.f64N/A
add-flipN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
distribute-neg-frac2N/A
sub-to-fractionN/A
lower-/.f64N/A
Applied rewrites85.1%
Taylor expanded in F around -inf
lower-*.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-/.f6451.4%
Applied rewrites51.4%
Taylor expanded in F around -inf
lower-+.f64N/A
lower-*.f64N/A
lower-cos.f6455.8%
Applied rewrites55.8%
if -4.3000000000000003e-33 < F < -8.1999999999999996e-259 or 7.7999999999999998e-122 < F < 4.4999999999999998e-15Initial program 76.9%
Taylor expanded in B around 0
lower-/.f6449.2%
Applied rewrites49.2%
Taylor expanded in F around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-+.f64N/A
lower-*.f64N/A
metadata-evalN/A
metadata-evalN/A
lower-sin.f6435.7%
Applied rewrites35.7%
if -8.1999999999999996e-259 < F < 7.7999999999999998e-122Initial program 76.9%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6455.8%
Applied rewrites55.8%
lift-*.f64N/A
metadata-evalN/A
distribute-lft-neg-outN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
div-flip-revN/A
lift-sin.f64N/A
lift-cos.f64N/A
tan-quotN/A
lift-tan.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-*l*N/A
*-lft-identityN/A
*-commutativeN/A
Applied rewrites55.9%
if 4.4999999999999998e-15 < F Initial program 76.9%
lift-+.f64N/A
add-flipN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
distribute-neg-frac2N/A
sub-to-fractionN/A
lower-/.f64N/A
Applied rewrites85.1%
Applied rewrites85.1%
Taylor expanded in F around inf
Applied rewrites56.5%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (- (* (pow (- (+ x x) -2) -1/2) (/ F (sin B))) (/ x B))))
(if (<=
F
-6284457040522883/1461501637330902918203684832716283019655932542976)
(/ (+ 1 (* x (cos B))) (- (sin B)))
(if (<=
F
-3548786815231963/4327788799063369698118367518036104040602397294887907509272254128346512609744690048814426160231687683233172643784762398137404191207445999921156415311568401014033503715319849649510248592805285405106374515984066055406780647774220793764564147394699562815402300054714269682368512)
t_0
(if (<=
F
5470679174164527/14396524142538228424993723224595141948383030778566133225922417832357880258148761185020930195532450742879746914027266864394266451377581759004827248578768524336431104)
(/ (- x) (tan B))
(if (<= F 713053462628379/158456325028528675187087900672)
t_0
(/ (- 1 (* (cos B) x)) (sin B))))))))double code(double F, double B, double x) {
double t_0 = (pow(((x + x) - -2.0), -0.5) * (F / sin(B))) - (x / B);
double tmp;
if (F <= -4.3e-33) {
tmp = (1.0 + (x * cos(B))) / -sin(B);
} else if (F <= -8.2e-259) {
tmp = t_0;
} else if (F <= 3.8e-148) {
tmp = -x / tan(B);
} else if (F <= 4.5e-15) {
tmp = t_0;
} 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 + x) - (-2.0d0)) ** (-0.5d0)) * (f / sin(b))) - (x / b)
if (f <= (-4.3d-33)) then
tmp = (1.0d0 + (x * cos(b))) / -sin(b)
else if (f <= (-8.2d-259)) then
tmp = t_0
else if (f <= 3.8d-148) then
tmp = -x / tan(b)
else if (f <= 4.5d-15) then
tmp = t_0
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 = (Math.pow(((x + x) - -2.0), -0.5) * (F / Math.sin(B))) - (x / B);
double tmp;
if (F <= -4.3e-33) {
tmp = (1.0 + (x * Math.cos(B))) / -Math.sin(B);
} else if (F <= -8.2e-259) {
tmp = t_0;
} else if (F <= 3.8e-148) {
tmp = -x / Math.tan(B);
} else if (F <= 4.5e-15) {
tmp = t_0;
} else {
tmp = (1.0 - (Math.cos(B) * x)) / Math.sin(B);
}
return tmp;
}
def code(F, B, x): t_0 = (math.pow(((x + x) - -2.0), -0.5) * (F / math.sin(B))) - (x / B) tmp = 0 if F <= -4.3e-33: tmp = (1.0 + (x * math.cos(B))) / -math.sin(B) elif F <= -8.2e-259: tmp = t_0 elif F <= 3.8e-148: tmp = -x / math.tan(B) elif F <= 4.5e-15: tmp = t_0 else: tmp = (1.0 - (math.cos(B) * x)) / math.sin(B) return tmp
function code(F, B, x) t_0 = Float64(Float64((Float64(Float64(x + x) - -2.0) ^ -0.5) * Float64(F / sin(B))) - Float64(x / B)) tmp = 0.0 if (F <= -4.3e-33) tmp = Float64(Float64(1.0 + Float64(x * cos(B))) / Float64(-sin(B))); elseif (F <= -8.2e-259) tmp = t_0; elseif (F <= 3.8e-148) tmp = Float64(Float64(-x) / tan(B)); elseif (F <= 4.5e-15) tmp = t_0; 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 + x) - -2.0) ^ -0.5) * (F / sin(B))) - (x / B); tmp = 0.0; if (F <= -4.3e-33) tmp = (1.0 + (x * cos(B))) / -sin(B); elseif (F <= -8.2e-259) tmp = t_0; elseif (F <= 3.8e-148) tmp = -x / tan(B); elseif (F <= 4.5e-15) tmp = t_0; else tmp = (1.0 - (cos(B) * x)) / sin(B); end tmp_2 = tmp; end
code[F_, B_, x_] := Block[{t$95$0 = N[(N[(N[Power[N[(N[(x + x), $MachinePrecision] - -2), $MachinePrecision], -1/2], $MachinePrecision] * N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -6284457040522883/1461501637330902918203684832716283019655932542976], N[(N[(1 + N[(x * N[Cos[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / (-N[Sin[B], $MachinePrecision])), $MachinePrecision], If[LessEqual[F, -3548786815231963/4327788799063369698118367518036104040602397294887907509272254128346512609744690048814426160231687683233172643784762398137404191207445999921156415311568401014033503715319849649510248592805285405106374515984066055406780647774220793764564147394699562815402300054714269682368512], t$95$0, If[LessEqual[F, 5470679174164527/14396524142538228424993723224595141948383030778566133225922417832357880258148761185020930195532450742879746914027266864394266451377581759004827248578768524336431104], N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 713053462628379/158456325028528675187087900672], t$95$0, N[(N[(1 - N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
t_0 := {\left(\left(x + x\right) - -2\right)}^{\frac{-1}{2}} \cdot \frac{F}{\sin B} - \frac{x}{B}\\
\mathbf{if}\;F \leq \frac{-6284457040522883}{1461501637330902918203684832716283019655932542976}:\\
\;\;\;\;\frac{1 + x \cdot \cos B}{-\sin B}\\
\mathbf{elif}\;F \leq \frac{-3548786815231963}{4327788799063369698118367518036104040602397294887907509272254128346512609744690048814426160231687683233172643784762398137404191207445999921156415311568401014033503715319849649510248592805285405106374515984066055406780647774220793764564147394699562815402300054714269682368512}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;F \leq \frac{5470679174164527}{14396524142538228424993723224595141948383030778566133225922417832357880258148761185020930195532450742879746914027266864394266451377581759004827248578768524336431104}:\\
\;\;\;\;\frac{-x}{\tan B}\\
\mathbf{elif}\;F \leq \frac{713053462628379}{158456325028528675187087900672}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - \cos B \cdot x}{\sin B}\\
\end{array}
if F < -4.3000000000000003e-33Initial program 76.9%
lift-+.f64N/A
add-flipN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
distribute-neg-frac2N/A
sub-to-fractionN/A
lower-/.f64N/A
Applied rewrites85.1%
Taylor expanded in F around -inf
lower-*.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-/.f6451.4%
Applied rewrites51.4%
Taylor expanded in F around -inf
lower-+.f64N/A
lower-*.f64N/A
lower-cos.f6455.8%
Applied rewrites55.8%
if -4.3000000000000003e-33 < F < -8.1999999999999996e-259 or 3.8000000000000001e-148 < F < 4.4999999999999998e-15Initial program 76.9%
Taylor expanded in B around 0
lower-/.f6449.2%
Applied rewrites49.2%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6449.2%
Applied rewrites49.2%
Taylor expanded in F around 0
Applied rewrites35.1%
if -8.1999999999999996e-259 < F < 3.8000000000000001e-148Initial program 76.9%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6455.8%
Applied rewrites55.8%
lift-*.f64N/A
metadata-evalN/A
distribute-lft-neg-outN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
div-flip-revN/A
lift-sin.f64N/A
lift-cos.f64N/A
tan-quotN/A
lift-tan.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-*l*N/A
*-lft-identityN/A
*-commutativeN/A
Applied rewrites55.9%
if 4.4999999999999998e-15 < F Initial program 76.9%
lift-+.f64N/A
add-flipN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
distribute-neg-frac2N/A
sub-to-fractionN/A
lower-/.f64N/A
Applied rewrites85.1%
Applied rewrites85.1%
Taylor expanded in F around inf
Applied rewrites56.5%
(FPCore (F B x)
:precision binary64
(if (<=
F
-1010998000018149/3369993333393829974333376885877453834204643052817571560137951281152)
(/ (+ 1 (* x (cos B))) (- (sin B)))
(if (<=
F
5057235284857433/3064991081731777716716694054300618367237478244367204352)
(/ (- x) (tan B))
(/ (- 1 (* (cos B) x)) (sin B)))))double code(double F, double B, double x) {
double tmp;
if (F <= -3e-52) {
tmp = (1.0 + (x * cos(B))) / -sin(B);
} else if (F <= 1.65e-39) {
tmp = -x / tan(B);
} else {
tmp = (1.0 - (cos(B) * x)) / sin(B);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: tmp
if (f <= (-3d-52)) then
tmp = (1.0d0 + (x * cos(b))) / -sin(b)
else if (f <= 1.65d-39) then
tmp = -x / tan(b)
else
tmp = (1.0d0 - (cos(b) * x)) / sin(b)
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -3e-52) {
tmp = (1.0 + (x * Math.cos(B))) / -Math.sin(B);
} else if (F <= 1.65e-39) {
tmp = -x / Math.tan(B);
} else {
tmp = (1.0 - (Math.cos(B) * x)) / Math.sin(B);
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -3e-52: tmp = (1.0 + (x * math.cos(B))) / -math.sin(B) elif F <= 1.65e-39: tmp = -x / math.tan(B) else: tmp = (1.0 - (math.cos(B) * x)) / math.sin(B) return tmp
function code(F, B, x) tmp = 0.0 if (F <= -3e-52) tmp = Float64(Float64(1.0 + Float64(x * cos(B))) / Float64(-sin(B))); elseif (F <= 1.65e-39) tmp = Float64(Float64(-x) / tan(B)); else tmp = Float64(Float64(1.0 - Float64(cos(B) * x)) / sin(B)); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -3e-52) tmp = (1.0 + (x * cos(B))) / -sin(B); elseif (F <= 1.65e-39) tmp = -x / tan(B); else tmp = (1.0 - (cos(B) * x)) / sin(B); end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -1010998000018149/3369993333393829974333376885877453834204643052817571560137951281152], N[(N[(1 + N[(x * N[Cos[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / (-N[Sin[B], $MachinePrecision])), $MachinePrecision], If[LessEqual[F, 5057235284857433/3064991081731777716716694054300618367237478244367204352], N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision], N[(N[(1 - N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;F \leq \frac{-1010998000018149}{3369993333393829974333376885877453834204643052817571560137951281152}:\\
\;\;\;\;\frac{1 + x \cdot \cos B}{-\sin B}\\
\mathbf{elif}\;F \leq \frac{5057235284857433}{3064991081731777716716694054300618367237478244367204352}:\\
\;\;\;\;\frac{-x}{\tan B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - \cos B \cdot x}{\sin B}\\
\end{array}
if F < -3e-52Initial program 76.9%
lift-+.f64N/A
add-flipN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
distribute-neg-frac2N/A
sub-to-fractionN/A
lower-/.f64N/A
Applied rewrites85.1%
Taylor expanded in F around -inf
lower-*.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-/.f6451.4%
Applied rewrites51.4%
Taylor expanded in F around -inf
lower-+.f64N/A
lower-*.f64N/A
lower-cos.f6455.8%
Applied rewrites55.8%
if -3e-52 < F < 1.6499999999999999e-39Initial program 76.9%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6455.8%
Applied rewrites55.8%
lift-*.f64N/A
metadata-evalN/A
distribute-lft-neg-outN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
div-flip-revN/A
lift-sin.f64N/A
lift-cos.f64N/A
tan-quotN/A
lift-tan.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-*l*N/A
*-lft-identityN/A
*-commutativeN/A
Applied rewrites55.9%
if 1.6499999999999999e-39 < F Initial program 76.9%
lift-+.f64N/A
add-flipN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
distribute-neg-frac2N/A
sub-to-fractionN/A
lower-/.f64N/A
Applied rewrites85.1%
Applied rewrites85.1%
Taylor expanded in F around inf
Applied rewrites56.5%
(FPCore (F B x)
:precision binary64
(if (<= F -800000000000)
(/ (* -1 (* F (- (* -1 (/ x F)) (/ 1 F)))) (- (sin B)))
(if (<=
F
-3548786815231963/4327788799063369698118367518036104040602397294887907509272254128346512609744690048814426160231687683233172643784762398137404191207445999921156415311568401014033503715319849649510248592805285405106374515984066055406780647774220793764564147394699562815402300054714269682368512)
(+
(- (/ x B))
(* (/ F B) (pow (+ (+ (* F F) 2) (* 2 x)) (- (/ 1 2)))))
(if (<=
F
5057235284857433/3064991081731777716716694054300618367237478244367204352)
(/ (- x) (tan B))
(/ (- 1 (* (cos B) x)) (sin B))))))double code(double F, double B, double x) {
double tmp;
if (F <= -800000000000.0) {
tmp = (-1.0 * (F * ((-1.0 * (x / F)) - (1.0 / F)))) / -sin(B);
} else if (F <= -8.2e-259) {
tmp = -(x / B) + ((F / B) * pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
} else if (F <= 1.65e-39) {
tmp = -x / tan(B);
} else {
tmp = (1.0 - (cos(B) * x)) / sin(B);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: tmp
if (f <= (-800000000000.0d0)) then
tmp = ((-1.0d0) * (f * (((-1.0d0) * (x / f)) - (1.0d0 / f)))) / -sin(b)
else if (f <= (-8.2d-259)) then
tmp = -(x / b) + ((f / b) * ((((f * f) + 2.0d0) + (2.0d0 * x)) ** -(1.0d0 / 2.0d0)))
else if (f <= 1.65d-39) then
tmp = -x / tan(b)
else
tmp = (1.0d0 - (cos(b) * x)) / sin(b)
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -800000000000.0) {
tmp = (-1.0 * (F * ((-1.0 * (x / F)) - (1.0 / F)))) / -Math.sin(B);
} else if (F <= -8.2e-259) {
tmp = -(x / B) + ((F / B) * Math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
} else if (F <= 1.65e-39) {
tmp = -x / Math.tan(B);
} else {
tmp = (1.0 - (Math.cos(B) * x)) / Math.sin(B);
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -800000000000.0: tmp = (-1.0 * (F * ((-1.0 * (x / F)) - (1.0 / F)))) / -math.sin(B) elif F <= -8.2e-259: tmp = -(x / B) + ((F / B) * math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0))) elif F <= 1.65e-39: tmp = -x / math.tan(B) else: tmp = (1.0 - (math.cos(B) * x)) / math.sin(B) return tmp
function code(F, B, x) tmp = 0.0 if (F <= -800000000000.0) tmp = Float64(Float64(-1.0 * Float64(F * Float64(Float64(-1.0 * Float64(x / F)) - Float64(1.0 / F)))) / Float64(-sin(B))); elseif (F <= -8.2e-259) tmp = Float64(Float64(-Float64(x / B)) + Float64(Float64(F / B) * (Float64(Float64(Float64(F * F) + 2.0) + Float64(2.0 * x)) ^ Float64(-Float64(1.0 / 2.0))))); elseif (F <= 1.65e-39) tmp = Float64(Float64(-x) / tan(B)); else tmp = Float64(Float64(1.0 - Float64(cos(B) * x)) / sin(B)); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -800000000000.0) tmp = (-1.0 * (F * ((-1.0 * (x / F)) - (1.0 / F)))) / -sin(B); elseif (F <= -8.2e-259) tmp = -(x / B) + ((F / B) * ((((F * F) + 2.0) + (2.0 * x)) ^ -(1.0 / 2.0))); elseif (F <= 1.65e-39) tmp = -x / tan(B); else tmp = (1.0 - (cos(B) * x)) / sin(B); end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -800000000000], N[(N[(-1 * N[(F * N[(N[(-1 * N[(x / F), $MachinePrecision]), $MachinePrecision] - N[(1 / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / (-N[Sin[B], $MachinePrecision])), $MachinePrecision], If[LessEqual[F, -3548786815231963/4327788799063369698118367518036104040602397294887907509272254128346512609744690048814426160231687683233172643784762398137404191207445999921156415311568401014033503715319849649510248592805285405106374515984066055406780647774220793764564147394699562815402300054714269682368512], N[((-N[(x / B), $MachinePrecision]) + N[(N[(F / B), $MachinePrecision] * N[Power[N[(N[(N[(F * F), $MachinePrecision] + 2), $MachinePrecision] + N[(2 * x), $MachinePrecision]), $MachinePrecision], (-N[(1 / 2), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 5057235284857433/3064991081731777716716694054300618367237478244367204352], N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision], N[(N[(1 - N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\mathbf{if}\;F \leq -800000000000:\\
\;\;\;\;\frac{-1 \cdot \left(F \cdot \left(-1 \cdot \frac{x}{F} - \frac{1}{F}\right)\right)}{-\sin B}\\
\mathbf{elif}\;F \leq \frac{-3548786815231963}{4327788799063369698118367518036104040602397294887907509272254128346512609744690048814426160231687683233172643784762398137404191207445999921156415311568401014033503715319849649510248592805285405106374515984066055406780647774220793764564147394699562815402300054714269682368512}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{F}{B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}\\
\mathbf{elif}\;F \leq \frac{5057235284857433}{3064991081731777716716694054300618367237478244367204352}:\\
\;\;\;\;\frac{-x}{\tan B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - \cos B \cdot x}{\sin B}\\
\end{array}
if F < -8e11Initial program 76.9%
lift-+.f64N/A
add-flipN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
distribute-neg-frac2N/A
sub-to-fractionN/A
lower-/.f64N/A
Applied rewrites85.1%
Taylor expanded in F around -inf
lower-*.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-/.f6451.4%
Applied rewrites51.4%
Taylor expanded in B around 0
Applied rewrites35.9%
if -8e11 < F < -8.1999999999999996e-259Initial program 76.9%
Taylor expanded in B around 0
lower-/.f6449.2%
Applied rewrites49.2%
Taylor expanded in B around 0
lower-/.f6435.5%
Applied rewrites35.5%
if -8.1999999999999996e-259 < F < 1.6499999999999999e-39Initial program 76.9%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6455.8%
Applied rewrites55.8%
lift-*.f64N/A
metadata-evalN/A
distribute-lft-neg-outN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
div-flip-revN/A
lift-sin.f64N/A
lift-cos.f64N/A
tan-quotN/A
lift-tan.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-*l*N/A
*-lft-identityN/A
*-commutativeN/A
Applied rewrites55.9%
if 1.6499999999999999e-39 < F Initial program 76.9%
lift-+.f64N/A
add-flipN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
distribute-neg-frac2N/A
sub-to-fractionN/A
lower-/.f64N/A
Applied rewrites85.1%
Applied rewrites85.1%
Taylor expanded in F around inf
Applied rewrites56.5%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (- (/ x B))))
(if (<= F -800000000000)
(/ (* -1 (* F (- (* -1 (/ x F)) (/ 1 F)))) (- (sin B)))
(if (<=
F
-3548786815231963/4327788799063369698118367518036104040602397294887907509272254128346512609744690048814426160231687683233172643784762398137404191207445999921156415311568401014033503715319849649510248592805285405106374515984066055406780647774220793764564147394699562815402300054714269682368512)
(+ t_0 (* (/ F B) (pow (+ (+ (* F F) 2) (* 2 x)) (- (/ 1 2)))))
(if (<= F 1850000000000)
(/ (- x) (tan B))
(+ t_0 (/ 1 (sin B))))))))double code(double F, double B, double x) {
double t_0 = -(x / B);
double tmp;
if (F <= -800000000000.0) {
tmp = (-1.0 * (F * ((-1.0 * (x / F)) - (1.0 / F)))) / -sin(B);
} else if (F <= -8.2e-259) {
tmp = t_0 + ((F / B) * pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
} else if (F <= 1850000000000.0) {
tmp = -x / tan(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 / b)
if (f <= (-800000000000.0d0)) then
tmp = ((-1.0d0) * (f * (((-1.0d0) * (x / f)) - (1.0d0 / f)))) / -sin(b)
else if (f <= (-8.2d-259)) then
tmp = t_0 + ((f / b) * ((((f * f) + 2.0d0) + (2.0d0 * x)) ** -(1.0d0 / 2.0d0)))
else if (f <= 1850000000000.0d0) then
tmp = -x / tan(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 / B);
double tmp;
if (F <= -800000000000.0) {
tmp = (-1.0 * (F * ((-1.0 * (x / F)) - (1.0 / F)))) / -Math.sin(B);
} else if (F <= -8.2e-259) {
tmp = t_0 + ((F / B) * Math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
} else if (F <= 1850000000000.0) {
tmp = -x / Math.tan(B);
} else {
tmp = t_0 + (1.0 / Math.sin(B));
}
return tmp;
}
def code(F, B, x): t_0 = -(x / B) tmp = 0 if F <= -800000000000.0: tmp = (-1.0 * (F * ((-1.0 * (x / F)) - (1.0 / F)))) / -math.sin(B) elif F <= -8.2e-259: tmp = t_0 + ((F / B) * math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0))) elif F <= 1850000000000.0: tmp = -x / math.tan(B) else: tmp = t_0 + (1.0 / math.sin(B)) return tmp
function code(F, B, x) t_0 = Float64(-Float64(x / B)) tmp = 0.0 if (F <= -800000000000.0) tmp = Float64(Float64(-1.0 * Float64(F * Float64(Float64(-1.0 * Float64(x / F)) - Float64(1.0 / F)))) / Float64(-sin(B))); elseif (F <= -8.2e-259) tmp = Float64(t_0 + Float64(Float64(F / B) * (Float64(Float64(Float64(F * F) + 2.0) + Float64(2.0 * x)) ^ Float64(-Float64(1.0 / 2.0))))); elseif (F <= 1850000000000.0) tmp = Float64(Float64(-x) / tan(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 / B); tmp = 0.0; if (F <= -800000000000.0) tmp = (-1.0 * (F * ((-1.0 * (x / F)) - (1.0 / F)))) / -sin(B); elseif (F <= -8.2e-259) tmp = t_0 + ((F / B) * ((((F * F) + 2.0) + (2.0 * x)) ^ -(1.0 / 2.0))); elseif (F <= 1850000000000.0) tmp = -x / tan(B); else tmp = t_0 + (1.0 / sin(B)); end tmp_2 = tmp; end
code[F_, B_, x_] := Block[{t$95$0 = (-N[(x / B), $MachinePrecision])}, If[LessEqual[F, -800000000000], N[(N[(-1 * N[(F * N[(N[(-1 * N[(x / F), $MachinePrecision]), $MachinePrecision] - N[(1 / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / (-N[Sin[B], $MachinePrecision])), $MachinePrecision], If[LessEqual[F, -3548786815231963/4327788799063369698118367518036104040602397294887907509272254128346512609744690048814426160231687683233172643784762398137404191207445999921156415311568401014033503715319849649510248592805285405106374515984066055406780647774220793764564147394699562815402300054714269682368512], N[(t$95$0 + N[(N[(F / B), $MachinePrecision] * N[Power[N[(N[(N[(F * F), $MachinePrecision] + 2), $MachinePrecision] + N[(2 * x), $MachinePrecision]), $MachinePrecision], (-N[(1 / 2), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1850000000000], N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(1 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := -\frac{x}{B}\\
\mathbf{if}\;F \leq -800000000000:\\
\;\;\;\;\frac{-1 \cdot \left(F \cdot \left(-1 \cdot \frac{x}{F} - \frac{1}{F}\right)\right)}{-\sin B}\\
\mathbf{elif}\;F \leq \frac{-3548786815231963}{4327788799063369698118367518036104040602397294887907509272254128346512609744690048814426160231687683233172643784762398137404191207445999921156415311568401014033503715319849649510248592805285405106374515984066055406780647774220793764564147394699562815402300054714269682368512}:\\
\;\;\;\;t\_0 + \frac{F}{B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}\\
\mathbf{elif}\;F \leq 1850000000000:\\
\;\;\;\;\frac{-x}{\tan B}\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \frac{1}{\sin B}\\
\end{array}
if F < -8e11Initial program 76.9%
lift-+.f64N/A
add-flipN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
distribute-neg-frac2N/A
sub-to-fractionN/A
lower-/.f64N/A
Applied rewrites85.1%
Taylor expanded in F around -inf
lower-*.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-/.f6451.4%
Applied rewrites51.4%
Taylor expanded in B around 0
Applied rewrites35.9%
if -8e11 < F < -8.1999999999999996e-259Initial program 76.9%
Taylor expanded in B around 0
lower-/.f6449.2%
Applied rewrites49.2%
Taylor expanded in B around 0
lower-/.f6435.5%
Applied rewrites35.5%
if -8.1999999999999996e-259 < F < 1.85e12Initial program 76.9%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6455.8%
Applied rewrites55.8%
lift-*.f64N/A
metadata-evalN/A
distribute-lft-neg-outN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
div-flip-revN/A
lift-sin.f64N/A
lift-cos.f64N/A
tan-quotN/A
lift-tan.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-*l*N/A
*-lft-identityN/A
*-commutativeN/A
Applied rewrites55.9%
if 1.85e12 < F Initial program 76.9%
Taylor expanded in B around 0
lower-/.f6449.2%
Applied rewrites49.2%
Taylor expanded in F around inf
lower-/.f64N/A
lower-sin.f6436.4%
Applied rewrites36.4%
(FPCore (F B x)
:precision binary64
(if (<= F -631383297997835/332306998946228968225951765070086144)
(/ (* -1 (* F (- (* -1 (/ x F)) (/ 1 F)))) (- (sin B)))
(if (<= F 1850000000000)
(/ (- x) (tan B))
(+ (- (/ x B)) (/ 1 (sin B))))))double code(double F, double B, double x) {
double tmp;
if (F <= -1.9e-21) {
tmp = (-1.0 * (F * ((-1.0 * (x / F)) - (1.0 / F)))) / -sin(B);
} else if (F <= 1850000000000.0) {
tmp = -x / tan(B);
} else {
tmp = -(x / B) + (1.0 / sin(B));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: tmp
if (f <= (-1.9d-21)) then
tmp = ((-1.0d0) * (f * (((-1.0d0) * (x / f)) - (1.0d0 / f)))) / -sin(b)
else if (f <= 1850000000000.0d0) then
tmp = -x / tan(b)
else
tmp = -(x / b) + (1.0d0 / sin(b))
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -1.9e-21) {
tmp = (-1.0 * (F * ((-1.0 * (x / F)) - (1.0 / F)))) / -Math.sin(B);
} else if (F <= 1850000000000.0) {
tmp = -x / Math.tan(B);
} else {
tmp = -(x / B) + (1.0 / Math.sin(B));
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -1.9e-21: tmp = (-1.0 * (F * ((-1.0 * (x / F)) - (1.0 / F)))) / -math.sin(B) elif F <= 1850000000000.0: tmp = -x / math.tan(B) else: tmp = -(x / B) + (1.0 / math.sin(B)) return tmp
function code(F, B, x) tmp = 0.0 if (F <= -1.9e-21) tmp = Float64(Float64(-1.0 * Float64(F * Float64(Float64(-1.0 * Float64(x / F)) - Float64(1.0 / F)))) / Float64(-sin(B))); elseif (F <= 1850000000000.0) tmp = Float64(Float64(-x) / tan(B)); else tmp = Float64(Float64(-Float64(x / B)) + Float64(1.0 / sin(B))); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -1.9e-21) tmp = (-1.0 * (F * ((-1.0 * (x / F)) - (1.0 / F)))) / -sin(B); elseif (F <= 1850000000000.0) tmp = -x / tan(B); else tmp = -(x / B) + (1.0 / sin(B)); end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -631383297997835/332306998946228968225951765070086144], N[(N[(-1 * N[(F * N[(N[(-1 * N[(x / F), $MachinePrecision]), $MachinePrecision] - N[(1 / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / (-N[Sin[B], $MachinePrecision])), $MachinePrecision], If[LessEqual[F, 1850000000000], N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision], N[((-N[(x / B), $MachinePrecision]) + N[(1 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;F \leq \frac{-631383297997835}{332306998946228968225951765070086144}:\\
\;\;\;\;\frac{-1 \cdot \left(F \cdot \left(-1 \cdot \frac{x}{F} - \frac{1}{F}\right)\right)}{-\sin B}\\
\mathbf{elif}\;F \leq 1850000000000:\\
\;\;\;\;\frac{-x}{\tan B}\\
\mathbf{else}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{1}{\sin B}\\
\end{array}
if F < -1.8999999999999999e-21Initial program 76.9%
lift-+.f64N/A
add-flipN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
distribute-neg-frac2N/A
sub-to-fractionN/A
lower-/.f64N/A
Applied rewrites85.1%
Taylor expanded in F around -inf
lower-*.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-/.f6451.4%
Applied rewrites51.4%
Taylor expanded in B around 0
Applied rewrites35.9%
if -1.8999999999999999e-21 < F < 1.85e12Initial program 76.9%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6455.8%
Applied rewrites55.8%
lift-*.f64N/A
metadata-evalN/A
distribute-lft-neg-outN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
div-flip-revN/A
lift-sin.f64N/A
lift-cos.f64N/A
tan-quotN/A
lift-tan.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-*l*N/A
*-lft-identityN/A
*-commutativeN/A
Applied rewrites55.9%
if 1.85e12 < F Initial program 76.9%
Taylor expanded in B around 0
lower-/.f6449.2%
Applied rewrites49.2%
Taylor expanded in F around inf
lower-/.f64N/A
lower-sin.f6436.4%
Applied rewrites36.4%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (- (/ x B))))
(if (<= F -631383297997835/332306998946228968225951765070086144)
(+ t_0 (/ -1 (sin B)))
(if (<= F 1850000000000)
(/ (- x) (tan B))
(+ t_0 (/ 1 (sin B)))))))double code(double F, double B, double x) {
double t_0 = -(x / B);
double tmp;
if (F <= -1.9e-21) {
tmp = t_0 + (-1.0 / sin(B));
} else if (F <= 1850000000000.0) {
tmp = -x / tan(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 / b)
if (f <= (-1.9d-21)) then
tmp = t_0 + ((-1.0d0) / sin(b))
else if (f <= 1850000000000.0d0) then
tmp = -x / tan(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 / B);
double tmp;
if (F <= -1.9e-21) {
tmp = t_0 + (-1.0 / Math.sin(B));
} else if (F <= 1850000000000.0) {
tmp = -x / Math.tan(B);
} else {
tmp = t_0 + (1.0 / Math.sin(B));
}
return tmp;
}
def code(F, B, x): t_0 = -(x / B) tmp = 0 if F <= -1.9e-21: tmp = t_0 + (-1.0 / math.sin(B)) elif F <= 1850000000000.0: tmp = -x / math.tan(B) else: tmp = t_0 + (1.0 / math.sin(B)) return tmp
function code(F, B, x) t_0 = Float64(-Float64(x / B)) tmp = 0.0 if (F <= -1.9e-21) tmp = Float64(t_0 + Float64(-1.0 / sin(B))); elseif (F <= 1850000000000.0) tmp = Float64(Float64(-x) / tan(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 / B); tmp = 0.0; if (F <= -1.9e-21) tmp = t_0 + (-1.0 / sin(B)); elseif (F <= 1850000000000.0) tmp = -x / tan(B); else tmp = t_0 + (1.0 / sin(B)); end tmp_2 = tmp; end
code[F_, B_, x_] := Block[{t$95$0 = (-N[(x / B), $MachinePrecision])}, If[LessEqual[F, -631383297997835/332306998946228968225951765070086144], N[(t$95$0 + N[(-1 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1850000000000], N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(1 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := -\frac{x}{B}\\
\mathbf{if}\;F \leq \frac{-631383297997835}{332306998946228968225951765070086144}:\\
\;\;\;\;t\_0 + \frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 1850000000000:\\
\;\;\;\;\frac{-x}{\tan B}\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \frac{1}{\sin B}\\
\end{array}
if F < -1.8999999999999999e-21Initial program 76.9%
Taylor expanded in B around 0
lower-/.f6449.2%
Applied rewrites49.2%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6435.7%
Applied rewrites35.7%
if -1.8999999999999999e-21 < F < 1.85e12Initial program 76.9%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6455.8%
Applied rewrites55.8%
lift-*.f64N/A
metadata-evalN/A
distribute-lft-neg-outN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
div-flip-revN/A
lift-sin.f64N/A
lift-cos.f64N/A
tan-quotN/A
lift-tan.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-*l*N/A
*-lft-identityN/A
*-commutativeN/A
Applied rewrites55.9%
if 1.85e12 < F Initial program 76.9%
Taylor expanded in B around 0
lower-/.f6449.2%
Applied rewrites49.2%
Taylor expanded in F around inf
lower-/.f64N/A
lower-sin.f6436.4%
Applied rewrites36.4%
(FPCore (F B x)
:precision binary64
(if (<= F -631383297997835/332306998946228968225951765070086144)
(+ (- (/ x B)) (/ -1 (sin B)))
(if (<=
F
2800000000000000113078950170696485178350383232651583988151595665389099233453737098594544983240697983719967744055948864694408373044400218446508962682114742997152086973947001523074882120184614624849536236760622355503693081243909389889239515136)
(/ (- x) (tan B))
(/ -1 (- (sin B))))))double code(double F, double B, double x) {
double tmp;
if (F <= -1.9e-21) {
tmp = -(x / B) + (-1.0 / sin(B));
} else if (F <= 2.8e+240) {
tmp = -x / tan(B);
} else {
tmp = -1.0 / -sin(B);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: tmp
if (f <= (-1.9d-21)) then
tmp = -(x / b) + ((-1.0d0) / sin(b))
else if (f <= 2.8d+240) then
tmp = -x / tan(b)
else
tmp = (-1.0d0) / -sin(b)
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -1.9e-21) {
tmp = -(x / B) + (-1.0 / Math.sin(B));
} else if (F <= 2.8e+240) {
tmp = -x / Math.tan(B);
} else {
tmp = -1.0 / -Math.sin(B);
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -1.9e-21: tmp = -(x / B) + (-1.0 / math.sin(B)) elif F <= 2.8e+240: tmp = -x / math.tan(B) else: tmp = -1.0 / -math.sin(B) return tmp
function code(F, B, x) tmp = 0.0 if (F <= -1.9e-21) tmp = Float64(Float64(-Float64(x / B)) + Float64(-1.0 / sin(B))); elseif (F <= 2.8e+240) tmp = Float64(Float64(-x) / tan(B)); else tmp = Float64(-1.0 / Float64(-sin(B))); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -1.9e-21) tmp = -(x / B) + (-1.0 / sin(B)); elseif (F <= 2.8e+240) tmp = -x / tan(B); else tmp = -1.0 / -sin(B); end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -631383297997835/332306998946228968225951765070086144], N[((-N[(x / B), $MachinePrecision]) + N[(-1 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 2800000000000000113078950170696485178350383232651583988151595665389099233453737098594544983240697983719967744055948864694408373044400218446508962682114742997152086973947001523074882120184614624849536236760622355503693081243909389889239515136], N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision], N[(-1 / (-N[Sin[B], $MachinePrecision])), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;F \leq \frac{-631383297997835}{332306998946228968225951765070086144}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 2800000000000000113078950170696485178350383232651583988151595665389099233453737098594544983240697983719967744055948864694408373044400218446508962682114742997152086973947001523074882120184614624849536236760622355503693081243909389889239515136:\\
\;\;\;\;\frac{-x}{\tan B}\\
\mathbf{else}:\\
\;\;\;\;\frac{-1}{-\sin B}\\
\end{array}
if F < -1.8999999999999999e-21Initial program 76.9%
Taylor expanded in B around 0
lower-/.f6449.2%
Applied rewrites49.2%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6435.7%
Applied rewrites35.7%
if -1.8999999999999999e-21 < F < 2.8000000000000001e240Initial program 76.9%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6455.8%
Applied rewrites55.8%
lift-*.f64N/A
metadata-evalN/A
distribute-lft-neg-outN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
div-flip-revN/A
lift-sin.f64N/A
lift-cos.f64N/A
tan-quotN/A
lift-tan.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-*l*N/A
*-lft-identityN/A
*-commutativeN/A
Applied rewrites55.9%
if 2.8000000000000001e240 < F Initial program 76.9%
lift-+.f64N/A
add-flipN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
distribute-neg-frac2N/A
sub-to-fractionN/A
lower-/.f64N/A
Applied rewrites85.1%
Taylor expanded in F around inf
Applied rewrites17.1%
(FPCore (F B x)
:precision binary64
(if (<=
F
2800000000000000113078950170696485178350383232651583988151595665389099233453737098594544983240697983719967744055948864694408373044400218446508962682114742997152086973947001523074882120184614624849536236760622355503693081243909389889239515136)
(/ (- x) (tan B))
(/ -1 (- (sin B)))))double code(double F, double B, double x) {
double tmp;
if (F <= 2.8e+240) {
tmp = -x / tan(B);
} else {
tmp = -1.0 / -sin(B);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: tmp
if (f <= 2.8d+240) then
tmp = -x / tan(b)
else
tmp = (-1.0d0) / -sin(b)
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= 2.8e+240) {
tmp = -x / Math.tan(B);
} else {
tmp = -1.0 / -Math.sin(B);
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= 2.8e+240: tmp = -x / math.tan(B) else: tmp = -1.0 / -math.sin(B) return tmp
function code(F, B, x) tmp = 0.0 if (F <= 2.8e+240) tmp = Float64(Float64(-x) / tan(B)); else tmp = Float64(-1.0 / Float64(-sin(B))); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= 2.8e+240) tmp = -x / tan(B); else tmp = -1.0 / -sin(B); end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, 2800000000000000113078950170696485178350383232651583988151595665389099233453737098594544983240697983719967744055948864694408373044400218446508962682114742997152086973947001523074882120184614624849536236760622355503693081243909389889239515136], N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision], N[(-1 / (-N[Sin[B], $MachinePrecision])), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;F \leq 2800000000000000113078950170696485178350383232651583988151595665389099233453737098594544983240697983719967744055948864694408373044400218446508962682114742997152086973947001523074882120184614624849536236760622355503693081243909389889239515136:\\
\;\;\;\;\frac{-x}{\tan B}\\
\mathbf{else}:\\
\;\;\;\;\frac{-1}{-\sin B}\\
\end{array}
if F < 2.8000000000000001e240Initial program 76.9%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6455.8%
Applied rewrites55.8%
lift-*.f64N/A
metadata-evalN/A
distribute-lft-neg-outN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
div-flip-revN/A
lift-sin.f64N/A
lift-cos.f64N/A
tan-quotN/A
lift-tan.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-*l*N/A
*-lft-identityN/A
*-commutativeN/A
Applied rewrites55.9%
if 2.8000000000000001e240 < F Initial program 76.9%
lift-+.f64N/A
add-flipN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
distribute-neg-frac2N/A
sub-to-fractionN/A
lower-/.f64N/A
Applied rewrites85.1%
Taylor expanded in F around inf
Applied rewrites17.1%
(FPCore (F B x) :precision binary64 (/ (- x) (tan B)))
double code(double F, double B, double x) {
return -x / tan(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 / tan(b)
end function
public static double code(double F, double B, double x) {
return -x / Math.tan(B);
}
def code(F, B, x): return -x / math.tan(B)
function code(F, B, x) return Float64(Float64(-x) / tan(B)) end
function tmp = code(F, B, x) tmp = -x / tan(B); end
code[F_, B_, x_] := N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]
\frac{-x}{\tan B}
Initial program 76.9%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6455.8%
Applied rewrites55.8%
lift-*.f64N/A
metadata-evalN/A
distribute-lft-neg-outN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
div-flip-revN/A
lift-sin.f64N/A
lift-cos.f64N/A
tan-quotN/A
lift-tan.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-*l*N/A
*-lft-identityN/A
*-commutativeN/A
Applied rewrites55.9%
(FPCore (F B x) :precision binary64 (+ (- (/ x B)) (* (/ F B) (/ -1 F))))
double code(double F, double B, double x) {
return -(x / B) + ((F / B) * (-1.0 / F));
}
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) + ((f / b) * ((-1.0d0) / f))
end function
public static double code(double F, double B, double x) {
return -(x / B) + ((F / B) * (-1.0 / F));
}
def code(F, B, x): return -(x / B) + ((F / B) * (-1.0 / F))
function code(F, B, x) return Float64(Float64(-Float64(x / B)) + Float64(Float64(F / B) * Float64(-1.0 / F))) end
function tmp = code(F, B, x) tmp = -(x / B) + ((F / B) * (-1.0 / F)); end
code[F_, B_, x_] := N[((-N[(x / B), $MachinePrecision]) + N[(N[(F / B), $MachinePrecision] * N[(-1 / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(-\frac{x}{B}\right) + \frac{F}{B} \cdot \frac{-1}{F}
Initial program 76.9%
Taylor expanded in B around 0
lower-/.f6449.2%
Applied rewrites49.2%
Taylor expanded in F around -inf
lower-/.f6427.9%
Applied rewrites27.9%
Taylor expanded in B around 0
lower-/.f6421.3%
Applied rewrites21.3%
herbie shell --seed 2025285 -o generate:evaluate
(FPCore (F B x)
:name "VandenBroeck and Keller, Equation (23)"
:precision binary64
(+ (- (* x (/ 1 (tan B)))) (* (/ F (sin B)) (pow (+ (+ (* F F) 2) (* 2 x)) (- (/ 1 2))))))