
(FPCore (w0 M D h l d) :precision binary64 (* w0 (sqrt (- 1.0 (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ 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.0 - N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $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 6 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (w0 M D h l d) :precision binary64 (* w0 (sqrt (- 1.0 (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ 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.0 - N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $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 (fmin (fabs M) (fabs D)))
(t_1 (+ (fabs d) (fabs d)))
(t_2 (fmax (fabs M) (fabs D)))
(t_3 (/ (* t_0 t_2) (* 2.0 (fabs d))))
(t_4 (* t_2 t_0)))
(if (<= t_3 1e-20)
(*
w0
(sqrt (fma (* (/ t_0 t_1) t_2) (/ (* (/ t_2 t_1) (* t_0 h)) (- l)) 1.0)))
(if (<= t_3 1e+213)
(*
w0
(sqrt (fma (/ (* h t_4) (* l t_1)) (* (/ -0.5 (fabs d)) t_4) 1.0)))
(/
(*
t_2
(* w0 (sqrt (- (* 0.5 (/ (* (pow t_0 2.0) h) (* (fabs d) l)))))))
(sqrt t_1))))))double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = fmin(fabs(M), fabs(D));
double t_1 = fabs(d) + fabs(d);
double t_2 = fmax(fabs(M), fabs(D));
double t_3 = (t_0 * t_2) / (2.0 * fabs(d));
double t_4 = t_2 * t_0;
double tmp;
if (t_3 <= 1e-20) {
tmp = w0 * sqrt(fma(((t_0 / t_1) * t_2), (((t_2 / t_1) * (t_0 * h)) / -l), 1.0));
} else if (t_3 <= 1e+213) {
tmp = w0 * sqrt(fma(((h * t_4) / (l * t_1)), ((-0.5 / fabs(d)) * t_4), 1.0));
} else {
tmp = (t_2 * (w0 * sqrt(-(0.5 * ((pow(t_0, 2.0) * h) / (fabs(d) * l)))))) / sqrt(t_1);
}
return tmp;
}
function code(w0, M, D, h, l, d) t_0 = fmin(abs(M), abs(D)) t_1 = Float64(abs(d) + abs(d)) t_2 = fmax(abs(M), abs(D)) t_3 = Float64(Float64(t_0 * t_2) / Float64(2.0 * abs(d))) t_4 = Float64(t_2 * t_0) tmp = 0.0 if (t_3 <= 1e-20) tmp = Float64(w0 * sqrt(fma(Float64(Float64(t_0 / t_1) * t_2), Float64(Float64(Float64(t_2 / t_1) * Float64(t_0 * h)) / Float64(-l)), 1.0))); elseif (t_3 <= 1e+213) tmp = Float64(w0 * sqrt(fma(Float64(Float64(h * t_4) / Float64(l * t_1)), Float64(Float64(-0.5 / abs(d)) * t_4), 1.0))); else tmp = Float64(Float64(t_2 * Float64(w0 * sqrt(Float64(-Float64(0.5 * Float64(Float64((t_0 ^ 2.0) * h) / Float64(abs(d) * l))))))) / sqrt(t_1)); end return tmp end
code[w0_, M_, D_, h_, l_, d_] := Block[{t$95$0 = N[Min[N[Abs[M], $MachinePrecision], N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Abs[d], $MachinePrecision] + N[Abs[d], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Max[N[Abs[M], $MachinePrecision], N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(N[(t$95$0 * t$95$2), $MachinePrecision] / N[(2.0 * N[Abs[d], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(t$95$2 * t$95$0), $MachinePrecision]}, If[LessEqual[t$95$3, 1e-20], N[(w0 * N[Sqrt[N[(N[(N[(t$95$0 / t$95$1), $MachinePrecision] * t$95$2), $MachinePrecision] * N[(N[(N[(t$95$2 / t$95$1), $MachinePrecision] * N[(t$95$0 * h), $MachinePrecision]), $MachinePrecision] / (-l)), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 1e+213], N[(w0 * N[Sqrt[N[(N[(N[(h * t$95$4), $MachinePrecision] / N[(l * t$95$1), $MachinePrecision]), $MachinePrecision] * N[(N[(-0.5 / N[Abs[d], $MachinePrecision]), $MachinePrecision] * t$95$4), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(t$95$2 * N[(w0 * N[Sqrt[(-N[(0.5 * N[(N[(N[Power[t$95$0, 2.0], $MachinePrecision] * h), $MachinePrecision] / N[(N[Abs[d], $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[t$95$1], $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
t_0 := \mathsf{min}\left(\left|M\right|, \left|D\right|\right)\\
t_1 := \left|d\right| + \left|d\right|\\
t_2 := \mathsf{max}\left(\left|M\right|, \left|D\right|\right)\\
t_3 := \frac{t\_0 \cdot t\_2}{2 \cdot \left|d\right|}\\
t_4 := t\_2 \cdot t\_0\\
\mathbf{if}\;t\_3 \leq 10^{-20}:\\
\;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(\frac{t\_0}{t\_1} \cdot t\_2, \frac{\frac{t\_2}{t\_1} \cdot \left(t\_0 \cdot h\right)}{-\ell}, 1\right)}\\
\mathbf{elif}\;t\_3 \leq 10^{+213}:\\
\;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(\frac{h \cdot t\_4}{\ell \cdot t\_1}, \frac{-0.5}{\left|d\right|} \cdot t\_4, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_2 \cdot \left(w0 \cdot \sqrt{-0.5 \cdot \frac{{t\_0}^{2} \cdot h}{\left|d\right| \cdot \ell}}\right)}{\sqrt{t\_1}}\\
\end{array}
if (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) < 9.9999999999999995e-21Initial program 80.7%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-neg-outN/A
distribute-rgt-neg-inN/A
lift-/.f64N/A
distribute-neg-frac2N/A
associate-/l*N/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites83.8%
if 9.9999999999999995e-21 < (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) < 9.9999999999999998e212Initial program 80.7%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
distribute-rgt-neg-inN/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites84.0%
if 9.9999999999999998e212 < (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) Initial program 80.7%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-neg-outN/A
distribute-rgt-neg-inN/A
lift-/.f64N/A
distribute-neg-frac2N/A
associate-/l*N/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites83.8%
Applied rewrites41.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites38.4%
Taylor expanded in D around inf
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-*.f645.9%
Applied rewrites5.9%
(FPCore (w0 M D h l d)
:precision binary64
(let* ((t_0 (fmax (fabs M) (fabs D)))
(t_1 (+ (fabs d) (fabs d)))
(t_2 (fmin (fabs M) (fabs D))))
(if (<= (* (pow (/ (* t_2 t_0) (* 2.0 (fabs d))) 2.0) (/ h l)) -5e+47)
(*
w0
(*
t_2
(* -1.0 (* t_0 (* -1.0 (/ (sqrt (- (* 0.25 (/ h l)))) (fabs d)))))))
(*
w0
(sqrt
(fma (* (/ t_2 t_1) t_0) (/ (* (/ t_0 t_1) (* t_2 h)) (- l)) 1.0))))))double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = fmax(fabs(M), fabs(D));
double t_1 = fabs(d) + fabs(d);
double t_2 = fmin(fabs(M), fabs(D));
double tmp;
if ((pow(((t_2 * t_0) / (2.0 * fabs(d))), 2.0) * (h / l)) <= -5e+47) {
tmp = w0 * (t_2 * (-1.0 * (t_0 * (-1.0 * (sqrt(-(0.25 * (h / l))) / fabs(d))))));
} else {
tmp = w0 * sqrt(fma(((t_2 / t_1) * t_0), (((t_0 / t_1) * (t_2 * h)) / -l), 1.0));
}
return tmp;
}
function code(w0, M, D, h, l, d) t_0 = fmax(abs(M), abs(D)) t_1 = Float64(abs(d) + abs(d)) t_2 = fmin(abs(M), abs(D)) tmp = 0.0 if (Float64((Float64(Float64(t_2 * t_0) / Float64(2.0 * abs(d))) ^ 2.0) * Float64(h / l)) <= -5e+47) tmp = Float64(w0 * Float64(t_2 * Float64(-1.0 * Float64(t_0 * Float64(-1.0 * Float64(sqrt(Float64(-Float64(0.25 * Float64(h / l)))) / abs(d))))))); else tmp = Float64(w0 * sqrt(fma(Float64(Float64(t_2 / t_1) * t_0), Float64(Float64(Float64(t_0 / t_1) * Float64(t_2 * h)) / Float64(-l)), 1.0))); end return tmp end
code[w0_, M_, D_, h_, l_, d_] := Block[{t$95$0 = N[Max[N[Abs[M], $MachinePrecision], N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Abs[d], $MachinePrecision] + N[Abs[d], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Min[N[Abs[M], $MachinePrecision], N[Abs[D], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[Power[N[(N[(t$95$2 * t$95$0), $MachinePrecision] / N[(2.0 * N[Abs[d], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -5e+47], N[(w0 * N[(t$95$2 * N[(-1.0 * N[(t$95$0 * N[(-1.0 * N[(N[Sqrt[(-N[(0.25 * N[(h / l), $MachinePrecision]), $MachinePrecision])], $MachinePrecision] / N[Abs[d], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(N[(N[(t$95$2 / t$95$1), $MachinePrecision] * t$95$0), $MachinePrecision] * N[(N[(N[(t$95$0 / t$95$1), $MachinePrecision] * N[(t$95$2 * h), $MachinePrecision]), $MachinePrecision] / (-l)), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := \mathsf{max}\left(\left|M\right|, \left|D\right|\right)\\
t_1 := \left|d\right| + \left|d\right|\\
t_2 := \mathsf{min}\left(\left|M\right|, \left|D\right|\right)\\
\mathbf{if}\;{\left(\frac{t\_2 \cdot t\_0}{2 \cdot \left|d\right|}\right)}^{2} \cdot \frac{h}{\ell} \leq -5 \cdot 10^{+47}:\\
\;\;\;\;w0 \cdot \left(t\_2 \cdot \left(-1 \cdot \left(t\_0 \cdot \left(-1 \cdot \frac{\sqrt{-0.25 \cdot \frac{h}{\ell}}}{\left|d\right|}\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(\frac{t\_2}{t\_1} \cdot t\_0, \frac{\frac{t\_0}{t\_1} \cdot \left(t\_2 \cdot h\right)}{-\ell}, 1\right)}\\
\end{array}
if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -5.0000000000000002e47Initial program 80.7%
Taylor expanded in M around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lower-pow.f648.8%
Applied rewrites8.8%
Taylor expanded in D around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f6411.4%
Applied rewrites11.4%
Taylor expanded in d around -inf
lower-*.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower-/.f6413.3%
Applied rewrites13.3%
if -5.0000000000000002e47 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 80.7%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-neg-outN/A
distribute-rgt-neg-inN/A
lift-/.f64N/A
distribute-neg-frac2N/A
associate-/l*N/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites83.8%
(FPCore (w0 M D h l d)
:precision binary64
(if (<=
(* (pow (/ (* (fabs M) (fabs D)) (* 2.0 (fabs d))) 2.0) (/ h l))
-2000.0)
(*
w0
(*
(fabs M)
(* -1.0 (* (fabs D) (* -1.0 (/ (sqrt (- (* 0.25 (/ h l)))) (fabs d)))))))
(* w0 1.0)))double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((pow(((fabs(M) * fabs(D)) / (2.0 * fabs(d))), 2.0) * (h / l)) <= -2000.0) {
tmp = w0 * (fabs(M) * (-1.0 * (fabs(D) * (-1.0 * (sqrt(-(0.25 * (h / l))) / fabs(d))))));
} 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 (((((abs(m) * abs(d)) / (2.0d0 * abs(d_1))) ** 2.0d0) * (h / l)) <= (-2000.0d0)) then
tmp = w0 * (abs(m) * ((-1.0d0) * (abs(d) * ((-1.0d0) * (sqrt(-(0.25d0 * (h / l))) / abs(d_1))))))
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(((Math.abs(M) * Math.abs(D)) / (2.0 * Math.abs(d))), 2.0) * (h / l)) <= -2000.0) {
tmp = w0 * (Math.abs(M) * (-1.0 * (Math.abs(D) * (-1.0 * (Math.sqrt(-(0.25 * (h / l))) / Math.abs(d))))));
} else {
tmp = w0 * 1.0;
}
return tmp;
}
def code(w0, M, D, h, l, d): tmp = 0 if (math.pow(((math.fabs(M) * math.fabs(D)) / (2.0 * math.fabs(d))), 2.0) * (h / l)) <= -2000.0: tmp = w0 * (math.fabs(M) * (-1.0 * (math.fabs(D) * (-1.0 * (math.sqrt(-(0.25 * (h / l))) / math.fabs(d)))))) else: tmp = w0 * 1.0 return tmp
function code(w0, M, D, h, l, d) tmp = 0.0 if (Float64((Float64(Float64(abs(M) * abs(D)) / Float64(2.0 * abs(d))) ^ 2.0) * Float64(h / l)) <= -2000.0) tmp = Float64(w0 * Float64(abs(M) * Float64(-1.0 * Float64(abs(D) * Float64(-1.0 * Float64(sqrt(Float64(-Float64(0.25 * Float64(h / l)))) / abs(d))))))); else tmp = Float64(w0 * 1.0); end return tmp end
function tmp_2 = code(w0, M, D, h, l, d) tmp = 0.0; if (((((abs(M) * abs(D)) / (2.0 * abs(d))) ^ 2.0) * (h / l)) <= -2000.0) tmp = w0 * (abs(M) * (-1.0 * (abs(D) * (-1.0 * (sqrt(-(0.25 * (h / l))) / abs(d)))))); else tmp = w0 * 1.0; end tmp_2 = tmp; end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(N[Abs[M], $MachinePrecision] * N[Abs[D], $MachinePrecision]), $MachinePrecision] / N[(2.0 * N[Abs[d], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -2000.0], N[(w0 * N[(N[Abs[M], $MachinePrecision] * N[(-1.0 * N[(N[Abs[D], $MachinePrecision] * N[(-1.0 * N[(N[Sqrt[(-N[(0.25 * N[(h / l), $MachinePrecision]), $MachinePrecision])], $MachinePrecision] / N[Abs[d], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(w0 * 1.0), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;{\left(\frac{\left|M\right| \cdot \left|D\right|}{2 \cdot \left|d\right|}\right)}^{2} \cdot \frac{h}{\ell} \leq -2000:\\
\;\;\;\;w0 \cdot \left(\left|M\right| \cdot \left(-1 \cdot \left(\left|D\right| \cdot \left(-1 \cdot \frac{\sqrt{-0.25 \cdot \frac{h}{\ell}}}{\left|d\right|}\right)\right)\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)) < -2e3Initial program 80.7%
Taylor expanded in M around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lower-pow.f648.8%
Applied rewrites8.8%
Taylor expanded in D around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f6411.4%
Applied rewrites11.4%
Taylor expanded in d around -inf
lower-*.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower-/.f6413.3%
Applied rewrites13.3%
if -2e3 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 80.7%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-neg-outN/A
distribute-rgt-neg-inN/A
lift-/.f64N/A
distribute-neg-frac2N/A
associate-/l*N/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites83.8%
Applied rewrites41.7%
Taylor expanded in M around 0
Applied rewrites68.6%
(FPCore (w0 M D h l d)
:precision binary64
(let* ((t_0 (fmax (fabs M) (fabs D))) (t_1 (fmin (fabs M) (fabs D))))
(if (<= (* (pow (/ (* t_1 t_0) (* 2.0 d)) 2.0) (/ h l)) -2e+22)
(* (* (/ (sqrt (* -0.25 (/ (* (* t_0 t_0) h) l))) (fabs d)) t_1) w0)
(* w0 1.0))))double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = fmax(fabs(M), fabs(D));
double t_1 = fmin(fabs(M), fabs(D));
double tmp;
if ((pow(((t_1 * t_0) / (2.0 * d)), 2.0) * (h / l)) <= -2e+22) {
tmp = ((sqrt((-0.25 * (((t_0 * t_0) * h) / l))) / fabs(d)) * t_1) * 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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = fmax(abs(m), abs(d))
t_1 = fmin(abs(m), abs(d))
if (((((t_1 * t_0) / (2.0d0 * d_1)) ** 2.0d0) * (h / l)) <= (-2d+22)) then
tmp = ((sqrt(((-0.25d0) * (((t_0 * t_0) * h) / l))) / abs(d_1)) * t_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 t_0 = fmax(Math.abs(M), Math.abs(D));
double t_1 = fmin(Math.abs(M), Math.abs(D));
double tmp;
if ((Math.pow(((t_1 * t_0) / (2.0 * d)), 2.0) * (h / l)) <= -2e+22) {
tmp = ((Math.sqrt((-0.25 * (((t_0 * t_0) * h) / l))) / Math.abs(d)) * t_1) * w0;
} else {
tmp = w0 * 1.0;
}
return tmp;
}
def code(w0, M, D, h, l, d): t_0 = fmax(math.fabs(M), math.fabs(D)) t_1 = fmin(math.fabs(M), math.fabs(D)) tmp = 0 if (math.pow(((t_1 * t_0) / (2.0 * d)), 2.0) * (h / l)) <= -2e+22: tmp = ((math.sqrt((-0.25 * (((t_0 * t_0) * h) / l))) / math.fabs(d)) * t_1) * w0 else: tmp = w0 * 1.0 return tmp
function code(w0, M, D, h, l, d) t_0 = fmax(abs(M), abs(D)) t_1 = fmin(abs(M), abs(D)) tmp = 0.0 if (Float64((Float64(Float64(t_1 * t_0) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) <= -2e+22) tmp = Float64(Float64(Float64(sqrt(Float64(-0.25 * Float64(Float64(Float64(t_0 * t_0) * h) / l))) / abs(d)) * t_1) * w0); 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), abs(D)); t_1 = min(abs(M), abs(D)); tmp = 0.0; if (((((t_1 * t_0) / (2.0 * d)) ^ 2.0) * (h / l)) <= -2e+22) tmp = ((sqrt((-0.25 * (((t_0 * t_0) * h) / l))) / abs(d)) * t_1) * w0; 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], N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Min[N[Abs[M], $MachinePrecision], N[Abs[D], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[Power[N[(N[(t$95$1 * t$95$0), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -2e+22], N[(N[(N[(N[Sqrt[N[(-0.25 * N[(N[(N[(t$95$0 * t$95$0), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Abs[d], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] * w0), $MachinePrecision], N[(w0 * 1.0), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \mathsf{max}\left(\left|M\right|, \left|D\right|\right)\\
t_1 := \mathsf{min}\left(\left|M\right|, \left|D\right|\right)\\
\mathbf{if}\;{\left(\frac{t\_1 \cdot t\_0}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -2 \cdot 10^{+22}:\\
\;\;\;\;\left(\frac{\sqrt{-0.25 \cdot \frac{\left(t\_0 \cdot t\_0\right) \cdot h}{\ell}}}{\left|d\right|} \cdot t\_1\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)) < -2e22Initial program 80.7%
Taylor expanded in M around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lower-pow.f648.8%
Applied rewrites8.8%
lift-neg.f64N/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
metadata-eval8.8%
lift-pow.f64N/A
pow2N/A
lift-*.f648.8%
lift-pow.f64N/A
pow2N/A
lift-*.f648.8%
Applied rewrites8.8%
lift-*.f64N/A
*-commutativeN/A
lower-*.f648.8%
Applied rewrites10.7%
if -2e22 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 80.7%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-neg-outN/A
distribute-rgt-neg-inN/A
lift-/.f64N/A
distribute-neg-frac2N/A
associate-/l*N/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites83.8%
Applied rewrites41.7%
Taylor expanded in M around 0
Applied rewrites68.6%
(FPCore (w0 M D h l d) :precision binary64 (if (<= (* (pow (/ (* M D) (* 2.0 (fabs d))) 2.0) (/ h l)) -2e+163) (/ (* (fabs d) (* w0 (sqrt (/ 2.0 (fabs d))))) (sqrt (+ (fabs d) (fabs d)))) (* w0 1.0)))
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((pow(((M * D) / (2.0 * fabs(d))), 2.0) * (h / l)) <= -2e+163) {
tmp = (fabs(d) * (w0 * sqrt((2.0 / fabs(d))))) / sqrt((fabs(d) + fabs(d)));
} 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 * abs(d_1))) ** 2.0d0) * (h / l)) <= (-2d+163)) then
tmp = (abs(d_1) * (w0 * sqrt((2.0d0 / abs(d_1))))) / sqrt((abs(d_1) + abs(d_1)))
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 * Math.abs(d))), 2.0) * (h / l)) <= -2e+163) {
tmp = (Math.abs(d) * (w0 * Math.sqrt((2.0 / Math.abs(d))))) / Math.sqrt((Math.abs(d) + Math.abs(d)));
} else {
tmp = w0 * 1.0;
}
return tmp;
}
def code(w0, M, D, h, l, d): tmp = 0 if (math.pow(((M * D) / (2.0 * math.fabs(d))), 2.0) * (h / l)) <= -2e+163: tmp = (math.fabs(d) * (w0 * math.sqrt((2.0 / math.fabs(d))))) / math.sqrt((math.fabs(d) + math.fabs(d))) 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 * abs(d))) ^ 2.0) * Float64(h / l)) <= -2e+163) tmp = Float64(Float64(abs(d) * Float64(w0 * sqrt(Float64(2.0 / abs(d))))) / sqrt(Float64(abs(d) + abs(d)))); 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 * abs(d))) ^ 2.0) * (h / l)) <= -2e+163) tmp = (abs(d) * (w0 * sqrt((2.0 / abs(d))))) / sqrt((abs(d) + abs(d))); 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.0 * N[Abs[d], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -2e+163], N[(N[(N[Abs[d], $MachinePrecision] * N[(w0 * N[Sqrt[N[(2.0 / N[Abs[d], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(N[Abs[d], $MachinePrecision] + N[Abs[d], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * 1.0), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot \left|d\right|}\right)}^{2} \cdot \frac{h}{\ell} \leq -2 \cdot 10^{+163}:\\
\;\;\;\;\frac{\left|d\right| \cdot \left(w0 \cdot \sqrt{\frac{2}{\left|d\right|}}\right)}{\sqrt{\left|d\right| + \left|d\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)) < -1.9999999999999999e163Initial program 80.7%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-neg-outN/A
distribute-rgt-neg-inN/A
lift-/.f64N/A
distribute-neg-frac2N/A
associate-/l*N/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites83.8%
Applied rewrites41.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites38.4%
Taylor expanded in d around inf
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6428.9%
Applied rewrites28.9%
if -1.9999999999999999e163 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 80.7%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-neg-outN/A
distribute-rgt-neg-inN/A
lift-/.f64N/A
distribute-neg-frac2N/A
associate-/l*N/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites83.8%
Applied rewrites41.7%
Taylor expanded in M around 0
Applied rewrites68.6%
(FPCore (w0 M D h l d) :precision binary64 (* w0 1.0))
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.0), $MachinePrecision]
w0 \cdot 1
Initial program 80.7%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-neg-outN/A
distribute-rgt-neg-inN/A
lift-/.f64N/A
distribute-neg-frac2N/A
associate-/l*N/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites83.8%
Applied rewrites41.7%
Taylor expanded in M around 0
Applied rewrites68.6%
herbie shell --seed 2025204
(FPCore (w0 M D h l d)
:name "Henrywood and Agarwal, Equation (9a)"
:precision binary64
(* w0 (sqrt (- 1.0 (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l))))))