
(FPCore (F B x) :precision binary64 (+ (- (* x (/ 1.0 (tan B)))) (* (/ F (sin B)) (pow (+ (+ (* F F) 2.0) (* 2.0 x)) (- (/ 1.0 2.0))))))
double code(double F, double B, double x) {
return -(x * (1.0 / tan(B))) + ((F / sin(B)) * pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
code = -(x * (1.0d0 / tan(b))) + ((f / sin(b)) * ((((f * f) + 2.0d0) + (2.0d0 * x)) ** -(1.0d0 / 2.0d0)))
end function
public static double code(double F, double B, double x) {
return -(x * (1.0 / Math.tan(B))) + ((F / Math.sin(B)) * Math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
}
def code(F, B, x): return -(x * (1.0 / math.tan(B))) + ((F / math.sin(B)) * math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)))
function code(F, B, x) return Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(Float64(F / sin(B)) * (Float64(Float64(Float64(F * F) + 2.0) + Float64(2.0 * x)) ^ Float64(-Float64(1.0 / 2.0))))) end
function tmp = code(F, B, x) tmp = -(x * (1.0 / tan(B))) + ((F / sin(B)) * ((((F * F) + 2.0) + (2.0 * x)) ^ -(1.0 / 2.0))); end
code[F_, B_, x_] := N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(N[(F * F), $MachinePrecision] + 2.0), $MachinePrecision] + N[(2.0 * x), $MachinePrecision]), $MachinePrecision], (-N[(1.0 / 2.0), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}
\end{array}
Herbie found 21 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (F B x) :precision binary64 (+ (- (* x (/ 1.0 (tan B)))) (* (/ F (sin B)) (pow (+ (+ (* F F) 2.0) (* 2.0 x)) (- (/ 1.0 2.0))))))
double code(double F, double B, double x) {
return -(x * (1.0 / tan(B))) + ((F / sin(B)) * pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
code = -(x * (1.0d0 / tan(b))) + ((f / sin(b)) * ((((f * f) + 2.0d0) + (2.0d0 * x)) ** -(1.0d0 / 2.0d0)))
end function
public static double code(double F, double B, double x) {
return -(x * (1.0 / Math.tan(B))) + ((F / Math.sin(B)) * Math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
}
def code(F, B, x): return -(x * (1.0 / math.tan(B))) + ((F / math.sin(B)) * math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)))
function code(F, B, x) return Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(Float64(F / sin(B)) * (Float64(Float64(Float64(F * F) + 2.0) + Float64(2.0 * x)) ^ Float64(-Float64(1.0 / 2.0))))) end
function tmp = code(F, B, x) tmp = -(x * (1.0 / tan(B))) + ((F / sin(B)) * ((((F * F) + 2.0) + (2.0 * x)) ^ -(1.0 / 2.0))); end
code[F_, B_, x_] := N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(N[(F * F), $MachinePrecision] + 2.0), $MachinePrecision] + N[(2.0 * x), $MachinePrecision]), $MachinePrecision], (-N[(1.0 / 2.0), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}
\end{array}
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ (- x) (tan B))))
(if (<= F -2e+19)
(fma -1.0 (/ 1.0 (sin B)) t_0)
(if (<= F 3.8e+23)
(fma F (/ (pow (fma 2.0 x (fma F F 2.0)) -0.5) (sin B)) t_0)
(/ (- 1.0 (* (cos B) x)) (sin B))))))
double code(double F, double B, double x) {
double t_0 = -x / tan(B);
double tmp;
if (F <= -2e+19) {
tmp = fma(-1.0, (1.0 / sin(B)), t_0);
} else if (F <= 3.8e+23) {
tmp = fma(F, (pow(fma(2.0, x, fma(F, F, 2.0)), -0.5) / sin(B)), t_0);
} else {
tmp = (1.0 - (cos(B) * x)) / sin(B);
}
return tmp;
}
function code(F, B, x) t_0 = Float64(Float64(-x) / tan(B)) tmp = 0.0 if (F <= -2e+19) tmp = fma(-1.0, Float64(1.0 / sin(B)), t_0); elseif (F <= 3.8e+23) tmp = fma(F, Float64((fma(2.0, x, fma(F, F, 2.0)) ^ -0.5) / sin(B)), t_0); else tmp = Float64(Float64(1.0 - Float64(cos(B) * x)) / sin(B)); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -2e+19], N[(-1.0 * N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision], If[LessEqual[F, 3.8e+23], N[(F * N[(N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision], N[(N[(1.0 - N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-x}{\tan B}\\
\mathbf{if}\;F \leq -2 \cdot 10^{+19}:\\
\;\;\;\;\mathsf{fma}\left(-1, \frac{1}{\sin B}, t\_0\right)\\
\mathbf{elif}\;F \leq 3.8 \cdot 10^{+23}:\\
\;\;\;\;\mathsf{fma}\left(F, \frac{{\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{\sin B}, t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - \cos B \cdot x}{\sin B}\\
\end{array}
\end{array}
if F < -2e19Initial program 76.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites84.8%
lift-fma.f64N/A
lift-/.f64N/A
lift-neg.f64N/A
distribute-frac-negN/A
mult-flip-revN/A
lift-/.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
mult-flipN/A
lift-neg.f64N/A
lower-fma.f64N/A
Applied rewrites84.8%
Taylor expanded in F around -inf
Applied rewrites56.6%
if -2e19 < F < 3.79999999999999975e23Initial program 76.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites84.8%
if 3.79999999999999975e23 < F Initial program 76.2%
Taylor expanded in F around inf
lower-*.f64N/A
lower-fma.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.8
Applied rewrites47.8%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6447.8
Applied rewrites50.5%
lift-*.f64N/A
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l*N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
associate-*l/N/A
Applied rewrites56.3%
(FPCore (F B x)
:precision binary64
(if (<= F -200000000.0)
(fma -1.0 (/ 1.0 (sin B)) (/ (- x) (tan B)))
(if (<= F 3.8e+23)
(- (* (pow (fma 2.0 x (fma F F 2.0)) -0.5) (/ F (sin B))) (/ x (tan B)))
(/ (- 1.0 (* (cos B) x)) (sin B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -200000000.0) {
tmp = fma(-1.0, (1.0 / sin(B)), (-x / tan(B)));
} else if (F <= 3.8e+23) {
tmp = (pow(fma(2.0, x, fma(F, F, 2.0)), -0.5) * (F / sin(B))) - (x / tan(B));
} else {
tmp = (1.0 - (cos(B) * x)) / sin(B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -200000000.0) tmp = fma(-1.0, Float64(1.0 / sin(B)), Float64(Float64(-x) / tan(B))); elseif (F <= 3.8e+23) tmp = Float64(Float64((fma(2.0, x, fma(F, F, 2.0)) ^ -0.5) * Float64(F / sin(B))) - Float64(x / tan(B))); else tmp = Float64(Float64(1.0 - Float64(cos(B) * x)) / sin(B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -200000000.0], N[(-1.0 * N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] + N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 3.8e+23], N[(N[(N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -200000000:\\
\;\;\;\;\mathsf{fma}\left(-1, \frac{1}{\sin B}, \frac{-x}{\tan B}\right)\\
\mathbf{elif}\;F \leq 3.8 \cdot 10^{+23}:\\
\;\;\;\;{\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5} \cdot \frac{F}{\sin B} - \frac{x}{\tan B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - \cos B \cdot x}{\sin B}\\
\end{array}
\end{array}
if F < -2e8Initial program 76.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites84.8%
lift-fma.f64N/A
lift-/.f64N/A
lift-neg.f64N/A
distribute-frac-negN/A
mult-flip-revN/A
lift-/.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
mult-flipN/A
lift-neg.f64N/A
lower-fma.f64N/A
Applied rewrites84.8%
Taylor expanded in F around -inf
Applied rewrites56.6%
if -2e8 < F < 3.79999999999999975e23Initial program 76.2%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6476.2
Applied rewrites76.3%
if 3.79999999999999975e23 < F Initial program 76.2%
Taylor expanded in F around inf
lower-*.f64N/A
lower-fma.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.8
Applied rewrites47.8%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6447.8
Applied rewrites50.5%
lift-*.f64N/A
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l*N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
associate-*l/N/A
Applied rewrites56.3%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ (- x) (tan B))))
(if (<= F -1.52)
(fma -1.0 (/ 1.0 (sin B)) t_0)
(if (<= F 1.65)
(fma F (/ (pow (fma 2.0 x 2.0) -0.5) (sin B)) t_0)
(/ (- 1.0 (* (cos B) x)) (sin B))))))
double code(double F, double B, double x) {
double t_0 = -x / tan(B);
double tmp;
if (F <= -1.52) {
tmp = fma(-1.0, (1.0 / sin(B)), t_0);
} else if (F <= 1.65) {
tmp = fma(F, (pow(fma(2.0, x, 2.0), -0.5) / sin(B)), t_0);
} else {
tmp = (1.0 - (cos(B) * x)) / sin(B);
}
return tmp;
}
function code(F, B, x) t_0 = Float64(Float64(-x) / tan(B)) tmp = 0.0 if (F <= -1.52) tmp = fma(-1.0, Float64(1.0 / sin(B)), t_0); elseif (F <= 1.65) tmp = fma(F, Float64((fma(2.0, x, 2.0) ^ -0.5) / sin(B)), t_0); else tmp = Float64(Float64(1.0 - Float64(cos(B) * x)) / sin(B)); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -1.52], N[(-1.0 * N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision], If[LessEqual[F, 1.65], N[(F * N[(N[Power[N[(2.0 * x + 2.0), $MachinePrecision], -0.5], $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision], N[(N[(1.0 - N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-x}{\tan B}\\
\mathbf{if}\;F \leq -1.52:\\
\;\;\;\;\mathsf{fma}\left(-1, \frac{1}{\sin B}, t\_0\right)\\
\mathbf{elif}\;F \leq 1.65:\\
\;\;\;\;\mathsf{fma}\left(F, \frac{{\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{-0.5}}{\sin B}, t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - \cos B \cdot x}{\sin B}\\
\end{array}
\end{array}
if F < -1.52Initial program 76.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites84.8%
lift-fma.f64N/A
lift-/.f64N/A
lift-neg.f64N/A
distribute-frac-negN/A
mult-flip-revN/A
lift-/.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
mult-flipN/A
lift-neg.f64N/A
lower-fma.f64N/A
Applied rewrites84.8%
Taylor expanded in F around -inf
Applied rewrites56.6%
if -1.52 < F < 1.6499999999999999Initial program 76.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites84.8%
Taylor expanded in F around 0
Applied rewrites55.5%
if 1.6499999999999999 < F Initial program 76.2%
Taylor expanded in F around inf
lower-*.f64N/A
lower-fma.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.8
Applied rewrites47.8%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6447.8
Applied rewrites50.5%
lift-*.f64N/A
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l*N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
associate-*l/N/A
Applied rewrites56.3%
(FPCore (F B x)
:precision binary64
(if (<= F -0.182)
(fma -1.0 (/ 1.0 (sin B)) (/ (- x) (tan B)))
(if (<= F 1700.0)
(+
(- (* x (/ 1.0 (tan B))))
(* (/ F B) (pow (+ (+ (* F F) 2.0) (* 2.0 x)) (- (/ 1.0 2.0)))))
(/ (- 1.0 (* (cos B) x)) (sin B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -0.182) {
tmp = fma(-1.0, (1.0 / sin(B)), (-x / tan(B)));
} else if (F <= 1700.0) {
tmp = -(x * (1.0 / tan(B))) + ((F / B) * pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
} else {
tmp = (1.0 - (cos(B) * x)) / sin(B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -0.182) tmp = fma(-1.0, Float64(1.0 / sin(B)), Float64(Float64(-x) / tan(B))); elseif (F <= 1700.0) tmp = Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(Float64(F / B) * (Float64(Float64(Float64(F * F) + 2.0) + Float64(2.0 * x)) ^ Float64(-Float64(1.0 / 2.0))))); else tmp = Float64(Float64(1.0 - Float64(cos(B) * x)) / sin(B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -0.182], N[(-1.0 * N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] + N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1700.0], N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + 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[(N[(1.0 - N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -0.182:\\
\;\;\;\;\mathsf{fma}\left(-1, \frac{1}{\sin B}, \frac{-x}{\tan B}\right)\\
\mathbf{elif}\;F \leq 1700:\\
\;\;\;\;\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - \cos B \cdot x}{\sin B}\\
\end{array}
\end{array}
if F < -0.182Initial program 76.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites84.8%
lift-fma.f64N/A
lift-/.f64N/A
lift-neg.f64N/A
distribute-frac-negN/A
mult-flip-revN/A
lift-/.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
mult-flipN/A
lift-neg.f64N/A
lower-fma.f64N/A
Applied rewrites84.8%
Taylor expanded in F around -inf
Applied rewrites56.6%
if -0.182 < F < 1700Initial program 76.2%
Taylor expanded in B around 0
lower-/.f6461.4
Applied rewrites61.4%
if 1700 < F Initial program 76.2%
Taylor expanded in F around inf
lower-*.f64N/A
lower-fma.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.8
Applied rewrites47.8%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6447.8
Applied rewrites50.5%
lift-*.f64N/A
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l*N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
associate-*l/N/A
Applied rewrites56.3%
(FPCore (F B x)
:precision binary64
(let* ((t_0
(fma F (/ (pow (fma 2.0 x (fma F F 2.0)) -0.5) (sin B)) (/ (- x) B)))
(t_1 (/ (- x) (tan B))))
(if (<= F -1.55e+19)
(fma -1.0 (/ 1.0 (sin B)) t_1)
(if (<= F -3.7e-227)
t_0
(if (<= F 5e-139)
t_1
(if (<= F 500000.0) t_0 (/ (- 1.0 (* (cos B) x)) (sin B))))))))
double code(double F, double B, double x) {
double t_0 = fma(F, (pow(fma(2.0, x, fma(F, F, 2.0)), -0.5) / sin(B)), (-x / B));
double t_1 = -x / tan(B);
double tmp;
if (F <= -1.55e+19) {
tmp = fma(-1.0, (1.0 / sin(B)), t_1);
} else if (F <= -3.7e-227) {
tmp = t_0;
} else if (F <= 5e-139) {
tmp = t_1;
} else if (F <= 500000.0) {
tmp = t_0;
} else {
tmp = (1.0 - (cos(B) * x)) / sin(B);
}
return tmp;
}
function code(F, B, x) t_0 = fma(F, Float64((fma(2.0, x, fma(F, F, 2.0)) ^ -0.5) / sin(B)), Float64(Float64(-x) / B)) t_1 = Float64(Float64(-x) / tan(B)) tmp = 0.0 if (F <= -1.55e+19) tmp = fma(-1.0, Float64(1.0 / sin(B)), t_1); elseif (F <= -3.7e-227) tmp = t_0; elseif (F <= 5e-139) tmp = t_1; elseif (F <= 500000.0) tmp = t_0; else tmp = Float64(Float64(1.0 - Float64(cos(B) * x)) / sin(B)); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(F * N[(N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] + N[((-x) / B), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -1.55e+19], N[(-1.0 * N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision], If[LessEqual[F, -3.7e-227], t$95$0, If[LessEqual[F, 5e-139], t$95$1, If[LessEqual[F, 500000.0], t$95$0, N[(N[(1.0 - N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(F, \frac{{\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{\sin B}, \frac{-x}{B}\right)\\
t_1 := \frac{-x}{\tan B}\\
\mathbf{if}\;F \leq -1.55 \cdot 10^{+19}:\\
\;\;\;\;\mathsf{fma}\left(-1, \frac{1}{\sin B}, t\_1\right)\\
\mathbf{elif}\;F \leq -3.7 \cdot 10^{-227}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;F \leq 5 \cdot 10^{-139}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;F \leq 500000:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - \cos B \cdot x}{\sin B}\\
\end{array}
\end{array}
if F < -1.55e19Initial program 76.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites84.8%
lift-fma.f64N/A
lift-/.f64N/A
lift-neg.f64N/A
distribute-frac-negN/A
mult-flip-revN/A
lift-/.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
mult-flipN/A
lift-neg.f64N/A
lower-fma.f64N/A
Applied rewrites84.8%
Taylor expanded in F around -inf
Applied rewrites56.6%
if -1.55e19 < F < -3.69999999999999978e-227 or 5.00000000000000034e-139 < F < 5e5Initial program 76.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites84.8%
lift-fma.f64N/A
lift-/.f64N/A
lift-neg.f64N/A
distribute-frac-negN/A
mult-flip-revN/A
lift-/.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
mult-flipN/A
lift-neg.f64N/A
lower-fma.f64N/A
Applied rewrites84.8%
Taylor expanded in B around 0
lower-*.f64N/A
lower-/.f6457.3
Applied rewrites57.3%
lift-fma.f64N/A
lift-/.f64N/A
mult-flip-revN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6457.3
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6457.3
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
distribute-neg-fracN/A
lift-neg.f64N/A
lower-/.f6457.3
Applied rewrites57.3%
if -3.69999999999999978e-227 < F < 5.00000000000000034e-139Initial program 76.2%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6455.4
Applied rewrites55.4%
metadata-eval55.4
metadata-eval55.4
metadata-eval55.4
metadata-eval55.4
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
Applied rewrites55.5%
if 5e5 < F Initial program 76.2%
Taylor expanded in F around inf
lower-*.f64N/A
lower-fma.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.8
Applied rewrites47.8%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6447.8
Applied rewrites50.5%
lift-*.f64N/A
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l*N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
associate-*l/N/A
Applied rewrites56.3%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ (- x) (tan B))))
(if (<= x -2.1e+16)
t_0
(if (<= x 1.8e-34)
(fma
(* (pow (fma x 2.0 (fma F F 2.0)) -0.5) F)
(/ 1.0 (sin B))
(* -1.0 (/ x B)))
t_0))))
double code(double F, double B, double x) {
double t_0 = -x / tan(B);
double tmp;
if (x <= -2.1e+16) {
tmp = t_0;
} else if (x <= 1.8e-34) {
tmp = fma((pow(fma(x, 2.0, fma(F, F, 2.0)), -0.5) * F), (1.0 / sin(B)), (-1.0 * (x / B)));
} else {
tmp = t_0;
}
return tmp;
}
function code(F, B, x) t_0 = Float64(Float64(-x) / tan(B)) tmp = 0.0 if (x <= -2.1e+16) tmp = t_0; elseif (x <= 1.8e-34) tmp = fma(Float64((fma(x, 2.0, fma(F, F, 2.0)) ^ -0.5) * F), Float64(1.0 / sin(B)), Float64(-1.0 * Float64(x / B))); else tmp = t_0; end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.1e+16], t$95$0, If[LessEqual[x, 1.8e-34], N[(N[(N[Power[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * F), $MachinePrecision] * N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] + N[(-1.0 * N[(x / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-x}{\tan B}\\
\mathbf{if}\;x \leq -2.1 \cdot 10^{+16}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 1.8 \cdot 10^{-34}:\\
\;\;\;\;\mathsf{fma}\left({\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5} \cdot F, \frac{1}{\sin B}, -1 \cdot \frac{x}{B}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -2.1e16 or 1.80000000000000004e-34 < x Initial program 76.2%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6455.4
Applied rewrites55.4%
metadata-eval55.4
metadata-eval55.4
metadata-eval55.4
metadata-eval55.4
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
Applied rewrites55.5%
if -2.1e16 < x < 1.80000000000000004e-34Initial program 76.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites84.8%
lift-fma.f64N/A
lift-/.f64N/A
lift-neg.f64N/A
distribute-frac-negN/A
mult-flip-revN/A
lift-/.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
mult-flipN/A
lift-neg.f64N/A
lower-fma.f64N/A
Applied rewrites84.8%
Taylor expanded in B around 0
lower-*.f64N/A
lower-/.f6457.3
Applied rewrites57.3%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ (- x) (tan B))))
(if (<= x -2.1e+16)
t_0
(if (<= x 1.8e-34)
(fma F (/ (pow (fma 2.0 x (fma F F 2.0)) -0.5) (sin B)) (/ (- x) B))
t_0))))
double code(double F, double B, double x) {
double t_0 = -x / tan(B);
double tmp;
if (x <= -2.1e+16) {
tmp = t_0;
} else if (x <= 1.8e-34) {
tmp = fma(F, (pow(fma(2.0, x, fma(F, F, 2.0)), -0.5) / sin(B)), (-x / B));
} else {
tmp = t_0;
}
return tmp;
}
function code(F, B, x) t_0 = Float64(Float64(-x) / tan(B)) tmp = 0.0 if (x <= -2.1e+16) tmp = t_0; elseif (x <= 1.8e-34) tmp = fma(F, Float64((fma(2.0, x, fma(F, F, 2.0)) ^ -0.5) / sin(B)), Float64(Float64(-x) / B)); else tmp = t_0; end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.1e+16], t$95$0, If[LessEqual[x, 1.8e-34], N[(F * N[(N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] + N[((-x) / B), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-x}{\tan B}\\
\mathbf{if}\;x \leq -2.1 \cdot 10^{+16}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 1.8 \cdot 10^{-34}:\\
\;\;\;\;\mathsf{fma}\left(F, \frac{{\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{\sin B}, \frac{-x}{B}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -2.1e16 or 1.80000000000000004e-34 < x Initial program 76.2%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6455.4
Applied rewrites55.4%
metadata-eval55.4
metadata-eval55.4
metadata-eval55.4
metadata-eval55.4
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
Applied rewrites55.5%
if -2.1e16 < x < 1.80000000000000004e-34Initial program 76.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites84.8%
lift-fma.f64N/A
lift-/.f64N/A
lift-neg.f64N/A
distribute-frac-negN/A
mult-flip-revN/A
lift-/.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
mult-flipN/A
lift-neg.f64N/A
lower-fma.f64N/A
Applied rewrites84.8%
Taylor expanded in B around 0
lower-*.f64N/A
lower-/.f6457.3
Applied rewrites57.3%
lift-fma.f64N/A
lift-/.f64N/A
mult-flip-revN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6457.3
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6457.3
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
distribute-neg-fracN/A
lift-neg.f64N/A
lower-/.f6457.3
Applied rewrites57.3%
(FPCore (F B x) :precision binary64 (if (<= B 6.5e-6) (/ (- (* F (pow (+ 2.0 (fma 2.0 x (pow F 2.0))) -0.5)) x) B) (/ (- x) (tan B))))
double code(double F, double B, double x) {
double tmp;
if (B <= 6.5e-6) {
tmp = ((F * pow((2.0 + fma(2.0, x, pow(F, 2.0))), -0.5)) - x) / B;
} else {
tmp = -x / tan(B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (B <= 6.5e-6) tmp = Float64(Float64(Float64(F * (Float64(2.0 + fma(2.0, x, (F ^ 2.0))) ^ -0.5)) - x) / B); else tmp = Float64(Float64(-x) / tan(B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[B, 6.5e-6], N[(N[(N[(F * N[Power[N[(2.0 + N[(2.0 * x + N[Power[F, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq 6.5 \cdot 10^{-6}:\\
\;\;\;\;\frac{F \cdot {\left(2 + \mathsf{fma}\left(2, x, {F}^{2}\right)\right)}^{-0.5} - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{-x}{\tan B}\\
\end{array}
\end{array}
if B < 6.4999999999999996e-6Initial program 76.2%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites43.3%
if 6.4999999999999996e-6 < B Initial program 76.2%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6455.4
Applied rewrites55.4%
metadata-eval55.4
metadata-eval55.4
metadata-eval55.4
metadata-eval55.4
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
Applied rewrites55.5%
(FPCore (F B x) :precision binary64 (if (<= B 6.5e-6) (fma (* (pow (fma x 2.0 (fma F F 2.0)) -0.5) F) (/ 1.0 B) (* -1.0 (/ x B))) (/ (- x) (tan B))))
double code(double F, double B, double x) {
double tmp;
if (B <= 6.5e-6) {
tmp = fma((pow(fma(x, 2.0, fma(F, F, 2.0)), -0.5) * F), (1.0 / B), (-1.0 * (x / B)));
} else {
tmp = -x / tan(B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (B <= 6.5e-6) tmp = fma(Float64((fma(x, 2.0, fma(F, F, 2.0)) ^ -0.5) * F), Float64(1.0 / B), Float64(-1.0 * Float64(x / B))); else tmp = Float64(Float64(-x) / tan(B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[B, 6.5e-6], N[(N[(N[Power[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * F), $MachinePrecision] * N[(1.0 / B), $MachinePrecision] + N[(-1.0 * N[(x / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq 6.5 \cdot 10^{-6}:\\
\;\;\;\;\mathsf{fma}\left({\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5} \cdot F, \frac{1}{B}, -1 \cdot \frac{x}{B}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{-x}{\tan B}\\
\end{array}
\end{array}
if B < 6.4999999999999996e-6Initial program 76.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites84.8%
lift-fma.f64N/A
lift-/.f64N/A
lift-neg.f64N/A
distribute-frac-negN/A
mult-flip-revN/A
lift-/.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
mult-flipN/A
lift-neg.f64N/A
lower-fma.f64N/A
Applied rewrites84.8%
Taylor expanded in B around 0
lower-*.f64N/A
lower-/.f6457.3
Applied rewrites57.3%
Taylor expanded in B around 0
Applied rewrites43.3%
if 6.4999999999999996e-6 < B Initial program 76.2%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6455.4
Applied rewrites55.4%
metadata-eval55.4
metadata-eval55.4
metadata-eval55.4
metadata-eval55.4
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
Applied rewrites55.5%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ (- x) (tan B))))
(if (<= x -2.3e+15)
t_0
(if (<= x -2.3e-194)
(* F (fma -1.0 (/ x (* B F)) (fabs (/ 1.0 (* B F)))))
(if (<= x 1.4e-225) (/ -1.0 (sin B)) t_0)))))
double code(double F, double B, double x) {
double t_0 = -x / tan(B);
double tmp;
if (x <= -2.3e+15) {
tmp = t_0;
} else if (x <= -2.3e-194) {
tmp = F * fma(-1.0, (x / (B * F)), fabs((1.0 / (B * F))));
} else if (x <= 1.4e-225) {
tmp = -1.0 / sin(B);
} else {
tmp = t_0;
}
return tmp;
}
function code(F, B, x) t_0 = Float64(Float64(-x) / tan(B)) tmp = 0.0 if (x <= -2.3e+15) tmp = t_0; elseif (x <= -2.3e-194) tmp = Float64(F * fma(-1.0, Float64(x / Float64(B * F)), abs(Float64(1.0 / Float64(B * F))))); elseif (x <= 1.4e-225) tmp = Float64(-1.0 / sin(B)); else tmp = t_0; end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.3e+15], t$95$0, If[LessEqual[x, -2.3e-194], N[(F * N[(-1.0 * N[(x / N[(B * F), $MachinePrecision]), $MachinePrecision] + N[Abs[N[(1.0 / N[(B * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.4e-225], N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-x}{\tan B}\\
\mathbf{if}\;x \leq -2.3 \cdot 10^{+15}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq -2.3 \cdot 10^{-194}:\\
\;\;\;\;F \cdot \mathsf{fma}\left(-1, \frac{x}{B \cdot F}, \left|\frac{1}{B \cdot F}\right|\right)\\
\mathbf{elif}\;x \leq 1.4 \cdot 10^{-225}:\\
\;\;\;\;\frac{-1}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -2.3e15 or 1.4e-225 < x Initial program 76.2%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6455.4
Applied rewrites55.4%
metadata-eval55.4
metadata-eval55.4
metadata-eval55.4
metadata-eval55.4
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
Applied rewrites55.5%
if -2.3e15 < x < -2.30000000000000003e-194Initial program 76.2%
Taylor expanded in F around inf
lower-*.f64N/A
lower-fma.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.8
Applied rewrites47.8%
Taylor expanded in B around 0
lower-/.f64N/A
lower-*.f6431.5
Applied rewrites31.5%
Taylor expanded in B around 0
lower-/.f64N/A
lower-*.f6424.4
Applied rewrites24.4%
lift-/.f64N/A
inv-powN/A
pow-to-expN/A
exp-fabsN/A
pow-to-expN/A
inv-powN/A
lift-/.f64N/A
lower-fabs.f6426.0
Applied rewrites26.0%
if -2.30000000000000003e-194 < x < 1.4e-225Initial program 76.2%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6417.7
Applied rewrites17.7%
(FPCore (F B x) :precision binary64 (if (<= F -1.5e-12) (/ -1.0 (sin B)) (if (<= F 1.5e-37) (* -1.0 (/ x (sin B))) (/ (- 1.0 x) (sin B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1.5e-12) {
tmp = -1.0 / sin(B);
} else if (F <= 1.5e-37) {
tmp = -1.0 * (x / sin(B));
} else {
tmp = (1.0 - x) / sin(B);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: tmp
if (f <= (-1.5d-12)) then
tmp = (-1.0d0) / sin(b)
else if (f <= 1.5d-37) then
tmp = (-1.0d0) * (x / sin(b))
else
tmp = (1.0d0 - x) / sin(b)
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -1.5e-12) {
tmp = -1.0 / Math.sin(B);
} else if (F <= 1.5e-37) {
tmp = -1.0 * (x / Math.sin(B));
} else {
tmp = (1.0 - x) / Math.sin(B);
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -1.5e-12: tmp = -1.0 / math.sin(B) elif F <= 1.5e-37: tmp = -1.0 * (x / math.sin(B)) else: tmp = (1.0 - x) / math.sin(B) return tmp
function code(F, B, x) tmp = 0.0 if (F <= -1.5e-12) tmp = Float64(-1.0 / sin(B)); elseif (F <= 1.5e-37) tmp = Float64(-1.0 * Float64(x / sin(B))); else tmp = Float64(Float64(1.0 - x) / sin(B)); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -1.5e-12) tmp = -1.0 / sin(B); elseif (F <= 1.5e-37) tmp = -1.0 * (x / sin(B)); else tmp = (1.0 - x) / sin(B); end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -1.5e-12], N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.5e-37], N[(-1.0 * N[(x / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.5 \cdot 10^{-12}:\\
\;\;\;\;\frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 1.5 \cdot 10^{-37}:\\
\;\;\;\;-1 \cdot \frac{x}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{\sin B}\\
\end{array}
\end{array}
if F < -1.5000000000000001e-12Initial program 76.2%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6417.7
Applied rewrites17.7%
if -1.5000000000000001e-12 < F < 1.5e-37Initial program 76.2%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6455.4
Applied rewrites55.4%
Taylor expanded in B around 0
Applied rewrites31.1%
if 1.5e-37 < F Initial program 76.2%
Taylor expanded in F around inf
lower-*.f64N/A
lower-fma.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.8
Applied rewrites47.8%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6447.8
Applied rewrites50.5%
Taylor expanded in B around 0
lower--.f6435.4
Applied rewrites35.4%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
mult-flip-revN/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lift-/.f64N/A
associate-/l*N/A
lift-/.f64N/A
rgt-mult-inverseN/A
mult-flipN/A
Applied rewrites38.3%
(FPCore (F B x)
:precision binary64
(if (<= F -1.5e-12)
(/ -1.0 (sin B))
(if (<= F 4.4e-69)
(* -1.0 (/ (fma (* (* -0.3333333333333333 x) B) B x) B))
(/ (- 1.0 x) (sin B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1.5e-12) {
tmp = -1.0 / sin(B);
} else if (F <= 4.4e-69) {
tmp = -1.0 * (fma(((-0.3333333333333333 * x) * B), B, x) / B);
} else {
tmp = (1.0 - x) / sin(B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -1.5e-12) tmp = Float64(-1.0 / sin(B)); elseif (F <= 4.4e-69) tmp = Float64(-1.0 * Float64(fma(Float64(Float64(-0.3333333333333333 * x) * B), B, x) / B)); else tmp = Float64(Float64(1.0 - x) / sin(B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -1.5e-12], N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 4.4e-69], N[(-1.0 * N[(N[(N[(N[(-0.3333333333333333 * x), $MachinePrecision] * B), $MachinePrecision] * B + x), $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.5 \cdot 10^{-12}:\\
\;\;\;\;\frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 4.4 \cdot 10^{-69}:\\
\;\;\;\;-1 \cdot \frac{\mathsf{fma}\left(\left(-0.3333333333333333 \cdot x\right) \cdot B, B, x\right)}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{\sin B}\\
\end{array}
\end{array}
if F < -1.5000000000000001e-12Initial program 76.2%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6417.7
Applied rewrites17.7%
if -1.5000000000000001e-12 < F < 4.4e-69Initial program 76.2%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6455.4
Applied rewrites55.4%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites28.7%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f6428.9
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
distribute-rgt-out--N/A
*-commutativeN/A
lower-*.f64N/A
metadata-eval28.9
Applied rewrites28.9%
if 4.4e-69 < F Initial program 76.2%
Taylor expanded in F around inf
lower-*.f64N/A
lower-fma.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.8
Applied rewrites47.8%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6447.8
Applied rewrites50.5%
Taylor expanded in B around 0
lower--.f6435.4
Applied rewrites35.4%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
mult-flip-revN/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lift-/.f64N/A
associate-/l*N/A
lift-/.f64N/A
rgt-mult-inverseN/A
mult-flipN/A
Applied rewrites38.3%
(FPCore (F B x)
:precision binary64
(if (<= F -1.5e-12)
(/ -1.0 (sin B))
(if (<= F 1.32e-21)
(* -1.0 (/ (fma (* (* -0.3333333333333333 x) B) B x) B))
(/ 1.0 (sin B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1.5e-12) {
tmp = -1.0 / sin(B);
} else if (F <= 1.32e-21) {
tmp = -1.0 * (fma(((-0.3333333333333333 * x) * B), B, x) / B);
} else {
tmp = 1.0 / sin(B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -1.5e-12) tmp = Float64(-1.0 / sin(B)); elseif (F <= 1.32e-21) tmp = Float64(-1.0 * Float64(fma(Float64(Float64(-0.3333333333333333 * x) * B), B, x) / B)); else tmp = Float64(1.0 / sin(B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -1.5e-12], N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.32e-21], N[(-1.0 * N[(N[(N[(N[(-0.3333333333333333 * x), $MachinePrecision] * B), $MachinePrecision] * B + x), $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.5 \cdot 10^{-12}:\\
\;\;\;\;\frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 1.32 \cdot 10^{-21}:\\
\;\;\;\;-1 \cdot \frac{\mathsf{fma}\left(\left(-0.3333333333333333 \cdot x\right) \cdot B, B, x\right)}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B}\\
\end{array}
\end{array}
if F < -1.5000000000000001e-12Initial program 76.2%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6417.7
Applied rewrites17.7%
if -1.5000000000000001e-12 < F < 1.32e-21Initial program 76.2%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6455.4
Applied rewrites55.4%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites28.7%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f6428.9
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
distribute-rgt-out--N/A
*-commutativeN/A
lower-*.f64N/A
metadata-eval28.9
Applied rewrites28.9%
if 1.32e-21 < F Initial program 76.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 -1.5e-12)
(/ -1.0 (sin B))
(if (<= F 9.2e-69)
(* -1.0 (/ (fma (* (* -0.3333333333333333 x) B) B x) B))
(- (/ 1.0 B) (/ x B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1.5e-12) {
tmp = -1.0 / sin(B);
} else if (F <= 9.2e-69) {
tmp = -1.0 * (fma(((-0.3333333333333333 * x) * B), B, x) / B);
} else {
tmp = (1.0 / B) - (x / B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -1.5e-12) tmp = Float64(-1.0 / sin(B)); elseif (F <= 9.2e-69) tmp = Float64(-1.0 * Float64(fma(Float64(Float64(-0.3333333333333333 * x) * B), B, x) / B)); else tmp = Float64(Float64(1.0 / B) - Float64(x / B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -1.5e-12], N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 9.2e-69], N[(-1.0 * N[(N[(N[(N[(-0.3333333333333333 * x), $MachinePrecision] * B), $MachinePrecision] * B + x), $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / B), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.5 \cdot 10^{-12}:\\
\;\;\;\;\frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 9.2 \cdot 10^{-69}:\\
\;\;\;\;-1 \cdot \frac{\mathsf{fma}\left(\left(-0.3333333333333333 \cdot x\right) \cdot B, B, x\right)}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{B} - \frac{x}{B}\\
\end{array}
\end{array}
if F < -1.5000000000000001e-12Initial program 76.2%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6417.7
Applied rewrites17.7%
if -1.5000000000000001e-12 < F < 9.2000000000000003e-69Initial program 76.2%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6455.4
Applied rewrites55.4%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites28.7%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f6428.9
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
distribute-rgt-out--N/A
*-commutativeN/A
lower-*.f64N/A
metadata-eval28.9
Applied rewrites28.9%
if 9.2000000000000003e-69 < F Initial program 76.2%
Taylor expanded in F around inf
lower-*.f64N/A
lower-fma.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.8
Applied rewrites47.8%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6447.8
Applied rewrites50.5%
Taylor expanded in B around 0
lower-/.f64N/A
lower--.f6429.7
Applied rewrites29.7%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lift-/.f64N/A
lower--.f64N/A
lower-/.f6429.7
Applied rewrites29.7%
(FPCore (F B x)
:precision binary64
(if (<= F -5.9e-61)
(* F (fma -1.0 (/ x (* B F)) (fabs (/ 1.0 (* B F)))))
(if (<= F 9.2e-69)
(* -1.0 (/ (fma (* (* -0.3333333333333333 x) B) B x) B))
(- (/ 1.0 B) (/ x B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -5.9e-61) {
tmp = F * fma(-1.0, (x / (B * F)), fabs((1.0 / (B * F))));
} else if (F <= 9.2e-69) {
tmp = -1.0 * (fma(((-0.3333333333333333 * x) * B), B, x) / B);
} else {
tmp = (1.0 / B) - (x / B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -5.9e-61) tmp = Float64(F * fma(-1.0, Float64(x / Float64(B * F)), abs(Float64(1.0 / Float64(B * F))))); elseif (F <= 9.2e-69) tmp = Float64(-1.0 * Float64(fma(Float64(Float64(-0.3333333333333333 * x) * B), B, x) / B)); else tmp = Float64(Float64(1.0 / B) - Float64(x / B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -5.9e-61], N[(F * N[(-1.0 * N[(x / N[(B * F), $MachinePrecision]), $MachinePrecision] + N[Abs[N[(1.0 / N[(B * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 9.2e-69], N[(-1.0 * N[(N[(N[(N[(-0.3333333333333333 * x), $MachinePrecision] * B), $MachinePrecision] * B + x), $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / B), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -5.9 \cdot 10^{-61}:\\
\;\;\;\;F \cdot \mathsf{fma}\left(-1, \frac{x}{B \cdot F}, \left|\frac{1}{B \cdot F}\right|\right)\\
\mathbf{elif}\;F \leq 9.2 \cdot 10^{-69}:\\
\;\;\;\;-1 \cdot \frac{\mathsf{fma}\left(\left(-0.3333333333333333 \cdot x\right) \cdot B, B, x\right)}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{B} - \frac{x}{B}\\
\end{array}
\end{array}
if F < -5.89999999999999972e-61Initial program 76.2%
Taylor expanded in F around inf
lower-*.f64N/A
lower-fma.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.8
Applied rewrites47.8%
Taylor expanded in B around 0
lower-/.f64N/A
lower-*.f6431.5
Applied rewrites31.5%
Taylor expanded in B around 0
lower-/.f64N/A
lower-*.f6424.4
Applied rewrites24.4%
lift-/.f64N/A
inv-powN/A
pow-to-expN/A
exp-fabsN/A
pow-to-expN/A
inv-powN/A
lift-/.f64N/A
lower-fabs.f6426.0
Applied rewrites26.0%
if -5.89999999999999972e-61 < F < 9.2000000000000003e-69Initial program 76.2%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6455.4
Applied rewrites55.4%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites28.7%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f6428.9
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
distribute-rgt-out--N/A
*-commutativeN/A
lower-*.f64N/A
metadata-eval28.9
Applied rewrites28.9%
if 9.2000000000000003e-69 < F Initial program 76.2%
Taylor expanded in F around inf
lower-*.f64N/A
lower-fma.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.8
Applied rewrites47.8%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6447.8
Applied rewrites50.5%
Taylor expanded in B around 0
lower-/.f64N/A
lower--.f6429.7
Applied rewrites29.7%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lift-/.f64N/A
lower--.f64N/A
lower-/.f6429.7
Applied rewrites29.7%
(FPCore (F B x)
:precision binary64
(if (<= F -1.5e-12)
(/ -1.0 B)
(if (<= F 9.2e-69)
(* -1.0 (/ (fma (* (* -0.3333333333333333 x) B) B x) B))
(- (/ 1.0 B) (/ x B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1.5e-12) {
tmp = -1.0 / B;
} else if (F <= 9.2e-69) {
tmp = -1.0 * (fma(((-0.3333333333333333 * x) * B), B, x) / B);
} else {
tmp = (1.0 / B) - (x / B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -1.5e-12) tmp = Float64(-1.0 / B); elseif (F <= 9.2e-69) tmp = Float64(-1.0 * Float64(fma(Float64(Float64(-0.3333333333333333 * x) * B), B, x) / B)); else tmp = Float64(Float64(1.0 / B) - Float64(x / B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -1.5e-12], N[(-1.0 / B), $MachinePrecision], If[LessEqual[F, 9.2e-69], N[(-1.0 * N[(N[(N[(N[(-0.3333333333333333 * x), $MachinePrecision] * B), $MachinePrecision] * B + x), $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / B), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.5 \cdot 10^{-12}:\\
\;\;\;\;\frac{-1}{B}\\
\mathbf{elif}\;F \leq 9.2 \cdot 10^{-69}:\\
\;\;\;\;-1 \cdot \frac{\mathsf{fma}\left(\left(-0.3333333333333333 \cdot x\right) \cdot B, B, x\right)}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{B} - \frac{x}{B}\\
\end{array}
\end{array}
if F < -1.5000000000000001e-12Initial program 76.2%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6417.7
Applied rewrites17.7%
Taylor expanded in B around 0
Applied rewrites10.8%
if -1.5000000000000001e-12 < F < 9.2000000000000003e-69Initial program 76.2%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6455.4
Applied rewrites55.4%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites28.7%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f6428.9
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
distribute-rgt-out--N/A
*-commutativeN/A
lower-*.f64N/A
metadata-eval28.9
Applied rewrites28.9%
if 9.2000000000000003e-69 < F Initial program 76.2%
Taylor expanded in F around inf
lower-*.f64N/A
lower-fma.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.8
Applied rewrites47.8%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6447.8
Applied rewrites50.5%
Taylor expanded in B around 0
lower-/.f64N/A
lower--.f6429.7
Applied rewrites29.7%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lift-/.f64N/A
lower--.f64N/A
lower-/.f6429.7
Applied rewrites29.7%
(FPCore (F B x)
:precision binary64
(if (<= F -1.5e-12)
(/ -1.0 B)
(if (<= F 9.2e-69)
(- (/ (fma (* -0.3333333333333333 x) (* B B) x) B))
(- (/ 1.0 B) (/ x B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1.5e-12) {
tmp = -1.0 / B;
} else if (F <= 9.2e-69) {
tmp = -(fma((-0.3333333333333333 * x), (B * B), x) / B);
} else {
tmp = (1.0 / B) - (x / B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -1.5e-12) tmp = Float64(-1.0 / B); elseif (F <= 9.2e-69) tmp = Float64(-Float64(fma(Float64(-0.3333333333333333 * x), Float64(B * B), x) / B)); else tmp = Float64(Float64(1.0 / B) - Float64(x / B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -1.5e-12], N[(-1.0 / B), $MachinePrecision], If[LessEqual[F, 9.2e-69], (-N[(N[(N[(-0.3333333333333333 * x), $MachinePrecision] * N[(B * B), $MachinePrecision] + x), $MachinePrecision] / B), $MachinePrecision]), N[(N[(1.0 / B), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.5 \cdot 10^{-12}:\\
\;\;\;\;\frac{-1}{B}\\
\mathbf{elif}\;F \leq 9.2 \cdot 10^{-69}:\\
\;\;\;\;-\frac{\mathsf{fma}\left(-0.3333333333333333 \cdot x, B \cdot B, x\right)}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{B} - \frac{x}{B}\\
\end{array}
\end{array}
if F < -1.5000000000000001e-12Initial program 76.2%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6417.7
Applied rewrites17.7%
Taylor expanded in B around 0
Applied rewrites10.8%
if -1.5000000000000001e-12 < F < 9.2000000000000003e-69Initial program 76.2%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6455.4
Applied rewrites55.4%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites28.7%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6428.7
Applied rewrites28.7%
if 9.2000000000000003e-69 < F Initial program 76.2%
Taylor expanded in F around inf
lower-*.f64N/A
lower-fma.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.8
Applied rewrites47.8%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6447.8
Applied rewrites50.5%
Taylor expanded in B around 0
lower-/.f64N/A
lower--.f6429.7
Applied rewrites29.7%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lift-/.f64N/A
lower--.f64N/A
lower-/.f6429.7
Applied rewrites29.7%
(FPCore (F B x) :precision binary64 (if (<= F -1.5e-12) (/ -1.0 B) (if (<= F 3.7e-64) (* -1.0 (/ x B)) (- (/ 1.0 B) (/ x B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1.5e-12) {
tmp = -1.0 / B;
} else if (F <= 3.7e-64) {
tmp = -1.0 * (x / B);
} else {
tmp = (1.0 / B) - (x / B);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: tmp
if (f <= (-1.5d-12)) then
tmp = (-1.0d0) / b
else if (f <= 3.7d-64) then
tmp = (-1.0d0) * (x / b)
else
tmp = (1.0d0 / b) - (x / b)
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -1.5e-12) {
tmp = -1.0 / B;
} else if (F <= 3.7e-64) {
tmp = -1.0 * (x / B);
} else {
tmp = (1.0 / B) - (x / B);
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -1.5e-12: tmp = -1.0 / B elif F <= 3.7e-64: tmp = -1.0 * (x / B) else: tmp = (1.0 / B) - (x / B) return tmp
function code(F, B, x) tmp = 0.0 if (F <= -1.5e-12) tmp = Float64(-1.0 / B); elseif (F <= 3.7e-64) tmp = Float64(-1.0 * Float64(x / B)); else tmp = Float64(Float64(1.0 / B) - Float64(x / B)); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -1.5e-12) tmp = -1.0 / B; elseif (F <= 3.7e-64) tmp = -1.0 * (x / B); else tmp = (1.0 / B) - (x / B); end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -1.5e-12], N[(-1.0 / B), $MachinePrecision], If[LessEqual[F, 3.7e-64], N[(-1.0 * N[(x / B), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / B), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.5 \cdot 10^{-12}:\\
\;\;\;\;\frac{-1}{B}\\
\mathbf{elif}\;F \leq 3.7 \cdot 10^{-64}:\\
\;\;\;\;-1 \cdot \frac{x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{B} - \frac{x}{B}\\
\end{array}
\end{array}
if F < -1.5000000000000001e-12Initial program 76.2%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6417.7
Applied rewrites17.7%
Taylor expanded in B around 0
Applied rewrites10.8%
if -1.5000000000000001e-12 < F < 3.69999999999999999e-64Initial program 76.2%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6455.4
Applied rewrites55.4%
Taylor expanded in B around 0
lower-/.f6428.8
Applied rewrites28.8%
if 3.69999999999999999e-64 < F Initial program 76.2%
Taylor expanded in F around inf
lower-*.f64N/A
lower-fma.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.8
Applied rewrites47.8%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6447.8
Applied rewrites50.5%
Taylor expanded in B around 0
lower-/.f64N/A
lower--.f6429.7
Applied rewrites29.7%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lift-/.f64N/A
lower--.f64N/A
lower-/.f6429.7
Applied rewrites29.7%
(FPCore (F B x) :precision binary64 (if (<= F -1.5e-12) (/ -1.0 B) (if (<= F 3.7e-64) (* -1.0 (/ x B)) (/ (- 1.0 x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1.5e-12) {
tmp = -1.0 / B;
} else if (F <= 3.7e-64) {
tmp = -1.0 * (x / B);
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: tmp
if (f <= (-1.5d-12)) then
tmp = (-1.0d0) / b
else if (f <= 3.7d-64) then
tmp = (-1.0d0) * (x / b)
else
tmp = (1.0d0 - x) / b
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -1.5e-12) {
tmp = -1.0 / B;
} else if (F <= 3.7e-64) {
tmp = -1.0 * (x / B);
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -1.5e-12: tmp = -1.0 / B elif F <= 3.7e-64: tmp = -1.0 * (x / B) else: tmp = (1.0 - x) / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= -1.5e-12) tmp = Float64(-1.0 / B); elseif (F <= 3.7e-64) tmp = Float64(-1.0 * Float64(x / B)); else tmp = Float64(Float64(1.0 - x) / B); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -1.5e-12) tmp = -1.0 / B; elseif (F <= 3.7e-64) tmp = -1.0 * (x / B); else tmp = (1.0 - x) / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -1.5e-12], N[(-1.0 / B), $MachinePrecision], If[LessEqual[F, 3.7e-64], N[(-1.0 * N[(x / B), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.5 \cdot 10^{-12}:\\
\;\;\;\;\frac{-1}{B}\\
\mathbf{elif}\;F \leq 3.7 \cdot 10^{-64}:\\
\;\;\;\;-1 \cdot \frac{x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < -1.5000000000000001e-12Initial program 76.2%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6417.7
Applied rewrites17.7%
Taylor expanded in B around 0
Applied rewrites10.8%
if -1.5000000000000001e-12 < F < 3.69999999999999999e-64Initial program 76.2%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6455.4
Applied rewrites55.4%
Taylor expanded in B around 0
lower-/.f6428.8
Applied rewrites28.8%
if 3.69999999999999999e-64 < F Initial program 76.2%
Taylor expanded in F around inf
lower-*.f64N/A
lower-fma.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.8
Applied rewrites47.8%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6447.8
Applied rewrites50.5%
Taylor expanded in B around 0
lower-/.f64N/A
lower--.f6429.7
Applied rewrites29.7%
(FPCore (F B x) :precision binary64 (if (<= F -46000000000.0) (/ -1.0 B) (/ (- 1.0 x) B)))
double code(double F, double B, double x) {
double tmp;
if (F <= -46000000000.0) {
tmp = -1.0 / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: tmp
if (f <= (-46000000000.0d0)) then
tmp = (-1.0d0) / b
else
tmp = (1.0d0 - x) / b
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -46000000000.0) {
tmp = -1.0 / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -46000000000.0: tmp = -1.0 / B else: tmp = (1.0 - x) / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= -46000000000.0) tmp = Float64(-1.0 / B); else tmp = Float64(Float64(1.0 - x) / B); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -46000000000.0) tmp = -1.0 / B; else tmp = (1.0 - x) / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -46000000000.0], N[(-1.0 / B), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -46000000000:\\
\;\;\;\;\frac{-1}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < -4.6e10Initial program 76.2%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6417.7
Applied rewrites17.7%
Taylor expanded in B around 0
Applied rewrites10.8%
if -4.6e10 < F Initial program 76.2%
Taylor expanded in F around inf
lower-*.f64N/A
lower-fma.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.8
Applied rewrites47.8%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6447.8
Applied rewrites50.5%
Taylor expanded in B around 0
lower-/.f64N/A
lower--.f6429.7
Applied rewrites29.7%
(FPCore (F B x) :precision binary64 (/ -1.0 B))
double code(double F, double B, double x) {
return -1.0 / B;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
code = (-1.0d0) / b
end function
public static double code(double F, double B, double x) {
return -1.0 / B;
}
def code(F, B, x): return -1.0 / B
function code(F, B, x) return Float64(-1.0 / B) end
function tmp = code(F, B, x) tmp = -1.0 / B; end
code[F_, B_, x_] := N[(-1.0 / B), $MachinePrecision]
\begin{array}{l}
\\
\frac{-1}{B}
\end{array}
Initial program 76.2%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6417.7
Applied rewrites17.7%
Taylor expanded in B around 0
Applied rewrites10.8%
herbie shell --seed 2025142
(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))))))