
(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 (* (/ (fabs D) d) (fabs M))))
(if (<=
(* (pow (/ (* (fabs M) (fabs D)) (* 2.0 d)) 2.0) (/ h l))
-1e+182)
(/
(* (fabs D) (* (fabs M) (* w0 (sqrt (* -0.25 (/ h l))))))
(fabs d))
(* w0 (sqrt (- 1.0 (* (* t_0 0.25) (/ (* t_0 h) l))))))))double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = (fabs(D) / d) * fabs(M);
double tmp;
if ((pow(((fabs(M) * fabs(D)) / (2.0 * d)), 2.0) * (h / l)) <= -1e+182) {
tmp = (fabs(D) * (fabs(M) * (w0 * sqrt((-0.25 * (h / l)))))) / fabs(d);
} else {
tmp = w0 * sqrt((1.0 - ((t_0 * 0.25) * ((t_0 * h) / l))));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(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) :: tmp
t_0 = (abs(d) / d_1) * abs(m)
if (((((abs(m) * abs(d)) / (2.0d0 * d_1)) ** 2.0d0) * (h / l)) <= (-1d+182)) then
tmp = (abs(d) * (abs(m) * (w0 * sqrt(((-0.25d0) * (h / l)))))) / abs(d_1)
else
tmp = w0 * sqrt((1.0d0 - ((t_0 * 0.25d0) * ((t_0 * h) / l))))
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 = (Math.abs(D) / d) * Math.abs(M);
double tmp;
if ((Math.pow(((Math.abs(M) * Math.abs(D)) / (2.0 * d)), 2.0) * (h / l)) <= -1e+182) {
tmp = (Math.abs(D) * (Math.abs(M) * (w0 * Math.sqrt((-0.25 * (h / l)))))) / Math.abs(d);
} else {
tmp = w0 * Math.sqrt((1.0 - ((t_0 * 0.25) * ((t_0 * h) / l))));
}
return tmp;
}
def code(w0, M, D, h, l, d): t_0 = (math.fabs(D) / d) * math.fabs(M) tmp = 0 if (math.pow(((math.fabs(M) * math.fabs(D)) / (2.0 * d)), 2.0) * (h / l)) <= -1e+182: tmp = (math.fabs(D) * (math.fabs(M) * (w0 * math.sqrt((-0.25 * (h / l)))))) / math.fabs(d) else: tmp = w0 * math.sqrt((1.0 - ((t_0 * 0.25) * ((t_0 * h) / l)))) return tmp
function code(w0, M, D, h, l, d) t_0 = Float64(Float64(abs(D) / d) * abs(M)) tmp = 0.0 if (Float64((Float64(Float64(abs(M) * abs(D)) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) <= -1e+182) tmp = Float64(Float64(abs(D) * Float64(abs(M) * Float64(w0 * sqrt(Float64(-0.25 * Float64(h / l)))))) / abs(d)); else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(t_0 * 0.25) * Float64(Float64(t_0 * h) / l))))); end return tmp end
function tmp_2 = code(w0, M, D, h, l, d) t_0 = (abs(D) / d) * abs(M); tmp = 0.0; if (((((abs(M) * abs(D)) / (2.0 * d)) ^ 2.0) * (h / l)) <= -1e+182) tmp = (abs(D) * (abs(M) * (w0 * sqrt((-0.25 * (h / l)))))) / abs(d); else tmp = w0 * sqrt((1.0 - ((t_0 * 0.25) * ((t_0 * h) / l)))); end tmp_2 = tmp; end
code[w0_, M_, D_, h_, l_, d_] := Block[{t$95$0 = N[(N[(N[Abs[D], $MachinePrecision] / d), $MachinePrecision] * N[Abs[M], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[Power[N[(N[(N[Abs[M], $MachinePrecision] * N[Abs[D], $MachinePrecision]), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -1e+182], N[(N[(N[Abs[D], $MachinePrecision] * N[(N[Abs[M], $MachinePrecision] * N[(w0 * N[Sqrt[N[(-0.25 * N[(h / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Abs[d], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(t$95$0 * 0.25), $MachinePrecision] * N[(N[(t$95$0 * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_0 := \frac{\left|D\right|}{d} \cdot \left|M\right|\\
\mathbf{if}\;{\left(\frac{\left|M\right| \cdot \left|D\right|}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -1 \cdot 10^{+182}:\\
\;\;\;\;\frac{\left|D\right| \cdot \left(\left|M\right| \cdot \left(w0 \cdot \sqrt{-0.25 \cdot \frac{h}{\ell}}\right)\right)}{\left|d\right|}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \left(t\_0 \cdot 0.25\right) \cdot \frac{t\_0 \cdot h}{\ell}}\\
\end{array}
if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -1.0000000000000001e182Initial program 80.7%
Taylor expanded in M 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-*.f64N/A
lower-pow.f649.4%
Applied rewrites9.4%
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-eval9.4%
lift-pow.f64N/A
pow2N/A
lift-*.f649.4%
lift-pow.f64N/A
pow2N/A
lift-*.f649.4%
Applied rewrites9.4%
Applied rewrites11.5%
Taylor expanded in D around 0
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-fabs.f6413.9%
Applied rewrites13.9%
if -1.0000000000000001e182 < (*.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-pow.f64N/A
unpow2N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
frac-timesN/A
metadata-evalN/A
cosh-0-revN/A
lower-/.f64N/A
Applied rewrites80.6%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
associate-*l*N/A
times-fracN/A
lower-*.f64N/A
mult-flipN/A
metadata-evalN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6488.5%
Applied rewrites88.5%
(FPCore (w0 M D h l d)
:precision binary64
(let* ((t_0 (* (pow (/ (* (fabs M) (fabs D)) (* 2.0 d)) 2.0) (/ h l)))
(t_1 (* (fabs M) (/ (fabs D) d))))
(if (<= t_0 -1e+182)
(/
(* (fabs D) (* (fabs M) (* w0 (sqrt (* -0.25 (/ h l))))))
(fabs d))
(if (<= t_0 -20000.0)
(* w0 (sqrt (fma (* (* -0.25 t_1) t_1) (/ h l) 1.0)))
(* w0 (sqrt 1.0))))))double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = pow(((fabs(M) * fabs(D)) / (2.0 * d)), 2.0) * (h / l);
double t_1 = fabs(M) * (fabs(D) / d);
double tmp;
if (t_0 <= -1e+182) {
tmp = (fabs(D) * (fabs(M) * (w0 * sqrt((-0.25 * (h / l)))))) / fabs(d);
} else if (t_0 <= -20000.0) {
tmp = w0 * sqrt(fma(((-0.25 * t_1) * t_1), (h / l), 1.0));
} else {
tmp = w0 * sqrt(1.0);
}
return tmp;
}
function code(w0, M, D, h, l, d) t_0 = Float64((Float64(Float64(abs(M) * abs(D)) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) t_1 = Float64(abs(M) * Float64(abs(D) / d)) tmp = 0.0 if (t_0 <= -1e+182) tmp = Float64(Float64(abs(D) * Float64(abs(M) * Float64(w0 * sqrt(Float64(-0.25 * Float64(h / l)))))) / abs(d)); elseif (t_0 <= -20000.0) tmp = Float64(w0 * sqrt(fma(Float64(Float64(-0.25 * t_1) * t_1), Float64(h / l), 1.0))); else tmp = Float64(w0 * sqrt(1.0)); end return tmp end
code[w0_, M_, D_, h_, l_, d_] := Block[{t$95$0 = N[(N[Power[N[(N[(N[Abs[M], $MachinePrecision] * N[Abs[D], $MachinePrecision]), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Abs[M], $MachinePrecision] * N[(N[Abs[D], $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -1e+182], N[(N[(N[Abs[D], $MachinePrecision] * N[(N[Abs[M], $MachinePrecision] * N[(w0 * N[Sqrt[N[(-0.25 * N[(h / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Abs[d], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, -20000.0], N[(w0 * N[Sqrt[N[(N[(N[(-0.25 * t$95$1), $MachinePrecision] * t$95$1), $MachinePrecision] * N[(h / l), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[1.0], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := {\left(\frac{\left|M\right| \cdot \left|D\right|}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}\\
t_1 := \left|M\right| \cdot \frac{\left|D\right|}{d}\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{+182}:\\
\;\;\;\;\frac{\left|D\right| \cdot \left(\left|M\right| \cdot \left(w0 \cdot \sqrt{-0.25 \cdot \frac{h}{\ell}}\right)\right)}{\left|d\right|}\\
\mathbf{elif}\;t\_0 \leq -20000:\\
\;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(\left(-0.25 \cdot t\_1\right) \cdot t\_1, \frac{h}{\ell}, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{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.0000000000000001e182Initial program 80.7%
Taylor expanded in M 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-*.f64N/A
lower-pow.f649.4%
Applied rewrites9.4%
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-eval9.4%
lift-pow.f64N/A
pow2N/A
lift-*.f649.4%
lift-pow.f64N/A
pow2N/A
lift-*.f649.4%
Applied rewrites9.4%
Applied rewrites11.5%
Taylor expanded in D around 0
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-fabs.f6413.9%
Applied rewrites13.9%
if -1.0000000000000001e182 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -2e4Initial program 80.7%
lift-pow.f64N/A
unpow2N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
frac-timesN/A
metadata-evalN/A
cosh-0-revN/A
lower-/.f64N/A
Applied rewrites80.6%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
associate-*l*N/A
times-fracN/A
lower-*.f64N/A
mult-flipN/A
metadata-evalN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6488.5%
Applied rewrites88.5%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-/.f64N/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites80.6%
if -2e4 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 80.7%
Taylor expanded in M around 0
Applied rewrites68.0%
(FPCore (w0 M D h l d)
:precision binary64
(let* ((t_0 (* (pow (/ (* (fabs M) (fabs D)) (* 2.0 d)) 2.0) (/ h l)))
(t_1 (sqrt (* -0.25 (/ h l)))))
(if (<= t_0 (- INFINITY))
(/ (* (fabs D) (* (fabs M) (* w0 t_1))) (fabs d))
(if (<= t_0 -20000.0)
(* (/ (* (fabs D) (* (fabs M) t_1)) (fabs d)) w0)
(* w0 (sqrt 1.0))))))double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = pow(((fabs(M) * fabs(D)) / (2.0 * d)), 2.0) * (h / l);
double t_1 = sqrt((-0.25 * (h / l)));
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = (fabs(D) * (fabs(M) * (w0 * t_1))) / fabs(d);
} else if (t_0 <= -20000.0) {
tmp = ((fabs(D) * (fabs(M) * t_1)) / fabs(d)) * w0;
} else {
tmp = w0 * sqrt(1.0);
}
return tmp;
}
public static double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = Math.pow(((Math.abs(M) * Math.abs(D)) / (2.0 * d)), 2.0) * (h / l);
double t_1 = Math.sqrt((-0.25 * (h / l)));
double tmp;
if (t_0 <= -Double.POSITIVE_INFINITY) {
tmp = (Math.abs(D) * (Math.abs(M) * (w0 * t_1))) / Math.abs(d);
} else if (t_0 <= -20000.0) {
tmp = ((Math.abs(D) * (Math.abs(M) * t_1)) / Math.abs(d)) * w0;
} else {
tmp = w0 * Math.sqrt(1.0);
}
return tmp;
}
def code(w0, M, D, h, l, d): t_0 = math.pow(((math.fabs(M) * math.fabs(D)) / (2.0 * d)), 2.0) * (h / l) t_1 = math.sqrt((-0.25 * (h / l))) tmp = 0 if t_0 <= -math.inf: tmp = (math.fabs(D) * (math.fabs(M) * (w0 * t_1))) / math.fabs(d) elif t_0 <= -20000.0: tmp = ((math.fabs(D) * (math.fabs(M) * t_1)) / math.fabs(d)) * w0 else: tmp = w0 * math.sqrt(1.0) return tmp
function code(w0, M, D, h, l, d) t_0 = Float64((Float64(Float64(abs(M) * abs(D)) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) t_1 = sqrt(Float64(-0.25 * Float64(h / l))) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = Float64(Float64(abs(D) * Float64(abs(M) * Float64(w0 * t_1))) / abs(d)); elseif (t_0 <= -20000.0) tmp = Float64(Float64(Float64(abs(D) * Float64(abs(M) * t_1)) / abs(d)) * w0); else tmp = Float64(w0 * sqrt(1.0)); end return tmp end
function tmp_2 = code(w0, M, D, h, l, d) t_0 = (((abs(M) * abs(D)) / (2.0 * d)) ^ 2.0) * (h / l); t_1 = sqrt((-0.25 * (h / l))); tmp = 0.0; if (t_0 <= -Inf) tmp = (abs(D) * (abs(M) * (w0 * t_1))) / abs(d); elseif (t_0 <= -20000.0) tmp = ((abs(D) * (abs(M) * t_1)) / abs(d)) * w0; else tmp = w0 * sqrt(1.0); end tmp_2 = tmp; end
code[w0_, M_, D_, h_, l_, d_] := Block[{t$95$0 = N[(N[Power[N[(N[(N[Abs[M], $MachinePrecision] * N[Abs[D], $MachinePrecision]), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(-0.25 * N[(h / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(N[(N[Abs[D], $MachinePrecision] * N[(N[Abs[M], $MachinePrecision] * N[(w0 * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Abs[d], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, -20000.0], N[(N[(N[(N[Abs[D], $MachinePrecision] * N[(N[Abs[M], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision] / N[Abs[d], $MachinePrecision]), $MachinePrecision] * w0), $MachinePrecision], N[(w0 * N[Sqrt[1.0], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := {\left(\frac{\left|M\right| \cdot \left|D\right|}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}\\
t_1 := \sqrt{-0.25 \cdot \frac{h}{\ell}}\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;\frac{\left|D\right| \cdot \left(\left|M\right| \cdot \left(w0 \cdot t\_1\right)\right)}{\left|d\right|}\\
\mathbf{elif}\;t\_0 \leq -20000:\\
\;\;\;\;\frac{\left|D\right| \cdot \left(\left|M\right| \cdot t\_1\right)}{\left|d\right|} \cdot w0\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1}\\
\end{array}
if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -inf.0Initial program 80.7%
Taylor expanded in M 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-*.f64N/A
lower-pow.f649.4%
Applied rewrites9.4%
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-eval9.4%
lift-pow.f64N/A
pow2N/A
lift-*.f649.4%
lift-pow.f64N/A
pow2N/A
lift-*.f649.4%
Applied rewrites9.4%
Applied rewrites11.5%
Taylor expanded in D around 0
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-fabs.f6413.9%
Applied rewrites13.9%
if -inf.0 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -2e4Initial program 80.7%
Taylor expanded in M 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-*.f64N/A
lower-pow.f649.4%
Applied rewrites9.4%
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-eval9.4%
lift-pow.f64N/A
pow2N/A
lift-*.f649.4%
lift-pow.f64N/A
pow2N/A
lift-*.f649.4%
Applied rewrites9.4%
Applied rewrites11.5%
Taylor expanded in D around 0
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-fabs.f6413.6%
Applied rewrites13.6%
if -2e4 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 80.7%
Taylor expanded in M around 0
Applied rewrites68.0%
(FPCore (w0 M D h l d)
:precision binary64
(if (<= (* (pow (/ (* (fabs M) D) (* 2.0 d)) 2.0) (/ h l)) -20000.0)
(*
(*
(* (fabs D) (sqrt (* (/ h l) -0.25)))
(* (/ 1.0 (fabs d)) (fabs M)))
w0)
(* w0 (sqrt 1.0))))double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((pow(((fabs(M) * D) / (2.0 * d)), 2.0) * (h / l)) <= -20000.0) {
tmp = ((fabs(D) * sqrt(((h / l) * -0.25))) * ((1.0 / fabs(d)) * fabs(M))) * w0;
} else {
tmp = w0 * sqrt(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) * d) / (2.0d0 * d_1)) ** 2.0d0) * (h / l)) <= (-20000.0d0)) then
tmp = ((abs(d) * sqrt(((h / l) * (-0.25d0)))) * ((1.0d0 / abs(d_1)) * abs(m))) * w0
else
tmp = w0 * sqrt(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) * D) / (2.0 * d)), 2.0) * (h / l)) <= -20000.0) {
tmp = ((Math.abs(D) * Math.sqrt(((h / l) * -0.25))) * ((1.0 / Math.abs(d)) * Math.abs(M))) * w0;
} else {
tmp = w0 * Math.sqrt(1.0);
}
return tmp;
}
def code(w0, M, D, h, l, d): tmp = 0 if (math.pow(((math.fabs(M) * D) / (2.0 * d)), 2.0) * (h / l)) <= -20000.0: tmp = ((math.fabs(D) * math.sqrt(((h / l) * -0.25))) * ((1.0 / math.fabs(d)) * math.fabs(M))) * w0 else: tmp = w0 * math.sqrt(1.0) return tmp
function code(w0, M, D, h, l, d) tmp = 0.0 if (Float64((Float64(Float64(abs(M) * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) <= -20000.0) tmp = Float64(Float64(Float64(abs(D) * sqrt(Float64(Float64(h / l) * -0.25))) * Float64(Float64(1.0 / abs(d)) * abs(M))) * w0); else tmp = Float64(w0 * sqrt(1.0)); end return tmp end
function tmp_2 = code(w0, M, D, h, l, d) tmp = 0.0; if (((((abs(M) * D) / (2.0 * d)) ^ 2.0) * (h / l)) <= -20000.0) tmp = ((abs(D) * sqrt(((h / l) * -0.25))) * ((1.0 / abs(d)) * abs(M))) * w0; else tmp = w0 * sqrt(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] * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -20000.0], N[(N[(N[(N[Abs[D], $MachinePrecision] * N[Sqrt[N[(N[(h / l), $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 / N[Abs[d], $MachinePrecision]), $MachinePrecision] * N[Abs[M], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * w0), $MachinePrecision], N[(w0 * N[Sqrt[1.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;{\left(\frac{\left|M\right| \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -20000:\\
\;\;\;\;\left(\left(\left|D\right| \cdot \sqrt{\frac{h}{\ell} \cdot -0.25}\right) \cdot \left(\frac{1}{\left|d\right|} \cdot \left|M\right|\right)\right) \cdot w0\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1}\\
\end{array}
if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -2e4Initial program 80.7%
Taylor expanded in M 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-*.f64N/A
lower-pow.f649.4%
Applied rewrites9.4%
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-eval9.4%
lift-pow.f64N/A
pow2N/A
lift-*.f649.4%
lift-pow.f64N/A
pow2N/A
lift-*.f649.4%
Applied rewrites9.4%
Applied rewrites11.5%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
mult-flipN/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites13.6%
if -2e4 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 80.7%
Taylor expanded in M around 0
Applied rewrites68.0%
(FPCore (w0 M D h l d)
:precision binary64
(if (<=
(* (pow (/ (* (fabs M) (fabs D)) (* 2.0 d)) 2.0) (/ h l))
-100000000.0)
(/
(* (fabs D) (* (fabs M) (* w0 (sqrt (* -0.25 (/ h l))))))
(fabs d))
(* w0 (sqrt 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 * d)), 2.0) * (h / l)) <= -100000000.0) {
tmp = (fabs(D) * (fabs(M) * (w0 * sqrt((-0.25 * (h / l)))))) / fabs(d);
} else {
tmp = w0 * sqrt(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 * d_1)) ** 2.0d0) * (h / l)) <= (-100000000.0d0)) then
tmp = (abs(d) * (abs(m) * (w0 * sqrt(((-0.25d0) * (h / l)))))) / abs(d_1)
else
tmp = w0 * sqrt(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 * d)), 2.0) * (h / l)) <= -100000000.0) {
tmp = (Math.abs(D) * (Math.abs(M) * (w0 * Math.sqrt((-0.25 * (h / l)))))) / Math.abs(d);
} else {
tmp = w0 * Math.sqrt(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 * d)), 2.0) * (h / l)) <= -100000000.0: tmp = (math.fabs(D) * (math.fabs(M) * (w0 * math.sqrt((-0.25 * (h / l)))))) / math.fabs(d) else: tmp = w0 * math.sqrt(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 * d)) ^ 2.0) * Float64(h / l)) <= -100000000.0) tmp = Float64(Float64(abs(D) * Float64(abs(M) * Float64(w0 * sqrt(Float64(-0.25 * Float64(h / l)))))) / abs(d)); else tmp = Float64(w0 * sqrt(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 * d)) ^ 2.0) * (h / l)) <= -100000000.0) tmp = (abs(D) * (abs(M) * (w0 * sqrt((-0.25 * (h / l)))))) / abs(d); else tmp = w0 * sqrt(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 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -100000000.0], N[(N[(N[Abs[D], $MachinePrecision] * N[(N[Abs[M], $MachinePrecision] * N[(w0 * N[Sqrt[N[(-0.25 * N[(h / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Abs[d], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[1.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;{\left(\frac{\left|M\right| \cdot \left|D\right|}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -100000000:\\
\;\;\;\;\frac{\left|D\right| \cdot \left(\left|M\right| \cdot \left(w0 \cdot \sqrt{-0.25 \cdot \frac{h}{\ell}}\right)\right)}{\left|d\right|}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1}\\
\end{array}
if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -1e8Initial program 80.7%
Taylor expanded in M 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-*.f64N/A
lower-pow.f649.4%
Applied rewrites9.4%
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-eval9.4%
lift-pow.f64N/A
pow2N/A
lift-*.f649.4%
lift-pow.f64N/A
pow2N/A
lift-*.f649.4%
Applied rewrites9.4%
Applied rewrites11.5%
Taylor expanded in D around 0
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-fabs.f6413.9%
Applied rewrites13.9%
if -1e8 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 80.7%
Taylor expanded in M around 0
Applied rewrites68.0%
(FPCore (w0 M D h l d) :precision binary64 (* w0 (sqrt 1.0)))
double code(double w0, double M, double D, double h, double l, double d) {
return w0 * sqrt(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 * sqrt(1.0d0)
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
return w0 * Math.sqrt(1.0);
}
def code(w0, M, D, h, l, d): return w0 * math.sqrt(1.0)
function code(w0, M, D, h, l, d) return Float64(w0 * sqrt(1.0)) end
function tmp = code(w0, M, D, h, l, d) tmp = w0 * sqrt(1.0); end
code[w0_, M_, D_, h_, l_, d_] := N[(w0 * N[Sqrt[1.0], $MachinePrecision]), $MachinePrecision]
w0 \cdot \sqrt{1}
Initial program 80.7%
Taylor expanded in M around 0
Applied rewrites68.0%
herbie shell --seed 2025210
(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))))))