
(FPCore (n U t l Om U*) :precision binary64 (sqrt (* (* (* 2.0 n) U) (- (- t (* 2.0 (/ (* l l) Om))) (* (* n (pow (/ l Om) 2.0)) (- U U*))))))
double code(double n, double U, double t, double l, double Om, double U_42_) {
return sqrt((((2.0 * n) * U) * ((t - (2.0 * ((l * l) / Om))) - ((n * pow((l / Om), 2.0)) * (U - U_42_)))));
}
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(n, u, t, l, om, u_42)
use fmin_fmax_functions
real(8), intent (in) :: n
real(8), intent (in) :: u
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: om
real(8), intent (in) :: u_42
code = sqrt((((2.0d0 * n) * u) * ((t - (2.0d0 * ((l * l) / om))) - ((n * ((l / om) ** 2.0d0)) * (u - u_42)))))
end function
public static double code(double n, double U, double t, double l, double Om, double U_42_) {
return Math.sqrt((((2.0 * n) * U) * ((t - (2.0 * ((l * l) / Om))) - ((n * Math.pow((l / Om), 2.0)) * (U - U_42_)))));
}
def code(n, U, t, l, Om, U_42_): return math.sqrt((((2.0 * n) * U) * ((t - (2.0 * ((l * l) / Om))) - ((n * math.pow((l / Om), 2.0)) * (U - U_42_)))))
function code(n, U, t, l, Om, U_42_) return sqrt(Float64(Float64(Float64(2.0 * n) * U) * Float64(Float64(t - Float64(2.0 * Float64(Float64(l * l) / Om))) - Float64(Float64(n * (Float64(l / Om) ^ 2.0)) * Float64(U - U_42_))))) end
function tmp = code(n, U, t, l, Om, U_42_) tmp = sqrt((((2.0 * n) * U) * ((t - (2.0 * ((l * l) / Om))) - ((n * ((l / Om) ^ 2.0)) * (U - U_42_))))); end
code[n_, U_, t_, l_, Om_, U$42$_] := N[Sqrt[N[(N[(N[(2.0 * n), $MachinePrecision] * U), $MachinePrecision] * N[(N[(t - N[(2.0 * N[(N[(l * l), $MachinePrecision] / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(n * N[Power[N[(l / Om), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(U - U$42$), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (n U t l Om U*) :precision binary64 (sqrt (* (* (* 2.0 n) U) (- (- t (* 2.0 (/ (* l l) Om))) (* (* n (pow (/ l Om) 2.0)) (- U U*))))))
double code(double n, double U, double t, double l, double Om, double U_42_) {
return sqrt((((2.0 * n) * U) * ((t - (2.0 * ((l * l) / Om))) - ((n * pow((l / Om), 2.0)) * (U - U_42_)))));
}
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(n, u, t, l, om, u_42)
use fmin_fmax_functions
real(8), intent (in) :: n
real(8), intent (in) :: u
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: om
real(8), intent (in) :: u_42
code = sqrt((((2.0d0 * n) * u) * ((t - (2.0d0 * ((l * l) / om))) - ((n * ((l / om) ** 2.0d0)) * (u - u_42)))))
end function
public static double code(double n, double U, double t, double l, double Om, double U_42_) {
return Math.sqrt((((2.0 * n) * U) * ((t - (2.0 * ((l * l) / Om))) - ((n * Math.pow((l / Om), 2.0)) * (U - U_42_)))));
}
def code(n, U, t, l, Om, U_42_): return math.sqrt((((2.0 * n) * U) * ((t - (2.0 * ((l * l) / Om))) - ((n * math.pow((l / Om), 2.0)) * (U - U_42_)))))
function code(n, U, t, l, Om, U_42_) return sqrt(Float64(Float64(Float64(2.0 * n) * U) * Float64(Float64(t - Float64(2.0 * Float64(Float64(l * l) / Om))) - Float64(Float64(n * (Float64(l / Om) ^ 2.0)) * Float64(U - U_42_))))) end
function tmp = code(n, U, t, l, Om, U_42_) tmp = sqrt((((2.0 * n) * U) * ((t - (2.0 * ((l * l) / Om))) - ((n * ((l / Om) ^ 2.0)) * (U - U_42_))))); end
code[n_, U_, t_, l_, Om_, U$42$_] := N[Sqrt[N[(N[(N[(2.0 * n), $MachinePrecision] * U), $MachinePrecision] * N[(N[(t - N[(2.0 * N[(N[(l * l), $MachinePrecision] / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(n * N[Power[N[(l / Om), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(U - U$42$), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right)}
\end{array}
(FPCore (n U t l Om U*)
:precision binary64
(let* ((t_1 (* (fma -2.0 (* l (/ l Om)) t) n))
(t_2
(sqrt
(*
(* (* 2.0 n) U)
(-
(- t (* 2.0 (/ (* l l) Om)))
(* (* n (pow (/ l Om) 2.0)) (- U U*)))))))
(if (<= t_2 0.0)
(* (pow 2.0 0.5) (* (pow t_1 0.5) (pow U 0.5)))
(if (<= t_2 4e+138) t_2 (* (pow 2.0 0.5) (pow (* t_1 U) 0.5))))))
double code(double n, double U, double t, double l, double Om, double U_42_) {
double t_1 = fma(-2.0, (l * (l / Om)), t) * n;
double t_2 = sqrt((((2.0 * n) * U) * ((t - (2.0 * ((l * l) / Om))) - ((n * pow((l / Om), 2.0)) * (U - U_42_)))));
double tmp;
if (t_2 <= 0.0) {
tmp = pow(2.0, 0.5) * (pow(t_1, 0.5) * pow(U, 0.5));
} else if (t_2 <= 4e+138) {
tmp = t_2;
} else {
tmp = pow(2.0, 0.5) * pow((t_1 * U), 0.5);
}
return tmp;
}
function code(n, U, t, l, Om, U_42_) t_1 = Float64(fma(-2.0, Float64(l * Float64(l / Om)), t) * n) t_2 = sqrt(Float64(Float64(Float64(2.0 * n) * U) * Float64(Float64(t - Float64(2.0 * Float64(Float64(l * l) / Om))) - Float64(Float64(n * (Float64(l / Om) ^ 2.0)) * Float64(U - U_42_))))) tmp = 0.0 if (t_2 <= 0.0) tmp = Float64((2.0 ^ 0.5) * Float64((t_1 ^ 0.5) * (U ^ 0.5))); elseif (t_2 <= 4e+138) tmp = t_2; else tmp = Float64((2.0 ^ 0.5) * (Float64(t_1 * U) ^ 0.5)); end return tmp end
code[n_, U_, t_, l_, Om_, U$42$_] := Block[{t$95$1 = N[(N[(-2.0 * N[(l * N[(l / Om), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision] * n), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(N[(N[(2.0 * n), $MachinePrecision] * U), $MachinePrecision] * N[(N[(t - N[(2.0 * N[(N[(l * l), $MachinePrecision] / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(n * N[Power[N[(l / Om), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(U - U$42$), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$2, 0.0], N[(N[Power[2.0, 0.5], $MachinePrecision] * N[(N[Power[t$95$1, 0.5], $MachinePrecision] * N[Power[U, 0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 4e+138], t$95$2, N[(N[Power[2.0, 0.5], $MachinePrecision] * N[Power[N[(t$95$1 * U), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-2, \ell \cdot \frac{\ell}{Om}, t\right) \cdot n\\
t_2 := \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right)}\\
\mathbf{if}\;t\_2 \leq 0:\\
\;\;\;\;{2}^{0.5} \cdot \left({t\_1}^{0.5} \cdot {U}^{0.5}\right)\\
\mathbf{elif}\;t\_2 \leq 4 \cdot 10^{+138}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;{2}^{0.5} \cdot {\left(t\_1 \cdot U\right)}^{0.5}\\
\end{array}
\end{array}
if (sqrt.f64 (*.f64 (*.f64 (*.f64 #s(literal 2 binary64) n) U) (-.f64 (-.f64 t (*.f64 #s(literal 2 binary64) (/.f64 (*.f64 l l) Om))) (*.f64 (*.f64 n (pow.f64 (/.f64 l Om) #s(literal 2 binary64))) (-.f64 U U*))))) < 0.0Initial program 13.1%
Taylor expanded in n around 0
*-commutativeN/A
lower-*.f64N/A
pow1/2N/A
lower-pow.f64N/A
pow1/2N/A
lower-pow.f64N/A
Applied rewrites32.0%
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-/.f64N/A
unpow-prod-downN/A
lower-*.f64N/A
Applied rewrites40.0%
if 0.0 < (sqrt.f64 (*.f64 (*.f64 (*.f64 #s(literal 2 binary64) n) U) (-.f64 (-.f64 t (*.f64 #s(literal 2 binary64) (/.f64 (*.f64 l l) Om))) (*.f64 (*.f64 n (pow.f64 (/.f64 l Om) #s(literal 2 binary64))) (-.f64 U U*))))) < 4.0000000000000001e138Initial program 97.8%
if 4.0000000000000001e138 < (sqrt.f64 (*.f64 (*.f64 (*.f64 #s(literal 2 binary64) n) U) (-.f64 (-.f64 t (*.f64 #s(literal 2 binary64) (/.f64 (*.f64 l l) Om))) (*.f64 (*.f64 n (pow.f64 (/.f64 l Om) #s(literal 2 binary64))) (-.f64 U U*))))) Initial program 22.8%
Taylor expanded in n around 0
*-commutativeN/A
lower-*.f64N/A
pow1/2N/A
lower-pow.f64N/A
pow1/2N/A
lower-pow.f64N/A
Applied rewrites41.5%
(FPCore (n U t l Om U*)
:precision binary64
(if (<= l 6e-154)
(sqrt (* (* n 2.0) (* U (- t (* (- U U*) (* (pow (/ l Om) 2.0) n))))))
(if (<= l 4.6e+49)
(sqrt
(*
(*
2.0
(*
n
(-
t
(fma
-1.0
(* (/ U* Om) (/ (* (* l l) n) Om))
(* 2.0 (/ (* l l) Om))))))
U))
(* (pow 2.0 0.5) (pow (* (* (fma -2.0 (* l (/ l Om)) t) n) U) 0.5)))))
double code(double n, double U, double t, double l, double Om, double U_42_) {
double tmp;
if (l <= 6e-154) {
tmp = sqrt(((n * 2.0) * (U * (t - ((U - U_42_) * (pow((l / Om), 2.0) * n))))));
} else if (l <= 4.6e+49) {
tmp = sqrt(((2.0 * (n * (t - fma(-1.0, ((U_42_ / Om) * (((l * l) * n) / Om)), (2.0 * ((l * l) / Om)))))) * U));
} else {
tmp = pow(2.0, 0.5) * pow(((fma(-2.0, (l * (l / Om)), t) * n) * U), 0.5);
}
return tmp;
}
function code(n, U, t, l, Om, U_42_) tmp = 0.0 if (l <= 6e-154) tmp = sqrt(Float64(Float64(n * 2.0) * Float64(U * Float64(t - Float64(Float64(U - U_42_) * Float64((Float64(l / Om) ^ 2.0) * n)))))); elseif (l <= 4.6e+49) tmp = sqrt(Float64(Float64(2.0 * Float64(n * Float64(t - fma(-1.0, Float64(Float64(U_42_ / Om) * Float64(Float64(Float64(l * l) * n) / Om)), Float64(2.0 * Float64(Float64(l * l) / Om)))))) * U)); else tmp = Float64((2.0 ^ 0.5) * (Float64(Float64(fma(-2.0, Float64(l * Float64(l / Om)), t) * n) * U) ^ 0.5)); end return tmp end
code[n_, U_, t_, l_, Om_, U$42$_] := If[LessEqual[l, 6e-154], N[Sqrt[N[(N[(n * 2.0), $MachinePrecision] * N[(U * N[(t - N[(N[(U - U$42$), $MachinePrecision] * N[(N[Power[N[(l / Om), $MachinePrecision], 2.0], $MachinePrecision] * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[l, 4.6e+49], N[Sqrt[N[(N[(2.0 * N[(n * N[(t - N[(-1.0 * N[(N[(U$42$ / Om), $MachinePrecision] * N[(N[(N[(l * l), $MachinePrecision] * n), $MachinePrecision] / Om), $MachinePrecision]), $MachinePrecision] + N[(2.0 * N[(N[(l * l), $MachinePrecision] / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * U), $MachinePrecision]], $MachinePrecision], N[(N[Power[2.0, 0.5], $MachinePrecision] * N[Power[N[(N[(N[(-2.0 * N[(l * N[(l / Om), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision] * n), $MachinePrecision] * U), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 6 \cdot 10^{-154}:\\
\;\;\;\;\sqrt{\left(n \cdot 2\right) \cdot \left(U \cdot \left(t - \left(U - U*\right) \cdot \left({\left(\frac{\ell}{Om}\right)}^{2} \cdot n\right)\right)\right)}\\
\mathbf{elif}\;\ell \leq 4.6 \cdot 10^{+49}:\\
\;\;\;\;\sqrt{\left(2 \cdot \left(n \cdot \left(t - \mathsf{fma}\left(-1, \frac{U*}{Om} \cdot \frac{\left(\ell \cdot \ell\right) \cdot n}{Om}, 2 \cdot \frac{\ell \cdot \ell}{Om}\right)\right)\right)\right) \cdot U}\\
\mathbf{else}:\\
\;\;\;\;{2}^{0.5} \cdot {\left(\left(\mathsf{fma}\left(-2, \ell \cdot \frac{\ell}{Om}, t\right) \cdot n\right) \cdot U\right)}^{0.5}\\
\end{array}
\end{array}
if l < 6.0000000000000005e-154Initial program 51.1%
Applied rewrites56.1%
Taylor expanded in t around inf
Applied rewrites51.6%
if 6.0000000000000005e-154 < l < 4.60000000000000004e49Initial program 58.8%
Taylor expanded in U around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites42.3%
Taylor expanded in Om around -inf
lower-fma.f64N/A
Applied rewrites44.4%
Taylor expanded in U around 0
lower-*.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-fma.f64N/A
Applied rewrites74.0%
if 4.60000000000000004e49 < l Initial program 23.6%
Taylor expanded in n around 0
*-commutativeN/A
lower-*.f64N/A
pow1/2N/A
lower-pow.f64N/A
pow1/2N/A
lower-pow.f64N/A
Applied rewrites50.7%
(FPCore (n U t l Om U*)
:precision binary64
(let* ((t_1 (fma -2.0 (* l (/ l Om)) t)) (t_2 (pow (/ l Om) 2.0)))
(if (<=
(sqrt
(*
(* (* 2.0 n) U)
(- (- t (* 2.0 (/ (* l l) Om))) (* (* n t_2) (- U U*)))))
1e+116)
(sqrt (* (* n 2.0) (* U (- t_1 (* (- U U*) (* t_2 n))))))
(* (pow 2.0 0.5) (pow (* (* t_1 n) U) 0.5)))))
double code(double n, double U, double t, double l, double Om, double U_42_) {
double t_1 = fma(-2.0, (l * (l / Om)), t);
double t_2 = pow((l / Om), 2.0);
double tmp;
if (sqrt((((2.0 * n) * U) * ((t - (2.0 * ((l * l) / Om))) - ((n * t_2) * (U - U_42_))))) <= 1e+116) {
tmp = sqrt(((n * 2.0) * (U * (t_1 - ((U - U_42_) * (t_2 * n))))));
} else {
tmp = pow(2.0, 0.5) * pow(((t_1 * n) * U), 0.5);
}
return tmp;
}
function code(n, U, t, l, Om, U_42_) t_1 = fma(-2.0, Float64(l * Float64(l / Om)), t) t_2 = Float64(l / Om) ^ 2.0 tmp = 0.0 if (sqrt(Float64(Float64(Float64(2.0 * n) * U) * Float64(Float64(t - Float64(2.0 * Float64(Float64(l * l) / Om))) - Float64(Float64(n * t_2) * Float64(U - U_42_))))) <= 1e+116) tmp = sqrt(Float64(Float64(n * 2.0) * Float64(U * Float64(t_1 - Float64(Float64(U - U_42_) * Float64(t_2 * n)))))); else tmp = Float64((2.0 ^ 0.5) * (Float64(Float64(t_1 * n) * U) ^ 0.5)); end return tmp end
code[n_, U_, t_, l_, Om_, U$42$_] := Block[{t$95$1 = N[(-2.0 * N[(l * N[(l / Om), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]}, Block[{t$95$2 = N[Power[N[(l / Om), $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[N[Sqrt[N[(N[(N[(2.0 * n), $MachinePrecision] * U), $MachinePrecision] * N[(N[(t - N[(2.0 * N[(N[(l * l), $MachinePrecision] / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(n * t$95$2), $MachinePrecision] * N[(U - U$42$), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 1e+116], N[Sqrt[N[(N[(n * 2.0), $MachinePrecision] * N[(U * N[(t$95$1 - N[(N[(U - U$42$), $MachinePrecision] * N[(t$95$2 * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[Power[2.0, 0.5], $MachinePrecision] * N[Power[N[(N[(t$95$1 * n), $MachinePrecision] * U), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-2, \ell \cdot \frac{\ell}{Om}, t\right)\\
t_2 := {\left(\frac{\ell}{Om}\right)}^{2}\\
\mathbf{if}\;\sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot t\_2\right) \cdot \left(U - U*\right)\right)} \leq 10^{+116}:\\
\;\;\;\;\sqrt{\left(n \cdot 2\right) \cdot \left(U \cdot \left(t\_1 - \left(U - U*\right) \cdot \left(t\_2 \cdot n\right)\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;{2}^{0.5} \cdot {\left(\left(t\_1 \cdot n\right) \cdot U\right)}^{0.5}\\
\end{array}
\end{array}
if (sqrt.f64 (*.f64 (*.f64 (*.f64 #s(literal 2 binary64) n) U) (-.f64 (-.f64 t (*.f64 #s(literal 2 binary64) (/.f64 (*.f64 l l) Om))) (*.f64 (*.f64 n (pow.f64 (/.f64 l Om) #s(literal 2 binary64))) (-.f64 U U*))))) < 1.00000000000000002e116Initial program 71.3%
Applied rewrites75.5%
if 1.00000000000000002e116 < (sqrt.f64 (*.f64 (*.f64 (*.f64 #s(literal 2 binary64) n) U) (-.f64 (-.f64 t (*.f64 #s(literal 2 binary64) (/.f64 (*.f64 l l) Om))) (*.f64 (*.f64 n (pow.f64 (/.f64 l Om) #s(literal 2 binary64))) (-.f64 U U*))))) Initial program 25.8%
Taylor expanded in n around 0
*-commutativeN/A
lower-*.f64N/A
pow1/2N/A
lower-pow.f64N/A
pow1/2N/A
lower-pow.f64N/A
Applied rewrites43.0%
(FPCore (n U t l Om U*)
:precision binary64
(let* ((t_1 (* (fma -2.0 (* l (/ l Om)) t) n)))
(if (<= U -5e-310)
(* (pow 2.0 0.5) (pow (* t_1 U) 0.5))
(* (pow 2.0 0.5) (* (pow t_1 0.5) (pow U 0.5))))))
double code(double n, double U, double t, double l, double Om, double U_42_) {
double t_1 = fma(-2.0, (l * (l / Om)), t) * n;
double tmp;
if (U <= -5e-310) {
tmp = pow(2.0, 0.5) * pow((t_1 * U), 0.5);
} else {
tmp = pow(2.0, 0.5) * (pow(t_1, 0.5) * pow(U, 0.5));
}
return tmp;
}
function code(n, U, t, l, Om, U_42_) t_1 = Float64(fma(-2.0, Float64(l * Float64(l / Om)), t) * n) tmp = 0.0 if (U <= -5e-310) tmp = Float64((2.0 ^ 0.5) * (Float64(t_1 * U) ^ 0.5)); else tmp = Float64((2.0 ^ 0.5) * Float64((t_1 ^ 0.5) * (U ^ 0.5))); end return tmp end
code[n_, U_, t_, l_, Om_, U$42$_] := Block[{t$95$1 = N[(N[(-2.0 * N[(l * N[(l / Om), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision] * n), $MachinePrecision]}, If[LessEqual[U, -5e-310], N[(N[Power[2.0, 0.5], $MachinePrecision] * N[Power[N[(t$95$1 * U), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision], N[(N[Power[2.0, 0.5], $MachinePrecision] * N[(N[Power[t$95$1, 0.5], $MachinePrecision] * N[Power[U, 0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-2, \ell \cdot \frac{\ell}{Om}, t\right) \cdot n\\
\mathbf{if}\;U \leq -5 \cdot 10^{-310}:\\
\;\;\;\;{2}^{0.5} \cdot {\left(t\_1 \cdot U\right)}^{0.5}\\
\mathbf{else}:\\
\;\;\;\;{2}^{0.5} \cdot \left({t\_1}^{0.5} \cdot {U}^{0.5}\right)\\
\end{array}
\end{array}
if U < -4.999999999999985e-310Initial program 46.3%
Taylor expanded in n around 0
*-commutativeN/A
lower-*.f64N/A
pow1/2N/A
lower-pow.f64N/A
pow1/2N/A
lower-pow.f64N/A
Applied rewrites55.0%
if -4.999999999999985e-310 < U Initial program 50.8%
Taylor expanded in n around 0
*-commutativeN/A
lower-*.f64N/A
pow1/2N/A
lower-pow.f64N/A
pow1/2N/A
lower-pow.f64N/A
Applied rewrites51.4%
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-/.f64N/A
unpow-prod-downN/A
lower-*.f64N/A
Applied rewrites62.0%
(FPCore (n U t l Om U*)
:precision binary64
(let* ((t_1 (* (fma -2.0 (* l (/ l Om)) t) n)))
(if (<= U -5e-310)
(* (exp (* (log 2.0) 0.5)) (pow (* t_1 U) 0.5))
(* (pow 2.0 0.5) (* (pow t_1 0.5) (pow U 0.5))))))
double code(double n, double U, double t, double l, double Om, double U_42_) {
double t_1 = fma(-2.0, (l * (l / Om)), t) * n;
double tmp;
if (U <= -5e-310) {
tmp = exp((log(2.0) * 0.5)) * pow((t_1 * U), 0.5);
} else {
tmp = pow(2.0, 0.5) * (pow(t_1, 0.5) * pow(U, 0.5));
}
return tmp;
}
function code(n, U, t, l, Om, U_42_) t_1 = Float64(fma(-2.0, Float64(l * Float64(l / Om)), t) * n) tmp = 0.0 if (U <= -5e-310) tmp = Float64(exp(Float64(log(2.0) * 0.5)) * (Float64(t_1 * U) ^ 0.5)); else tmp = Float64((2.0 ^ 0.5) * Float64((t_1 ^ 0.5) * (U ^ 0.5))); end return tmp end
code[n_, U_, t_, l_, Om_, U$42$_] := Block[{t$95$1 = N[(N[(-2.0 * N[(l * N[(l / Om), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision] * n), $MachinePrecision]}, If[LessEqual[U, -5e-310], N[(N[Exp[N[(N[Log[2.0], $MachinePrecision] * 0.5), $MachinePrecision]], $MachinePrecision] * N[Power[N[(t$95$1 * U), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision], N[(N[Power[2.0, 0.5], $MachinePrecision] * N[(N[Power[t$95$1, 0.5], $MachinePrecision] * N[Power[U, 0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-2, \ell \cdot \frac{\ell}{Om}, t\right) \cdot n\\
\mathbf{if}\;U \leq -5 \cdot 10^{-310}:\\
\;\;\;\;e^{\log 2 \cdot 0.5} \cdot {\left(t\_1 \cdot U\right)}^{0.5}\\
\mathbf{else}:\\
\;\;\;\;{2}^{0.5} \cdot \left({t\_1}^{0.5} \cdot {U}^{0.5}\right)\\
\end{array}
\end{array}
if U < -4.999999999999985e-310Initial program 46.3%
Taylor expanded in n around 0
*-commutativeN/A
lower-*.f64N/A
pow1/2N/A
lower-pow.f64N/A
pow1/2N/A
lower-pow.f64N/A
Applied rewrites55.0%
lift-pow.f64N/A
pow-to-expN/A
lower-exp.f64N/A
lower-*.f64N/A
lower-log.f6454.8
Applied rewrites54.8%
if -4.999999999999985e-310 < U Initial program 50.8%
Taylor expanded in n around 0
*-commutativeN/A
lower-*.f64N/A
pow1/2N/A
lower-pow.f64N/A
pow1/2N/A
lower-pow.f64N/A
Applied rewrites51.4%
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-/.f64N/A
unpow-prod-downN/A
lower-*.f64N/A
Applied rewrites62.0%
(FPCore (n U t l Om U*)
:precision binary64
(let* ((t_1 (* (fma -2.0 (* l (/ l Om)) t) n)) (t_2 (exp (* (log 2.0) 0.5))))
(if (<= U -5e-310)
(* t_2 (pow (* t_1 U) 0.5))
(* t_2 (* (pow t_1 0.5) (pow U 0.5))))))
double code(double n, double U, double t, double l, double Om, double U_42_) {
double t_1 = fma(-2.0, (l * (l / Om)), t) * n;
double t_2 = exp((log(2.0) * 0.5));
double tmp;
if (U <= -5e-310) {
tmp = t_2 * pow((t_1 * U), 0.5);
} else {
tmp = t_2 * (pow(t_1, 0.5) * pow(U, 0.5));
}
return tmp;
}
function code(n, U, t, l, Om, U_42_) t_1 = Float64(fma(-2.0, Float64(l * Float64(l / Om)), t) * n) t_2 = exp(Float64(log(2.0) * 0.5)) tmp = 0.0 if (U <= -5e-310) tmp = Float64(t_2 * (Float64(t_1 * U) ^ 0.5)); else tmp = Float64(t_2 * Float64((t_1 ^ 0.5) * (U ^ 0.5))); end return tmp end
code[n_, U_, t_, l_, Om_, U$42$_] := Block[{t$95$1 = N[(N[(-2.0 * N[(l * N[(l / Om), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision] * n), $MachinePrecision]}, Block[{t$95$2 = N[Exp[N[(N[Log[2.0], $MachinePrecision] * 0.5), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[U, -5e-310], N[(t$95$2 * N[Power[N[(t$95$1 * U), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision], N[(t$95$2 * N[(N[Power[t$95$1, 0.5], $MachinePrecision] * N[Power[U, 0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-2, \ell \cdot \frac{\ell}{Om}, t\right) \cdot n\\
t_2 := e^{\log 2 \cdot 0.5}\\
\mathbf{if}\;U \leq -5 \cdot 10^{-310}:\\
\;\;\;\;t\_2 \cdot {\left(t\_1 \cdot U\right)}^{0.5}\\
\mathbf{else}:\\
\;\;\;\;t\_2 \cdot \left({t\_1}^{0.5} \cdot {U}^{0.5}\right)\\
\end{array}
\end{array}
if U < -4.999999999999985e-310Initial program 46.3%
Taylor expanded in n around 0
*-commutativeN/A
lower-*.f64N/A
pow1/2N/A
lower-pow.f64N/A
pow1/2N/A
lower-pow.f64N/A
Applied rewrites55.0%
lift-pow.f64N/A
pow-to-expN/A
lower-exp.f64N/A
lower-*.f64N/A
lower-log.f6454.8
Applied rewrites54.8%
if -4.999999999999985e-310 < U Initial program 50.8%
Taylor expanded in n around 0
*-commutativeN/A
lower-*.f64N/A
pow1/2N/A
lower-pow.f64N/A
pow1/2N/A
lower-pow.f64N/A
Applied rewrites51.4%
lift-pow.f64N/A
pow-to-expN/A
lower-exp.f64N/A
lower-*.f64N/A
lower-log.f6451.2
Applied rewrites51.2%
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-/.f64N/A
unpow-prod-downN/A
lower-*.f64N/A
lower-pow.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lower-pow.f6461.8
Applied rewrites61.8%
(FPCore (n U t l Om U*)
:precision binary64
(let* ((t_1 (exp (* (log 2.0) 0.5))))
(if (<= U -5e-310)
(*
t_1
(pow (* t (fma -2.0 (* (/ U Om) (/ (* (* l l) n) t)) (* U n))) 0.5))
(* t_1 (* (pow (* (fma -2.0 (* l (/ l Om)) t) n) 0.5) (pow U 0.5))))))
double code(double n, double U, double t, double l, double Om, double U_42_) {
double t_1 = exp((log(2.0) * 0.5));
double tmp;
if (U <= -5e-310) {
tmp = t_1 * pow((t * fma(-2.0, ((U / Om) * (((l * l) * n) / t)), (U * n))), 0.5);
} else {
tmp = t_1 * (pow((fma(-2.0, (l * (l / Om)), t) * n), 0.5) * pow(U, 0.5));
}
return tmp;
}
function code(n, U, t, l, Om, U_42_) t_1 = exp(Float64(log(2.0) * 0.5)) tmp = 0.0 if (U <= -5e-310) tmp = Float64(t_1 * (Float64(t * fma(-2.0, Float64(Float64(U / Om) * Float64(Float64(Float64(l * l) * n) / t)), Float64(U * n))) ^ 0.5)); else tmp = Float64(t_1 * Float64((Float64(fma(-2.0, Float64(l * Float64(l / Om)), t) * n) ^ 0.5) * (U ^ 0.5))); end return tmp end
code[n_, U_, t_, l_, Om_, U$42$_] := Block[{t$95$1 = N[Exp[N[(N[Log[2.0], $MachinePrecision] * 0.5), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[U, -5e-310], N[(t$95$1 * N[Power[N[(t * N[(-2.0 * N[(N[(U / Om), $MachinePrecision] * N[(N[(N[(l * l), $MachinePrecision] * n), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] + N[(U * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[(N[Power[N[(N[(-2.0 * N[(l * N[(l / Om), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision] * n), $MachinePrecision], 0.5], $MachinePrecision] * N[Power[U, 0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := e^{\log 2 \cdot 0.5}\\
\mathbf{if}\;U \leq -5 \cdot 10^{-310}:\\
\;\;\;\;t\_1 \cdot {\left(t \cdot \mathsf{fma}\left(-2, \frac{U}{Om} \cdot \frac{\left(\ell \cdot \ell\right) \cdot n}{t}, U \cdot n\right)\right)}^{0.5}\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \left({\left(\mathsf{fma}\left(-2, \ell \cdot \frac{\ell}{Om}, t\right) \cdot n\right)}^{0.5} \cdot {U}^{0.5}\right)\\
\end{array}
\end{array}
if U < -4.999999999999985e-310Initial program 46.3%
Taylor expanded in n around 0
*-commutativeN/A
lower-*.f64N/A
pow1/2N/A
lower-pow.f64N/A
pow1/2N/A
lower-pow.f64N/A
Applied rewrites55.0%
lift-pow.f64N/A
pow-to-expN/A
lower-exp.f64N/A
lower-*.f64N/A
lower-log.f6454.8
Applied rewrites54.8%
Taylor expanded in t around inf
lower-*.f64N/A
lower-fma.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f6446.0
Applied rewrites46.0%
if -4.999999999999985e-310 < U Initial program 50.8%
Taylor expanded in n around 0
*-commutativeN/A
lower-*.f64N/A
pow1/2N/A
lower-pow.f64N/A
pow1/2N/A
lower-pow.f64N/A
Applied rewrites51.4%
lift-pow.f64N/A
pow-to-expN/A
lower-exp.f64N/A
lower-*.f64N/A
lower-log.f6451.2
Applied rewrites51.2%
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-/.f64N/A
unpow-prod-downN/A
lower-*.f64N/A
lower-pow.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lower-pow.f6461.8
Applied rewrites61.8%
(FPCore (n U t l Om U*)
:precision binary64
(if (<= U -8.5e-88)
(* t (* (* -1.0 (pow (/ (* U n) t) 0.5)) (pow 2.0 0.5)))
(if (<= U -5e-310)
(* t (* U (* (pow (/ n (* U t)) 0.5) (pow 2.0 0.5))))
(*
(exp (* (log 2.0) 0.5))
(* (pow (* (fma -2.0 (* l (/ l Om)) t) n) 0.5) (pow U 0.5))))))
double code(double n, double U, double t, double l, double Om, double U_42_) {
double tmp;
if (U <= -8.5e-88) {
tmp = t * ((-1.0 * pow(((U * n) / t), 0.5)) * pow(2.0, 0.5));
} else if (U <= -5e-310) {
tmp = t * (U * (pow((n / (U * t)), 0.5) * pow(2.0, 0.5)));
} else {
tmp = exp((log(2.0) * 0.5)) * (pow((fma(-2.0, (l * (l / Om)), t) * n), 0.5) * pow(U, 0.5));
}
return tmp;
}
function code(n, U, t, l, Om, U_42_) tmp = 0.0 if (U <= -8.5e-88) tmp = Float64(t * Float64(Float64(-1.0 * (Float64(Float64(U * n) / t) ^ 0.5)) * (2.0 ^ 0.5))); elseif (U <= -5e-310) tmp = Float64(t * Float64(U * Float64((Float64(n / Float64(U * t)) ^ 0.5) * (2.0 ^ 0.5)))); else tmp = Float64(exp(Float64(log(2.0) * 0.5)) * Float64((Float64(fma(-2.0, Float64(l * Float64(l / Om)), t) * n) ^ 0.5) * (U ^ 0.5))); end return tmp end
code[n_, U_, t_, l_, Om_, U$42$_] := If[LessEqual[U, -8.5e-88], N[(t * N[(N[(-1.0 * N[Power[N[(N[(U * n), $MachinePrecision] / t), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] * N[Power[2.0, 0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[U, -5e-310], N[(t * N[(U * N[(N[Power[N[(n / N[(U * t), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision] * N[Power[2.0, 0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(N[Log[2.0], $MachinePrecision] * 0.5), $MachinePrecision]], $MachinePrecision] * N[(N[Power[N[(N[(-2.0 * N[(l * N[(l / Om), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision] * n), $MachinePrecision], 0.5], $MachinePrecision] * N[Power[U, 0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;U \leq -8.5 \cdot 10^{-88}:\\
\;\;\;\;t \cdot \left(\left(-1 \cdot {\left(\frac{U \cdot n}{t}\right)}^{0.5}\right) \cdot {2}^{0.5}\right)\\
\mathbf{elif}\;U \leq -5 \cdot 10^{-310}:\\
\;\;\;\;t \cdot \left(U \cdot \left({\left(\frac{n}{U \cdot t}\right)}^{0.5} \cdot {2}^{0.5}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;e^{\log 2 \cdot 0.5} \cdot \left({\left(\mathsf{fma}\left(-2, \ell \cdot \frac{\ell}{Om}, t\right) \cdot n\right)}^{0.5} \cdot {U}^{0.5}\right)\\
\end{array}
\end{array}
if U < -8.4999999999999996e-88Initial program 58.6%
Taylor expanded in n around 0
*-commutativeN/A
lower-*.f64N/A
pow1/2N/A
lower-pow.f64N/A
pow1/2N/A
lower-pow.f64N/A
Applied rewrites65.1%
Taylor expanded in t around inf
lower-*.f64N/A
lower-fma.f64N/A
Applied rewrites16.2%
Taylor expanded in t around -inf
lower-*.f64N/A
pow1/2N/A
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
sqrt-pow2N/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
pow1/2N/A
lift-pow.f6423.7
Applied rewrites23.7%
if -8.4999999999999996e-88 < U < -4.999999999999985e-310Initial program 28.6%
Taylor expanded in n around 0
*-commutativeN/A
lower-*.f64N/A
pow1/2N/A
lower-pow.f64N/A
pow1/2N/A
lower-pow.f64N/A
Applied rewrites40.6%
Taylor expanded in t around inf
lower-*.f64N/A
lower-fma.f64N/A
Applied rewrites3.5%
Taylor expanded in U around inf
lower-*.f64N/A
lower-fma.f64N/A
Applied rewrites13.8%
Taylor expanded in t around inf
pow1/2N/A
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
pow1/2N/A
lift-pow.f64N/A
lift-*.f6421.4
Applied rewrites21.4%
if -4.999999999999985e-310 < U Initial program 50.8%
Taylor expanded in n around 0
*-commutativeN/A
lower-*.f64N/A
pow1/2N/A
lower-pow.f64N/A
pow1/2N/A
lower-pow.f64N/A
Applied rewrites51.4%
lift-pow.f64N/A
pow-to-expN/A
lower-exp.f64N/A
lower-*.f64N/A
lower-log.f6451.2
Applied rewrites51.2%
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-/.f64N/A
unpow-prod-downN/A
lower-*.f64N/A
lower-pow.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lower-pow.f6461.8
Applied rewrites61.8%
Final simplification42.2%
(FPCore (n U t l Om U*)
:precision binary64
(let* ((t_1 (pow (/ n (* U t)) 0.5)))
(if (<= n 4.4e-269)
(* t (* U (* (* -1.0 t_1) (pow 2.0 0.5))))
(* t (* U (* t_1 (pow 2.0 0.5)))))))
double code(double n, double U, double t, double l, double Om, double U_42_) {
double t_1 = pow((n / (U * t)), 0.5);
double tmp;
if (n <= 4.4e-269) {
tmp = t * (U * ((-1.0 * t_1) * pow(2.0, 0.5)));
} else {
tmp = t * (U * (t_1 * pow(2.0, 0.5)));
}
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(n, u, t, l, om, u_42)
use fmin_fmax_functions
real(8), intent (in) :: n
real(8), intent (in) :: u
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: om
real(8), intent (in) :: u_42
real(8) :: t_1
real(8) :: tmp
t_1 = (n / (u * t)) ** 0.5d0
if (n <= 4.4d-269) then
tmp = t * (u * (((-1.0d0) * t_1) * (2.0d0 ** 0.5d0)))
else
tmp = t * (u * (t_1 * (2.0d0 ** 0.5d0)))
end if
code = tmp
end function
public static double code(double n, double U, double t, double l, double Om, double U_42_) {
double t_1 = Math.pow((n / (U * t)), 0.5);
double tmp;
if (n <= 4.4e-269) {
tmp = t * (U * ((-1.0 * t_1) * Math.pow(2.0, 0.5)));
} else {
tmp = t * (U * (t_1 * Math.pow(2.0, 0.5)));
}
return tmp;
}
def code(n, U, t, l, Om, U_42_): t_1 = math.pow((n / (U * t)), 0.5) tmp = 0 if n <= 4.4e-269: tmp = t * (U * ((-1.0 * t_1) * math.pow(2.0, 0.5))) else: tmp = t * (U * (t_1 * math.pow(2.0, 0.5))) return tmp
function code(n, U, t, l, Om, U_42_) t_1 = Float64(n / Float64(U * t)) ^ 0.5 tmp = 0.0 if (n <= 4.4e-269) tmp = Float64(t * Float64(U * Float64(Float64(-1.0 * t_1) * (2.0 ^ 0.5)))); else tmp = Float64(t * Float64(U * Float64(t_1 * (2.0 ^ 0.5)))); end return tmp end
function tmp_2 = code(n, U, t, l, Om, U_42_) t_1 = (n / (U * t)) ^ 0.5; tmp = 0.0; if (n <= 4.4e-269) tmp = t * (U * ((-1.0 * t_1) * (2.0 ^ 0.5))); else tmp = t * (U * (t_1 * (2.0 ^ 0.5))); end tmp_2 = tmp; end
code[n_, U_, t_, l_, Om_, U$42$_] := Block[{t$95$1 = N[Power[N[(n / N[(U * t), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision]}, If[LessEqual[n, 4.4e-269], N[(t * N[(U * N[(N[(-1.0 * t$95$1), $MachinePrecision] * N[Power[2.0, 0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * N[(U * N[(t$95$1 * N[Power[2.0, 0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := {\left(\frac{n}{U \cdot t}\right)}^{0.5}\\
\mathbf{if}\;n \leq 4.4 \cdot 10^{-269}:\\
\;\;\;\;t \cdot \left(U \cdot \left(\left(-1 \cdot t\_1\right) \cdot {2}^{0.5}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(U \cdot \left(t\_1 \cdot {2}^{0.5}\right)\right)\\
\end{array}
\end{array}
if n < 4.39999999999999968e-269Initial program 49.0%
Taylor expanded in n around 0
*-commutativeN/A
lower-*.f64N/A
pow1/2N/A
lower-pow.f64N/A
pow1/2N/A
lower-pow.f64N/A
Applied rewrites52.8%
Taylor expanded in t around inf
lower-*.f64N/A
lower-fma.f64N/A
Applied rewrites11.6%
Taylor expanded in U around inf
lower-*.f64N/A
lower-fma.f64N/A
Applied rewrites3.3%
Taylor expanded in t around -inf
lower-*.f64N/A
pow1/2N/A
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
sqrt-pow2N/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
pow1/2N/A
lift-pow.f6431.7
Applied rewrites31.7%
if 4.39999999999999968e-269 < n Initial program 47.9%
Taylor expanded in n around 0
*-commutativeN/A
lower-*.f64N/A
pow1/2N/A
lower-pow.f64N/A
pow1/2N/A
lower-pow.f64N/A
Applied rewrites53.6%
Taylor expanded in t around inf
lower-*.f64N/A
lower-fma.f64N/A
Applied rewrites10.3%
Taylor expanded in U around inf
lower-*.f64N/A
lower-fma.f64N/A
Applied rewrites23.1%
Taylor expanded in t around inf
pow1/2N/A
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
pow1/2N/A
lift-pow.f64N/A
lift-*.f6432.5
Applied rewrites32.5%
Final simplification32.1%
(FPCore (n U t l Om U*) :precision binary64 (* t (* U (* (* -1.0 (pow (/ n (* U t)) 0.5)) (pow 2.0 0.5)))))
double code(double n, double U, double t, double l, double Om, double U_42_) {
return t * (U * ((-1.0 * pow((n / (U * t)), 0.5)) * pow(2.0, 0.5)));
}
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(n, u, t, l, om, u_42)
use fmin_fmax_functions
real(8), intent (in) :: n
real(8), intent (in) :: u
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: om
real(8), intent (in) :: u_42
code = t * (u * (((-1.0d0) * ((n / (u * t)) ** 0.5d0)) * (2.0d0 ** 0.5d0)))
end function
public static double code(double n, double U, double t, double l, double Om, double U_42_) {
return t * (U * ((-1.0 * Math.pow((n / (U * t)), 0.5)) * Math.pow(2.0, 0.5)));
}
def code(n, U, t, l, Om, U_42_): return t * (U * ((-1.0 * math.pow((n / (U * t)), 0.5)) * math.pow(2.0, 0.5)))
function code(n, U, t, l, Om, U_42_) return Float64(t * Float64(U * Float64(Float64(-1.0 * (Float64(n / Float64(U * t)) ^ 0.5)) * (2.0 ^ 0.5)))) end
function tmp = code(n, U, t, l, Om, U_42_) tmp = t * (U * ((-1.0 * ((n / (U * t)) ^ 0.5)) * (2.0 ^ 0.5))); end
code[n_, U_, t_, l_, Om_, U$42$_] := N[(t * N[(U * N[(N[(-1.0 * N[Power[N[(n / N[(U * t), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] * N[Power[2.0, 0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
t \cdot \left(U \cdot \left(\left(-1 \cdot {\left(\frac{n}{U \cdot t}\right)}^{0.5}\right) \cdot {2}^{0.5}\right)\right)
\end{array}
Initial program 48.5%
Taylor expanded in n around 0
*-commutativeN/A
lower-*.f64N/A
pow1/2N/A
lower-pow.f64N/A
pow1/2N/A
lower-pow.f64N/A
Applied rewrites53.2%
Taylor expanded in t around inf
lower-*.f64N/A
lower-fma.f64N/A
Applied rewrites11.0%
Taylor expanded in U around inf
lower-*.f64N/A
lower-fma.f64N/A
Applied rewrites12.7%
Taylor expanded in t around -inf
lower-*.f64N/A
pow1/2N/A
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
sqrt-pow2N/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
pow1/2N/A
lift-pow.f6417.7
Applied rewrites17.7%
Final simplification17.7%
herbie shell --seed 2025065
(FPCore (n U t l Om U*)
:name "Toniolo and Linder, Equation (13)"
:precision binary64
(sqrt (* (* (* 2.0 n) U) (- (- t (* 2.0 (/ (* l l) Om))) (* (* n (pow (/ l Om) 2.0)) (- U U*))))))