
(FPCore (F B x) :precision binary64 (+ (- (* x (/ 1.0 (tan B)))) (* (/ F (sin B)) (pow (+ (+ (* F F) 2.0) (* 2.0 x)) (- (/ 1.0 2.0))))))
double code(double F, double B, double x) {
return -(x * (1.0 / tan(B))) + ((F / sin(B)) * pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
code = -(x * (1.0d0 / tan(b))) + ((f / sin(b)) * ((((f * f) + 2.0d0) + (2.0d0 * x)) ** -(1.0d0 / 2.0d0)))
end function
public static double code(double F, double B, double x) {
return -(x * (1.0 / Math.tan(B))) + ((F / Math.sin(B)) * Math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
}
def code(F, B, x): return -(x * (1.0 / math.tan(B))) + ((F / math.sin(B)) * math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)))
function code(F, B, x) return Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(Float64(F / sin(B)) * (Float64(Float64(Float64(F * F) + 2.0) + Float64(2.0 * x)) ^ Float64(-Float64(1.0 / 2.0))))) end
function tmp = code(F, B, x) tmp = -(x * (1.0 / tan(B))) + ((F / sin(B)) * ((((F * F) + 2.0) + (2.0 * x)) ^ -(1.0 / 2.0))); end
code[F_, B_, x_] := N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(N[(F * F), $MachinePrecision] + 2.0), $MachinePrecision] + N[(2.0 * x), $MachinePrecision]), $MachinePrecision], (-N[(1.0 / 2.0), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\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 18 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (F B x) :precision binary64 (+ (- (* x (/ 1.0 (tan B)))) (* (/ F (sin B)) (pow (+ (+ (* F F) 2.0) (* 2.0 x)) (- (/ 1.0 2.0))))))
double code(double F, double B, double x) {
return -(x * (1.0 / tan(B))) + ((F / sin(B)) * pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
code = -(x * (1.0d0 / tan(b))) + ((f / sin(b)) * ((((f * f) + 2.0d0) + (2.0d0 * x)) ** -(1.0d0 / 2.0d0)))
end function
public static double code(double F, double B, double x) {
return -(x * (1.0 / Math.tan(B))) + ((F / Math.sin(B)) * Math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
}
def code(F, B, x): return -(x * (1.0 / math.tan(B))) + ((F / math.sin(B)) * math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)))
function code(F, B, x) return Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(Float64(F / sin(B)) * (Float64(Float64(Float64(F * F) + 2.0) + Float64(2.0 * x)) ^ Float64(-Float64(1.0 / 2.0))))) end
function tmp = code(F, B, x) tmp = -(x * (1.0 / tan(B))) + ((F / sin(B)) * ((((F * F) + 2.0) + (2.0 * x)) ^ -(1.0 / 2.0))); end
code[F_, B_, x_] := N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(N[(F * F), $MachinePrecision] + 2.0), $MachinePrecision] + N[(2.0 * x), $MachinePrecision]), $MachinePrecision], (-N[(1.0 / 2.0), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\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 (- (sin B))))
(if (<= F -5e+122)
(/ (+ 1.0 (* x (cos B))) t_0)
(if (<= F 1e+106)
(/
(-
(* (/ (- x) (tan B)) t_0)
(* (pow (- (+ x x) (- -2.0 (* F F))) -0.5) F))
t_0)
(+ (- (* x (/ 1.0 (tan B)))) (/ 1.0 (sin B)))))))double code(double F, double B, double x) {
double t_0 = -sin(B);
double tmp;
if (F <= -5e+122) {
tmp = (1.0 + (x * cos(B))) / t_0;
} else if (F <= 1e+106) {
tmp = (((-x / tan(B)) * t_0) - (pow(((x + x) - (-2.0 - (F * F))), -0.5) * F)) / t_0;
} else {
tmp = -(x * (1.0 / tan(B))) + (1.0 / sin(B));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: tmp
t_0 = -sin(b)
if (f <= (-5d+122)) then
tmp = (1.0d0 + (x * cos(b))) / t_0
else if (f <= 1d+106) then
tmp = (((-x / tan(b)) * t_0) - ((((x + x) - ((-2.0d0) - (f * f))) ** (-0.5d0)) * f)) / t_0
else
tmp = -(x * (1.0d0 / tan(b))) + (1.0d0 / sin(b))
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double t_0 = -Math.sin(B);
double tmp;
if (F <= -5e+122) {
tmp = (1.0 + (x * Math.cos(B))) / t_0;
} else if (F <= 1e+106) {
tmp = (((-x / Math.tan(B)) * t_0) - (Math.pow(((x + x) - (-2.0 - (F * F))), -0.5) * F)) / t_0;
} else {
tmp = -(x * (1.0 / Math.tan(B))) + (1.0 / Math.sin(B));
}
return tmp;
}
def code(F, B, x): t_0 = -math.sin(B) tmp = 0 if F <= -5e+122: tmp = (1.0 + (x * math.cos(B))) / t_0 elif F <= 1e+106: tmp = (((-x / math.tan(B)) * t_0) - (math.pow(((x + x) - (-2.0 - (F * F))), -0.5) * F)) / t_0 else: tmp = -(x * (1.0 / math.tan(B))) + (1.0 / math.sin(B)) return tmp
function code(F, B, x) t_0 = Float64(-sin(B)) tmp = 0.0 if (F <= -5e+122) tmp = Float64(Float64(1.0 + Float64(x * cos(B))) / t_0); elseif (F <= 1e+106) tmp = Float64(Float64(Float64(Float64(Float64(-x) / tan(B)) * t_0) - Float64((Float64(Float64(x + x) - Float64(-2.0 - Float64(F * F))) ^ -0.5) * F)) / t_0); else tmp = Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(1.0 / sin(B))); end return tmp end
function tmp_2 = code(F, B, x) t_0 = -sin(B); tmp = 0.0; if (F <= -5e+122) tmp = (1.0 + (x * cos(B))) / t_0; elseif (F <= 1e+106) tmp = (((-x / tan(B)) * t_0) - ((((x + x) - (-2.0 - (F * F))) ^ -0.5) * F)) / t_0; else tmp = -(x * (1.0 / tan(B))) + (1.0 / sin(B)); end tmp_2 = tmp; end
code[F_, B_, x_] := Block[{t$95$0 = (-N[Sin[B], $MachinePrecision])}, If[LessEqual[F, -5e+122], N[(N[(1.0 + N[(x * N[Cos[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision], If[LessEqual[F, 1e+106], N[(N[(N[(N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] - N[(N[Power[N[(N[(x + x), $MachinePrecision] - N[(-2.0 - N[(F * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision], N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := -\sin B\\
\mathbf{if}\;F \leq -5 \cdot 10^{+122}:\\
\;\;\;\;\frac{1 + x \cdot \cos B}{t\_0}\\
\mathbf{elif}\;F \leq 10^{+106}:\\
\;\;\;\;\frac{\frac{-x}{\tan B} \cdot t\_0 - {\left(\left(x + x\right) - \left(-2 - F \cdot F\right)\right)}^{-0.5} \cdot F}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B}\\
\end{array}
if F < -4.9999999999999999e122Initial program 76.6%
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.2%
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.3%
Applied rewrites51.3%
Taylor expanded in F around -inf
lower-+.f64N/A
lower-*.f64N/A
lower-cos.f6455.8%
Applied rewrites55.8%
if -4.9999999999999999e122 < F < 1.0000000000000001e106Initial program 76.6%
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.2%
if 1.0000000000000001e106 < F Initial program 76.6%
Taylor expanded in F around inf
lower-/.f64N/A
lower-sin.f6455.9%
Applied rewrites55.9%
(FPCore (F B x)
:precision binary64
(if (<= F -2e+42)
(/ (+ 1.0 (* x (cos B))) (- (sin B)))
(if (<= F 1e+152)
(/
(- (* (pow (- (* F F) (- -2.0 (+ x x))) -0.5) F) (* (cos B) x))
(sin B))
(+ (- (* x (/ 1.0 (tan B)))) (/ 1.0 (sin B))))))double code(double F, double B, double x) {
double tmp;
if (F <= -2e+42) {
tmp = (1.0 + (x * cos(B))) / -sin(B);
} else if (F <= 1e+152) {
tmp = ((pow(((F * F) - (-2.0 - (x + x))), -0.5) * F) - (cos(B) * x)) / sin(B);
} else {
tmp = -(x * (1.0 / tan(B))) + (1.0 / sin(B));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: tmp
if (f <= (-2d+42)) then
tmp = (1.0d0 + (x * cos(b))) / -sin(b)
else if (f <= 1d+152) then
tmp = (((((f * f) - ((-2.0d0) - (x + x))) ** (-0.5d0)) * f) - (cos(b) * x)) / sin(b)
else
tmp = -(x * (1.0d0 / tan(b))) + (1.0d0 / sin(b))
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -2e+42) {
tmp = (1.0 + (x * Math.cos(B))) / -Math.sin(B);
} else if (F <= 1e+152) {
tmp = ((Math.pow(((F * F) - (-2.0 - (x + x))), -0.5) * F) - (Math.cos(B) * x)) / Math.sin(B);
} else {
tmp = -(x * (1.0 / Math.tan(B))) + (1.0 / Math.sin(B));
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -2e+42: tmp = (1.0 + (x * math.cos(B))) / -math.sin(B) elif F <= 1e+152: tmp = ((math.pow(((F * F) - (-2.0 - (x + x))), -0.5) * F) - (math.cos(B) * x)) / math.sin(B) else: tmp = -(x * (1.0 / math.tan(B))) + (1.0 / math.sin(B)) return tmp
function code(F, B, x) tmp = 0.0 if (F <= -2e+42) tmp = Float64(Float64(1.0 + Float64(x * cos(B))) / Float64(-sin(B))); elseif (F <= 1e+152) tmp = Float64(Float64(Float64((Float64(Float64(F * F) - Float64(-2.0 - Float64(x + x))) ^ -0.5) * F) - Float64(cos(B) * x)) / sin(B)); else tmp = Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(1.0 / sin(B))); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -2e+42) tmp = (1.0 + (x * cos(B))) / -sin(B); elseif (F <= 1e+152) tmp = (((((F * F) - (-2.0 - (x + x))) ^ -0.5) * F) - (cos(B) * x)) / sin(B); else tmp = -(x * (1.0 / tan(B))) + (1.0 / sin(B)); end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -2e+42], N[(N[(1.0 + N[(x * N[Cos[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / (-N[Sin[B], $MachinePrecision])), $MachinePrecision], If[LessEqual[F, 1e+152], N[(N[(N[(N[Power[N[(N[(F * F), $MachinePrecision] - N[(-2.0 - N[(x + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * F), $MachinePrecision] - N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;F \leq -2 \cdot 10^{+42}:\\
\;\;\;\;\frac{1 + x \cdot \cos B}{-\sin B}\\
\mathbf{elif}\;F \leq 10^{+152}:\\
\;\;\;\;\frac{{\left(F \cdot F - \left(-2 - \left(x + x\right)\right)\right)}^{-0.5} \cdot F - \cos B \cdot x}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B}\\
\end{array}
if F < -2.0000000000000001e42Initial program 76.6%
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.2%
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.3%
Applied rewrites51.3%
Taylor expanded in F around -inf
lower-+.f64N/A
lower-*.f64N/A
lower-cos.f6455.8%
Applied rewrites55.8%
if -2.0000000000000001e42 < F < 1e152Initial program 76.6%
lift-*.f64N/A
lift-/.f64N/A
mult-flipN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites85.0%
Applied rewrites85.1%
if 1e152 < F Initial program 76.6%
Taylor expanded in F around inf
lower-/.f64N/A
lower-sin.f6455.9%
Applied rewrites55.9%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (- (* x (/ 1.0 (tan B))))))
(if (<= F -118000.0)
(/ (+ 1.0 (* x (cos B))) (- (sin B)))
(if (<= F 1.25e-6)
(+
t_0
(*
(/ F B)
(pow (+ (+ (* F F) 2.0) (* 2.0 x)) (- (/ 1.0 2.0)))))
(+ t_0 (/ 1.0 (sin B)))))))double code(double F, double B, double x) {
double t_0 = -(x * (1.0 / tan(B)));
double tmp;
if (F <= -118000.0) {
tmp = (1.0 + (x * cos(B))) / -sin(B);
} else if (F <= 1.25e-6) {
tmp = t_0 + ((F / B) * pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
} else {
tmp = t_0 + (1.0 / sin(B));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: tmp
t_0 = -(x * (1.0d0 / tan(b)))
if (f <= (-118000.0d0)) then
tmp = (1.0d0 + (x * cos(b))) / -sin(b)
else if (f <= 1.25d-6) then
tmp = t_0 + ((f / b) * ((((f * f) + 2.0d0) + (2.0d0 * x)) ** -(1.0d0 / 2.0d0)))
else
tmp = t_0 + (1.0d0 / sin(b))
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double t_0 = -(x * (1.0 / Math.tan(B)));
double tmp;
if (F <= -118000.0) {
tmp = (1.0 + (x * Math.cos(B))) / -Math.sin(B);
} else if (F <= 1.25e-6) {
tmp = t_0 + ((F / B) * Math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
} else {
tmp = t_0 + (1.0 / Math.sin(B));
}
return tmp;
}
def code(F, B, x): t_0 = -(x * (1.0 / math.tan(B))) tmp = 0 if F <= -118000.0: tmp = (1.0 + (x * math.cos(B))) / -math.sin(B) elif F <= 1.25e-6: tmp = t_0 + ((F / B) * math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0))) else: tmp = t_0 + (1.0 / math.sin(B)) return tmp
function code(F, B, x) t_0 = Float64(-Float64(x * Float64(1.0 / tan(B)))) tmp = 0.0 if (F <= -118000.0) tmp = Float64(Float64(1.0 + Float64(x * cos(B))) / Float64(-sin(B))); elseif (F <= 1.25e-6) 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))))); else tmp = Float64(t_0 + Float64(1.0 / sin(B))); end return tmp end
function tmp_2 = code(F, B, x) t_0 = -(x * (1.0 / tan(B))); tmp = 0.0; if (F <= -118000.0) tmp = (1.0 + (x * cos(B))) / -sin(B); elseif (F <= 1.25e-6) tmp = t_0 + ((F / B) * ((((F * F) + 2.0) + (2.0 * x)) ^ -(1.0 / 2.0))); else tmp = t_0 + (1.0 / sin(B)); end tmp_2 = tmp; end
code[F_, B_, x_] := Block[{t$95$0 = (-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision])}, If[LessEqual[F, -118000.0], N[(N[(1.0 + N[(x * N[Cos[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / (-N[Sin[B], $MachinePrecision])), $MachinePrecision], If[LessEqual[F, 1.25e-6], N[(t$95$0 + N[(N[(F / B), $MachinePrecision] * N[Power[N[(N[(N[(F * F), $MachinePrecision] + 2.0), $MachinePrecision] + N[(2.0 * x), $MachinePrecision]), $MachinePrecision], (-N[(1.0 / 2.0), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := -x \cdot \frac{1}{\tan B}\\
\mathbf{if}\;F \leq -118000:\\
\;\;\;\;\frac{1 + x \cdot \cos B}{-\sin B}\\
\mathbf{elif}\;F \leq 1.25 \cdot 10^{-6}:\\
\;\;\;\;t\_0 + \frac{F}{B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \frac{1}{\sin B}\\
\end{array}
if F < -118000Initial program 76.6%
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.2%
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.3%
Applied rewrites51.3%
Taylor expanded in F around -inf
lower-+.f64N/A
lower-*.f64N/A
lower-cos.f6455.8%
Applied rewrites55.8%
if -118000 < F < 1.2500000000000001e-6Initial program 76.6%
Taylor expanded in B around 0
lower-/.f6461.9%
Applied rewrites61.9%
if 1.2500000000000001e-6 < F Initial program 76.6%
Taylor expanded in F around inf
lower-/.f64N/A
lower-sin.f6455.9%
Applied rewrites55.9%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (- (sin B)))
(t_1
(/ (- x (* (pow (- (+ x x) (- -2.0 (* F F))) -0.5) F)) t_0)))
(if (<= F -2.6e+14)
(/ (+ 1.0 (* x (cos B))) t_0)
(if (<= F -1.05e-281)
t_1
(if (<= F 5.5e-82)
(* -1.0 (* (/ x (sin B)) (cos B)))
(if (<= F 1.25e-6)
t_1
(+ (- (* x (/ 1.0 (tan B)))) (/ 1.0 (sin B)))))))))double code(double F, double B, double x) {
double t_0 = -sin(B);
double t_1 = (x - (pow(((x + x) - (-2.0 - (F * F))), -0.5) * F)) / t_0;
double tmp;
if (F <= -2.6e+14) {
tmp = (1.0 + (x * cos(B))) / t_0;
} else if (F <= -1.05e-281) {
tmp = t_1;
} else if (F <= 5.5e-82) {
tmp = -1.0 * ((x / sin(B)) * cos(B));
} else if (F <= 1.25e-6) {
tmp = t_1;
} else {
tmp = -(x * (1.0 / tan(B))) + (1.0 / sin(B));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = -sin(b)
t_1 = (x - ((((x + x) - ((-2.0d0) - (f * f))) ** (-0.5d0)) * f)) / t_0
if (f <= (-2.6d+14)) then
tmp = (1.0d0 + (x * cos(b))) / t_0
else if (f <= (-1.05d-281)) then
tmp = t_1
else if (f <= 5.5d-82) then
tmp = (-1.0d0) * ((x / sin(b)) * cos(b))
else if (f <= 1.25d-6) then
tmp = t_1
else
tmp = -(x * (1.0d0 / tan(b))) + (1.0d0 / sin(b))
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double t_0 = -Math.sin(B);
double t_1 = (x - (Math.pow(((x + x) - (-2.0 - (F * F))), -0.5) * F)) / t_0;
double tmp;
if (F <= -2.6e+14) {
tmp = (1.0 + (x * Math.cos(B))) / t_0;
} else if (F <= -1.05e-281) {
tmp = t_1;
} else if (F <= 5.5e-82) {
tmp = -1.0 * ((x / Math.sin(B)) * Math.cos(B));
} else if (F <= 1.25e-6) {
tmp = t_1;
} else {
tmp = -(x * (1.0 / Math.tan(B))) + (1.0 / Math.sin(B));
}
return tmp;
}
def code(F, B, x): t_0 = -math.sin(B) t_1 = (x - (math.pow(((x + x) - (-2.0 - (F * F))), -0.5) * F)) / t_0 tmp = 0 if F <= -2.6e+14: tmp = (1.0 + (x * math.cos(B))) / t_0 elif F <= -1.05e-281: tmp = t_1 elif F <= 5.5e-82: tmp = -1.0 * ((x / math.sin(B)) * math.cos(B)) elif F <= 1.25e-6: tmp = t_1 else: tmp = -(x * (1.0 / math.tan(B))) + (1.0 / math.sin(B)) return tmp
function code(F, B, x) t_0 = Float64(-sin(B)) t_1 = Float64(Float64(x - Float64((Float64(Float64(x + x) - Float64(-2.0 - Float64(F * F))) ^ -0.5) * F)) / t_0) tmp = 0.0 if (F <= -2.6e+14) tmp = Float64(Float64(1.0 + Float64(x * cos(B))) / t_0); elseif (F <= -1.05e-281) tmp = t_1; elseif (F <= 5.5e-82) tmp = Float64(-1.0 * Float64(Float64(x / sin(B)) * cos(B))); elseif (F <= 1.25e-6) tmp = t_1; else tmp = Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(1.0 / sin(B))); end return tmp end
function tmp_2 = code(F, B, x) t_0 = -sin(B); t_1 = (x - ((((x + x) - (-2.0 - (F * F))) ^ -0.5) * F)) / t_0; tmp = 0.0; if (F <= -2.6e+14) tmp = (1.0 + (x * cos(B))) / t_0; elseif (F <= -1.05e-281) tmp = t_1; elseif (F <= 5.5e-82) tmp = -1.0 * ((x / sin(B)) * cos(B)); elseif (F <= 1.25e-6) tmp = t_1; else tmp = -(x * (1.0 / tan(B))) + (1.0 / sin(B)); end tmp_2 = tmp; end
code[F_, B_, x_] := Block[{t$95$0 = (-N[Sin[B], $MachinePrecision])}, Block[{t$95$1 = N[(N[(x - N[(N[Power[N[(N[(x + x), $MachinePrecision] - N[(-2.0 - N[(F * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]}, If[LessEqual[F, -2.6e+14], N[(N[(1.0 + N[(x * N[Cos[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision], If[LessEqual[F, -1.05e-281], t$95$1, If[LessEqual[F, 5.5e-82], N[(-1.0 * N[(N[(x / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Cos[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.25e-6], t$95$1, N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
t_0 := -\sin B\\
t_1 := \frac{x - {\left(\left(x + x\right) - \left(-2 - F \cdot F\right)\right)}^{-0.5} \cdot F}{t\_0}\\
\mathbf{if}\;F \leq -2.6 \cdot 10^{+14}:\\
\;\;\;\;\frac{1 + x \cdot \cos B}{t\_0}\\
\mathbf{elif}\;F \leq -1.05 \cdot 10^{-281}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;F \leq 5.5 \cdot 10^{-82}:\\
\;\;\;\;-1 \cdot \left(\frac{x}{\sin B} \cdot \cos B\right)\\
\mathbf{elif}\;F \leq 1.25 \cdot 10^{-6}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B}\\
\end{array}
if F < -2.6e14Initial program 76.6%
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.2%
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.3%
Applied rewrites51.3%
Taylor expanded in F around -inf
lower-+.f64N/A
lower-*.f64N/A
lower-cos.f6455.8%
Applied rewrites55.8%
if -2.6e14 < F < -1.0499999999999999e-281 or 5.4999999999999998e-82 < F < 1.2500000000000001e-6Initial program 76.6%
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.2%
Taylor expanded in B around 0
Applied rewrites60.8%
if -1.0499999999999999e-281 < F < 5.4999999999999998e-82Initial program 76.6%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6455.9%
Applied rewrites55.9%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
associate-*l*N/A
mult-flipN/A
div-flip-revN/A
lift-sin.f64N/A
lift-cos.f64N/A
tan-quotN/A
lift-tan.f64N/A
mult-flip-revN/A
lift-tan.f64N/A
tan-quotN/A
lift-sin.f64N/A
lift-cos.f64N/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f6455.9%
Applied rewrites55.9%
if 1.2500000000000001e-6 < F Initial program 76.6%
Taylor expanded in F around inf
lower-/.f64N/A
lower-sin.f6455.9%
Applied rewrites55.9%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (* (pow (- (+ x x) (- -2.0 (* F F))) -0.5) F))
(t_1 (- (sin B))))
(if (<= F -118000.0)
(/ (+ 1.0 (* x (cos B))) t_1)
(if (<= F 5.1e-82)
(/ (- (* (/ (- x) (tan B)) (* -1.0 B)) t_0) (* -1.0 B))
(if (<= F 1.25e-6)
(/ (- x t_0) t_1)
(+ (- (* x (/ 1.0 (tan B)))) (/ 1.0 (sin B))))))))double code(double F, double B, double x) {
double t_0 = pow(((x + x) - (-2.0 - (F * F))), -0.5) * F;
double t_1 = -sin(B);
double tmp;
if (F <= -118000.0) {
tmp = (1.0 + (x * cos(B))) / t_1;
} else if (F <= 5.1e-82) {
tmp = (((-x / tan(B)) * (-1.0 * B)) - t_0) / (-1.0 * B);
} else if (F <= 1.25e-6) {
tmp = (x - t_0) / t_1;
} else {
tmp = -(x * (1.0 / tan(B))) + (1.0 / sin(B));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (((x + x) - ((-2.0d0) - (f * f))) ** (-0.5d0)) * f
t_1 = -sin(b)
if (f <= (-118000.0d0)) then
tmp = (1.0d0 + (x * cos(b))) / t_1
else if (f <= 5.1d-82) then
tmp = (((-x / tan(b)) * ((-1.0d0) * b)) - t_0) / ((-1.0d0) * b)
else if (f <= 1.25d-6) then
tmp = (x - t_0) / t_1
else
tmp = -(x * (1.0d0 / tan(b))) + (1.0d0 / sin(b))
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double t_0 = Math.pow(((x + x) - (-2.0 - (F * F))), -0.5) * F;
double t_1 = -Math.sin(B);
double tmp;
if (F <= -118000.0) {
tmp = (1.0 + (x * Math.cos(B))) / t_1;
} else if (F <= 5.1e-82) {
tmp = (((-x / Math.tan(B)) * (-1.0 * B)) - t_0) / (-1.0 * B);
} else if (F <= 1.25e-6) {
tmp = (x - t_0) / t_1;
} else {
tmp = -(x * (1.0 / Math.tan(B))) + (1.0 / Math.sin(B));
}
return tmp;
}
def code(F, B, x): t_0 = math.pow(((x + x) - (-2.0 - (F * F))), -0.5) * F t_1 = -math.sin(B) tmp = 0 if F <= -118000.0: tmp = (1.0 + (x * math.cos(B))) / t_1 elif F <= 5.1e-82: tmp = (((-x / math.tan(B)) * (-1.0 * B)) - t_0) / (-1.0 * B) elif F <= 1.25e-6: tmp = (x - t_0) / t_1 else: tmp = -(x * (1.0 / math.tan(B))) + (1.0 / math.sin(B)) return tmp
function code(F, B, x) t_0 = Float64((Float64(Float64(x + x) - Float64(-2.0 - Float64(F * F))) ^ -0.5) * F) t_1 = Float64(-sin(B)) tmp = 0.0 if (F <= -118000.0) tmp = Float64(Float64(1.0 + Float64(x * cos(B))) / t_1); elseif (F <= 5.1e-82) tmp = Float64(Float64(Float64(Float64(Float64(-x) / tan(B)) * Float64(-1.0 * B)) - t_0) / Float64(-1.0 * B)); elseif (F <= 1.25e-6) tmp = Float64(Float64(x - t_0) / t_1); else tmp = Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(1.0 / sin(B))); end return tmp end
function tmp_2 = code(F, B, x) t_0 = (((x + x) - (-2.0 - (F * F))) ^ -0.5) * F; t_1 = -sin(B); tmp = 0.0; if (F <= -118000.0) tmp = (1.0 + (x * cos(B))) / t_1; elseif (F <= 5.1e-82) tmp = (((-x / tan(B)) * (-1.0 * B)) - t_0) / (-1.0 * B); elseif (F <= 1.25e-6) tmp = (x - t_0) / t_1; else tmp = -(x * (1.0 / tan(B))) + (1.0 / sin(B)); end tmp_2 = tmp; end
code[F_, B_, x_] := Block[{t$95$0 = N[(N[Power[N[(N[(x + x), $MachinePrecision] - N[(-2.0 - N[(F * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * F), $MachinePrecision]}, Block[{t$95$1 = (-N[Sin[B], $MachinePrecision])}, If[LessEqual[F, -118000.0], N[(N[(1.0 + N[(x * N[Cos[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[F, 5.1e-82], N[(N[(N[(N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision] * N[(-1.0 * B), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision] / N[(-1.0 * B), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.25e-6], N[(N[(x - t$95$0), $MachinePrecision] / t$95$1), $MachinePrecision], N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
t_0 := {\left(\left(x + x\right) - \left(-2 - F \cdot F\right)\right)}^{-0.5} \cdot F\\
t_1 := -\sin B\\
\mathbf{if}\;F \leq -118000:\\
\;\;\;\;\frac{1 + x \cdot \cos B}{t\_1}\\
\mathbf{elif}\;F \leq 5.1 \cdot 10^{-82}:\\
\;\;\;\;\frac{\frac{-x}{\tan B} \cdot \left(-1 \cdot B\right) - t\_0}{-1 \cdot B}\\
\mathbf{elif}\;F \leq 1.25 \cdot 10^{-6}:\\
\;\;\;\;\frac{x - t\_0}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B}\\
\end{array}
if F < -118000Initial program 76.6%
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.2%
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.3%
Applied rewrites51.3%
Taylor expanded in F around -inf
lower-+.f64N/A
lower-*.f64N/A
lower-cos.f6455.8%
Applied rewrites55.8%
if -118000 < F < 5.0999999999999999e-82Initial program 76.6%
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.2%
Taylor expanded in B around 0
lower-*.f6450.6%
Applied rewrites50.6%
Taylor expanded in B around 0
lower-*.f6461.9%
Applied rewrites61.9%
if 5.0999999999999999e-82 < F < 1.2500000000000001e-6Initial program 76.6%
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.2%
Taylor expanded in B around 0
Applied rewrites60.8%
if 1.2500000000000001e-6 < F Initial program 76.6%
Taylor expanded in F around inf
lower-/.f64N/A
lower-sin.f6455.9%
Applied rewrites55.9%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (* (pow (- (+ x x) (- -2.0 (* F F))) -0.5) F))
(t_1 (- (sin B))))
(if (<= F -118000.0)
(/ (+ 1.0 (* x (cos B))) t_1)
(if (<= F 5.1e-82)
(/ (- (* (- x) (/ (* -1.0 B) (tan B))) t_0) (* -1.0 B))
(if (<= F 1.25e-6)
(/ (- x t_0) t_1)
(+ (- (* x (/ 1.0 (tan B)))) (/ 1.0 (sin B))))))))double code(double F, double B, double x) {
double t_0 = pow(((x + x) - (-2.0 - (F * F))), -0.5) * F;
double t_1 = -sin(B);
double tmp;
if (F <= -118000.0) {
tmp = (1.0 + (x * cos(B))) / t_1;
} else if (F <= 5.1e-82) {
tmp = ((-x * ((-1.0 * B) / tan(B))) - t_0) / (-1.0 * B);
} else if (F <= 1.25e-6) {
tmp = (x - t_0) / t_1;
} else {
tmp = -(x * (1.0 / tan(B))) + (1.0 / sin(B));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (((x + x) - ((-2.0d0) - (f * f))) ** (-0.5d0)) * f
t_1 = -sin(b)
if (f <= (-118000.0d0)) then
tmp = (1.0d0 + (x * cos(b))) / t_1
else if (f <= 5.1d-82) then
tmp = ((-x * (((-1.0d0) * b) / tan(b))) - t_0) / ((-1.0d0) * b)
else if (f <= 1.25d-6) then
tmp = (x - t_0) / t_1
else
tmp = -(x * (1.0d0 / tan(b))) + (1.0d0 / sin(b))
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double t_0 = Math.pow(((x + x) - (-2.0 - (F * F))), -0.5) * F;
double t_1 = -Math.sin(B);
double tmp;
if (F <= -118000.0) {
tmp = (1.0 + (x * Math.cos(B))) / t_1;
} else if (F <= 5.1e-82) {
tmp = ((-x * ((-1.0 * B) / Math.tan(B))) - t_0) / (-1.0 * B);
} else if (F <= 1.25e-6) {
tmp = (x - t_0) / t_1;
} else {
tmp = -(x * (1.0 / Math.tan(B))) + (1.0 / Math.sin(B));
}
return tmp;
}
def code(F, B, x): t_0 = math.pow(((x + x) - (-2.0 - (F * F))), -0.5) * F t_1 = -math.sin(B) tmp = 0 if F <= -118000.0: tmp = (1.0 + (x * math.cos(B))) / t_1 elif F <= 5.1e-82: tmp = ((-x * ((-1.0 * B) / math.tan(B))) - t_0) / (-1.0 * B) elif F <= 1.25e-6: tmp = (x - t_0) / t_1 else: tmp = -(x * (1.0 / math.tan(B))) + (1.0 / math.sin(B)) return tmp
function code(F, B, x) t_0 = Float64((Float64(Float64(x + x) - Float64(-2.0 - Float64(F * F))) ^ -0.5) * F) t_1 = Float64(-sin(B)) tmp = 0.0 if (F <= -118000.0) tmp = Float64(Float64(1.0 + Float64(x * cos(B))) / t_1); elseif (F <= 5.1e-82) tmp = Float64(Float64(Float64(Float64(-x) * Float64(Float64(-1.0 * B) / tan(B))) - t_0) / Float64(-1.0 * B)); elseif (F <= 1.25e-6) tmp = Float64(Float64(x - t_0) / t_1); else tmp = Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(1.0 / sin(B))); end return tmp end
function tmp_2 = code(F, B, x) t_0 = (((x + x) - (-2.0 - (F * F))) ^ -0.5) * F; t_1 = -sin(B); tmp = 0.0; if (F <= -118000.0) tmp = (1.0 + (x * cos(B))) / t_1; elseif (F <= 5.1e-82) tmp = ((-x * ((-1.0 * B) / tan(B))) - t_0) / (-1.0 * B); elseif (F <= 1.25e-6) tmp = (x - t_0) / t_1; else tmp = -(x * (1.0 / tan(B))) + (1.0 / sin(B)); end tmp_2 = tmp; end
code[F_, B_, x_] := Block[{t$95$0 = N[(N[Power[N[(N[(x + x), $MachinePrecision] - N[(-2.0 - N[(F * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * F), $MachinePrecision]}, Block[{t$95$1 = (-N[Sin[B], $MachinePrecision])}, If[LessEqual[F, -118000.0], N[(N[(1.0 + N[(x * N[Cos[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[F, 5.1e-82], N[(N[(N[((-x) * N[(N[(-1.0 * B), $MachinePrecision] / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision] / N[(-1.0 * B), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.25e-6], N[(N[(x - t$95$0), $MachinePrecision] / t$95$1), $MachinePrecision], N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
t_0 := {\left(\left(x + x\right) - \left(-2 - F \cdot F\right)\right)}^{-0.5} \cdot F\\
t_1 := -\sin B\\
\mathbf{if}\;F \leq -118000:\\
\;\;\;\;\frac{1 + x \cdot \cos B}{t\_1}\\
\mathbf{elif}\;F \leq 5.1 \cdot 10^{-82}:\\
\;\;\;\;\frac{\left(-x\right) \cdot \frac{-1 \cdot B}{\tan B} - t\_0}{-1 \cdot B}\\
\mathbf{elif}\;F \leq 1.25 \cdot 10^{-6}:\\
\;\;\;\;\frac{x - t\_0}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B}\\
\end{array}
if F < -118000Initial program 76.6%
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.2%
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.3%
Applied rewrites51.3%
Taylor expanded in F around -inf
lower-+.f64N/A
lower-*.f64N/A
lower-cos.f6455.8%
Applied rewrites55.8%
if -118000 < F < 5.0999999999999999e-82Initial program 76.6%
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.2%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6485.1%
Applied rewrites85.1%
Taylor expanded in B around 0
lower-*.f6450.6%
Applied rewrites50.6%
Taylor expanded in B around 0
lower-*.f6461.9%
Applied rewrites61.9%
if 5.0999999999999999e-82 < F < 1.2500000000000001e-6Initial program 76.6%
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.2%
Taylor expanded in B around 0
Applied rewrites60.8%
if 1.2500000000000001e-6 < F Initial program 76.6%
Taylor expanded in F around inf
lower-/.f64N/A
lower-sin.f6455.9%
Applied rewrites55.9%
(FPCore (F B x)
:precision binary64
(if (<= F -1.05e-41)
(/ (+ 1.0 (* x (cos B))) (- (sin B)))
(if (<= F 3.9e-53)
(/ (- x) (tan B))
(if (<= F 1.25e-6)
(/ (- (* F (pow (+ 2.0 (+ (* 2.0 x) (pow F 2.0))) -0.5)) x) B)
(+ (- (* x (/ 1.0 (tan B)))) (/ 1.0 (sin B)))))))double code(double F, double B, double x) {
double tmp;
if (F <= -1.05e-41) {
tmp = (1.0 + (x * cos(B))) / -sin(B);
} else if (F <= 3.9e-53) {
tmp = -x / tan(B);
} else if (F <= 1.25e-6) {
tmp = ((F * pow((2.0 + ((2.0 * x) + pow(F, 2.0))), -0.5)) - x) / B;
} else {
tmp = -(x * (1.0 / tan(B))) + (1.0 / sin(B));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: tmp
if (f <= (-1.05d-41)) then
tmp = (1.0d0 + (x * cos(b))) / -sin(b)
else if (f <= 3.9d-53) then
tmp = -x / tan(b)
else if (f <= 1.25d-6) then
tmp = ((f * ((2.0d0 + ((2.0d0 * x) + (f ** 2.0d0))) ** (-0.5d0))) - x) / b
else
tmp = -(x * (1.0d0 / tan(b))) + (1.0d0 / sin(b))
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -1.05e-41) {
tmp = (1.0 + (x * Math.cos(B))) / -Math.sin(B);
} else if (F <= 3.9e-53) {
tmp = -x / Math.tan(B);
} else if (F <= 1.25e-6) {
tmp = ((F * Math.pow((2.0 + ((2.0 * x) + Math.pow(F, 2.0))), -0.5)) - x) / B;
} else {
tmp = -(x * (1.0 / Math.tan(B))) + (1.0 / Math.sin(B));
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -1.05e-41: tmp = (1.0 + (x * math.cos(B))) / -math.sin(B) elif F <= 3.9e-53: tmp = -x / math.tan(B) elif F <= 1.25e-6: tmp = ((F * math.pow((2.0 + ((2.0 * x) + math.pow(F, 2.0))), -0.5)) - x) / B else: tmp = -(x * (1.0 / math.tan(B))) + (1.0 / math.sin(B)) return tmp
function code(F, B, x) tmp = 0.0 if (F <= -1.05e-41) tmp = Float64(Float64(1.0 + Float64(x * cos(B))) / Float64(-sin(B))); elseif (F <= 3.9e-53) tmp = Float64(Float64(-x) / tan(B)); elseif (F <= 1.25e-6) tmp = Float64(Float64(Float64(F * (Float64(2.0 + Float64(Float64(2.0 * x) + (F ^ 2.0))) ^ -0.5)) - x) / B); else tmp = Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(1.0 / sin(B))); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -1.05e-41) tmp = (1.0 + (x * cos(B))) / -sin(B); elseif (F <= 3.9e-53) tmp = -x / tan(B); elseif (F <= 1.25e-6) tmp = ((F * ((2.0 + ((2.0 * x) + (F ^ 2.0))) ^ -0.5)) - x) / B; else tmp = -(x * (1.0 / tan(B))) + (1.0 / sin(B)); end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -1.05e-41], N[(N[(1.0 + N[(x * N[Cos[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / (-N[Sin[B], $MachinePrecision])), $MachinePrecision], If[LessEqual[F, 3.9e-53], N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.25e-6], N[(N[(N[(F * N[Power[N[(2.0 + N[(N[(2.0 * x), $MachinePrecision] + N[Power[F, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\mathbf{if}\;F \leq -1.05 \cdot 10^{-41}:\\
\;\;\;\;\frac{1 + x \cdot \cos B}{-\sin B}\\
\mathbf{elif}\;F \leq 3.9 \cdot 10^{-53}:\\
\;\;\;\;\frac{-x}{\tan B}\\
\mathbf{elif}\;F \leq 1.25 \cdot 10^{-6}:\\
\;\;\;\;\frac{F \cdot {\left(2 + \left(2 \cdot x + {F}^{2}\right)\right)}^{-0.5} - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B}\\
\end{array}
if F < -1.0500000000000001e-41Initial program 76.6%
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.2%
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.3%
Applied rewrites51.3%
Taylor expanded in F around -inf
lower-+.f64N/A
lower-*.f64N/A
lower-cos.f6455.8%
Applied rewrites55.8%
if -1.0500000000000001e-41 < F < 3.9000000000000002e-53Initial program 76.6%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6455.9%
Applied rewrites55.9%
lift-cos.f64N/A
cos-neg-revN/A
sin-+PI/2-revN/A
lower-sin.f64N/A
+-commutativeN/A
lower-+.f64N/A
mult-flipN/A
lift-/.f64N/A
lower-*.f64N/A
lower-PI.f64N/A
lift-/.f64N/A
metadata-evalN/A
lower-neg.f6433.0%
Applied rewrites33.0%
metadata-evalN/A
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
distribute-lft-neg-inN/A
Applied rewrites55.9%
if 3.9000000000000002e-53 < F < 1.2500000000000001e-6Initial program 76.6%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6455.9%
Applied rewrites55.9%
Taylor expanded in B around 0
lower-/.f6430.3%
Applied rewrites30.3%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites44.9%
if 1.2500000000000001e-6 < F Initial program 76.6%
Taylor expanded in F around inf
lower-/.f64N/A
lower-sin.f6455.9%
Applied rewrites55.9%
(FPCore (F B x)
:precision binary64
(if (<= F -1.05e-41)
(/ (+ 1.0 (* x (cos B))) (- (sin B)))
(if (<= F 3.9e-53)
(/ (- x) (tan B))
(if (<= F 1.25e-6)
(/ (- (* F (pow (+ 2.0 (+ (* 2.0 x) (pow F 2.0))) -0.5)) x) B)
(* (/ (+ 1.0 (* (cos B) (- x))) (* F (sin B))) F)))))double code(double F, double B, double x) {
double tmp;
if (F <= -1.05e-41) {
tmp = (1.0 + (x * cos(B))) / -sin(B);
} else if (F <= 3.9e-53) {
tmp = -x / tan(B);
} else if (F <= 1.25e-6) {
tmp = ((F * pow((2.0 + ((2.0 * x) + pow(F, 2.0))), -0.5)) - x) / B;
} else {
tmp = ((1.0 + (cos(B) * -x)) / (F * sin(B))) * F;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: tmp
if (f <= (-1.05d-41)) then
tmp = (1.0d0 + (x * cos(b))) / -sin(b)
else if (f <= 3.9d-53) then
tmp = -x / tan(b)
else if (f <= 1.25d-6) then
tmp = ((f * ((2.0d0 + ((2.0d0 * x) + (f ** 2.0d0))) ** (-0.5d0))) - x) / b
else
tmp = ((1.0d0 + (cos(b) * -x)) / (f * sin(b))) * f
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -1.05e-41) {
tmp = (1.0 + (x * Math.cos(B))) / -Math.sin(B);
} else if (F <= 3.9e-53) {
tmp = -x / Math.tan(B);
} else if (F <= 1.25e-6) {
tmp = ((F * Math.pow((2.0 + ((2.0 * x) + Math.pow(F, 2.0))), -0.5)) - x) / B;
} else {
tmp = ((1.0 + (Math.cos(B) * -x)) / (F * Math.sin(B))) * F;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -1.05e-41: tmp = (1.0 + (x * math.cos(B))) / -math.sin(B) elif F <= 3.9e-53: tmp = -x / math.tan(B) elif F <= 1.25e-6: tmp = ((F * math.pow((2.0 + ((2.0 * x) + math.pow(F, 2.0))), -0.5)) - x) / B else: tmp = ((1.0 + (math.cos(B) * -x)) / (F * math.sin(B))) * F return tmp
function code(F, B, x) tmp = 0.0 if (F <= -1.05e-41) tmp = Float64(Float64(1.0 + Float64(x * cos(B))) / Float64(-sin(B))); elseif (F <= 3.9e-53) tmp = Float64(Float64(-x) / tan(B)); elseif (F <= 1.25e-6) tmp = Float64(Float64(Float64(F * (Float64(2.0 + Float64(Float64(2.0 * x) + (F ^ 2.0))) ^ -0.5)) - x) / B); else tmp = Float64(Float64(Float64(1.0 + Float64(cos(B) * Float64(-x))) / Float64(F * sin(B))) * F); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -1.05e-41) tmp = (1.0 + (x * cos(B))) / -sin(B); elseif (F <= 3.9e-53) tmp = -x / tan(B); elseif (F <= 1.25e-6) tmp = ((F * ((2.0 + ((2.0 * x) + (F ^ 2.0))) ^ -0.5)) - x) / B; else tmp = ((1.0 + (cos(B) * -x)) / (F * sin(B))) * F; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -1.05e-41], N[(N[(1.0 + N[(x * N[Cos[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / (-N[Sin[B], $MachinePrecision])), $MachinePrecision], If[LessEqual[F, 3.9e-53], N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.25e-6], N[(N[(N[(F * N[Power[N[(2.0 + N[(N[(2.0 * x), $MachinePrecision] + N[Power[F, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(N[(1.0 + N[(N[Cos[B], $MachinePrecision] * (-x)), $MachinePrecision]), $MachinePrecision] / N[(F * N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * F), $MachinePrecision]]]]
\begin{array}{l}
\mathbf{if}\;F \leq -1.05 \cdot 10^{-41}:\\
\;\;\;\;\frac{1 + x \cdot \cos B}{-\sin B}\\
\mathbf{elif}\;F \leq 3.9 \cdot 10^{-53}:\\
\;\;\;\;\frac{-x}{\tan B}\\
\mathbf{elif}\;F \leq 1.25 \cdot 10^{-6}:\\
\;\;\;\;\frac{F \cdot {\left(2 + \left(2 \cdot x + {F}^{2}\right)\right)}^{-0.5} - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + \cos B \cdot \left(-x\right)}{F \cdot \sin B} \cdot F\\
\end{array}
if F < -1.0500000000000001e-41Initial program 76.6%
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.2%
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.3%
Applied rewrites51.3%
Taylor expanded in F around -inf
lower-+.f64N/A
lower-*.f64N/A
lower-cos.f6455.8%
Applied rewrites55.8%
if -1.0500000000000001e-41 < F < 3.9000000000000002e-53Initial program 76.6%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6455.9%
Applied rewrites55.9%
lift-cos.f64N/A
cos-neg-revN/A
sin-+PI/2-revN/A
lower-sin.f64N/A
+-commutativeN/A
lower-+.f64N/A
mult-flipN/A
lift-/.f64N/A
lower-*.f64N/A
lower-PI.f64N/A
lift-/.f64N/A
metadata-evalN/A
lower-neg.f6433.0%
Applied rewrites33.0%
metadata-evalN/A
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
distribute-lft-neg-inN/A
Applied rewrites55.9%
if 3.9000000000000002e-53 < F < 1.2500000000000001e-6Initial program 76.6%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6455.9%
Applied rewrites55.9%
Taylor expanded in B around 0
lower-/.f6430.3%
Applied rewrites30.3%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites44.9%
if 1.2500000000000001e-6 < F Initial program 76.6%
Taylor expanded in F around inf
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f6447.5%
Applied rewrites47.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6447.5%
Applied rewrites50.2%
(FPCore (F B x)
:precision binary64
(if (<= F -1.05e-41)
(/ (+ 1.0 (* x (cos B))) (- (sin B)))
(if (<= F 3.9e-53)
(/ (- x) (tan B))
(if (<= F 1.25e-6)
(+
(- (* x (/ 1.0 B)))
(*
(/ 1.0 (/ B F))
(pow (+ (+ (* F F) 2.0) (* 2.0 x)) (- (/ 1.0 2.0)))))
(* (/ (+ 1.0 (* (cos B) (- x))) (* F (sin B))) F)))))double code(double F, double B, double x) {
double tmp;
if (F <= -1.05e-41) {
tmp = (1.0 + (x * cos(B))) / -sin(B);
} else if (F <= 3.9e-53) {
tmp = -x / tan(B);
} else if (F <= 1.25e-6) {
tmp = -(x * (1.0 / B)) + ((1.0 / (B / F)) * pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
} else {
tmp = ((1.0 + (cos(B) * -x)) / (F * sin(B))) * F;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: tmp
if (f <= (-1.05d-41)) then
tmp = (1.0d0 + (x * cos(b))) / -sin(b)
else if (f <= 3.9d-53) then
tmp = -x / tan(b)
else if (f <= 1.25d-6) then
tmp = -(x * (1.0d0 / b)) + ((1.0d0 / (b / f)) * ((((f * f) + 2.0d0) + (2.0d0 * x)) ** -(1.0d0 / 2.0d0)))
else
tmp = ((1.0d0 + (cos(b) * -x)) / (f * sin(b))) * f
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -1.05e-41) {
tmp = (1.0 + (x * Math.cos(B))) / -Math.sin(B);
} else if (F <= 3.9e-53) {
tmp = -x / Math.tan(B);
} else if (F <= 1.25e-6) {
tmp = -(x * (1.0 / B)) + ((1.0 / (B / F)) * Math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
} else {
tmp = ((1.0 + (Math.cos(B) * -x)) / (F * Math.sin(B))) * F;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -1.05e-41: tmp = (1.0 + (x * math.cos(B))) / -math.sin(B) elif F <= 3.9e-53: tmp = -x / math.tan(B) elif F <= 1.25e-6: tmp = -(x * (1.0 / B)) + ((1.0 / (B / F)) * math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0))) else: tmp = ((1.0 + (math.cos(B) * -x)) / (F * math.sin(B))) * F return tmp
function code(F, B, x) tmp = 0.0 if (F <= -1.05e-41) tmp = Float64(Float64(1.0 + Float64(x * cos(B))) / Float64(-sin(B))); elseif (F <= 3.9e-53) tmp = Float64(Float64(-x) / tan(B)); elseif (F <= 1.25e-6) tmp = Float64(Float64(-Float64(x * Float64(1.0 / B))) + Float64(Float64(1.0 / Float64(B / F)) * (Float64(Float64(Float64(F * F) + 2.0) + Float64(2.0 * x)) ^ Float64(-Float64(1.0 / 2.0))))); else tmp = Float64(Float64(Float64(1.0 + Float64(cos(B) * Float64(-x))) / Float64(F * sin(B))) * F); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -1.05e-41) tmp = (1.0 + (x * cos(B))) / -sin(B); elseif (F <= 3.9e-53) tmp = -x / tan(B); elseif (F <= 1.25e-6) tmp = -(x * (1.0 / B)) + ((1.0 / (B / F)) * ((((F * F) + 2.0) + (2.0 * x)) ^ -(1.0 / 2.0))); else tmp = ((1.0 + (cos(B) * -x)) / (F * sin(B))) * F; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -1.05e-41], N[(N[(1.0 + N[(x * N[Cos[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / (-N[Sin[B], $MachinePrecision])), $MachinePrecision], If[LessEqual[F, 3.9e-53], N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.25e-6], N[((-N[(x * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]) + N[(N[(1.0 / N[(B / F), $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(N[(F * F), $MachinePrecision] + 2.0), $MachinePrecision] + N[(2.0 * x), $MachinePrecision]), $MachinePrecision], (-N[(1.0 / 2.0), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 + N[(N[Cos[B], $MachinePrecision] * (-x)), $MachinePrecision]), $MachinePrecision] / N[(F * N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * F), $MachinePrecision]]]]
\begin{array}{l}
\mathbf{if}\;F \leq -1.05 \cdot 10^{-41}:\\
\;\;\;\;\frac{1 + x \cdot \cos B}{-\sin B}\\
\mathbf{elif}\;F \leq 3.9 \cdot 10^{-53}:\\
\;\;\;\;\frac{-x}{\tan B}\\
\mathbf{elif}\;F \leq 1.25 \cdot 10^{-6}:\\
\;\;\;\;\left(-x \cdot \frac{1}{B}\right) + \frac{1}{\frac{B}{F}} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + \cos B \cdot \left(-x\right)}{F \cdot \sin B} \cdot F\\
\end{array}
if F < -1.0500000000000001e-41Initial program 76.6%
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.2%
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.3%
Applied rewrites51.3%
Taylor expanded in F around -inf
lower-+.f64N/A
lower-*.f64N/A
lower-cos.f6455.8%
Applied rewrites55.8%
if -1.0500000000000001e-41 < F < 3.9000000000000002e-53Initial program 76.6%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6455.9%
Applied rewrites55.9%
lift-cos.f64N/A
cos-neg-revN/A
sin-+PI/2-revN/A
lower-sin.f64N/A
+-commutativeN/A
lower-+.f64N/A
mult-flipN/A
lift-/.f64N/A
lower-*.f64N/A
lower-PI.f64N/A
lift-/.f64N/A
metadata-evalN/A
lower-neg.f6433.0%
Applied rewrites33.0%
metadata-evalN/A
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
distribute-lft-neg-inN/A
Applied rewrites55.9%
if 3.9000000000000002e-53 < F < 1.2500000000000001e-6Initial program 76.6%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6476.6%
Applied rewrites76.6%
Taylor expanded in B around 0
lower-/.f6450.3%
Applied rewrites50.3%
Taylor expanded in B around 0
lower-/.f6436.3%
Applied rewrites36.3%
if 1.2500000000000001e-6 < F Initial program 76.6%
Taylor expanded in F around inf
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f6447.5%
Applied rewrites47.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6447.5%
Applied rewrites50.2%
(FPCore (F B x)
:precision binary64
(if (<= F -1.05e-41)
(/ (+ 1.0 (* x (cos B))) (- (sin B)))
(if (<= F 3.9e-53)
(/ (- x) (tan B))
(if (<= F 1.4e-5)
(+
(- (* x (/ 1.0 B)))
(*
(/ 1.0 (/ B F))
(pow (+ (+ (* F F) 2.0) (* 2.0 x)) (- (/ 1.0 2.0)))))
(* F (+ (* -1.0 (/ x (* B F))) (/ 1.0 (* F (sin B)))))))))double code(double F, double B, double x) {
double tmp;
if (F <= -1.05e-41) {
tmp = (1.0 + (x * cos(B))) / -sin(B);
} else if (F <= 3.9e-53) {
tmp = -x / tan(B);
} else if (F <= 1.4e-5) {
tmp = -(x * (1.0 / B)) + ((1.0 / (B / F)) * pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
} else {
tmp = F * ((-1.0 * (x / (B * F))) + (1.0 / (F * 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.05d-41)) then
tmp = (1.0d0 + (x * cos(b))) / -sin(b)
else if (f <= 3.9d-53) then
tmp = -x / tan(b)
else if (f <= 1.4d-5) then
tmp = -(x * (1.0d0 / b)) + ((1.0d0 / (b / f)) * ((((f * f) + 2.0d0) + (2.0d0 * x)) ** -(1.0d0 / 2.0d0)))
else
tmp = f * (((-1.0d0) * (x / (b * f))) + (1.0d0 / (f * sin(b))))
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -1.05e-41) {
tmp = (1.0 + (x * Math.cos(B))) / -Math.sin(B);
} else if (F <= 3.9e-53) {
tmp = -x / Math.tan(B);
} else if (F <= 1.4e-5) {
tmp = -(x * (1.0 / B)) + ((1.0 / (B / F)) * Math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
} else {
tmp = F * ((-1.0 * (x / (B * F))) + (1.0 / (F * Math.sin(B))));
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -1.05e-41: tmp = (1.0 + (x * math.cos(B))) / -math.sin(B) elif F <= 3.9e-53: tmp = -x / math.tan(B) elif F <= 1.4e-5: tmp = -(x * (1.0 / B)) + ((1.0 / (B / F)) * math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0))) else: tmp = F * ((-1.0 * (x / (B * F))) + (1.0 / (F * math.sin(B)))) return tmp
function code(F, B, x) tmp = 0.0 if (F <= -1.05e-41) tmp = Float64(Float64(1.0 + Float64(x * cos(B))) / Float64(-sin(B))); elseif (F <= 3.9e-53) tmp = Float64(Float64(-x) / tan(B)); elseif (F <= 1.4e-5) tmp = Float64(Float64(-Float64(x * Float64(1.0 / B))) + Float64(Float64(1.0 / Float64(B / F)) * (Float64(Float64(Float64(F * F) + 2.0) + Float64(2.0 * x)) ^ Float64(-Float64(1.0 / 2.0))))); else tmp = Float64(F * Float64(Float64(-1.0 * Float64(x / Float64(B * F))) + Float64(1.0 / Float64(F * sin(B))))); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -1.05e-41) tmp = (1.0 + (x * cos(B))) / -sin(B); elseif (F <= 3.9e-53) tmp = -x / tan(B); elseif (F <= 1.4e-5) tmp = -(x * (1.0 / B)) + ((1.0 / (B / F)) * ((((F * F) + 2.0) + (2.0 * x)) ^ -(1.0 / 2.0))); else tmp = F * ((-1.0 * (x / (B * F))) + (1.0 / (F * sin(B)))); end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -1.05e-41], N[(N[(1.0 + N[(x * N[Cos[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / (-N[Sin[B], $MachinePrecision])), $MachinePrecision], If[LessEqual[F, 3.9e-53], N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.4e-5], N[((-N[(x * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]) + N[(N[(1.0 / N[(B / F), $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(N[(F * F), $MachinePrecision] + 2.0), $MachinePrecision] + N[(2.0 * x), $MachinePrecision]), $MachinePrecision], (-N[(1.0 / 2.0), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(F * N[(N[(-1.0 * N[(x / N[(B * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(F * N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\mathbf{if}\;F \leq -1.05 \cdot 10^{-41}:\\
\;\;\;\;\frac{1 + x \cdot \cos B}{-\sin B}\\
\mathbf{elif}\;F \leq 3.9 \cdot 10^{-53}:\\
\;\;\;\;\frac{-x}{\tan B}\\
\mathbf{elif}\;F \leq 1.4 \cdot 10^{-5}:\\
\;\;\;\;\left(-x \cdot \frac{1}{B}\right) + \frac{1}{\frac{B}{F}} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}\\
\mathbf{else}:\\
\;\;\;\;F \cdot \left(-1 \cdot \frac{x}{B \cdot F} + \frac{1}{F \cdot \sin B}\right)\\
\end{array}
if F < -1.0500000000000001e-41Initial program 76.6%
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.2%
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.3%
Applied rewrites51.3%
Taylor expanded in F around -inf
lower-+.f64N/A
lower-*.f64N/A
lower-cos.f6455.8%
Applied rewrites55.8%
if -1.0500000000000001e-41 < F < 3.9000000000000002e-53Initial program 76.6%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6455.9%
Applied rewrites55.9%
lift-cos.f64N/A
cos-neg-revN/A
sin-+PI/2-revN/A
lower-sin.f64N/A
+-commutativeN/A
lower-+.f64N/A
mult-flipN/A
lift-/.f64N/A
lower-*.f64N/A
lower-PI.f64N/A
lift-/.f64N/A
metadata-evalN/A
lower-neg.f6433.0%
Applied rewrites33.0%
metadata-evalN/A
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
distribute-lft-neg-inN/A
Applied rewrites55.9%
if 3.9000000000000002e-53 < F < 1.4e-5Initial program 76.6%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6476.6%
Applied rewrites76.6%
Taylor expanded in B around 0
lower-/.f6450.3%
Applied rewrites50.3%
Taylor expanded in B around 0
lower-/.f6436.3%
Applied rewrites36.3%
if 1.4e-5 < F Initial program 76.6%
Taylor expanded in F around inf
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f6447.5%
Applied rewrites47.5%
Taylor expanded in B around 0
lower-/.f64N/A
lower-*.f6432.3%
Applied rewrites32.3%
(FPCore (F B x)
:precision binary64
(if (<= F -2.5e-9)
(/ (* -1.0 (* F (- (* -1.0 (/ x F)) (/ 1.0 F)))) (- (sin B)))
(if (<= F 3.9e-53)
(/ (- x) (tan B))
(if (<= F 1.4e-5)
(+
(- (* x (/ 1.0 B)))
(*
(/ 1.0 (/ B F))
(pow (+ (+ (* F F) 2.0) (* 2.0 x)) (- (/ 1.0 2.0)))))
(* F (+ (* -1.0 (/ x (* B F))) (/ 1.0 (* F (sin B)))))))))double code(double F, double B, double x) {
double tmp;
if (F <= -2.5e-9) {
tmp = (-1.0 * (F * ((-1.0 * (x / F)) - (1.0 / F)))) / -sin(B);
} else if (F <= 3.9e-53) {
tmp = -x / tan(B);
} else if (F <= 1.4e-5) {
tmp = -(x * (1.0 / B)) + ((1.0 / (B / F)) * pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
} else {
tmp = F * ((-1.0 * (x / (B * F))) + (1.0 / (F * 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.5d-9)) then
tmp = ((-1.0d0) * (f * (((-1.0d0) * (x / f)) - (1.0d0 / f)))) / -sin(b)
else if (f <= 3.9d-53) then
tmp = -x / tan(b)
else if (f <= 1.4d-5) then
tmp = -(x * (1.0d0 / b)) + ((1.0d0 / (b / f)) * ((((f * f) + 2.0d0) + (2.0d0 * x)) ** -(1.0d0 / 2.0d0)))
else
tmp = f * (((-1.0d0) * (x / (b * f))) + (1.0d0 / (f * sin(b))))
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -2.5e-9) {
tmp = (-1.0 * (F * ((-1.0 * (x / F)) - (1.0 / F)))) / -Math.sin(B);
} else if (F <= 3.9e-53) {
tmp = -x / Math.tan(B);
} else if (F <= 1.4e-5) {
tmp = -(x * (1.0 / B)) + ((1.0 / (B / F)) * Math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
} else {
tmp = F * ((-1.0 * (x / (B * F))) + (1.0 / (F * Math.sin(B))));
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -2.5e-9: tmp = (-1.0 * (F * ((-1.0 * (x / F)) - (1.0 / F)))) / -math.sin(B) elif F <= 3.9e-53: tmp = -x / math.tan(B) elif F <= 1.4e-5: tmp = -(x * (1.0 / B)) + ((1.0 / (B / F)) * math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0))) else: tmp = F * ((-1.0 * (x / (B * F))) + (1.0 / (F * math.sin(B)))) return tmp
function code(F, B, x) tmp = 0.0 if (F <= -2.5e-9) tmp = Float64(Float64(-1.0 * Float64(F * Float64(Float64(-1.0 * Float64(x / F)) - Float64(1.0 / F)))) / Float64(-sin(B))); elseif (F <= 3.9e-53) tmp = Float64(Float64(-x) / tan(B)); elseif (F <= 1.4e-5) tmp = Float64(Float64(-Float64(x * Float64(1.0 / B))) + Float64(Float64(1.0 / Float64(B / F)) * (Float64(Float64(Float64(F * F) + 2.0) + Float64(2.0 * x)) ^ Float64(-Float64(1.0 / 2.0))))); else tmp = Float64(F * Float64(Float64(-1.0 * Float64(x / Float64(B * F))) + Float64(1.0 / Float64(F * sin(B))))); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -2.5e-9) tmp = (-1.0 * (F * ((-1.0 * (x / F)) - (1.0 / F)))) / -sin(B); elseif (F <= 3.9e-53) tmp = -x / tan(B); elseif (F <= 1.4e-5) tmp = -(x * (1.0 / B)) + ((1.0 / (B / F)) * ((((F * F) + 2.0) + (2.0 * x)) ^ -(1.0 / 2.0))); else tmp = F * ((-1.0 * (x / (B * F))) + (1.0 / (F * sin(B)))); end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -2.5e-9], N[(N[(-1.0 * N[(F * N[(N[(-1.0 * N[(x / F), $MachinePrecision]), $MachinePrecision] - N[(1.0 / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / (-N[Sin[B], $MachinePrecision])), $MachinePrecision], If[LessEqual[F, 3.9e-53], N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.4e-5], N[((-N[(x * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]) + N[(N[(1.0 / N[(B / F), $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(N[(F * F), $MachinePrecision] + 2.0), $MachinePrecision] + N[(2.0 * x), $MachinePrecision]), $MachinePrecision], (-N[(1.0 / 2.0), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(F * N[(N[(-1.0 * N[(x / N[(B * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(F * N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\mathbf{if}\;F \leq -2.5 \cdot 10^{-9}:\\
\;\;\;\;\frac{-1 \cdot \left(F \cdot \left(-1 \cdot \frac{x}{F} - \frac{1}{F}\right)\right)}{-\sin B}\\
\mathbf{elif}\;F \leq 3.9 \cdot 10^{-53}:\\
\;\;\;\;\frac{-x}{\tan B}\\
\mathbf{elif}\;F \leq 1.4 \cdot 10^{-5}:\\
\;\;\;\;\left(-x \cdot \frac{1}{B}\right) + \frac{1}{\frac{B}{F}} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}\\
\mathbf{else}:\\
\;\;\;\;F \cdot \left(-1 \cdot \frac{x}{B \cdot F} + \frac{1}{F \cdot \sin B}\right)\\
\end{array}
if F < -2.5000000000000001e-9Initial program 76.6%
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.2%
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.3%
Applied rewrites51.3%
Taylor expanded in B around 0
lower-/.f6437.1%
Applied rewrites37.1%
if -2.5000000000000001e-9 < F < 3.9000000000000002e-53Initial program 76.6%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6455.9%
Applied rewrites55.9%
lift-cos.f64N/A
cos-neg-revN/A
sin-+PI/2-revN/A
lower-sin.f64N/A
+-commutativeN/A
lower-+.f64N/A
mult-flipN/A
lift-/.f64N/A
lower-*.f64N/A
lower-PI.f64N/A
lift-/.f64N/A
metadata-evalN/A
lower-neg.f6433.0%
Applied rewrites33.0%
metadata-evalN/A
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
distribute-lft-neg-inN/A
Applied rewrites55.9%
if 3.9000000000000002e-53 < F < 1.4e-5Initial program 76.6%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6476.6%
Applied rewrites76.6%
Taylor expanded in B around 0
lower-/.f6450.3%
Applied rewrites50.3%
Taylor expanded in B around 0
lower-/.f6436.3%
Applied rewrites36.3%
if 1.4e-5 < F Initial program 76.6%
Taylor expanded in F around inf
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f6447.5%
Applied rewrites47.5%
Taylor expanded in B around 0
lower-/.f64N/A
lower-*.f6432.3%
Applied rewrites32.3%
(FPCore (F B x)
:precision binary64
(if (<= F -2.5e-9)
(/ (* -1.0 (* F (- (* -1.0 (/ x F)) (/ 1.0 F)))) (- (sin B)))
(if (<= F 0.000215)
(/ (- x) (tan B))
(* F (+ (* -1.0 (/ x (* B F))) (/ 1.0 (* F (sin B))))))))double code(double F, double B, double x) {
double tmp;
if (F <= -2.5e-9) {
tmp = (-1.0 * (F * ((-1.0 * (x / F)) - (1.0 / F)))) / -sin(B);
} else if (F <= 0.000215) {
tmp = -x / tan(B);
} else {
tmp = F * ((-1.0 * (x / (B * F))) + (1.0 / (F * 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.5d-9)) then
tmp = ((-1.0d0) * (f * (((-1.0d0) * (x / f)) - (1.0d0 / f)))) / -sin(b)
else if (f <= 0.000215d0) then
tmp = -x / tan(b)
else
tmp = f * (((-1.0d0) * (x / (b * f))) + (1.0d0 / (f * sin(b))))
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -2.5e-9) {
tmp = (-1.0 * (F * ((-1.0 * (x / F)) - (1.0 / F)))) / -Math.sin(B);
} else if (F <= 0.000215) {
tmp = -x / Math.tan(B);
} else {
tmp = F * ((-1.0 * (x / (B * F))) + (1.0 / (F * Math.sin(B))));
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -2.5e-9: tmp = (-1.0 * (F * ((-1.0 * (x / F)) - (1.0 / F)))) / -math.sin(B) elif F <= 0.000215: tmp = -x / math.tan(B) else: tmp = F * ((-1.0 * (x / (B * F))) + (1.0 / (F * math.sin(B)))) return tmp
function code(F, B, x) tmp = 0.0 if (F <= -2.5e-9) tmp = Float64(Float64(-1.0 * Float64(F * Float64(Float64(-1.0 * Float64(x / F)) - Float64(1.0 / F)))) / Float64(-sin(B))); elseif (F <= 0.000215) tmp = Float64(Float64(-x) / tan(B)); else tmp = Float64(F * Float64(Float64(-1.0 * Float64(x / Float64(B * F))) + Float64(1.0 / Float64(F * sin(B))))); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -2.5e-9) tmp = (-1.0 * (F * ((-1.0 * (x / F)) - (1.0 / F)))) / -sin(B); elseif (F <= 0.000215) tmp = -x / tan(B); else tmp = F * ((-1.0 * (x / (B * F))) + (1.0 / (F * sin(B)))); end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -2.5e-9], N[(N[(-1.0 * N[(F * N[(N[(-1.0 * N[(x / F), $MachinePrecision]), $MachinePrecision] - N[(1.0 / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / (-N[Sin[B], $MachinePrecision])), $MachinePrecision], If[LessEqual[F, 0.000215], N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision], N[(F * N[(N[(-1.0 * N[(x / N[(B * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(F * N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;F \leq -2.5 \cdot 10^{-9}:\\
\;\;\;\;\frac{-1 \cdot \left(F \cdot \left(-1 \cdot \frac{x}{F} - \frac{1}{F}\right)\right)}{-\sin B}\\
\mathbf{elif}\;F \leq 0.000215:\\
\;\;\;\;\frac{-x}{\tan B}\\
\mathbf{else}:\\
\;\;\;\;F \cdot \left(-1 \cdot \frac{x}{B \cdot F} + \frac{1}{F \cdot \sin B}\right)\\
\end{array}
if F < -2.5000000000000001e-9Initial program 76.6%
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.2%
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.3%
Applied rewrites51.3%
Taylor expanded in B around 0
lower-/.f6437.1%
Applied rewrites37.1%
if -2.5000000000000001e-9 < F < 2.1499999999999999e-4Initial program 76.6%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6455.9%
Applied rewrites55.9%
lift-cos.f64N/A
cos-neg-revN/A
sin-+PI/2-revN/A
lower-sin.f64N/A
+-commutativeN/A
lower-+.f64N/A
mult-flipN/A
lift-/.f64N/A
lower-*.f64N/A
lower-PI.f64N/A
lift-/.f64N/A
metadata-evalN/A
lower-neg.f6433.0%
Applied rewrites33.0%
metadata-evalN/A
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
distribute-lft-neg-inN/A
Applied rewrites55.9%
if 2.1499999999999999e-4 < F Initial program 76.6%
Taylor expanded in F around inf
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f6447.5%
Applied rewrites47.5%
Taylor expanded in B around 0
lower-/.f64N/A
lower-*.f6432.3%
Applied rewrites32.3%
(FPCore (F B x)
:precision binary64
(if (<= F -7e+174)
(/ -1.0 (sin B))
(if (<= F 0.000215)
(/ (- x) (tan B))
(* F (+ (* -1.0 (/ x (* B F))) (/ 1.0 (* F (sin B))))))))double code(double F, double B, double x) {
double tmp;
if (F <= -7e+174) {
tmp = -1.0 / sin(B);
} else if (F <= 0.000215) {
tmp = -x / tan(B);
} else {
tmp = F * ((-1.0 * (x / (B * F))) + (1.0 / (F * 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 <= (-7d+174)) then
tmp = (-1.0d0) / sin(b)
else if (f <= 0.000215d0) then
tmp = -x / tan(b)
else
tmp = f * (((-1.0d0) * (x / (b * f))) + (1.0d0 / (f * sin(b))))
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -7e+174) {
tmp = -1.0 / Math.sin(B);
} else if (F <= 0.000215) {
tmp = -x / Math.tan(B);
} else {
tmp = F * ((-1.0 * (x / (B * F))) + (1.0 / (F * Math.sin(B))));
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -7e+174: tmp = -1.0 / math.sin(B) elif F <= 0.000215: tmp = -x / math.tan(B) else: tmp = F * ((-1.0 * (x / (B * F))) + (1.0 / (F * math.sin(B)))) return tmp
function code(F, B, x) tmp = 0.0 if (F <= -7e+174) tmp = Float64(-1.0 / sin(B)); elseif (F <= 0.000215) tmp = Float64(Float64(-x) / tan(B)); else tmp = Float64(F * Float64(Float64(-1.0 * Float64(x / Float64(B * F))) + Float64(1.0 / Float64(F * sin(B))))); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -7e+174) tmp = -1.0 / sin(B); elseif (F <= 0.000215) tmp = -x / tan(B); else tmp = F * ((-1.0 * (x / (B * F))) + (1.0 / (F * sin(B)))); end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -7e+174], N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 0.000215], N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision], N[(F * N[(N[(-1.0 * N[(x / N[(B * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(F * N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;F \leq -7 \cdot 10^{+174}:\\
\;\;\;\;\frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 0.000215:\\
\;\;\;\;\frac{-x}{\tan B}\\
\mathbf{else}:\\
\;\;\;\;F \cdot \left(-1 \cdot \frac{x}{B \cdot F} + \frac{1}{F \cdot \sin B}\right)\\
\end{array}
if F < -7.0000000000000003e174Initial program 76.6%
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.2%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6417.2%
Applied rewrites17.2%
if -7.0000000000000003e174 < F < 2.1499999999999999e-4Initial program 76.6%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6455.9%
Applied rewrites55.9%
lift-cos.f64N/A
cos-neg-revN/A
sin-+PI/2-revN/A
lower-sin.f64N/A
+-commutativeN/A
lower-+.f64N/A
mult-flipN/A
lift-/.f64N/A
lower-*.f64N/A
lower-PI.f64N/A
lift-/.f64N/A
metadata-evalN/A
lower-neg.f6433.0%
Applied rewrites33.0%
metadata-evalN/A
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
distribute-lft-neg-inN/A
Applied rewrites55.9%
if 2.1499999999999999e-4 < F Initial program 76.6%
Taylor expanded in F around inf
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f6447.5%
Applied rewrites47.5%
Taylor expanded in B around 0
lower-/.f64N/A
lower-*.f6432.3%
Applied rewrites32.3%
(FPCore (F B x) :precision binary64 (if (<= F -7e+174) (/ -1.0 (sin B)) (if (<= F 850000000000.0) (/ (- x) (tan B)) (/ 1.0 (sin B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -7e+174) {
tmp = -1.0 / sin(B);
} else if (F <= 850000000000.0) {
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 <= (-7d+174)) then
tmp = (-1.0d0) / sin(b)
else if (f <= 850000000000.0d0) 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 <= -7e+174) {
tmp = -1.0 / Math.sin(B);
} else if (F <= 850000000000.0) {
tmp = -x / Math.tan(B);
} else {
tmp = 1.0 / Math.sin(B);
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -7e+174: tmp = -1.0 / math.sin(B) elif F <= 850000000000.0: tmp = -x / math.tan(B) else: tmp = 1.0 / math.sin(B) return tmp
function code(F, B, x) tmp = 0.0 if (F <= -7e+174) tmp = Float64(-1.0 / sin(B)); elseif (F <= 850000000000.0) tmp = Float64(Float64(-x) / tan(B)); else tmp = Float64(1.0 / sin(B)); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -7e+174) tmp = -1.0 / sin(B); elseif (F <= 850000000000.0) tmp = -x / tan(B); else tmp = 1.0 / sin(B); end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -7e+174], N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 850000000000.0], N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision], N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;F \leq -7 \cdot 10^{+174}:\\
\;\;\;\;\frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 850000000000:\\
\;\;\;\;\frac{-x}{\tan B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B}\\
\end{array}
if F < -7.0000000000000003e174Initial program 76.6%
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.2%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6417.2%
Applied rewrites17.2%
if -7.0000000000000003e174 < F < 8.5e11Initial program 76.6%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6455.9%
Applied rewrites55.9%
lift-cos.f64N/A
cos-neg-revN/A
sin-+PI/2-revN/A
lower-sin.f64N/A
+-commutativeN/A
lower-+.f64N/A
mult-flipN/A
lift-/.f64N/A
lower-*.f64N/A
lower-PI.f64N/A
lift-/.f64N/A
metadata-evalN/A
lower-neg.f6433.0%
Applied rewrites33.0%
metadata-evalN/A
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
distribute-lft-neg-inN/A
Applied rewrites55.9%
if 8.5e11 < F Initial program 76.6%
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.2%
Taylor expanded in F around inf
lower-/.f64N/A
lower-sin.f6416.9%
Applied rewrites16.9%
(FPCore (F B x) :precision binary64 (if (<= F -80000.0) (/ -1.0 (sin B)) (if (<= F 21000000.0) (- (/ x B)) (/ 1.0 (sin B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -80000.0) {
tmp = -1.0 / sin(B);
} else if (F <= 21000000.0) {
tmp = -(x / 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 <= (-80000.0d0)) then
tmp = (-1.0d0) / sin(b)
else if (f <= 21000000.0d0) then
tmp = -(x / 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 <= -80000.0) {
tmp = -1.0 / Math.sin(B);
} else if (F <= 21000000.0) {
tmp = -(x / B);
} else {
tmp = 1.0 / Math.sin(B);
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -80000.0: tmp = -1.0 / math.sin(B) elif F <= 21000000.0: tmp = -(x / B) else: tmp = 1.0 / math.sin(B) return tmp
function code(F, B, x) tmp = 0.0 if (F <= -80000.0) tmp = Float64(-1.0 / sin(B)); elseif (F <= 21000000.0) tmp = Float64(-Float64(x / B)); else tmp = Float64(1.0 / sin(B)); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -80000.0) tmp = -1.0 / sin(B); elseif (F <= 21000000.0) tmp = -(x / B); else tmp = 1.0 / sin(B); end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -80000.0], N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 21000000.0], (-N[(x / B), $MachinePrecision]), N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;F \leq -80000:\\
\;\;\;\;\frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 21000000:\\
\;\;\;\;-\frac{x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B}\\
\end{array}
if F < -8e4Initial program 76.6%
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.2%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6417.2%
Applied rewrites17.2%
if -8e4 < F < 2.1e7Initial program 76.6%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6455.9%
Applied rewrites55.9%
Taylor expanded in B around 0
lower-/.f6430.3%
Applied rewrites30.3%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6430.3%
Applied rewrites30.3%
if 2.1e7 < F Initial program 76.6%
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.2%
Taylor expanded in F around inf
lower-/.f64N/A
lower-sin.f6416.9%
Applied rewrites16.9%
(FPCore (F B x)
:precision binary64
(if (<= F -80000.0)
(/ -1.0 (sin B))
(if (<= F 7.8e-14)
(- (/ x B))
(/ (* F (+ (* -1.0 (/ x F)) (/ 1.0 F))) B))))double code(double F, double B, double x) {
double tmp;
if (F <= -80000.0) {
tmp = -1.0 / sin(B);
} else if (F <= 7.8e-14) {
tmp = -(x / B);
} else {
tmp = (F * ((-1.0 * (x / F)) + (1.0 / F))) / 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 <= (-80000.0d0)) then
tmp = (-1.0d0) / sin(b)
else if (f <= 7.8d-14) then
tmp = -(x / b)
else
tmp = (f * (((-1.0d0) * (x / f)) + (1.0d0 / f))) / b
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -80000.0) {
tmp = -1.0 / Math.sin(B);
} else if (F <= 7.8e-14) {
tmp = -(x / B);
} else {
tmp = (F * ((-1.0 * (x / F)) + (1.0 / F))) / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -80000.0: tmp = -1.0 / math.sin(B) elif F <= 7.8e-14: tmp = -(x / B) else: tmp = (F * ((-1.0 * (x / F)) + (1.0 / F))) / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= -80000.0) tmp = Float64(-1.0 / sin(B)); elseif (F <= 7.8e-14) tmp = Float64(-Float64(x / B)); else tmp = Float64(Float64(F * Float64(Float64(-1.0 * Float64(x / F)) + Float64(1.0 / F))) / B); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -80000.0) tmp = -1.0 / sin(B); elseif (F <= 7.8e-14) tmp = -(x / B); else tmp = (F * ((-1.0 * (x / F)) + (1.0 / F))) / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -80000.0], N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 7.8e-14], (-N[(x / B), $MachinePrecision]), N[(N[(F * N[(N[(-1.0 * N[(x / F), $MachinePrecision]), $MachinePrecision] + N[(1.0 / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;F \leq -80000:\\
\;\;\;\;\frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 7.8 \cdot 10^{-14}:\\
\;\;\;\;-\frac{x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{F \cdot \left(-1 \cdot \frac{x}{F} + \frac{1}{F}\right)}{B}\\
\end{array}
if F < -8e4Initial program 76.6%
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.2%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6417.2%
Applied rewrites17.2%
if -8e4 < F < 7.7999999999999996e-14Initial program 76.6%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6455.9%
Applied rewrites55.9%
Taylor expanded in B around 0
lower-/.f6430.3%
Applied rewrites30.3%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6430.3%
Applied rewrites30.3%
if 7.7999999999999996e-14 < F Initial program 76.6%
Taylor expanded in F around inf
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f6447.5%
Applied rewrites47.5%
Taylor expanded in B around 0
lower-/.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6429.0%
Applied rewrites29.0%
(FPCore (F B x) :precision binary64 (if (<= F 7.8e-14) (- (/ x B)) (/ (* F (+ (* -1.0 (/ x F)) (/ 1.0 F))) B)))
double code(double F, double B, double x) {
double tmp;
if (F <= 7.8e-14) {
tmp = -(x / B);
} else {
tmp = (F * ((-1.0 * (x / F)) + (1.0 / F))) / 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 <= 7.8d-14) then
tmp = -(x / b)
else
tmp = (f * (((-1.0d0) * (x / f)) + (1.0d0 / f))) / b
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= 7.8e-14) {
tmp = -(x / B);
} else {
tmp = (F * ((-1.0 * (x / F)) + (1.0 / F))) / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= 7.8e-14: tmp = -(x / B) else: tmp = (F * ((-1.0 * (x / F)) + (1.0 / F))) / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= 7.8e-14) tmp = Float64(-Float64(x / B)); else tmp = Float64(Float64(F * Float64(Float64(-1.0 * Float64(x / F)) + Float64(1.0 / F))) / B); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= 7.8e-14) tmp = -(x / B); else tmp = (F * ((-1.0 * (x / F)) + (1.0 / F))) / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, 7.8e-14], (-N[(x / B), $MachinePrecision]), N[(N[(F * N[(N[(-1.0 * N[(x / F), $MachinePrecision]), $MachinePrecision] + N[(1.0 / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;F \leq 7.8 \cdot 10^{-14}:\\
\;\;\;\;-\frac{x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{F \cdot \left(-1 \cdot \frac{x}{F} + \frac{1}{F}\right)}{B}\\
\end{array}
if F < 7.7999999999999996e-14Initial program 76.6%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6455.9%
Applied rewrites55.9%
Taylor expanded in B around 0
lower-/.f6430.3%
Applied rewrites30.3%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6430.3%
Applied rewrites30.3%
if 7.7999999999999996e-14 < F Initial program 76.6%
Taylor expanded in F around inf
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f6447.5%
Applied rewrites47.5%
Taylor expanded in B around 0
lower-/.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6429.0%
Applied rewrites29.0%
(FPCore (F B x) :precision binary64 (- (/ x B)))
double code(double F, double B, double x) {
return -(x / B);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
code = -(x / b)
end function
public static double code(double F, double B, double x) {
return -(x / B);
}
def code(F, B, x): return -(x / B)
function code(F, B, x) return Float64(-Float64(x / B)) end
function tmp = code(F, B, x) tmp = -(x / B); end
code[F_, B_, x_] := (-N[(x / B), $MachinePrecision])
-\frac{x}{B}
Initial program 76.6%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6455.9%
Applied rewrites55.9%
Taylor expanded in B around 0
lower-/.f6430.3%
Applied rewrites30.3%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6430.3%
Applied rewrites30.3%
herbie shell --seed 2025258
(FPCore (F B x)
:name "VandenBroeck and Keller, Equation (23)"
:precision binary64
(+ (- (* x (/ 1.0 (tan B)))) (* (/ F (sin B)) (pow (+ (+ (* F F) 2.0) (* 2.0 x)) (- (/ 1.0 2.0))))))