
(FPCore (c0 A V l) :precision binary64 (* c0 (sqrt (/ A (* V l)))))
double code(double c0, double A, double V, double l) {
return c0 * sqrt((A / (V * l)));
}
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(c0, a, v, l)
use fmin_fmax_functions
real(8), intent (in) :: c0
real(8), intent (in) :: a
real(8), intent (in) :: v
real(8), intent (in) :: l
code = c0 * sqrt((a / (v * l)))
end function
public static double code(double c0, double A, double V, double l) {
return c0 * Math.sqrt((A / (V * l)));
}
def code(c0, A, V, l): return c0 * math.sqrt((A / (V * l)))
function code(c0, A, V, l) return Float64(c0 * sqrt(Float64(A / Float64(V * l)))) end
function tmp = code(c0, A, V, l) tmp = c0 * sqrt((A / (V * l))); end
code[c0_, A_, V_, l_] := N[(c0 * N[Sqrt[N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (c0 A V l) :precision binary64 (* c0 (sqrt (/ A (* V l)))))
double code(double c0, double A, double V, double l) {
return c0 * sqrt((A / (V * l)));
}
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(c0, a, v, l)
use fmin_fmax_functions
real(8), intent (in) :: c0
real(8), intent (in) :: a
real(8), intent (in) :: v
real(8), intent (in) :: l
code = c0 * sqrt((a / (v * l)))
end function
public static double code(double c0, double A, double V, double l) {
return c0 * Math.sqrt((A / (V * l)));
}
def code(c0, A, V, l): return c0 * math.sqrt((A / (V * l)))
function code(c0, A, V, l) return Float64(c0 * sqrt(Float64(A / Float64(V * l)))) end
function tmp = code(c0, A, V, l) tmp = c0 * sqrt((A / (V * l))); end
code[c0_, A_, V_, l_] := N[(c0 * N[Sqrt[N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}
(FPCore (c0 A V l)
:precision binary64
(let* ((t_0 (fmin (fabs V) (fabs l)))
(t_1 (fmax (fabs V) (fabs l)))
(t_2 (* t_0 t_1)))
(if (<= t_2 2e-309)
(* (/ c0 (sqrt t_0)) (sqrt (/ (fabs A) t_1)))
(if (<= t_2 5e+286)
(* c0 (/ (sqrt (fabs A)) (sqrt (* t_1 t_0))))
(* (/ c0 (sqrt t_1)) (sqrt (/ (fabs A) t_0)))))))double code(double c0, double A, double V, double l) {
double t_0 = fmin(fabs(V), fabs(l));
double t_1 = fmax(fabs(V), fabs(l));
double t_2 = t_0 * t_1;
double tmp;
if (t_2 <= 2e-309) {
tmp = (c0 / sqrt(t_0)) * sqrt((fabs(A) / t_1));
} else if (t_2 <= 5e+286) {
tmp = c0 * (sqrt(fabs(A)) / sqrt((t_1 * t_0)));
} else {
tmp = (c0 / sqrt(t_1)) * sqrt((fabs(A) / t_0));
}
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(c0, a, v, l)
use fmin_fmax_functions
real(8), intent (in) :: c0
real(8), intent (in) :: a
real(8), intent (in) :: v
real(8), intent (in) :: l
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = fmin(abs(v), abs(l))
t_1 = fmax(abs(v), abs(l))
t_2 = t_0 * t_1
if (t_2 <= 2d-309) then
tmp = (c0 / sqrt(t_0)) * sqrt((abs(a) / t_1))
else if (t_2 <= 5d+286) then
tmp = c0 * (sqrt(abs(a)) / sqrt((t_1 * t_0)))
else
tmp = (c0 / sqrt(t_1)) * sqrt((abs(a) / t_0))
end if
code = tmp
end function
public static double code(double c0, double A, double V, double l) {
double t_0 = fmin(Math.abs(V), Math.abs(l));
double t_1 = fmax(Math.abs(V), Math.abs(l));
double t_2 = t_0 * t_1;
double tmp;
if (t_2 <= 2e-309) {
tmp = (c0 / Math.sqrt(t_0)) * Math.sqrt((Math.abs(A) / t_1));
} else if (t_2 <= 5e+286) {
tmp = c0 * (Math.sqrt(Math.abs(A)) / Math.sqrt((t_1 * t_0)));
} else {
tmp = (c0 / Math.sqrt(t_1)) * Math.sqrt((Math.abs(A) / t_0));
}
return tmp;
}
def code(c0, A, V, l): t_0 = fmin(math.fabs(V), math.fabs(l)) t_1 = fmax(math.fabs(V), math.fabs(l)) t_2 = t_0 * t_1 tmp = 0 if t_2 <= 2e-309: tmp = (c0 / math.sqrt(t_0)) * math.sqrt((math.fabs(A) / t_1)) elif t_2 <= 5e+286: tmp = c0 * (math.sqrt(math.fabs(A)) / math.sqrt((t_1 * t_0))) else: tmp = (c0 / math.sqrt(t_1)) * math.sqrt((math.fabs(A) / t_0)) return tmp
function code(c0, A, V, l) t_0 = fmin(abs(V), abs(l)) t_1 = fmax(abs(V), abs(l)) t_2 = Float64(t_0 * t_1) tmp = 0.0 if (t_2 <= 2e-309) tmp = Float64(Float64(c0 / sqrt(t_0)) * sqrt(Float64(abs(A) / t_1))); elseif (t_2 <= 5e+286) tmp = Float64(c0 * Float64(sqrt(abs(A)) / sqrt(Float64(t_1 * t_0)))); else tmp = Float64(Float64(c0 / sqrt(t_1)) * sqrt(Float64(abs(A) / t_0))); end return tmp end
function tmp_2 = code(c0, A, V, l) t_0 = min(abs(V), abs(l)); t_1 = max(abs(V), abs(l)); t_2 = t_0 * t_1; tmp = 0.0; if (t_2 <= 2e-309) tmp = (c0 / sqrt(t_0)) * sqrt((abs(A) / t_1)); elseif (t_2 <= 5e+286) tmp = c0 * (sqrt(abs(A)) / sqrt((t_1 * t_0))); else tmp = (c0 / sqrt(t_1)) * sqrt((abs(A) / t_0)); end tmp_2 = tmp; end
code[c0_, A_, V_, l_] := Block[{t$95$0 = N[Min[N[Abs[V], $MachinePrecision], N[Abs[l], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Max[N[Abs[V], $MachinePrecision], N[Abs[l], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(t$95$0 * t$95$1), $MachinePrecision]}, If[LessEqual[t$95$2, 2e-309], N[(N[(c0 / N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(N[Abs[A], $MachinePrecision] / t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 5e+286], N[(c0 * N[(N[Sqrt[N[Abs[A], $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(t$95$1 * t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c0 / N[Sqrt[t$95$1], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(N[Abs[A], $MachinePrecision] / t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
t_0 := \mathsf{min}\left(\left|V\right|, \left|\ell\right|\right)\\
t_1 := \mathsf{max}\left(\left|V\right|, \left|\ell\right|\right)\\
t_2 := t\_0 \cdot t\_1\\
\mathbf{if}\;t\_2 \leq 2 \cdot 10^{-309}:\\
\;\;\;\;\frac{c0}{\sqrt{t\_0}} \cdot \sqrt{\frac{\left|A\right|}{t\_1}}\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+286}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{\left|A\right|}}{\sqrt{t\_1 \cdot t\_0}}\\
\mathbf{else}:\\
\;\;\;\;\frac{c0}{\sqrt{t\_1}} \cdot \sqrt{\frac{\left|A\right|}{t\_0}}\\
\end{array}
if (*.f64 V l) < 1.9999999999999988e-309Initial program 74.1%
lift-sqrt.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
sqrt-divN/A
lower-unsound-/.f64N/A
lower-unsound-sqrt.f64N/A
lower-/.f64N/A
lower-unsound-sqrt.f6442.7%
Applied rewrites42.7%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
mult-flipN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
associate-*l/N/A
*-commutativeN/A
metadata-evalN/A
*-rgt-identityN/A
lower-/.f6441.4%
Applied rewrites41.4%
if 1.9999999999999988e-309 < (*.f64 V l) < 5.0000000000000004e286Initial program 74.1%
lift-sqrt.f64N/A
lift-/.f64N/A
sqrt-divN/A
lower-unsound-/.f64N/A
lower-unsound-sqrt.f64N/A
lower-unsound-sqrt.f6442.0%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6442.0%
Applied rewrites42.0%
if 5.0000000000000004e286 < (*.f64 V l) Initial program 74.1%
lift-sqrt.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
sqrt-divN/A
lower-unsound-/.f64N/A
lower-unsound-sqrt.f64N/A
lower-/.f64N/A
lower-unsound-sqrt.f6442.6%
Applied rewrites42.6%
Applied rewrites41.5%
(FPCore (c0 A V l)
:precision binary64
(let* ((t_0 (fmin (fabs V) (fabs l)))
(t_1 (fmax (fabs V) (fabs l)))
(t_2 (* t_0 t_1))
(t_3 (* (/ c0 (sqrt t_0)) (sqrt (/ (fabs A) t_1)))))
(if (<= t_2 2e-309)
t_3
(if (<= t_2 2e+302)
(* c0 (/ (sqrt (fabs A)) (sqrt (* t_1 t_0))))
t_3))))double code(double c0, double A, double V, double l) {
double t_0 = fmin(fabs(V), fabs(l));
double t_1 = fmax(fabs(V), fabs(l));
double t_2 = t_0 * t_1;
double t_3 = (c0 / sqrt(t_0)) * sqrt((fabs(A) / t_1));
double tmp;
if (t_2 <= 2e-309) {
tmp = t_3;
} else if (t_2 <= 2e+302) {
tmp = c0 * (sqrt(fabs(A)) / sqrt((t_1 * t_0)));
} else {
tmp = t_3;
}
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(c0, a, v, l)
use fmin_fmax_functions
real(8), intent (in) :: c0
real(8), intent (in) :: a
real(8), intent (in) :: v
real(8), intent (in) :: l
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = fmin(abs(v), abs(l))
t_1 = fmax(abs(v), abs(l))
t_2 = t_0 * t_1
t_3 = (c0 / sqrt(t_0)) * sqrt((abs(a) / t_1))
if (t_2 <= 2d-309) then
tmp = t_3
else if (t_2 <= 2d+302) then
tmp = c0 * (sqrt(abs(a)) / sqrt((t_1 * t_0)))
else
tmp = t_3
end if
code = tmp
end function
public static double code(double c0, double A, double V, double l) {
double t_0 = fmin(Math.abs(V), Math.abs(l));
double t_1 = fmax(Math.abs(V), Math.abs(l));
double t_2 = t_0 * t_1;
double t_3 = (c0 / Math.sqrt(t_0)) * Math.sqrt((Math.abs(A) / t_1));
double tmp;
if (t_2 <= 2e-309) {
tmp = t_3;
} else if (t_2 <= 2e+302) {
tmp = c0 * (Math.sqrt(Math.abs(A)) / Math.sqrt((t_1 * t_0)));
} else {
tmp = t_3;
}
return tmp;
}
def code(c0, A, V, l): t_0 = fmin(math.fabs(V), math.fabs(l)) t_1 = fmax(math.fabs(V), math.fabs(l)) t_2 = t_0 * t_1 t_3 = (c0 / math.sqrt(t_0)) * math.sqrt((math.fabs(A) / t_1)) tmp = 0 if t_2 <= 2e-309: tmp = t_3 elif t_2 <= 2e+302: tmp = c0 * (math.sqrt(math.fabs(A)) / math.sqrt((t_1 * t_0))) else: tmp = t_3 return tmp
function code(c0, A, V, l) t_0 = fmin(abs(V), abs(l)) t_1 = fmax(abs(V), abs(l)) t_2 = Float64(t_0 * t_1) t_3 = Float64(Float64(c0 / sqrt(t_0)) * sqrt(Float64(abs(A) / t_1))) tmp = 0.0 if (t_2 <= 2e-309) tmp = t_3; elseif (t_2 <= 2e+302) tmp = Float64(c0 * Float64(sqrt(abs(A)) / sqrt(Float64(t_1 * t_0)))); else tmp = t_3; end return tmp end
function tmp_2 = code(c0, A, V, l) t_0 = min(abs(V), abs(l)); t_1 = max(abs(V), abs(l)); t_2 = t_0 * t_1; t_3 = (c0 / sqrt(t_0)) * sqrt((abs(A) / t_1)); tmp = 0.0; if (t_2 <= 2e-309) tmp = t_3; elseif (t_2 <= 2e+302) tmp = c0 * (sqrt(abs(A)) / sqrt((t_1 * t_0))); else tmp = t_3; end tmp_2 = tmp; end
code[c0_, A_, V_, l_] := Block[{t$95$0 = N[Min[N[Abs[V], $MachinePrecision], N[Abs[l], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Max[N[Abs[V], $MachinePrecision], N[Abs[l], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(t$95$0 * t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(N[(c0 / N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(N[Abs[A], $MachinePrecision] / t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, 2e-309], t$95$3, If[LessEqual[t$95$2, 2e+302], N[(c0 * N[(N[Sqrt[N[Abs[A], $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(t$95$1 * t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$3]]]]]]
\begin{array}{l}
t_0 := \mathsf{min}\left(\left|V\right|, \left|\ell\right|\right)\\
t_1 := \mathsf{max}\left(\left|V\right|, \left|\ell\right|\right)\\
t_2 := t\_0 \cdot t\_1\\
t_3 := \frac{c0}{\sqrt{t\_0}} \cdot \sqrt{\frac{\left|A\right|}{t\_1}}\\
\mathbf{if}\;t\_2 \leq 2 \cdot 10^{-309}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+302}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{\left|A\right|}}{\sqrt{t\_1 \cdot t\_0}}\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
if (*.f64 V l) < 1.9999999999999988e-309 or 2.0000000000000002e302 < (*.f64 V l) Initial program 74.1%
lift-sqrt.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
sqrt-divN/A
lower-unsound-/.f64N/A
lower-unsound-sqrt.f64N/A
lower-/.f64N/A
lower-unsound-sqrt.f6442.7%
Applied rewrites42.7%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
mult-flipN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
associate-*l/N/A
*-commutativeN/A
metadata-evalN/A
*-rgt-identityN/A
lower-/.f6441.4%
Applied rewrites41.4%
if 1.9999999999999988e-309 < (*.f64 V l) < 2.0000000000000002e302Initial program 74.1%
lift-sqrt.f64N/A
lift-/.f64N/A
sqrt-divN/A
lower-unsound-/.f64N/A
lower-unsound-sqrt.f64N/A
lower-unsound-sqrt.f6442.0%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6442.0%
Applied rewrites42.0%
(FPCore (c0 A V l)
:precision binary64
(let* ((t_0 (fmax (fabs V) (fabs l))) (t_1 (fmin (fabs V) (fabs l))))
(if (<= (fabs A) 1e-25)
(* c0 (/ (sqrt (/ (fabs A) t_1)) (sqrt t_0)))
(* c0 (* (sqrt (/ (fabs A) t_0)) (sqrt (/ 1.0 t_1)))))))double code(double c0, double A, double V, double l) {
double t_0 = fmax(fabs(V), fabs(l));
double t_1 = fmin(fabs(V), fabs(l));
double tmp;
if (fabs(A) <= 1e-25) {
tmp = c0 * (sqrt((fabs(A) / t_1)) / sqrt(t_0));
} else {
tmp = c0 * (sqrt((fabs(A) / t_0)) * sqrt((1.0 / t_1)));
}
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(c0, a, v, l)
use fmin_fmax_functions
real(8), intent (in) :: c0
real(8), intent (in) :: a
real(8), intent (in) :: v
real(8), intent (in) :: l
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = fmax(abs(v), abs(l))
t_1 = fmin(abs(v), abs(l))
if (abs(a) <= 1d-25) then
tmp = c0 * (sqrt((abs(a) / t_1)) / sqrt(t_0))
else
tmp = c0 * (sqrt((abs(a) / t_0)) * sqrt((1.0d0 / t_1)))
end if
code = tmp
end function
public static double code(double c0, double A, double V, double l) {
double t_0 = fmax(Math.abs(V), Math.abs(l));
double t_1 = fmin(Math.abs(V), Math.abs(l));
double tmp;
if (Math.abs(A) <= 1e-25) {
tmp = c0 * (Math.sqrt((Math.abs(A) / t_1)) / Math.sqrt(t_0));
} else {
tmp = c0 * (Math.sqrt((Math.abs(A) / t_0)) * Math.sqrt((1.0 / t_1)));
}
return tmp;
}
def code(c0, A, V, l): t_0 = fmax(math.fabs(V), math.fabs(l)) t_1 = fmin(math.fabs(V), math.fabs(l)) tmp = 0 if math.fabs(A) <= 1e-25: tmp = c0 * (math.sqrt((math.fabs(A) / t_1)) / math.sqrt(t_0)) else: tmp = c0 * (math.sqrt((math.fabs(A) / t_0)) * math.sqrt((1.0 / t_1))) return tmp
function code(c0, A, V, l) t_0 = fmax(abs(V), abs(l)) t_1 = fmin(abs(V), abs(l)) tmp = 0.0 if (abs(A) <= 1e-25) tmp = Float64(c0 * Float64(sqrt(Float64(abs(A) / t_1)) / sqrt(t_0))); else tmp = Float64(c0 * Float64(sqrt(Float64(abs(A) / t_0)) * sqrt(Float64(1.0 / t_1)))); end return tmp end
function tmp_2 = code(c0, A, V, l) t_0 = max(abs(V), abs(l)); t_1 = min(abs(V), abs(l)); tmp = 0.0; if (abs(A) <= 1e-25) tmp = c0 * (sqrt((abs(A) / t_1)) / sqrt(t_0)); else tmp = c0 * (sqrt((abs(A) / t_0)) * sqrt((1.0 / t_1))); end tmp_2 = tmp; end
code[c0_, A_, V_, l_] := Block[{t$95$0 = N[Max[N[Abs[V], $MachinePrecision], N[Abs[l], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Min[N[Abs[V], $MachinePrecision], N[Abs[l], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[Abs[A], $MachinePrecision], 1e-25], N[(c0 * N[(N[Sqrt[N[(N[Abs[A], $MachinePrecision] / t$95$1), $MachinePrecision]], $MachinePrecision] / N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c0 * N[(N[Sqrt[N[(N[Abs[A], $MachinePrecision] / t$95$0), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(1.0 / t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \mathsf{max}\left(\left|V\right|, \left|\ell\right|\right)\\
t_1 := \mathsf{min}\left(\left|V\right|, \left|\ell\right|\right)\\
\mathbf{if}\;\left|A\right| \leq 10^{-25}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{\frac{\left|A\right|}{t\_1}}}{\sqrt{t\_0}}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \left(\sqrt{\frac{\left|A\right|}{t\_0}} \cdot \sqrt{\frac{1}{t\_1}}\right)\\
\end{array}
if A < 1e-25Initial program 74.1%
lift-sqrt.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
sqrt-divN/A
lower-unsound-/.f64N/A
lower-unsound-sqrt.f64N/A
lower-/.f64N/A
lower-unsound-sqrt.f6442.6%
Applied rewrites42.6%
if 1e-25 < A Initial program 74.1%
lift-sqrt.f64N/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
rem-sqrt-square-revN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
rem-square-sqrtN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
mult-flipN/A
associate-*l/N/A
sqrt-prodN/A
lower-unsound-*.f64N/A
lower-unsound-sqrt.f64N/A
lower-/.f64N/A
lower-unsound-sqrt.f64N/A
lower-/.f6442.7%
Applied rewrites42.7%
(FPCore (c0 A V l)
:precision binary64
(let* ((t_0 (fmax (fabs V) (fabs l))) (t_1 (fmin (fabs V) (fabs l))))
(if (<= (sqrt (/ (fabs A) (* t_1 t_0))) 5.0)
(* c0 (/ (sqrt (/ (fabs A) t_1)) (sqrt t_0)))
(* c0 (/ (sqrt (/ (fabs A) t_0)) (sqrt t_1))))))double code(double c0, double A, double V, double l) {
double t_0 = fmax(fabs(V), fabs(l));
double t_1 = fmin(fabs(V), fabs(l));
double tmp;
if (sqrt((fabs(A) / (t_1 * t_0))) <= 5.0) {
tmp = c0 * (sqrt((fabs(A) / t_1)) / sqrt(t_0));
} else {
tmp = c0 * (sqrt((fabs(A) / t_0)) / sqrt(t_1));
}
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(c0, a, v, l)
use fmin_fmax_functions
real(8), intent (in) :: c0
real(8), intent (in) :: a
real(8), intent (in) :: v
real(8), intent (in) :: l
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = fmax(abs(v), abs(l))
t_1 = fmin(abs(v), abs(l))
if (sqrt((abs(a) / (t_1 * t_0))) <= 5.0d0) then
tmp = c0 * (sqrt((abs(a) / t_1)) / sqrt(t_0))
else
tmp = c0 * (sqrt((abs(a) / t_0)) / sqrt(t_1))
end if
code = tmp
end function
public static double code(double c0, double A, double V, double l) {
double t_0 = fmax(Math.abs(V), Math.abs(l));
double t_1 = fmin(Math.abs(V), Math.abs(l));
double tmp;
if (Math.sqrt((Math.abs(A) / (t_1 * t_0))) <= 5.0) {
tmp = c0 * (Math.sqrt((Math.abs(A) / t_1)) / Math.sqrt(t_0));
} else {
tmp = c0 * (Math.sqrt((Math.abs(A) / t_0)) / Math.sqrt(t_1));
}
return tmp;
}
def code(c0, A, V, l): t_0 = fmax(math.fabs(V), math.fabs(l)) t_1 = fmin(math.fabs(V), math.fabs(l)) tmp = 0 if math.sqrt((math.fabs(A) / (t_1 * t_0))) <= 5.0: tmp = c0 * (math.sqrt((math.fabs(A) / t_1)) / math.sqrt(t_0)) else: tmp = c0 * (math.sqrt((math.fabs(A) / t_0)) / math.sqrt(t_1)) return tmp
function code(c0, A, V, l) t_0 = fmax(abs(V), abs(l)) t_1 = fmin(abs(V), abs(l)) tmp = 0.0 if (sqrt(Float64(abs(A) / Float64(t_1 * t_0))) <= 5.0) tmp = Float64(c0 * Float64(sqrt(Float64(abs(A) / t_1)) / sqrt(t_0))); else tmp = Float64(c0 * Float64(sqrt(Float64(abs(A) / t_0)) / sqrt(t_1))); end return tmp end
function tmp_2 = code(c0, A, V, l) t_0 = max(abs(V), abs(l)); t_1 = min(abs(V), abs(l)); tmp = 0.0; if (sqrt((abs(A) / (t_1 * t_0))) <= 5.0) tmp = c0 * (sqrt((abs(A) / t_1)) / sqrt(t_0)); else tmp = c0 * (sqrt((abs(A) / t_0)) / sqrt(t_1)); end tmp_2 = tmp; end
code[c0_, A_, V_, l_] := Block[{t$95$0 = N[Max[N[Abs[V], $MachinePrecision], N[Abs[l], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Min[N[Abs[V], $MachinePrecision], N[Abs[l], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[Sqrt[N[(N[Abs[A], $MachinePrecision] / N[(t$95$1 * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 5.0], N[(c0 * N[(N[Sqrt[N[(N[Abs[A], $MachinePrecision] / t$95$1), $MachinePrecision]], $MachinePrecision] / N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c0 * N[(N[Sqrt[N[(N[Abs[A], $MachinePrecision] / t$95$0), $MachinePrecision]], $MachinePrecision] / N[Sqrt[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \mathsf{max}\left(\left|V\right|, \left|\ell\right|\right)\\
t_1 := \mathsf{min}\left(\left|V\right|, \left|\ell\right|\right)\\
\mathbf{if}\;\sqrt{\frac{\left|A\right|}{t\_1 \cdot t\_0}} \leq 5:\\
\;\;\;\;c0 \cdot \frac{\sqrt{\frac{\left|A\right|}{t\_1}}}{\sqrt{t\_0}}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{\frac{\left|A\right|}{t\_0}}}{\sqrt{t\_1}}\\
\end{array}
if (sqrt.f64 (/.f64 A (*.f64 V l))) < 5Initial program 74.1%
lift-sqrt.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
sqrt-divN/A
lower-unsound-/.f64N/A
lower-unsound-sqrt.f64N/A
lower-/.f64N/A
lower-unsound-sqrt.f6442.6%
Applied rewrites42.6%
if 5 < (sqrt.f64 (/.f64 A (*.f64 V l))) Initial program 74.1%
lift-sqrt.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
sqrt-divN/A
lower-unsound-/.f64N/A
lower-unsound-sqrt.f64N/A
lower-/.f64N/A
lower-unsound-sqrt.f6442.7%
Applied rewrites42.7%
(FPCore (c0 A V l)
:precision binary64
(let* ((t_0 (fmax (fabs V) (fabs l))) (t_1 (fmin (fabs V) (fabs l))))
(if (<= (fabs A) 1.45e+70)
(* c0 (/ (sqrt (/ (fabs A) t_1)) (sqrt t_0)))
(* (/ c0 (sqrt t_1)) (sqrt (/ (fabs A) t_0))))))double code(double c0, double A, double V, double l) {
double t_0 = fmax(fabs(V), fabs(l));
double t_1 = fmin(fabs(V), fabs(l));
double tmp;
if (fabs(A) <= 1.45e+70) {
tmp = c0 * (sqrt((fabs(A) / t_1)) / sqrt(t_0));
} else {
tmp = (c0 / sqrt(t_1)) * sqrt((fabs(A) / t_0));
}
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(c0, a, v, l)
use fmin_fmax_functions
real(8), intent (in) :: c0
real(8), intent (in) :: a
real(8), intent (in) :: v
real(8), intent (in) :: l
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = fmax(abs(v), abs(l))
t_1 = fmin(abs(v), abs(l))
if (abs(a) <= 1.45d+70) then
tmp = c0 * (sqrt((abs(a) / t_1)) / sqrt(t_0))
else
tmp = (c0 / sqrt(t_1)) * sqrt((abs(a) / t_0))
end if
code = tmp
end function
public static double code(double c0, double A, double V, double l) {
double t_0 = fmax(Math.abs(V), Math.abs(l));
double t_1 = fmin(Math.abs(V), Math.abs(l));
double tmp;
if (Math.abs(A) <= 1.45e+70) {
tmp = c0 * (Math.sqrt((Math.abs(A) / t_1)) / Math.sqrt(t_0));
} else {
tmp = (c0 / Math.sqrt(t_1)) * Math.sqrt((Math.abs(A) / t_0));
}
return tmp;
}
def code(c0, A, V, l): t_0 = fmax(math.fabs(V), math.fabs(l)) t_1 = fmin(math.fabs(V), math.fabs(l)) tmp = 0 if math.fabs(A) <= 1.45e+70: tmp = c0 * (math.sqrt((math.fabs(A) / t_1)) / math.sqrt(t_0)) else: tmp = (c0 / math.sqrt(t_1)) * math.sqrt((math.fabs(A) / t_0)) return tmp
function code(c0, A, V, l) t_0 = fmax(abs(V), abs(l)) t_1 = fmin(abs(V), abs(l)) tmp = 0.0 if (abs(A) <= 1.45e+70) tmp = Float64(c0 * Float64(sqrt(Float64(abs(A) / t_1)) / sqrt(t_0))); else tmp = Float64(Float64(c0 / sqrt(t_1)) * sqrt(Float64(abs(A) / t_0))); end return tmp end
function tmp_2 = code(c0, A, V, l) t_0 = max(abs(V), abs(l)); t_1 = min(abs(V), abs(l)); tmp = 0.0; if (abs(A) <= 1.45e+70) tmp = c0 * (sqrt((abs(A) / t_1)) / sqrt(t_0)); else tmp = (c0 / sqrt(t_1)) * sqrt((abs(A) / t_0)); end tmp_2 = tmp; end
code[c0_, A_, V_, l_] := Block[{t$95$0 = N[Max[N[Abs[V], $MachinePrecision], N[Abs[l], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Min[N[Abs[V], $MachinePrecision], N[Abs[l], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[Abs[A], $MachinePrecision], 1.45e+70], N[(c0 * N[(N[Sqrt[N[(N[Abs[A], $MachinePrecision] / t$95$1), $MachinePrecision]], $MachinePrecision] / N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c0 / N[Sqrt[t$95$1], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(N[Abs[A], $MachinePrecision] / t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \mathsf{max}\left(\left|V\right|, \left|\ell\right|\right)\\
t_1 := \mathsf{min}\left(\left|V\right|, \left|\ell\right|\right)\\
\mathbf{if}\;\left|A\right| \leq 1.45 \cdot 10^{+70}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{\frac{\left|A\right|}{t\_1}}}{\sqrt{t\_0}}\\
\mathbf{else}:\\
\;\;\;\;\frac{c0}{\sqrt{t\_1}} \cdot \sqrt{\frac{\left|A\right|}{t\_0}}\\
\end{array}
if A < 1.4499999999999999e70Initial program 74.1%
lift-sqrt.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
sqrt-divN/A
lower-unsound-/.f64N/A
lower-unsound-sqrt.f64N/A
lower-/.f64N/A
lower-unsound-sqrt.f6442.6%
Applied rewrites42.6%
if 1.4499999999999999e70 < A Initial program 74.1%
lift-sqrt.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
sqrt-divN/A
lower-unsound-/.f64N/A
lower-unsound-sqrt.f64N/A
lower-/.f64N/A
lower-unsound-sqrt.f6442.7%
Applied rewrites42.7%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
mult-flipN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
associate-*l/N/A
*-commutativeN/A
metadata-evalN/A
*-rgt-identityN/A
lower-/.f6441.4%
Applied rewrites41.4%
(FPCore (c0 A V l)
:precision binary64
(let* ((t_0 (* (fabs V) (fabs l))))
(if (<= t_0 0.0)
(* c0 (sqrt (/ (/ (fabs A) (fabs l)) (fabs V))))
(if (<= t_0 2e+288)
(* c0 (/ (sqrt (fabs A)) (sqrt (* (fabs l) (fabs V)))))
(* c0 (sqrt (/ (/ (fabs A) (fabs V)) (fabs l))))))))double code(double c0, double A, double V, double l) {
double t_0 = fabs(V) * fabs(l);
double tmp;
if (t_0 <= 0.0) {
tmp = c0 * sqrt(((fabs(A) / fabs(l)) / fabs(V)));
} else if (t_0 <= 2e+288) {
tmp = c0 * (sqrt(fabs(A)) / sqrt((fabs(l) * fabs(V))));
} else {
tmp = c0 * sqrt(((fabs(A) / fabs(V)) / fabs(l)));
}
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(c0, a, v, l)
use fmin_fmax_functions
real(8), intent (in) :: c0
real(8), intent (in) :: a
real(8), intent (in) :: v
real(8), intent (in) :: l
real(8) :: t_0
real(8) :: tmp
t_0 = abs(v) * abs(l)
if (t_0 <= 0.0d0) then
tmp = c0 * sqrt(((abs(a) / abs(l)) / abs(v)))
else if (t_0 <= 2d+288) then
tmp = c0 * (sqrt(abs(a)) / sqrt((abs(l) * abs(v))))
else
tmp = c0 * sqrt(((abs(a) / abs(v)) / abs(l)))
end if
code = tmp
end function
public static double code(double c0, double A, double V, double l) {
double t_0 = Math.abs(V) * Math.abs(l);
double tmp;
if (t_0 <= 0.0) {
tmp = c0 * Math.sqrt(((Math.abs(A) / Math.abs(l)) / Math.abs(V)));
} else if (t_0 <= 2e+288) {
tmp = c0 * (Math.sqrt(Math.abs(A)) / Math.sqrt((Math.abs(l) * Math.abs(V))));
} else {
tmp = c0 * Math.sqrt(((Math.abs(A) / Math.abs(V)) / Math.abs(l)));
}
return tmp;
}
def code(c0, A, V, l): t_0 = math.fabs(V) * math.fabs(l) tmp = 0 if t_0 <= 0.0: tmp = c0 * math.sqrt(((math.fabs(A) / math.fabs(l)) / math.fabs(V))) elif t_0 <= 2e+288: tmp = c0 * (math.sqrt(math.fabs(A)) / math.sqrt((math.fabs(l) * math.fabs(V)))) else: tmp = c0 * math.sqrt(((math.fabs(A) / math.fabs(V)) / math.fabs(l))) return tmp
function code(c0, A, V, l) t_0 = Float64(abs(V) * abs(l)) tmp = 0.0 if (t_0 <= 0.0) tmp = Float64(c0 * sqrt(Float64(Float64(abs(A) / abs(l)) / abs(V)))); elseif (t_0 <= 2e+288) tmp = Float64(c0 * Float64(sqrt(abs(A)) / sqrt(Float64(abs(l) * abs(V))))); else tmp = Float64(c0 * sqrt(Float64(Float64(abs(A) / abs(V)) / abs(l)))); end return tmp end
function tmp_2 = code(c0, A, V, l) t_0 = abs(V) * abs(l); tmp = 0.0; if (t_0 <= 0.0) tmp = c0 * sqrt(((abs(A) / abs(l)) / abs(V))); elseif (t_0 <= 2e+288) tmp = c0 * (sqrt(abs(A)) / sqrt((abs(l) * abs(V)))); else tmp = c0 * sqrt(((abs(A) / abs(V)) / abs(l))); end tmp_2 = tmp; end
code[c0_, A_, V_, l_] := Block[{t$95$0 = N[(N[Abs[V], $MachinePrecision] * N[Abs[l], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 0.0], N[(c0 * N[Sqrt[N[(N[(N[Abs[A], $MachinePrecision] / N[Abs[l], $MachinePrecision]), $MachinePrecision] / N[Abs[V], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 2e+288], N[(c0 * N[(N[Sqrt[N[Abs[A], $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(N[Abs[l], $MachinePrecision] * N[Abs[V], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c0 * N[Sqrt[N[(N[(N[Abs[A], $MachinePrecision] / N[Abs[V], $MachinePrecision]), $MachinePrecision] / N[Abs[l], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \left|V\right| \cdot \left|\ell\right|\\
\mathbf{if}\;t\_0 \leq 0:\\
\;\;\;\;c0 \cdot \sqrt{\frac{\frac{\left|A\right|}{\left|\ell\right|}}{\left|V\right|}}\\
\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+288}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{\left|A\right|}}{\sqrt{\left|\ell\right| \cdot \left|V\right|}}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \sqrt{\frac{\frac{\left|A\right|}{\left|V\right|}}{\left|\ell\right|}}\\
\end{array}
if (*.f64 V l) < 0.0Initial program 74.1%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6473.8%
Applied rewrites73.8%
if 0.0 < (*.f64 V l) < 2e288Initial program 74.1%
lift-sqrt.f64N/A
lift-/.f64N/A
sqrt-divN/A
lower-unsound-/.f64N/A
lower-unsound-sqrt.f64N/A
lower-unsound-sqrt.f6442.0%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6442.0%
Applied rewrites42.0%
if 2e288 < (*.f64 V l) Initial program 74.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6473.4%
Applied rewrites73.4%
(FPCore (c0 A V l)
:precision binary64
(let* ((t_0 (fmax (fabs V) (fabs l))) (t_1 (fmin (fabs V) (fabs l))))
(if (<= (sqrt (/ (fabs A) (* t_1 t_0))) 5e-5)
(* c0 (sqrt (/ (/ (fabs A) t_1) t_0)))
(* c0 (sqrt (/ (/ (fabs A) t_0) t_1))))))double code(double c0, double A, double V, double l) {
double t_0 = fmax(fabs(V), fabs(l));
double t_1 = fmin(fabs(V), fabs(l));
double tmp;
if (sqrt((fabs(A) / (t_1 * t_0))) <= 5e-5) {
tmp = c0 * sqrt(((fabs(A) / t_1) / t_0));
} else {
tmp = c0 * sqrt(((fabs(A) / t_0) / t_1));
}
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(c0, a, v, l)
use fmin_fmax_functions
real(8), intent (in) :: c0
real(8), intent (in) :: a
real(8), intent (in) :: v
real(8), intent (in) :: l
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = fmax(abs(v), abs(l))
t_1 = fmin(abs(v), abs(l))
if (sqrt((abs(a) / (t_1 * t_0))) <= 5d-5) then
tmp = c0 * sqrt(((abs(a) / t_1) / t_0))
else
tmp = c0 * sqrt(((abs(a) / t_0) / t_1))
end if
code = tmp
end function
public static double code(double c0, double A, double V, double l) {
double t_0 = fmax(Math.abs(V), Math.abs(l));
double t_1 = fmin(Math.abs(V), Math.abs(l));
double tmp;
if (Math.sqrt((Math.abs(A) / (t_1 * t_0))) <= 5e-5) {
tmp = c0 * Math.sqrt(((Math.abs(A) / t_1) / t_0));
} else {
tmp = c0 * Math.sqrt(((Math.abs(A) / t_0) / t_1));
}
return tmp;
}
def code(c0, A, V, l): t_0 = fmax(math.fabs(V), math.fabs(l)) t_1 = fmin(math.fabs(V), math.fabs(l)) tmp = 0 if math.sqrt((math.fabs(A) / (t_1 * t_0))) <= 5e-5: tmp = c0 * math.sqrt(((math.fabs(A) / t_1) / t_0)) else: tmp = c0 * math.sqrt(((math.fabs(A) / t_0) / t_1)) return tmp
function code(c0, A, V, l) t_0 = fmax(abs(V), abs(l)) t_1 = fmin(abs(V), abs(l)) tmp = 0.0 if (sqrt(Float64(abs(A) / Float64(t_1 * t_0))) <= 5e-5) tmp = Float64(c0 * sqrt(Float64(Float64(abs(A) / t_1) / t_0))); else tmp = Float64(c0 * sqrt(Float64(Float64(abs(A) / t_0) / t_1))); end return tmp end
function tmp_2 = code(c0, A, V, l) t_0 = max(abs(V), abs(l)); t_1 = min(abs(V), abs(l)); tmp = 0.0; if (sqrt((abs(A) / (t_1 * t_0))) <= 5e-5) tmp = c0 * sqrt(((abs(A) / t_1) / t_0)); else tmp = c0 * sqrt(((abs(A) / t_0) / t_1)); end tmp_2 = tmp; end
code[c0_, A_, V_, l_] := Block[{t$95$0 = N[Max[N[Abs[V], $MachinePrecision], N[Abs[l], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Min[N[Abs[V], $MachinePrecision], N[Abs[l], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[Sqrt[N[(N[Abs[A], $MachinePrecision] / N[(t$95$1 * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 5e-5], N[(c0 * N[Sqrt[N[(N[(N[Abs[A], $MachinePrecision] / t$95$1), $MachinePrecision] / t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(c0 * N[Sqrt[N[(N[(N[Abs[A], $MachinePrecision] / t$95$0), $MachinePrecision] / t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \mathsf{max}\left(\left|V\right|, \left|\ell\right|\right)\\
t_1 := \mathsf{min}\left(\left|V\right|, \left|\ell\right|\right)\\
\mathbf{if}\;\sqrt{\frac{\left|A\right|}{t\_1 \cdot t\_0}} \leq 5 \cdot 10^{-5}:\\
\;\;\;\;c0 \cdot \sqrt{\frac{\frac{\left|A\right|}{t\_1}}{t\_0}}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \sqrt{\frac{\frac{\left|A\right|}{t\_0}}{t\_1}}\\
\end{array}
if (sqrt.f64 (/.f64 A (*.f64 V l))) < 5.0000000000000002e-5Initial program 74.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6473.4%
Applied rewrites73.4%
if 5.0000000000000002e-5 < (sqrt.f64 (/.f64 A (*.f64 V l))) Initial program 74.1%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6473.8%
Applied rewrites73.8%
(FPCore (c0 A V l)
:precision binary64
(let* ((t_0 (fmax (fabs V) (fabs l)))
(t_1 (fmin (fabs V) (fabs l)))
(t_2 (* c0 (sqrt (/ (/ (fabs A) t_1) t_0))))
(t_3 (sqrt (/ (fabs A) (* t_1 t_0)))))
(if (<= t_3 4e-17) t_2 (if (<= t_3 2e+149) (* c0 t_3) t_2))))double code(double c0, double A, double V, double l) {
double t_0 = fmax(fabs(V), fabs(l));
double t_1 = fmin(fabs(V), fabs(l));
double t_2 = c0 * sqrt(((fabs(A) / t_1) / t_0));
double t_3 = sqrt((fabs(A) / (t_1 * t_0)));
double tmp;
if (t_3 <= 4e-17) {
tmp = t_2;
} else if (t_3 <= 2e+149) {
tmp = c0 * t_3;
} else {
tmp = t_2;
}
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(c0, a, v, l)
use fmin_fmax_functions
real(8), intent (in) :: c0
real(8), intent (in) :: a
real(8), intent (in) :: v
real(8), intent (in) :: l
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = fmax(abs(v), abs(l))
t_1 = fmin(abs(v), abs(l))
t_2 = c0 * sqrt(((abs(a) / t_1) / t_0))
t_3 = sqrt((abs(a) / (t_1 * t_0)))
if (t_3 <= 4d-17) then
tmp = t_2
else if (t_3 <= 2d+149) then
tmp = c0 * t_3
else
tmp = t_2
end if
code = tmp
end function
public static double code(double c0, double A, double V, double l) {
double t_0 = fmax(Math.abs(V), Math.abs(l));
double t_1 = fmin(Math.abs(V), Math.abs(l));
double t_2 = c0 * Math.sqrt(((Math.abs(A) / t_1) / t_0));
double t_3 = Math.sqrt((Math.abs(A) / (t_1 * t_0)));
double tmp;
if (t_3 <= 4e-17) {
tmp = t_2;
} else if (t_3 <= 2e+149) {
tmp = c0 * t_3;
} else {
tmp = t_2;
}
return tmp;
}
def code(c0, A, V, l): t_0 = fmax(math.fabs(V), math.fabs(l)) t_1 = fmin(math.fabs(V), math.fabs(l)) t_2 = c0 * math.sqrt(((math.fabs(A) / t_1) / t_0)) t_3 = math.sqrt((math.fabs(A) / (t_1 * t_0))) tmp = 0 if t_3 <= 4e-17: tmp = t_2 elif t_3 <= 2e+149: tmp = c0 * t_3 else: tmp = t_2 return tmp
function code(c0, A, V, l) t_0 = fmax(abs(V), abs(l)) t_1 = fmin(abs(V), abs(l)) t_2 = Float64(c0 * sqrt(Float64(Float64(abs(A) / t_1) / t_0))) t_3 = sqrt(Float64(abs(A) / Float64(t_1 * t_0))) tmp = 0.0 if (t_3 <= 4e-17) tmp = t_2; elseif (t_3 <= 2e+149) tmp = Float64(c0 * t_3); else tmp = t_2; end return tmp end
function tmp_2 = code(c0, A, V, l) t_0 = max(abs(V), abs(l)); t_1 = min(abs(V), abs(l)); t_2 = c0 * sqrt(((abs(A) / t_1) / t_0)); t_3 = sqrt((abs(A) / (t_1 * t_0))); tmp = 0.0; if (t_3 <= 4e-17) tmp = t_2; elseif (t_3 <= 2e+149) tmp = c0 * t_3; else tmp = t_2; end tmp_2 = tmp; end
code[c0_, A_, V_, l_] := Block[{t$95$0 = N[Max[N[Abs[V], $MachinePrecision], N[Abs[l], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Min[N[Abs[V], $MachinePrecision], N[Abs[l], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(c0 * N[Sqrt[N[(N[(N[Abs[A], $MachinePrecision] / t$95$1), $MachinePrecision] / t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(N[Abs[A], $MachinePrecision] / N[(t$95$1 * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$3, 4e-17], t$95$2, If[LessEqual[t$95$3, 2e+149], N[(c0 * t$95$3), $MachinePrecision], t$95$2]]]]]]
\begin{array}{l}
t_0 := \mathsf{max}\left(\left|V\right|, \left|\ell\right|\right)\\
t_1 := \mathsf{min}\left(\left|V\right|, \left|\ell\right|\right)\\
t_2 := c0 \cdot \sqrt{\frac{\frac{\left|A\right|}{t\_1}}{t\_0}}\\
t_3 := \sqrt{\frac{\left|A\right|}{t\_1 \cdot t\_0}}\\
\mathbf{if}\;t\_3 \leq 4 \cdot 10^{-17}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_3 \leq 2 \cdot 10^{+149}:\\
\;\;\;\;c0 \cdot t\_3\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
if (sqrt.f64 (/.f64 A (*.f64 V l))) < 4.0000000000000003e-17 or 2.0000000000000001e149 < (sqrt.f64 (/.f64 A (*.f64 V l))) Initial program 74.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6473.4%
Applied rewrites73.4%
if 4.0000000000000003e-17 < (sqrt.f64 (/.f64 A (*.f64 V l))) < 2.0000000000000001e149Initial program 74.1%
(FPCore (c0 A V l) :precision binary64 (* c0 (sqrt (/ (fabs A) (* (fabs V) (fabs l))))))
double code(double c0, double A, double V, double l) {
return c0 * sqrt((fabs(A) / (fabs(V) * fabs(l))));
}
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(c0, a, v, l)
use fmin_fmax_functions
real(8), intent (in) :: c0
real(8), intent (in) :: a
real(8), intent (in) :: v
real(8), intent (in) :: l
code = c0 * sqrt((abs(a) / (abs(v) * abs(l))))
end function
public static double code(double c0, double A, double V, double l) {
return c0 * Math.sqrt((Math.abs(A) / (Math.abs(V) * Math.abs(l))));
}
def code(c0, A, V, l): return c0 * math.sqrt((math.fabs(A) / (math.fabs(V) * math.fabs(l))))
function code(c0, A, V, l) return Float64(c0 * sqrt(Float64(abs(A) / Float64(abs(V) * abs(l))))) end
function tmp = code(c0, A, V, l) tmp = c0 * sqrt((abs(A) / (abs(V) * abs(l)))); end
code[c0_, A_, V_, l_] := N[(c0 * N[Sqrt[N[(N[Abs[A], $MachinePrecision] / N[(N[Abs[V], $MachinePrecision] * N[Abs[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
c0 \cdot \sqrt{\frac{\left|A\right|}{\left|V\right| \cdot \left|\ell\right|}}
Initial program 74.1%
herbie shell --seed 2025213
(FPCore (c0 A V l)
:name "Henrywood and Agarwal, Equation (3)"
:precision binary64
(* c0 (sqrt (/ A (* V l)))))