
(FPCore (w0 M D h l d) :precision binary64 (* w0 (sqrt (- 1 (* (pow (/ (* M D) (* 2 d)) 2) (/ h l))))))
double code(double w0, double M, double D, double h, double l, double d) {
return w0 * sqrt((1.0 - (pow(((M * D) / (2.0 * d)), 2.0) * (h / 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(w0, m, d, h, l, d_1)
use fmin_fmax_functions
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_1
code = w0 * sqrt((1.0d0 - ((((m * d) / (2.0d0 * d_1)) ** 2.0d0) * (h / l))))
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
return w0 * Math.sqrt((1.0 - (Math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l))));
}
def code(w0, M, D, h, l, d): return w0 * math.sqrt((1.0 - (math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l))))
function code(w0, M, D, h, l, d) return Float64(w0 * sqrt(Float64(1.0 - Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l))))) end
function tmp = code(w0, M, D, h, l, d) tmp = w0 * sqrt((1.0 - ((((M * D) / (2.0 * d)) ^ 2.0) * (h / l)))); end
code[w0_, M_, D_, h_, l_, d_] := N[(w0 * N[Sqrt[N[(1 - N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2 * d), $MachinePrecision]), $MachinePrecision], 2], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (w0 M D h l d) :precision binary64 (* w0 (sqrt (- 1 (* (pow (/ (* M D) (* 2 d)) 2) (/ h l))))))
double code(double w0, double M, double D, double h, double l, double d) {
return w0 * sqrt((1.0 - (pow(((M * D) / (2.0 * d)), 2.0) * (h / 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(w0, m, d, h, l, d_1)
use fmin_fmax_functions
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_1
code = w0 * sqrt((1.0d0 - ((((m * d) / (2.0d0 * d_1)) ** 2.0d0) * (h / l))))
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
return w0 * Math.sqrt((1.0 - (Math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l))));
}
def code(w0, M, D, h, l, d): return w0 * math.sqrt((1.0 - (math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l))))
function code(w0, M, D, h, l, d) return Float64(w0 * sqrt(Float64(1.0 - Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l))))) end
function tmp = code(w0, M, D, h, l, d) tmp = w0 * sqrt((1.0 - ((((M * D) / (2.0 * d)) ^ 2.0) * (h / l)))); end
code[w0_, M_, D_, h_, l_, d_] := N[(w0 * N[Sqrt[N[(1 - N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2 * d), $MachinePrecision]), $MachinePrecision], 2], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}
(FPCore (w0 M D h l d)
:precision binary64
(let* ((t_0 (pow (/ (* M D) (* 2 (fabs d))) 2)))
(*
(copysign 1 w0)
(if (<=
(* (fabs w0) (sqrt (- 1 (* t_0 (/ h l)))))
49999999999999998175343433979589279157951137391496288266157242743110873150620102906337171435410246399918892469000602018887594876771980109395971573896894072660533262290309118329484316681379045013850167655746877489167183814937869568749188006828844715705934104413037475872242663424)
(* (fabs w0) (sqrt (- 1 (* t_0 (* (/ 1 l) h)))))
(*
(fabs w0)
(/
(sqrt
(-
(fabs d)
(/
(* (/ (* (* M D) h) (+ (fabs d) (fabs d))) (* M D))
(+ l l))))
(sqrt (fabs d))))))))double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = pow(((M * D) / (2.0 * fabs(d))), 2.0);
double tmp;
if ((fabs(w0) * sqrt((1.0 - (t_0 * (h / l))))) <= 5e+277) {
tmp = fabs(w0) * sqrt((1.0 - (t_0 * ((1.0 / l) * h))));
} else {
tmp = fabs(w0) * (sqrt((fabs(d) - (((((M * D) * h) / (fabs(d) + fabs(d))) * (M * D)) / (l + l)))) / sqrt(fabs(d)));
}
return copysign(1.0, w0) * tmp;
}
public static double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = Math.pow(((M * D) / (2.0 * Math.abs(d))), 2.0);
double tmp;
if ((Math.abs(w0) * Math.sqrt((1.0 - (t_0 * (h / l))))) <= 5e+277) {
tmp = Math.abs(w0) * Math.sqrt((1.0 - (t_0 * ((1.0 / l) * h))));
} else {
tmp = Math.abs(w0) * (Math.sqrt((Math.abs(d) - (((((M * D) * h) / (Math.abs(d) + Math.abs(d))) * (M * D)) / (l + l)))) / Math.sqrt(Math.abs(d)));
}
return Math.copySign(1.0, w0) * tmp;
}
def code(w0, M, D, h, l, d): t_0 = math.pow(((M * D) / (2.0 * math.fabs(d))), 2.0) tmp = 0 if (math.fabs(w0) * math.sqrt((1.0 - (t_0 * (h / l))))) <= 5e+277: tmp = math.fabs(w0) * math.sqrt((1.0 - (t_0 * ((1.0 / l) * h)))) else: tmp = math.fabs(w0) * (math.sqrt((math.fabs(d) - (((((M * D) * h) / (math.fabs(d) + math.fabs(d))) * (M * D)) / (l + l)))) / math.sqrt(math.fabs(d))) return math.copysign(1.0, w0) * tmp
function code(w0, M, D, h, l, d) t_0 = Float64(Float64(M * D) / Float64(2.0 * abs(d))) ^ 2.0 tmp = 0.0 if (Float64(abs(w0) * sqrt(Float64(1.0 - Float64(t_0 * Float64(h / l))))) <= 5e+277) tmp = Float64(abs(w0) * sqrt(Float64(1.0 - Float64(t_0 * Float64(Float64(1.0 / l) * h))))); else tmp = Float64(abs(w0) * Float64(sqrt(Float64(abs(d) - Float64(Float64(Float64(Float64(Float64(M * D) * h) / Float64(abs(d) + abs(d))) * Float64(M * D)) / Float64(l + l)))) / sqrt(abs(d)))); end return Float64(copysign(1.0, w0) * tmp) end
function tmp_2 = code(w0, M, D, h, l, d) t_0 = ((M * D) / (2.0 * abs(d))) ^ 2.0; tmp = 0.0; if ((abs(w0) * sqrt((1.0 - (t_0 * (h / l))))) <= 5e+277) tmp = abs(w0) * sqrt((1.0 - (t_0 * ((1.0 / l) * h)))); else tmp = abs(w0) * (sqrt((abs(d) - (((((M * D) * h) / (abs(d) + abs(d))) * (M * D)) / (l + l)))) / sqrt(abs(d))); end tmp_2 = (sign(w0) * abs(1.0)) * tmp; end
code[w0_, M_, D_, h_, l_, d_] := Block[{t$95$0 = N[Power[N[(N[(M * D), $MachinePrecision] / N[(2 * N[Abs[d], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2], $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[w0]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[(N[Abs[w0], $MachinePrecision] * N[Sqrt[N[(1 - N[(t$95$0 * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 49999999999999998175343433979589279157951137391496288266157242743110873150620102906337171435410246399918892469000602018887594876771980109395971573896894072660533262290309118329484316681379045013850167655746877489167183814937869568749188006828844715705934104413037475872242663424], N[(N[Abs[w0], $MachinePrecision] * N[Sqrt[N[(1 - N[(t$95$0 * N[(N[(1 / l), $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Abs[w0], $MachinePrecision] * N[(N[Sqrt[N[(N[Abs[d], $MachinePrecision] - N[(N[(N[(N[(N[(M * D), $MachinePrecision] * h), $MachinePrecision] / N[(N[Abs[d], $MachinePrecision] + N[Abs[d], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(M * D), $MachinePrecision]), $MachinePrecision] / N[(l + l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[Abs[d], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
t_0 := {\left(\frac{M \cdot D}{2 \cdot \left|d\right|}\right)}^{2}\\
\mathsf{copysign}\left(1, w0\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|w0\right| \cdot \sqrt{1 - t\_0 \cdot \frac{h}{\ell}} \leq 49999999999999998175343433979589279157951137391496288266157242743110873150620102906337171435410246399918892469000602018887594876771980109395971573896894072660533262290309118329484316681379045013850167655746877489167183814937869568749188006828844715705934104413037475872242663424:\\
\;\;\;\;\left|w0\right| \cdot \sqrt{1 - t\_0 \cdot \left(\frac{1}{\ell} \cdot h\right)}\\
\mathbf{else}:\\
\;\;\;\;\left|w0\right| \cdot \frac{\sqrt{\left|d\right| - \frac{\frac{\left(M \cdot D\right) \cdot h}{\left|d\right| + \left|d\right|} \cdot \left(M \cdot D\right)}{\ell + \ell}}}{\sqrt{\left|d\right|}}\\
\end{array}
\end{array}
if (*.f64 w0 (sqrt.f64 (-.f64 #s(literal 1 binary64) (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l))))) < 4.9999999999999998e277Initial program 80.9%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6480.9%
Applied rewrites80.9%
if 4.9999999999999998e277 < (*.f64 w0 (sqrt.f64 (-.f64 #s(literal 1 binary64) (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l))))) Initial program 80.9%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites84.4%
lift-sqrt.f64N/A
lift--.f64N/A
lift-/.f64N/A
sub-to-fractionN/A
lift-+.f64N/A
count-2-revN/A
associate-/r*N/A
sqrt-divN/A
lower-unsound-/.f64N/A
Applied rewrites40.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
frac-timesN/A
lower-/.f64N/A
Applied rewrites43.3%
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
lower-+.f6443.3%
Applied rewrites43.3%
(FPCore (w0 M D h l d)
:precision binary64
(let* ((t_0
(*
(fabs w0)
(sqrt
(- 1 (* (pow (/ (* M D) (* 2 (fabs d))) 2) (/ h l)))))))
(*
(copysign 1 w0)
(if (<=
t_0
49999999999999998175343433979589279157951137391496288266157242743110873150620102906337171435410246399918892469000602018887594876771980109395971573896894072660533262290309118329484316681379045013850167655746877489167183814937869568749188006828844715705934104413037475872242663424)
t_0
(*
(fabs w0)
(/
(sqrt
(-
(fabs d)
(/
(* (/ (* (* M D) h) (+ (fabs d) (fabs d))) (* M D))
(+ l l))))
(sqrt (fabs d))))))))double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = fabs(w0) * sqrt((1.0 - (pow(((M * D) / (2.0 * fabs(d))), 2.0) * (h / l))));
double tmp;
if (t_0 <= 5e+277) {
tmp = t_0;
} else {
tmp = fabs(w0) * (sqrt((fabs(d) - (((((M * D) * h) / (fabs(d) + fabs(d))) * (M * D)) / (l + l)))) / sqrt(fabs(d)));
}
return copysign(1.0, w0) * tmp;
}
public static double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = Math.abs(w0) * Math.sqrt((1.0 - (Math.pow(((M * D) / (2.0 * Math.abs(d))), 2.0) * (h / l))));
double tmp;
if (t_0 <= 5e+277) {
tmp = t_0;
} else {
tmp = Math.abs(w0) * (Math.sqrt((Math.abs(d) - (((((M * D) * h) / (Math.abs(d) + Math.abs(d))) * (M * D)) / (l + l)))) / Math.sqrt(Math.abs(d)));
}
return Math.copySign(1.0, w0) * tmp;
}
def code(w0, M, D, h, l, d): t_0 = math.fabs(w0) * math.sqrt((1.0 - (math.pow(((M * D) / (2.0 * math.fabs(d))), 2.0) * (h / l)))) tmp = 0 if t_0 <= 5e+277: tmp = t_0 else: tmp = math.fabs(w0) * (math.sqrt((math.fabs(d) - (((((M * D) * h) / (math.fabs(d) + math.fabs(d))) * (M * D)) / (l + l)))) / math.sqrt(math.fabs(d))) return math.copysign(1.0, w0) * tmp
function code(w0, M, D, h, l, d) t_0 = Float64(abs(w0) * sqrt(Float64(1.0 - Float64((Float64(Float64(M * D) / Float64(2.0 * abs(d))) ^ 2.0) * Float64(h / l))))) tmp = 0.0 if (t_0 <= 5e+277) tmp = t_0; else tmp = Float64(abs(w0) * Float64(sqrt(Float64(abs(d) - Float64(Float64(Float64(Float64(Float64(M * D) * h) / Float64(abs(d) + abs(d))) * Float64(M * D)) / Float64(l + l)))) / sqrt(abs(d)))); end return Float64(copysign(1.0, w0) * tmp) end
function tmp_2 = code(w0, M, D, h, l, d) t_0 = abs(w0) * sqrt((1.0 - ((((M * D) / (2.0 * abs(d))) ^ 2.0) * (h / l)))); tmp = 0.0; if (t_0 <= 5e+277) tmp = t_0; else tmp = abs(w0) * (sqrt((abs(d) - (((((M * D) * h) / (abs(d) + abs(d))) * (M * D)) / (l + l)))) / sqrt(abs(d))); end tmp_2 = (sign(w0) * abs(1.0)) * tmp; end
code[w0_, M_, D_, h_, l_, d_] := Block[{t$95$0 = N[(N[Abs[w0], $MachinePrecision] * N[Sqrt[N[(1 - N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2 * N[Abs[d], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[w0]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[t$95$0, 49999999999999998175343433979589279157951137391496288266157242743110873150620102906337171435410246399918892469000602018887594876771980109395971573896894072660533262290309118329484316681379045013850167655746877489167183814937869568749188006828844715705934104413037475872242663424], t$95$0, N[(N[Abs[w0], $MachinePrecision] * N[(N[Sqrt[N[(N[Abs[d], $MachinePrecision] - N[(N[(N[(N[(N[(M * D), $MachinePrecision] * h), $MachinePrecision] / N[(N[Abs[d], $MachinePrecision] + N[Abs[d], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(M * D), $MachinePrecision]), $MachinePrecision] / N[(l + l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[Abs[d], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
t_0 := \left|w0\right| \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot \left|d\right|}\right)}^{2} \cdot \frac{h}{\ell}}\\
\mathsf{copysign}\left(1, w0\right) \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq 49999999999999998175343433979589279157951137391496288266157242743110873150620102906337171435410246399918892469000602018887594876771980109395971573896894072660533262290309118329484316681379045013850167655746877489167183814937869568749188006828844715705934104413037475872242663424:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\left|w0\right| \cdot \frac{\sqrt{\left|d\right| - \frac{\frac{\left(M \cdot D\right) \cdot h}{\left|d\right| + \left|d\right|} \cdot \left(M \cdot D\right)}{\ell + \ell}}}{\sqrt{\left|d\right|}}\\
\end{array}
\end{array}
if (*.f64 w0 (sqrt.f64 (-.f64 #s(literal 1 binary64) (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l))))) < 4.9999999999999998e277Initial program 80.9%
if 4.9999999999999998e277 < (*.f64 w0 (sqrt.f64 (-.f64 #s(literal 1 binary64) (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l))))) Initial program 80.9%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites84.4%
lift-sqrt.f64N/A
lift--.f64N/A
lift-/.f64N/A
sub-to-fractionN/A
lift-+.f64N/A
count-2-revN/A
associate-/r*N/A
sqrt-divN/A
lower-unsound-/.f64N/A
Applied rewrites40.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
frac-timesN/A
lower-/.f64N/A
Applied rewrites43.3%
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
lower-+.f6443.3%
Applied rewrites43.3%
(FPCore (w0 M D h l d)
:precision binary64
(*
w0
(/
(sqrt
(-
(fabs d)
(/ (* (/ (* (* M D) h) (+ (fabs d) (fabs d))) (* M D)) (+ l l))))
(sqrt (fabs d)))))double code(double w0, double M, double D, double h, double l, double d) {
return w0 * (sqrt((fabs(d) - (((((M * D) * h) / (fabs(d) + fabs(d))) * (M * D)) / (l + l)))) / sqrt(fabs(d)));
}
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(w0, m, d, h, l, d_1)
use fmin_fmax_functions
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_1
code = w0 * (sqrt((abs(d_1) - (((((m * d) * h) / (abs(d_1) + abs(d_1))) * (m * d)) / (l + l)))) / sqrt(abs(d_1)))
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
return w0 * (Math.sqrt((Math.abs(d) - (((((M * D) * h) / (Math.abs(d) + Math.abs(d))) * (M * D)) / (l + l)))) / Math.sqrt(Math.abs(d)));
}
def code(w0, M, D, h, l, d): return w0 * (math.sqrt((math.fabs(d) - (((((M * D) * h) / (math.fabs(d) + math.fabs(d))) * (M * D)) / (l + l)))) / math.sqrt(math.fabs(d)))
function code(w0, M, D, h, l, d) return Float64(w0 * Float64(sqrt(Float64(abs(d) - Float64(Float64(Float64(Float64(Float64(M * D) * h) / Float64(abs(d) + abs(d))) * Float64(M * D)) / Float64(l + l)))) / sqrt(abs(d)))) end
function tmp = code(w0, M, D, h, l, d) tmp = w0 * (sqrt((abs(d) - (((((M * D) * h) / (abs(d) + abs(d))) * (M * D)) / (l + l)))) / sqrt(abs(d))); end
code[w0_, M_, D_, h_, l_, d_] := N[(w0 * N[(N[Sqrt[N[(N[Abs[d], $MachinePrecision] - N[(N[(N[(N[(N[(M * D), $MachinePrecision] * h), $MachinePrecision] / N[(N[Abs[d], $MachinePrecision] + N[Abs[d], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(M * D), $MachinePrecision]), $MachinePrecision] / N[(l + l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[Abs[d], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
w0 \cdot \frac{\sqrt{\left|d\right| - \frac{\frac{\left(M \cdot D\right) \cdot h}{\left|d\right| + \left|d\right|} \cdot \left(M \cdot D\right)}{\ell + \ell}}}{\sqrt{\left|d\right|}}
Initial program 80.9%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites84.4%
lift-sqrt.f64N/A
lift--.f64N/A
lift-/.f64N/A
sub-to-fractionN/A
lift-+.f64N/A
count-2-revN/A
associate-/r*N/A
sqrt-divN/A
lower-unsound-/.f64N/A
Applied rewrites40.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
frac-timesN/A
lower-/.f64N/A
Applied rewrites43.3%
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
lower-+.f6443.3%
Applied rewrites43.3%
(FPCore (w0 M D h l d)
:precision binary64
(if (<=
(pow (/ (* M D) (* 2 d)) 2)
6304320991423117/157608024785577916849116160400574455220318957081861786671793173616982887085988842445657065019539662563226511961227264)
(* w0 1)
(*
w0
(sqrt
(- 1 (/ (* (/ (* h (* D M)) (* l (+ d d))) (* D M)) (+ d d)))))))double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (pow(((M * D) / (2.0 * d)), 2.0) <= 4e-101) {
tmp = w0 * 1.0;
} else {
tmp = w0 * sqrt((1.0 - ((((h * (D * M)) / (l * (d + d))) * (D * M)) / (d + d))));
}
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(w0, m, d, h, l, d_1)
use fmin_fmax_functions
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_1
real(8) :: tmp
if ((((m * d) / (2.0d0 * d_1)) ** 2.0d0) <= 4d-101) then
tmp = w0 * 1.0d0
else
tmp = w0 * sqrt((1.0d0 - ((((h * (d * m)) / (l * (d_1 + d_1))) * (d * m)) / (d_1 + d_1))))
end if
code = tmp
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (Math.pow(((M * D) / (2.0 * d)), 2.0) <= 4e-101) {
tmp = w0 * 1.0;
} else {
tmp = w0 * Math.sqrt((1.0 - ((((h * (D * M)) / (l * (d + d))) * (D * M)) / (d + d))));
}
return tmp;
}
def code(w0, M, D, h, l, d): tmp = 0 if math.pow(((M * D) / (2.0 * d)), 2.0) <= 4e-101: tmp = w0 * 1.0 else: tmp = w0 * math.sqrt((1.0 - ((((h * (D * M)) / (l * (d + d))) * (D * M)) / (d + d)))) return tmp
function code(w0, M, D, h, l, d) tmp = 0.0 if ((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) <= 4e-101) tmp = Float64(w0 * 1.0); else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(Float64(Float64(h * Float64(D * M)) / Float64(l * Float64(d + d))) * Float64(D * M)) / Float64(d + d))))); end return tmp end
function tmp_2 = code(w0, M, D, h, l, d) tmp = 0.0; if ((((M * D) / (2.0 * d)) ^ 2.0) <= 4e-101) tmp = w0 * 1.0; else tmp = w0 * sqrt((1.0 - ((((h * (D * M)) / (l * (d + d))) * (D * M)) / (d + d)))); end tmp_2 = tmp; end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[Power[N[(N[(M * D), $MachinePrecision] / N[(2 * d), $MachinePrecision]), $MachinePrecision], 2], $MachinePrecision], 6304320991423117/157608024785577916849116160400574455220318957081861786671793173616982887085988842445657065019539662563226511961227264], N[(w0 * 1), $MachinePrecision], N[(w0 * N[Sqrt[N[(1 - N[(N[(N[(N[(h * N[(D * M), $MachinePrecision]), $MachinePrecision] / N[(l * N[(d + d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(D * M), $MachinePrecision]), $MachinePrecision] / N[(d + d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \leq \frac{6304320991423117}{157608024785577916849116160400574455220318957081861786671793173616982887085988842445657065019539662563226511961227264}:\\
\;\;\;\;w0 \cdot 1\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{\frac{h \cdot \left(D \cdot M\right)}{\ell \cdot \left(d + d\right)} \cdot \left(D \cdot M\right)}{d + d}}\\
\end{array}
if (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) < 4.0000000000000002e-101Initial program 80.9%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites84.4%
lift-sqrt.f64N/A
lift--.f64N/A
lift-/.f64N/A
sub-to-fractionN/A
lift-+.f64N/A
count-2-revN/A
associate-/r*N/A
sqrt-divN/A
lower-unsound-/.f64N/A
Applied rewrites40.8%
Taylor expanded in M around 0
Applied rewrites68.1%
if 4.0000000000000002e-101 < (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) Initial program 80.9%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites84.4%
(FPCore (w0 M D h l d) :precision binary64 (if (<= (sqrt (- 1 (* (pow (/ (* M D) (* 2 d)) 2) (/ h l)))) 2) (* w0 1) (* (sqrt (- 1 (* (* h (* D M)) (/ (* (* 1/4 M) D) (* (* l d) d))))) w0)))
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (sqrt((1.0 - (pow(((M * D) / (2.0 * d)), 2.0) * (h / l)))) <= 2.0) {
tmp = w0 * 1.0;
} else {
tmp = sqrt((1.0 - ((h * (D * M)) * (((0.25 * M) * D) / ((l * d) * d))))) * w0;
}
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(w0, m, d, h, l, d_1)
use fmin_fmax_functions
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_1
real(8) :: tmp
if (sqrt((1.0d0 - ((((m * d) / (2.0d0 * d_1)) ** 2.0d0) * (h / l)))) <= 2.0d0) then
tmp = w0 * 1.0d0
else
tmp = sqrt((1.0d0 - ((h * (d * m)) * (((0.25d0 * m) * d) / ((l * d_1) * d_1))))) * w0
end if
code = tmp
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (Math.sqrt((1.0 - (Math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l)))) <= 2.0) {
tmp = w0 * 1.0;
} else {
tmp = Math.sqrt((1.0 - ((h * (D * M)) * (((0.25 * M) * D) / ((l * d) * d))))) * w0;
}
return tmp;
}
def code(w0, M, D, h, l, d): tmp = 0 if math.sqrt((1.0 - (math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l)))) <= 2.0: tmp = w0 * 1.0 else: tmp = math.sqrt((1.0 - ((h * (D * M)) * (((0.25 * M) * D) / ((l * d) * d))))) * w0 return tmp
function code(w0, M, D, h, l, d) tmp = 0.0 if (sqrt(Float64(1.0 - Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)))) <= 2.0) tmp = Float64(w0 * 1.0); else tmp = Float64(sqrt(Float64(1.0 - Float64(Float64(h * Float64(D * M)) * Float64(Float64(Float64(0.25 * M) * D) / Float64(Float64(l * d) * d))))) * w0); end return tmp end
function tmp_2 = code(w0, M, D, h, l, d) tmp = 0.0; if (sqrt((1.0 - ((((M * D) / (2.0 * d)) ^ 2.0) * (h / l)))) <= 2.0) tmp = w0 * 1.0; else tmp = sqrt((1.0 - ((h * (D * M)) * (((0.25 * M) * D) / ((l * d) * d))))) * w0; end tmp_2 = tmp; end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[Sqrt[N[(1 - N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2 * d), $MachinePrecision]), $MachinePrecision], 2], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2], N[(w0 * 1), $MachinePrecision], N[(N[Sqrt[N[(1 - N[(N[(h * N[(D * M), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(1/4 * M), $MachinePrecision] * D), $MachinePrecision] / N[(N[(l * d), $MachinePrecision] * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * w0), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \leq 2:\\
\;\;\;\;w0 \cdot 1\\
\mathbf{else}:\\
\;\;\;\;\sqrt{1 - \left(h \cdot \left(D \cdot M\right)\right) \cdot \frac{\left(\frac{1}{4} \cdot M\right) \cdot D}{\left(\ell \cdot d\right) \cdot d}} \cdot w0\\
\end{array}
if (sqrt.f64 (-.f64 #s(literal 1 binary64) (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)))) < 2Initial program 80.9%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites84.4%
lift-sqrt.f64N/A
lift--.f64N/A
lift-/.f64N/A
sub-to-fractionN/A
lift-+.f64N/A
count-2-revN/A
associate-/r*N/A
sqrt-divN/A
lower-unsound-/.f64N/A
Applied rewrites40.8%
Taylor expanded in M around 0
Applied rewrites68.1%
if 2 < (sqrt.f64 (-.f64 #s(literal 1 binary64) (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)))) Initial program 80.9%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6486.2%
Applied rewrites76.3%
Applied rewrites74.6%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6474.6%
Applied rewrites72.0%
lift-/.f64N/A
*-lft-identityN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-lft-identity74.6%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f6479.2%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6479.2%
Applied rewrites79.2%
(FPCore (w0 M D h l d) :precision binary64 (if (<= (* (pow (/ (* M D) (* 2 d)) 2) (/ h l)) -10) (* (sqrt (- 1 (* (* 1/4 M) (* D (* (* D M) (/ h (* (* l d) d))))))) w0) (* w0 1)))
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -10.0) {
tmp = sqrt((1.0 - ((0.25 * M) * (D * ((D * M) * (h / ((l * d) * d))))))) * w0;
} else {
tmp = w0 * 1.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(w0, m, d, h, l, d_1)
use fmin_fmax_functions
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_1
real(8) :: tmp
if (((((m * d) / (2.0d0 * d_1)) ** 2.0d0) * (h / l)) <= (-10.0d0)) then
tmp = sqrt((1.0d0 - ((0.25d0 * m) * (d * ((d * m) * (h / ((l * d_1) * d_1))))))) * w0
else
tmp = w0 * 1.0d0
end if
code = tmp
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((Math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -10.0) {
tmp = Math.sqrt((1.0 - ((0.25 * M) * (D * ((D * M) * (h / ((l * d) * d))))))) * w0;
} else {
tmp = w0 * 1.0;
}
return tmp;
}
def code(w0, M, D, h, l, d): tmp = 0 if (math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -10.0: tmp = math.sqrt((1.0 - ((0.25 * M) * (D * ((D * M) * (h / ((l * d) * d))))))) * w0 else: tmp = w0 * 1.0 return tmp
function code(w0, M, D, h, l, d) tmp = 0.0 if (Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) <= -10.0) tmp = Float64(sqrt(Float64(1.0 - Float64(Float64(0.25 * M) * Float64(D * Float64(Float64(D * M) * Float64(h / Float64(Float64(l * d) * d))))))) * w0); else tmp = Float64(w0 * 1.0); end return tmp end
function tmp_2 = code(w0, M, D, h, l, d) tmp = 0.0; if (((((M * D) / (2.0 * d)) ^ 2.0) * (h / l)) <= -10.0) tmp = sqrt((1.0 - ((0.25 * M) * (D * ((D * M) * (h / ((l * d) * d))))))) * w0; else tmp = w0 * 1.0; end tmp_2 = tmp; end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2 * d), $MachinePrecision]), $MachinePrecision], 2], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -10], N[(N[Sqrt[N[(1 - N[(N[(1/4 * M), $MachinePrecision] * N[(D * N[(N[(D * M), $MachinePrecision] * N[(h / N[(N[(l * d), $MachinePrecision] * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * w0), $MachinePrecision], N[(w0 * 1), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -10:\\
\;\;\;\;\sqrt{1 - \left(\frac{1}{4} \cdot M\right) \cdot \left(D \cdot \left(\left(D \cdot M\right) \cdot \frac{h}{\left(\ell \cdot d\right) \cdot d}\right)\right)} \cdot w0\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot 1\\
\end{array}
if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -10Initial program 80.9%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6486.2%
Applied rewrites76.3%
Applied rewrites74.6%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6474.6%
Applied rewrites72.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
*-lft-identityN/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
*-lft-identity73.2%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f6476.7%
Applied rewrites76.7%
if -10 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 80.9%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites84.4%
lift-sqrt.f64N/A
lift--.f64N/A
lift-/.f64N/A
sub-to-fractionN/A
lift-+.f64N/A
count-2-revN/A
associate-/r*N/A
sqrt-divN/A
lower-unsound-/.f64N/A
Applied rewrites40.8%
Taylor expanded in M around 0
Applied rewrites68.1%
(FPCore (w0 M D h l d)
:precision binary64
(let* ((t_0 (fmax (fabs M) D)) (t_1 (fmin (fabs M) D)))
(if (<=
(* (pow (/ (* t_1 t_0) (* 2 d)) 2) (/ h l))
-40000000000000000000)
(*
w0
(sqrt
(-
1
(/ (* (* (* (* t_0 t_1) t_0) t_1) h) (* (* 4 (* d d)) l)))))
(* w0 1))))double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = fmax(fabs(M), D);
double t_1 = fmin(fabs(M), D);
double tmp;
if ((pow(((t_1 * t_0) / (2.0 * d)), 2.0) * (h / l)) <= -4e+19) {
tmp = w0 * sqrt((1.0 - (((((t_0 * t_1) * t_0) * t_1) * h) / ((4.0 * (d * d)) * l))));
} else {
tmp = w0 * 1.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(w0, m, d, h, l, d_1)
use fmin_fmax_functions
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = fmax(abs(m), d)
t_1 = fmin(abs(m), d)
if (((((t_1 * t_0) / (2.0d0 * d_1)) ** 2.0d0) * (h / l)) <= (-4d+19)) then
tmp = w0 * sqrt((1.0d0 - (((((t_0 * t_1) * t_0) * t_1) * h) / ((4.0d0 * (d_1 * d_1)) * l))))
else
tmp = w0 * 1.0d0
end if
code = tmp
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = fmax(Math.abs(M), D);
double t_1 = fmin(Math.abs(M), D);
double tmp;
if ((Math.pow(((t_1 * t_0) / (2.0 * d)), 2.0) * (h / l)) <= -4e+19) {
tmp = w0 * Math.sqrt((1.0 - (((((t_0 * t_1) * t_0) * t_1) * h) / ((4.0 * (d * d)) * l))));
} else {
tmp = w0 * 1.0;
}
return tmp;
}
def code(w0, M, D, h, l, d): t_0 = fmax(math.fabs(M), D) t_1 = fmin(math.fabs(M), D) tmp = 0 if (math.pow(((t_1 * t_0) / (2.0 * d)), 2.0) * (h / l)) <= -4e+19: tmp = w0 * math.sqrt((1.0 - (((((t_0 * t_1) * t_0) * t_1) * h) / ((4.0 * (d * d)) * l)))) else: tmp = w0 * 1.0 return tmp
function code(w0, M, D, h, l, d) t_0 = fmax(abs(M), D) t_1 = fmin(abs(M), D) tmp = 0.0 if (Float64((Float64(Float64(t_1 * t_0) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) <= -4e+19) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(Float64(Float64(Float64(t_0 * t_1) * t_0) * t_1) * h) / Float64(Float64(4.0 * Float64(d * d)) * l))))); else tmp = Float64(w0 * 1.0); end return tmp end
function tmp_2 = code(w0, M, D, h, l, d) t_0 = max(abs(M), D); t_1 = min(abs(M), D); tmp = 0.0; if (((((t_1 * t_0) / (2.0 * d)) ^ 2.0) * (h / l)) <= -4e+19) tmp = w0 * sqrt((1.0 - (((((t_0 * t_1) * t_0) * t_1) * h) / ((4.0 * (d * d)) * l)))); else tmp = w0 * 1.0; end tmp_2 = tmp; end
code[w0_, M_, D_, h_, l_, d_] := Block[{t$95$0 = N[Max[N[Abs[M], $MachinePrecision], D], $MachinePrecision]}, Block[{t$95$1 = N[Min[N[Abs[M], $MachinePrecision], D], $MachinePrecision]}, If[LessEqual[N[(N[Power[N[(N[(t$95$1 * t$95$0), $MachinePrecision] / N[(2 * d), $MachinePrecision]), $MachinePrecision], 2], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -40000000000000000000], N[(w0 * N[Sqrt[N[(1 - N[(N[(N[(N[(N[(t$95$0 * t$95$1), $MachinePrecision] * t$95$0), $MachinePrecision] * t$95$1), $MachinePrecision] * h), $MachinePrecision] / N[(N[(4 * N[(d * d), $MachinePrecision]), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * 1), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \mathsf{max}\left(\left|M\right|, D\right)\\
t_1 := \mathsf{min}\left(\left|M\right|, D\right)\\
\mathbf{if}\;{\left(\frac{t\_1 \cdot t\_0}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -40000000000000000000:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{\left(\left(\left(t\_0 \cdot t\_1\right) \cdot t\_0\right) \cdot t\_1\right) \cdot h}{\left(4 \cdot \left(d \cdot d\right)\right) \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot 1\\
\end{array}
if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -4e19Initial program 80.9%
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-/.f64N/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
Applied rewrites67.5%
if -4e19 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 80.9%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites84.4%
lift-sqrt.f64N/A
lift--.f64N/A
lift-/.f64N/A
sub-to-fractionN/A
lift-+.f64N/A
count-2-revN/A
associate-/r*N/A
sqrt-divN/A
lower-unsound-/.f64N/A
Applied rewrites40.8%
Taylor expanded in M around 0
Applied rewrites68.1%
(FPCore (w0 M D h l d)
:precision binary64
(if (<=
(* (pow (/ (* M D) (* 2 d)) 2) (/ h l))
-9999999999999999635896294965248)
(*
w0
(sqrt (- 1 (/ (* (* (* (* D D) h) M) (* 1/4 M)) (* d (* d l))))))
(* w0 1)))double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -1e+31) {
tmp = w0 * sqrt((1.0 - (((((D * D) * h) * M) * (0.25 * M)) / (d * (d * l)))));
} else {
tmp = w0 * 1.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(w0, m, d, h, l, d_1)
use fmin_fmax_functions
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_1
real(8) :: tmp
if (((((m * d) / (2.0d0 * d_1)) ** 2.0d0) * (h / l)) <= (-1d+31)) then
tmp = w0 * sqrt((1.0d0 - (((((d * d) * h) * m) * (0.25d0 * m)) / (d_1 * (d_1 * l)))))
else
tmp = w0 * 1.0d0
end if
code = tmp
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((Math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -1e+31) {
tmp = w0 * Math.sqrt((1.0 - (((((D * D) * h) * M) * (0.25 * M)) / (d * (d * l)))));
} else {
tmp = w0 * 1.0;
}
return tmp;
}
def code(w0, M, D, h, l, d): tmp = 0 if (math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -1e+31: tmp = w0 * math.sqrt((1.0 - (((((D * D) * h) * M) * (0.25 * M)) / (d * (d * l))))) else: tmp = w0 * 1.0 return tmp
function code(w0, M, D, h, l, d) tmp = 0.0 if (Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) <= -1e+31) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(Float64(Float64(Float64(D * D) * h) * M) * Float64(0.25 * M)) / Float64(d * Float64(d * l)))))); else tmp = Float64(w0 * 1.0); end return tmp end
function tmp_2 = code(w0, M, D, h, l, d) tmp = 0.0; if (((((M * D) / (2.0 * d)) ^ 2.0) * (h / l)) <= -1e+31) tmp = w0 * sqrt((1.0 - (((((D * D) * h) * M) * (0.25 * M)) / (d * (d * l))))); else tmp = w0 * 1.0; end tmp_2 = tmp; end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2 * d), $MachinePrecision]), $MachinePrecision], 2], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -9999999999999999635896294965248], N[(w0 * N[Sqrt[N[(1 - N[(N[(N[(N[(N[(D * D), $MachinePrecision] * h), $MachinePrecision] * M), $MachinePrecision] * N[(1/4 * M), $MachinePrecision]), $MachinePrecision] / N[(d * N[(d * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * 1), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -9999999999999999635896294965248:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{\left(\left(\left(D \cdot D\right) \cdot h\right) \cdot M\right) \cdot \left(\frac{1}{4} \cdot M\right)}{d \cdot \left(d \cdot \ell\right)}}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot 1\\
\end{array}
if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -9.9999999999999996e30Initial program 80.9%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6486.2%
Applied rewrites76.3%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
Applied rewrites58.0%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6465.3%
Applied rewrites65.3%
if -9.9999999999999996e30 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 80.9%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites84.4%
lift-sqrt.f64N/A
lift--.f64N/A
lift-/.f64N/A
sub-to-fractionN/A
lift-+.f64N/A
count-2-revN/A
associate-/r*N/A
sqrt-divN/A
lower-unsound-/.f64N/A
Applied rewrites40.8%
Taylor expanded in M around 0
Applied rewrites68.1%
(FPCore (w0 M D h l d)
:precision binary64
(if (<=
(* (pow (/ (* M D) (* 2 d)) 2) (/ h l))
-50000000000000000372449025103715994572099746929157693617982127065631992623390808013185993818695352920423280130139232314186271691640488659154528462055811941854826944868021960704)
(*
w0
(sqrt (- 1 (* M (* (* 1/4 M) (* (* D D) (/ h (* (* d d) l))))))))
(* w0 1)))double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -5e+175) {
tmp = w0 * sqrt((1.0 - (M * ((0.25 * M) * ((D * D) * (h / ((d * d) * l)))))));
} else {
tmp = w0 * 1.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(w0, m, d, h, l, d_1)
use fmin_fmax_functions
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_1
real(8) :: tmp
if (((((m * d) / (2.0d0 * d_1)) ** 2.0d0) * (h / l)) <= (-5d+175)) then
tmp = w0 * sqrt((1.0d0 - (m * ((0.25d0 * m) * ((d * d) * (h / ((d_1 * d_1) * l)))))))
else
tmp = w0 * 1.0d0
end if
code = tmp
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((Math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -5e+175) {
tmp = w0 * Math.sqrt((1.0 - (M * ((0.25 * M) * ((D * D) * (h / ((d * d) * l)))))));
} else {
tmp = w0 * 1.0;
}
return tmp;
}
def code(w0, M, D, h, l, d): tmp = 0 if (math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -5e+175: tmp = w0 * math.sqrt((1.0 - (M * ((0.25 * M) * ((D * D) * (h / ((d * d) * l))))))) else: tmp = w0 * 1.0 return tmp
function code(w0, M, D, h, l, d) tmp = 0.0 if (Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) <= -5e+175) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(M * Float64(Float64(0.25 * M) * Float64(Float64(D * D) * Float64(h / Float64(Float64(d * d) * l)))))))); else tmp = Float64(w0 * 1.0); end return tmp end
function tmp_2 = code(w0, M, D, h, l, d) tmp = 0.0; if (((((M * D) / (2.0 * d)) ^ 2.0) * (h / l)) <= -5e+175) tmp = w0 * sqrt((1.0 - (M * ((0.25 * M) * ((D * D) * (h / ((d * d) * l))))))); else tmp = w0 * 1.0; end tmp_2 = tmp; end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2 * d), $MachinePrecision]), $MachinePrecision], 2], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -50000000000000000372449025103715994572099746929157693617982127065631992623390808013185993818695352920423280130139232314186271691640488659154528462055811941854826944868021960704], N[(w0 * N[Sqrt[N[(1 - N[(M * N[(N[(1/4 * M), $MachinePrecision] * N[(N[(D * D), $MachinePrecision] * N[(h / N[(N[(d * d), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * 1), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -50000000000000000372449025103715994572099746929157693617982127065631992623390808013185993818695352920423280130139232314186271691640488659154528462055811941854826944868021960704:\\
\;\;\;\;w0 \cdot \sqrt{1 - M \cdot \left(\left(\frac{1}{4} \cdot M\right) \cdot \left(\left(D \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot 1\\
\end{array}
if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -5e175Initial program 80.9%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6486.2%
Applied rewrites76.3%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
Applied rewrites58.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lift-*.f64N/A
*-lft-identityN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
*-lft-identity66.6%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
lower-*.f6463.7%
Applied rewrites63.7%
if -5e175 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 80.9%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites84.4%
lift-sqrt.f64N/A
lift--.f64N/A
lift-/.f64N/A
sub-to-fractionN/A
lift-+.f64N/A
count-2-revN/A
associate-/r*N/A
sqrt-divN/A
lower-unsound-/.f64N/A
Applied rewrites40.8%
Taylor expanded in M around 0
Applied rewrites68.1%
(FPCore (w0 M D h l d) :precision binary64 (* w0 1))
double code(double w0, double M, double D, double h, double l, double d) {
return w0 * 1.0;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(w0, m, d, h, l, d_1)
use fmin_fmax_functions
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_1
code = w0 * 1.0d0
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
return w0 * 1.0;
}
def code(w0, M, D, h, l, d): return w0 * 1.0
function code(w0, M, D, h, l, d) return Float64(w0 * 1.0) end
function tmp = code(w0, M, D, h, l, d) tmp = w0 * 1.0; end
code[w0_, M_, D_, h_, l_, d_] := N[(w0 * 1), $MachinePrecision]
w0 \cdot 1
Initial program 80.9%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites84.4%
lift-sqrt.f64N/A
lift--.f64N/A
lift-/.f64N/A
sub-to-fractionN/A
lift-+.f64N/A
count-2-revN/A
associate-/r*N/A
sqrt-divN/A
lower-unsound-/.f64N/A
Applied rewrites40.8%
Taylor expanded in M around 0
Applied rewrites68.1%
herbie shell --seed 2025271 -o generate:evaluate
(FPCore (w0 M D h l d)
:name "Henrywood and Agarwal, Equation (9a)"
:precision binary64
(* w0 (sqrt (- 1 (* (pow (/ (* M D) (* 2 d)) 2) (/ h l))))))