
(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}
Herbie found 9 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 (- t (* (/ l Om) (fma 2.0 l (* (* (/ l Om) n) (- U U*)))))))
(if (<= U -1000000.0)
(sqrt (* (* U (+ n n)) t_1))
(if (<= U 1.4e+98)
(sqrt (* (+ n n) (* t_1 U)))
(* (sqrt (* (fma (* l (/ l Om)) -2.0 t) (+ n n))) (sqrt U))))))
double code(double n, double U, double t, double l, double Om, double U_42_) {
double t_1 = t - ((l / Om) * fma(2.0, l, (((l / Om) * n) * (U - U_42_))));
double tmp;
if (U <= -1000000.0) {
tmp = sqrt(((U * (n + n)) * t_1));
} else if (U <= 1.4e+98) {
tmp = sqrt(((n + n) * (t_1 * U)));
} else {
tmp = sqrt((fma((l * (l / Om)), -2.0, t) * (n + n))) * sqrt(U);
}
return tmp;
}
function code(n, U, t, l, Om, U_42_) t_1 = Float64(t - Float64(Float64(l / Om) * fma(2.0, l, Float64(Float64(Float64(l / Om) * n) * Float64(U - U_42_))))) tmp = 0.0 if (U <= -1000000.0) tmp = sqrt(Float64(Float64(U * Float64(n + n)) * t_1)); elseif (U <= 1.4e+98) tmp = sqrt(Float64(Float64(n + n) * Float64(t_1 * U))); else tmp = Float64(sqrt(Float64(fma(Float64(l * Float64(l / Om)), -2.0, t) * Float64(n + n))) * sqrt(U)); end return tmp end
code[n_, U_, t_, l_, Om_, U$42$_] := Block[{t$95$1 = N[(t - N[(N[(l / Om), $MachinePrecision] * N[(2.0 * l + N[(N[(N[(l / Om), $MachinePrecision] * n), $MachinePrecision] * N[(U - U$42$), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[U, -1000000.0], N[Sqrt[N[(N[(U * N[(n + n), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]], $MachinePrecision], If[LessEqual[U, 1.4e+98], N[Sqrt[N[(N[(n + n), $MachinePrecision] * N[(t$95$1 * U), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[Sqrt[N[(N[(N[(l * N[(l / Om), $MachinePrecision]), $MachinePrecision] * -2.0 + t), $MachinePrecision] * N[(n + n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[U], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t - \frac{\ell}{Om} \cdot \mathsf{fma}\left(2, \ell, \left(\frac{\ell}{Om} \cdot n\right) \cdot \left(U - U*\right)\right)\\
\mathbf{if}\;U \leq -1000000:\\
\;\;\;\;\sqrt{\left(U \cdot \left(n + n\right)\right) \cdot t\_1}\\
\mathbf{elif}\;U \leq 1.4 \cdot 10^{+98}:\\
\;\;\;\;\sqrt{\left(n + n\right) \cdot \left(t\_1 \cdot U\right)}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\mathsf{fma}\left(\ell \cdot \frac{\ell}{Om}, -2, t\right) \cdot \left(n + n\right)} \cdot \sqrt{U}\\
\end{array}
\end{array}
if U < -1e6Initial program 50.3%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
sqr-neg-revN/A
associate-*l*N/A
lower-*.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower-neg.f64N/A
metadata-evalN/A
lower-/.f64N/A
metadata-eval54.2
Applied rewrites54.2%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6455.9
Applied rewrites55.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lift-*.f64N/A
count-2-revN/A
lift-+.f64N/A
lower-*.f6456.1
lift--.f64N/A
lift--.f64N/A
associate--l-N/A
Applied rewrites57.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lift-*.f64N/A
lower-*.f6457.5
lift-fma.f64N/A
lift-*.f64N/A
distribute-rgt-outN/A
lower-*.f64N/A
Applied rewrites60.2%
if -1e6 < U < 1.4e98Initial program 50.3%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
sqr-neg-revN/A
associate-*l*N/A
lower-*.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower-neg.f64N/A
metadata-evalN/A
lower-/.f64N/A
metadata-eval54.2
Applied rewrites54.2%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6455.9
Applied rewrites55.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lift-*.f64N/A
count-2-revN/A
lift-+.f64N/A
lower-*.f6456.1
lift--.f64N/A
lift--.f64N/A
associate--l-N/A
Applied rewrites57.8%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6457.8
Applied rewrites60.5%
if 1.4e98 < U Initial program 50.3%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites44.2%
Taylor expanded in n around 0
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f6444.6
Applied rewrites44.6%
lift-sqrt.f64N/A
lift-*.f64N/A
sqrt-prodN/A
lower-*.f64N/A
Applied rewrites28.8%
(FPCore (n U t l Om U*)
:precision binary64
(let* ((t_1 (- t (* (/ l Om) (fma 2.0 l (* (* (/ l Om) n) (- U U*)))))))
(if (<= n 2.7e-306)
(sqrt (* (* U (+ n n)) t_1))
(* (sqrt (+ n n)) (sqrt (* t_1 U))))))
double code(double n, double U, double t, double l, double Om, double U_42_) {
double t_1 = t - ((l / Om) * fma(2.0, l, (((l / Om) * n) * (U - U_42_))));
double tmp;
if (n <= 2.7e-306) {
tmp = sqrt(((U * (n + n)) * t_1));
} else {
tmp = sqrt((n + n)) * sqrt((t_1 * U));
}
return tmp;
}
function code(n, U, t, l, Om, U_42_) t_1 = Float64(t - Float64(Float64(l / Om) * fma(2.0, l, Float64(Float64(Float64(l / Om) * n) * Float64(U - U_42_))))) tmp = 0.0 if (n <= 2.7e-306) tmp = sqrt(Float64(Float64(U * Float64(n + n)) * t_1)); else tmp = Float64(sqrt(Float64(n + n)) * sqrt(Float64(t_1 * U))); end return tmp end
code[n_, U_, t_, l_, Om_, U$42$_] := Block[{t$95$1 = N[(t - N[(N[(l / Om), $MachinePrecision] * N[(2.0 * l + N[(N[(N[(l / Om), $MachinePrecision] * n), $MachinePrecision] * N[(U - U$42$), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, 2.7e-306], N[Sqrt[N[(N[(U * N[(n + n), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]], $MachinePrecision], N[(N[Sqrt[N[(n + n), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(t$95$1 * U), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t - \frac{\ell}{Om} \cdot \mathsf{fma}\left(2, \ell, \left(\frac{\ell}{Om} \cdot n\right) \cdot \left(U - U*\right)\right)\\
\mathbf{if}\;n \leq 2.7 \cdot 10^{-306}:\\
\;\;\;\;\sqrt{\left(U \cdot \left(n + n\right)\right) \cdot t\_1}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{n + n} \cdot \sqrt{t\_1 \cdot U}\\
\end{array}
\end{array}
if n < 2.70000000000000009e-306Initial program 50.3%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
sqr-neg-revN/A
associate-*l*N/A
lower-*.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower-neg.f64N/A
metadata-evalN/A
lower-/.f64N/A
metadata-eval54.2
Applied rewrites54.2%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6455.9
Applied rewrites55.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lift-*.f64N/A
count-2-revN/A
lift-+.f64N/A
lower-*.f6456.1
lift--.f64N/A
lift--.f64N/A
associate--l-N/A
Applied rewrites57.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lift-*.f64N/A
lower-*.f6457.5
lift-fma.f64N/A
lift-*.f64N/A
distribute-rgt-outN/A
lower-*.f64N/A
Applied rewrites60.2%
if 2.70000000000000009e-306 < n Initial program 50.3%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
sqr-neg-revN/A
associate-*l*N/A
lower-*.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower-neg.f64N/A
metadata-evalN/A
lower-/.f64N/A
metadata-eval54.2
Applied rewrites54.2%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6455.9
Applied rewrites55.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lift-*.f64N/A
count-2-revN/A
lift-+.f64N/A
lower-*.f6456.1
lift--.f64N/A
lift--.f64N/A
associate--l-N/A
Applied rewrites57.8%
lift-sqrt.f64N/A
lift-*.f64N/A
sqrt-prodN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6432.6
lift-*.f64N/A
*-commutativeN/A
lower-*.f6432.6
Applied rewrites34.0%
(FPCore (n U t l Om U*)
:precision binary64
(if (<=
(sqrt
(*
(* (* 2.0 n) U)
(-
(- t (* 2.0 (/ (* l l) Om)))
(* (* n (pow (/ l Om) 2.0)) (- U U*)))))
0.0)
(sqrt (* (* (+ n n) (fma (* l (/ l Om)) -2.0 t)) U))
(sqrt
(*
(* U (+ n n))
(- t (* (/ l Om) (fma 2.0 l (* (* (/ l Om) n) (- U U*)))))))))
double code(double n, double U, double t, double l, double Om, double U_42_) {
double tmp;
if (sqrt((((2.0 * n) * U) * ((t - (2.0 * ((l * l) / Om))) - ((n * pow((l / Om), 2.0)) * (U - U_42_))))) <= 0.0) {
tmp = sqrt((((n + n) * fma((l * (l / Om)), -2.0, t)) * U));
} else {
tmp = sqrt(((U * (n + n)) * (t - ((l / Om) * fma(2.0, l, (((l / Om) * n) * (U - U_42_)))))));
}
return tmp;
}
function code(n, U, t, l, Om, U_42_) 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 * (Float64(l / Om) ^ 2.0)) * Float64(U - U_42_))))) <= 0.0) tmp = sqrt(Float64(Float64(Float64(n + n) * fma(Float64(l * Float64(l / Om)), -2.0, t)) * U)); else tmp = sqrt(Float64(Float64(U * Float64(n + n)) * Float64(t - Float64(Float64(l / Om) * fma(2.0, l, Float64(Float64(Float64(l / Om) * n) * Float64(U - U_42_))))))); end return tmp end
code[n_, U_, t_, l_, Om_, U$42$_] := 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 * N[Power[N[(l / Om), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(U - U$42$), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 0.0], N[Sqrt[N[(N[(N[(n + n), $MachinePrecision] * N[(N[(l * N[(l / Om), $MachinePrecision]), $MachinePrecision] * -2.0 + t), $MachinePrecision]), $MachinePrecision] * U), $MachinePrecision]], $MachinePrecision], N[Sqrt[N[(N[(U * N[(n + n), $MachinePrecision]), $MachinePrecision] * N[(t - N[(N[(l / Om), $MachinePrecision] * N[(2.0 * l + N[(N[(N[(l / Om), $MachinePrecision] * n), $MachinePrecision] * N[(U - U$42$), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\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 {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right)} \leq 0:\\
\;\;\;\;\sqrt{\left(\left(n + n\right) \cdot \mathsf{fma}\left(\ell \cdot \frac{\ell}{Om}, -2, t\right)\right) \cdot U}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\left(U \cdot \left(n + n\right)\right) \cdot \left(t - \frac{\ell}{Om} \cdot \mathsf{fma}\left(2, \ell, \left(\frac{\ell}{Om} \cdot n\right) \cdot \left(U - U*\right)\right)\right)}\\
\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 50.3%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites44.2%
Taylor expanded in n around 0
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f6444.6
Applied rewrites44.6%
lift-*.f64N/A
lift-+.f64N/A
count-2-revN/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f6444.6
lift-*.f64N/A
count-2-revN/A
lift-+.f6444.6
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
Applied rewrites48.5%
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*))))) Initial program 50.3%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
sqr-neg-revN/A
associate-*l*N/A
lower-*.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower-neg.f64N/A
metadata-evalN/A
lower-/.f64N/A
metadata-eval54.2
Applied rewrites54.2%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6455.9
Applied rewrites55.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lift-*.f64N/A
count-2-revN/A
lift-+.f64N/A
lower-*.f6456.1
lift--.f64N/A
lift--.f64N/A
associate--l-N/A
Applied rewrites57.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lift-*.f64N/A
lower-*.f6457.5
lift-fma.f64N/A
lift-*.f64N/A
distribute-rgt-outN/A
lower-*.f64N/A
Applied rewrites60.2%
(FPCore (n U t l Om U*)
:precision binary64
(let* ((t_1 (fma (* l (/ l Om)) -2.0 t)))
(if (<= U -1e-309)
(sqrt (* (* (+ n n) t_1) U))
(* (sqrt (* t_1 (+ n n))) (sqrt U)))))
double code(double n, double U, double t, double l, double Om, double U_42_) {
double t_1 = fma((l * (l / Om)), -2.0, t);
double tmp;
if (U <= -1e-309) {
tmp = sqrt((((n + n) * t_1) * U));
} else {
tmp = sqrt((t_1 * (n + n))) * sqrt(U);
}
return tmp;
}
function code(n, U, t, l, Om, U_42_) t_1 = fma(Float64(l * Float64(l / Om)), -2.0, t) tmp = 0.0 if (U <= -1e-309) tmp = sqrt(Float64(Float64(Float64(n + n) * t_1) * U)); else tmp = Float64(sqrt(Float64(t_1 * Float64(n + n))) * sqrt(U)); end return tmp end
code[n_, U_, t_, l_, Om_, U$42$_] := Block[{t$95$1 = N[(N[(l * N[(l / Om), $MachinePrecision]), $MachinePrecision] * -2.0 + t), $MachinePrecision]}, If[LessEqual[U, -1e-309], N[Sqrt[N[(N[(N[(n + n), $MachinePrecision] * t$95$1), $MachinePrecision] * U), $MachinePrecision]], $MachinePrecision], N[(N[Sqrt[N[(t$95$1 * N[(n + n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[U], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\ell \cdot \frac{\ell}{Om}, -2, t\right)\\
\mathbf{if}\;U \leq -1 \cdot 10^{-309}:\\
\;\;\;\;\sqrt{\left(\left(n + n\right) \cdot t\_1\right) \cdot U}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{t\_1 \cdot \left(n + n\right)} \cdot \sqrt{U}\\
\end{array}
\end{array}
if U < -1.000000000000002e-309Initial program 50.3%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites44.2%
Taylor expanded in n around 0
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f6444.6
Applied rewrites44.6%
lift-*.f64N/A
lift-+.f64N/A
count-2-revN/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f6444.6
lift-*.f64N/A
count-2-revN/A
lift-+.f6444.6
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
Applied rewrites48.5%
if -1.000000000000002e-309 < U Initial program 50.3%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites44.2%
Taylor expanded in n around 0
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f6444.6
Applied rewrites44.6%
lift-sqrt.f64N/A
lift-*.f64N/A
sqrt-prodN/A
lower-*.f64N/A
Applied rewrites28.8%
(FPCore (n U t l Om U*) :precision binary64 (sqrt (* (* (+ n n) (fma (* l (/ l Om)) -2.0 t)) U)))
double code(double n, double U, double t, double l, double Om, double U_42_) {
return sqrt((((n + n) * fma((l * (l / Om)), -2.0, t)) * U));
}
function code(n, U, t, l, Om, U_42_) return sqrt(Float64(Float64(Float64(n + n) * fma(Float64(l * Float64(l / Om)), -2.0, t)) * U)) end
code[n_, U_, t_, l_, Om_, U$42$_] := N[Sqrt[N[(N[(N[(n + n), $MachinePrecision] * N[(N[(l * N[(l / Om), $MachinePrecision]), $MachinePrecision] * -2.0 + t), $MachinePrecision]), $MachinePrecision] * U), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\left(\left(n + n\right) \cdot \mathsf{fma}\left(\ell \cdot \frac{\ell}{Om}, -2, t\right)\right) \cdot U}
\end{array}
Initial program 50.3%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites44.2%
Taylor expanded in n around 0
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f6444.6
Applied rewrites44.6%
lift-*.f64N/A
lift-+.f64N/A
count-2-revN/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f6444.6
lift-*.f64N/A
count-2-revN/A
lift-+.f6444.6
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
Applied rewrites48.5%
(FPCore (n U t l Om U*)
:precision binary64
(if (<=
(sqrt
(*
(* (* 2.0 n) U)
(-
(- t (* 2.0 (/ (* l l) Om)))
(* (* n (pow (/ l Om) 2.0)) (- U U*)))))
0.0)
(sqrt (* U (* (+ n n) t)))
(sqrt (* (fma (* l (/ l Om)) -2.0 t) (* U (+ n n))))))
double code(double n, double U, double t, double l, double Om, double U_42_) {
double tmp;
if (sqrt((((2.0 * n) * U) * ((t - (2.0 * ((l * l) / Om))) - ((n * pow((l / Om), 2.0)) * (U - U_42_))))) <= 0.0) {
tmp = sqrt((U * ((n + n) * t)));
} else {
tmp = sqrt((fma((l * (l / Om)), -2.0, t) * (U * (n + n))));
}
return tmp;
}
function code(n, U, t, l, Om, U_42_) 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 * (Float64(l / Om) ^ 2.0)) * Float64(U - U_42_))))) <= 0.0) tmp = sqrt(Float64(U * Float64(Float64(n + n) * t))); else tmp = sqrt(Float64(fma(Float64(l * Float64(l / Om)), -2.0, t) * Float64(U * Float64(n + n)))); end return tmp end
code[n_, U_, t_, l_, Om_, U$42$_] := 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 * N[Power[N[(l / Om), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(U - U$42$), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 0.0], N[Sqrt[N[(U * N[(N[(n + n), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Sqrt[N[(N[(N[(l * N[(l / Om), $MachinePrecision]), $MachinePrecision] * -2.0 + t), $MachinePrecision] * N[(U * N[(n + n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\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 {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right)} \leq 0:\\
\;\;\;\;\sqrt{U \cdot \left(\left(n + n\right) \cdot t\right)}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\mathsf{fma}\left(\ell \cdot \frac{\ell}{Om}, -2, t\right) \cdot \left(U \cdot \left(n + n\right)\right)}\\
\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 50.3%
Taylor expanded in t around inf
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6436.0
Applied rewrites36.0%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6436.7
Applied rewrites36.7%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
lower-*.f6436.7
lift-*.f64N/A
*-commutativeN/A
lower-*.f6436.7
lift-*.f64N/A
count-2-revN/A
lift-+.f6436.7
Applied rewrites36.7%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6436.0
Applied rewrites36.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*))))) Initial program 50.3%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites44.2%
Taylor expanded in n around 0
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f6444.6
Applied rewrites44.6%
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
count-2-revN/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lower-*.f6444.5
Applied rewrites48.1%
(FPCore (n U t l Om U*) :precision binary64 (if (<= t 1.6e-306) (sqrt (* U (* (+ n n) t))) (* t (* (sqrt (* 2.0 (* U n))) (sqrt (/ 1.0 t))))))
double code(double n, double U, double t, double l, double Om, double U_42_) {
double tmp;
if (t <= 1.6e-306) {
tmp = sqrt((U * ((n + n) * t)));
} else {
tmp = t * (sqrt((2.0 * (U * n))) * sqrt((1.0 / t)));
}
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) :: tmp
if (t <= 1.6d-306) then
tmp = sqrt((u * ((n + n) * t)))
else
tmp = t * (sqrt((2.0d0 * (u * n))) * sqrt((1.0d0 / t)))
end if
code = tmp
end function
public static double code(double n, double U, double t, double l, double Om, double U_42_) {
double tmp;
if (t <= 1.6e-306) {
tmp = Math.sqrt((U * ((n + n) * t)));
} else {
tmp = t * (Math.sqrt((2.0 * (U * n))) * Math.sqrt((1.0 / t)));
}
return tmp;
}
def code(n, U, t, l, Om, U_42_): tmp = 0 if t <= 1.6e-306: tmp = math.sqrt((U * ((n + n) * t))) else: tmp = t * (math.sqrt((2.0 * (U * n))) * math.sqrt((1.0 / t))) return tmp
function code(n, U, t, l, Om, U_42_) tmp = 0.0 if (t <= 1.6e-306) tmp = sqrt(Float64(U * Float64(Float64(n + n) * t))); else tmp = Float64(t * Float64(sqrt(Float64(2.0 * Float64(U * n))) * sqrt(Float64(1.0 / t)))); end return tmp end
function tmp_2 = code(n, U, t, l, Om, U_42_) tmp = 0.0; if (t <= 1.6e-306) tmp = sqrt((U * ((n + n) * t))); else tmp = t * (sqrt((2.0 * (U * n))) * sqrt((1.0 / t))); end tmp_2 = tmp; end
code[n_, U_, t_, l_, Om_, U$42$_] := If[LessEqual[t, 1.6e-306], N[Sqrt[N[(U * N[(N[(n + n), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(t * N[(N[Sqrt[N[(2.0 * N[(U * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(1.0 / t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 1.6 \cdot 10^{-306}:\\
\;\;\;\;\sqrt{U \cdot \left(\left(n + n\right) \cdot t\right)}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(\sqrt{2 \cdot \left(U \cdot n\right)} \cdot \sqrt{\frac{1}{t}}\right)\\
\end{array}
\end{array}
if t < 1.59999999999999985e-306Initial program 50.3%
Taylor expanded in t around inf
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6436.0
Applied rewrites36.0%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6436.7
Applied rewrites36.7%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
lower-*.f6436.7
lift-*.f64N/A
*-commutativeN/A
lower-*.f6436.7
lift-*.f64N/A
count-2-revN/A
lift-+.f6436.7
Applied rewrites36.7%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6436.0
Applied rewrites36.0%
if 1.59999999999999985e-306 < t Initial program 50.3%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
sqr-neg-revN/A
associate-*l*N/A
lower-*.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower-neg.f64N/A
metadata-evalN/A
lower-/.f64N/A
metadata-eval54.2
Applied rewrites54.2%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6455.9
Applied rewrites55.9%
Applied rewrites33.6%
Taylor expanded in t around inf
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6421.5
Applied rewrites21.5%
(FPCore (n U t l Om U*) :precision binary64 (if (<= t 1.6e-306) (sqrt (* U (* (+ n n) t))) (* (sqrt (* U (+ n n))) (sqrt t))))
double code(double n, double U, double t, double l, double Om, double U_42_) {
double tmp;
if (t <= 1.6e-306) {
tmp = sqrt((U * ((n + n) * t)));
} else {
tmp = sqrt((U * (n + n))) * sqrt(t);
}
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) :: tmp
if (t <= 1.6d-306) then
tmp = sqrt((u * ((n + n) * t)))
else
tmp = sqrt((u * (n + n))) * sqrt(t)
end if
code = tmp
end function
public static double code(double n, double U, double t, double l, double Om, double U_42_) {
double tmp;
if (t <= 1.6e-306) {
tmp = Math.sqrt((U * ((n + n) * t)));
} else {
tmp = Math.sqrt((U * (n + n))) * Math.sqrt(t);
}
return tmp;
}
def code(n, U, t, l, Om, U_42_): tmp = 0 if t <= 1.6e-306: tmp = math.sqrt((U * ((n + n) * t))) else: tmp = math.sqrt((U * (n + n))) * math.sqrt(t) return tmp
function code(n, U, t, l, Om, U_42_) tmp = 0.0 if (t <= 1.6e-306) tmp = sqrt(Float64(U * Float64(Float64(n + n) * t))); else tmp = Float64(sqrt(Float64(U * Float64(n + n))) * sqrt(t)); end return tmp end
function tmp_2 = code(n, U, t, l, Om, U_42_) tmp = 0.0; if (t <= 1.6e-306) tmp = sqrt((U * ((n + n) * t))); else tmp = sqrt((U * (n + n))) * sqrt(t); end tmp_2 = tmp; end
code[n_, U_, t_, l_, Om_, U$42$_] := If[LessEqual[t, 1.6e-306], N[Sqrt[N[(U * N[(N[(n + n), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[Sqrt[N[(U * N[(n + n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[t], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 1.6 \cdot 10^{-306}:\\
\;\;\;\;\sqrt{U \cdot \left(\left(n + n\right) \cdot t\right)}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{U \cdot \left(n + n\right)} \cdot \sqrt{t}\\
\end{array}
\end{array}
if t < 1.59999999999999985e-306Initial program 50.3%
Taylor expanded in t around inf
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6436.0
Applied rewrites36.0%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6436.7
Applied rewrites36.7%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
lower-*.f6436.7
lift-*.f64N/A
*-commutativeN/A
lower-*.f6436.7
lift-*.f64N/A
count-2-revN/A
lift-+.f6436.7
Applied rewrites36.7%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6436.0
Applied rewrites36.0%
if 1.59999999999999985e-306 < t Initial program 50.3%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
sqr-neg-revN/A
associate-*l*N/A
lower-*.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower-neg.f64N/A
metadata-evalN/A
lower-/.f64N/A
metadata-eval54.2
Applied rewrites54.2%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6455.9
Applied rewrites55.9%
Applied rewrites33.6%
Taylor expanded in l around 0
lower-sqrt.f6421.5
Applied rewrites21.5%
(FPCore (n U t l Om U*) :precision binary64 (sqrt (* U (* (+ n n) t))))
double code(double n, double U, double t, double l, double Om, double U_42_) {
return sqrt((U * ((n + n) * t)));
}
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((u * ((n + n) * t)))
end function
public static double code(double n, double U, double t, double l, double Om, double U_42_) {
return Math.sqrt((U * ((n + n) * t)));
}
def code(n, U, t, l, Om, U_42_): return math.sqrt((U * ((n + n) * t)))
function code(n, U, t, l, Om, U_42_) return sqrt(Float64(U * Float64(Float64(n + n) * t))) end
function tmp = code(n, U, t, l, Om, U_42_) tmp = sqrt((U * ((n + n) * t))); end
code[n_, U_, t_, l_, Om_, U$42$_] := N[Sqrt[N[(U * N[(N[(n + n), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{U \cdot \left(\left(n + n\right) \cdot t\right)}
\end{array}
Initial program 50.3%
Taylor expanded in t around inf
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6436.0
Applied rewrites36.0%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6436.7
Applied rewrites36.7%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
lower-*.f6436.7
lift-*.f64N/A
*-commutativeN/A
lower-*.f6436.7
lift-*.f64N/A
count-2-revN/A
lift-+.f6436.7
Applied rewrites36.7%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6436.0
Applied rewrites36.0%
herbie shell --seed 2025148
(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*))))))