
(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 14 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 (fmax (fabs M) (fabs D)))
(t_2 (/ (* t_1 t_0) d)))
(*
(copysign 1.0 w0)
(if (<=
(*
(fabs w0)
(sqrt
(- 1.0 (* (pow (/ (* t_0 t_1) (* 2.0 d)) 2.0) (/ h l)))))
1e+164)
(* (fabs w0) (sqrt (fma (/ h l) (* (* t_2 t_2) -0.25) 1.0)))
(*
(fabs w0)
(sqrt
(fma
(* (/ t_0 (+ d d)) t_1)
(/ (* (/ t_1 (+ d d)) (* t_0 h)) (- l))
1.0)))))))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 = fmax(fabs(M), fabs(D));
double t_2 = (t_1 * t_0) / d;
double tmp;
if ((fabs(w0) * sqrt((1.0 - (pow(((t_0 * t_1) / (2.0 * d)), 2.0) * (h / l))))) <= 1e+164) {
tmp = fabs(w0) * sqrt(fma((h / l), ((t_2 * t_2) * -0.25), 1.0));
} else {
tmp = fabs(w0) * sqrt(fma(((t_0 / (d + d)) * t_1), (((t_1 / (d + d)) * (t_0 * h)) / -l), 1.0));
}
return copysign(1.0, w0) * tmp;
}
function code(w0, M, D, h, l, d) t_0 = fmin(abs(M), abs(D)) t_1 = fmax(abs(M), abs(D)) t_2 = Float64(Float64(t_1 * t_0) / d) tmp = 0.0 if (Float64(abs(w0) * sqrt(Float64(1.0 - Float64((Float64(Float64(t_0 * t_1) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l))))) <= 1e+164) tmp = Float64(abs(w0) * sqrt(fma(Float64(h / l), Float64(Float64(t_2 * t_2) * -0.25), 1.0))); else tmp = Float64(abs(w0) * sqrt(fma(Float64(Float64(t_0 / Float64(d + d)) * t_1), Float64(Float64(Float64(t_1 / Float64(d + d)) * Float64(t_0 * h)) / Float64(-l)), 1.0))); end return Float64(copysign(1.0, w0) * 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[Max[N[Abs[M], $MachinePrecision], N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(t$95$1 * t$95$0), $MachinePrecision] / d), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[w0]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[(N[Abs[w0], $MachinePrecision] * N[Sqrt[N[(1.0 - N[(N[Power[N[(N[(t$95$0 * t$95$1), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 1e+164], N[(N[Abs[w0], $MachinePrecision] * N[Sqrt[N[(N[(h / l), $MachinePrecision] * N[(N[(t$95$2 * t$95$2), $MachinePrecision] * -0.25), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Abs[w0], $MachinePrecision] * N[Sqrt[N[(N[(N[(t$95$0 / N[(d + d), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] * N[(N[(N[(t$95$1 / N[(d + d), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * h), $MachinePrecision]), $MachinePrecision] / (-l)), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \mathsf{min}\left(\left|M\right|, \left|D\right|\right)\\
t_1 := \mathsf{max}\left(\left|M\right|, \left|D\right|\right)\\
t_2 := \frac{t\_1 \cdot t\_0}{d}\\
\mathsf{copysign}\left(1, w0\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|w0\right| \cdot \sqrt{1 - {\left(\frac{t\_0 \cdot t\_1}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \leq 10^{+164}:\\
\;\;\;\;\left|w0\right| \cdot \sqrt{\mathsf{fma}\left(\frac{h}{\ell}, \left(t\_2 \cdot t\_2\right) \cdot -0.25, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\left|w0\right| \cdot \sqrt{\mathsf{fma}\left(\frac{t\_0}{d + d} \cdot t\_1, \frac{\frac{t\_1}{d + d} \cdot \left(t\_0 \cdot h\right)}{-\ell}, 1\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))))) < 1e164Initial program 80.4%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
associate-*r/N/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
lift-*.f64N/A
lift-*.f64N/A
swap-sqrN/A
Applied rewrites64.9%
Applied rewrites65.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6480.4%
Applied rewrites80.4%
if 1e164 < (*.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.4%
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 rewrites84.2%
(FPCore (w0 M D h l d)
:precision binary64
(let* ((t_0 (fmin M (fabs D)))
(t_1 (fmax M (fabs D)))
(t_2 (/ (* t_1 t_0) d)))
(*
(copysign 1.0 w0)
(if (<=
(*
(fabs w0)
(sqrt
(- 1.0 (* (pow (/ (* t_0 t_1) (* 2.0 d)) 2.0) (/ h l)))))
2e+226)
(* (fabs w0) (sqrt (fma (/ h l) (* (* t_2 t_2) -0.25) 1.0)))
(*
(fabs w0)
(sqrt
(fma
(* (/ t_0 (+ d d)) t_1)
(* (* h t_0) (/ (/ t_1 (* -2.0 d)) l))
1.0)))))))double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = fmin(M, fabs(D));
double t_1 = fmax(M, fabs(D));
double t_2 = (t_1 * t_0) / d;
double tmp;
if ((fabs(w0) * sqrt((1.0 - (pow(((t_0 * t_1) / (2.0 * d)), 2.0) * (h / l))))) <= 2e+226) {
tmp = fabs(w0) * sqrt(fma((h / l), ((t_2 * t_2) * -0.25), 1.0));
} else {
tmp = fabs(w0) * sqrt(fma(((t_0 / (d + d)) * t_1), ((h * t_0) * ((t_1 / (-2.0 * d)) / l)), 1.0));
}
return copysign(1.0, w0) * tmp;
}
function code(w0, M, D, h, l, d) t_0 = fmin(M, abs(D)) t_1 = fmax(M, abs(D)) t_2 = Float64(Float64(t_1 * t_0) / d) tmp = 0.0 if (Float64(abs(w0) * sqrt(Float64(1.0 - Float64((Float64(Float64(t_0 * t_1) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l))))) <= 2e+226) tmp = Float64(abs(w0) * sqrt(fma(Float64(h / l), Float64(Float64(t_2 * t_2) * -0.25), 1.0))); else tmp = Float64(abs(w0) * sqrt(fma(Float64(Float64(t_0 / Float64(d + d)) * t_1), Float64(Float64(h * t_0) * Float64(Float64(t_1 / Float64(-2.0 * d)) / l)), 1.0))); end return Float64(copysign(1.0, w0) * tmp) end
code[w0_, M_, D_, h_, l_, d_] := Block[{t$95$0 = N[Min[M, N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Max[M, N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(t$95$1 * t$95$0), $MachinePrecision] / d), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[w0]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[(N[Abs[w0], $MachinePrecision] * N[Sqrt[N[(1.0 - N[(N[Power[N[(N[(t$95$0 * t$95$1), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2e+226], N[(N[Abs[w0], $MachinePrecision] * N[Sqrt[N[(N[(h / l), $MachinePrecision] * N[(N[(t$95$2 * t$95$2), $MachinePrecision] * -0.25), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Abs[w0], $MachinePrecision] * N[Sqrt[N[(N[(N[(t$95$0 / N[(d + d), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] * N[(N[(h * t$95$0), $MachinePrecision] * N[(N[(t$95$1 / N[(-2.0 * d), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \mathsf{min}\left(M, \left|D\right|\right)\\
t_1 := \mathsf{max}\left(M, \left|D\right|\right)\\
t_2 := \frac{t\_1 \cdot t\_0}{d}\\
\mathsf{copysign}\left(1, w0\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|w0\right| \cdot \sqrt{1 - {\left(\frac{t\_0 \cdot t\_1}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \leq 2 \cdot 10^{+226}:\\
\;\;\;\;\left|w0\right| \cdot \sqrt{\mathsf{fma}\left(\frac{h}{\ell}, \left(t\_2 \cdot t\_2\right) \cdot -0.25, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\left|w0\right| \cdot \sqrt{\mathsf{fma}\left(\frac{t\_0}{d + d} \cdot t\_1, \left(h \cdot t\_0\right) \cdot \frac{\frac{t\_1}{-2 \cdot d}}{\ell}, 1\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))))) < 1.9999999999999999e226Initial program 80.4%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
associate-*r/N/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
lift-*.f64N/A
lift-*.f64N/A
swap-sqrN/A
Applied rewrites64.9%
Applied rewrites65.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6480.4%
Applied rewrites80.4%
if 1.9999999999999999e226 < (*.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.4%
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 rewrites84.2%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f64N/A
frac-2negN/A
distribute-frac-neg2N/A
lift-neg.f64N/A
frac-2neg-revN/A
lower-/.f64N/A
Applied rewrites82.8%
(FPCore (w0 M D h l d)
:precision binary64
(let* ((t_0 (fmin M (fabs D)))
(t_1 (fmax M (fabs D)))
(t_2 (* (pow (/ (* t_0 t_1) (* 2.0 d)) 2.0) (/ h l)))
(t_3 (* t_1 t_0))
(t_4 (/ t_3 d))
(t_5 (* t_3 t_1)))
(if (<= t_2 (- INFINITY))
(/
(* (sqrt (fma (* (* t_5 t_0) -0.25) (/ h l) (* d d))) w0)
(fabs d))
(if (<= t_2 5e-32)
(* w0 (sqrt (fma (/ h l) (* (* t_4 t_4) -0.25) 1.0)))
(*
w0
(sqrt (fma h (/ (* (* -0.25 t_5) (/ t_0 (* d d))) l) 1.0)))))))double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = fmin(M, fabs(D));
double t_1 = fmax(M, fabs(D));
double t_2 = pow(((t_0 * t_1) / (2.0 * d)), 2.0) * (h / l);
double t_3 = t_1 * t_0;
double t_4 = t_3 / d;
double t_5 = t_3 * t_1;
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = (sqrt(fma(((t_5 * t_0) * -0.25), (h / l), (d * d))) * w0) / fabs(d);
} else if (t_2 <= 5e-32) {
tmp = w0 * sqrt(fma((h / l), ((t_4 * t_4) * -0.25), 1.0));
} else {
tmp = w0 * sqrt(fma(h, (((-0.25 * t_5) * (t_0 / (d * d))) / l), 1.0));
}
return tmp;
}
function code(w0, M, D, h, l, d) t_0 = fmin(M, abs(D)) t_1 = fmax(M, abs(D)) t_2 = Float64((Float64(Float64(t_0 * t_1) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) t_3 = Float64(t_1 * t_0) t_4 = Float64(t_3 / d) t_5 = Float64(t_3 * t_1) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = Float64(Float64(sqrt(fma(Float64(Float64(t_5 * t_0) * -0.25), Float64(h / l), Float64(d * d))) * w0) / abs(d)); elseif (t_2 <= 5e-32) tmp = Float64(w0 * sqrt(fma(Float64(h / l), Float64(Float64(t_4 * t_4) * -0.25), 1.0))); else tmp = Float64(w0 * sqrt(fma(h, Float64(Float64(Float64(-0.25 * t_5) * Float64(t_0 / Float64(d * d))) / l), 1.0))); end return tmp end
code[w0_, M_, D_, h_, l_, d_] := Block[{t$95$0 = N[Min[M, N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Max[M, N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Power[N[(N[(t$95$0 * t$95$1), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$1 * t$95$0), $MachinePrecision]}, Block[{t$95$4 = N[(t$95$3 / d), $MachinePrecision]}, Block[{t$95$5 = N[(t$95$3 * t$95$1), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], N[(N[(N[Sqrt[N[(N[(N[(t$95$5 * t$95$0), $MachinePrecision] * -0.25), $MachinePrecision] * N[(h / l), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * w0), $MachinePrecision] / N[Abs[d], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 5e-32], N[(w0 * N[Sqrt[N[(N[(h / l), $MachinePrecision] * N[(N[(t$95$4 * t$95$4), $MachinePrecision] * -0.25), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(h * N[(N[(N[(-0.25 * t$95$5), $MachinePrecision] * N[(t$95$0 / N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
t_0 := \mathsf{min}\left(M, \left|D\right|\right)\\
t_1 := \mathsf{max}\left(M, \left|D\right|\right)\\
t_2 := {\left(\frac{t\_0 \cdot t\_1}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}\\
t_3 := t\_1 \cdot t\_0\\
t_4 := \frac{t\_3}{d}\\
t_5 := t\_3 \cdot t\_1\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;\frac{\sqrt{\mathsf{fma}\left(\left(t\_5 \cdot t\_0\right) \cdot -0.25, \frac{h}{\ell}, d \cdot d\right)} \cdot w0}{\left|d\right|}\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{-32}:\\
\;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(\frac{h}{\ell}, \left(t\_4 \cdot t\_4\right) \cdot -0.25, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(h, \frac{\left(-0.25 \cdot t\_5\right) \cdot \frac{t\_0}{d \cdot d}}{\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)) < -inf.0Initial program 80.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6480.4%
Applied rewrites56.3%
Applied rewrites47.2%
if -inf.0 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < 5.0000000000000004e-32Initial program 80.4%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
associate-*r/N/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
lift-*.f64N/A
lift-*.f64N/A
swap-sqrN/A
Applied rewrites64.9%
Applied rewrites65.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6480.4%
Applied rewrites80.4%
if 5.0000000000000004e-32 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 80.4%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
associate-*r/N/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
lift-*.f64N/A
lift-*.f64N/A
swap-sqrN/A
Applied rewrites64.9%
Applied rewrites65.9%
lift-fma.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6471.0%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6471.0%
Applied rewrites71.0%
(FPCore (w0 M D h l d)
:precision binary64
(let* ((t_0 (fmin (fabs M) (fabs D)))
(t_1 (fmax (fabs M) (fabs D)))
(t_2 (* t_1 t_0))
(t_3 (* t_2 t_1))
(t_4 (/ t_2 d))
(t_5
(*
(fabs w0)
(sqrt
(- 1.0 (* (pow (/ (* t_0 t_1) (* 2.0 d)) 2.0) (/ h l)))))))
(*
(copysign 1.0 w0)
(if (<= t_5 2e+306)
(* (fabs w0) (sqrt (fma (/ h l) (* (* t_4 t_4) -0.25) 1.0)))
(if (<= t_5 INFINITY)
(*
(/
(sqrt (fma (* (* t_3 t_0) -0.25) (/ h l) (* d d)))
(fabs d))
(fabs w0))
(*
(fabs w0)
(sqrt
(fma h (/ (* (* -0.25 t_3) (/ t_0 (* d d))) l) 1.0))))))))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 = fmax(fabs(M), fabs(D));
double t_2 = t_1 * t_0;
double t_3 = t_2 * t_1;
double t_4 = t_2 / d;
double t_5 = fabs(w0) * sqrt((1.0 - (pow(((t_0 * t_1) / (2.0 * d)), 2.0) * (h / l))));
double tmp;
if (t_5 <= 2e+306) {
tmp = fabs(w0) * sqrt(fma((h / l), ((t_4 * t_4) * -0.25), 1.0));
} else if (t_5 <= ((double) INFINITY)) {
tmp = (sqrt(fma(((t_3 * t_0) * -0.25), (h / l), (d * d))) / fabs(d)) * fabs(w0);
} else {
tmp = fabs(w0) * sqrt(fma(h, (((-0.25 * t_3) * (t_0 / (d * d))) / l), 1.0));
}
return copysign(1.0, w0) * tmp;
}
function code(w0, M, D, h, l, d) t_0 = fmin(abs(M), abs(D)) t_1 = fmax(abs(M), abs(D)) t_2 = Float64(t_1 * t_0) t_3 = Float64(t_2 * t_1) t_4 = Float64(t_2 / d) t_5 = Float64(abs(w0) * sqrt(Float64(1.0 - Float64((Float64(Float64(t_0 * t_1) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l))))) tmp = 0.0 if (t_5 <= 2e+306) tmp = Float64(abs(w0) * sqrt(fma(Float64(h / l), Float64(Float64(t_4 * t_4) * -0.25), 1.0))); elseif (t_5 <= Inf) tmp = Float64(Float64(sqrt(fma(Float64(Float64(t_3 * t_0) * -0.25), Float64(h / l), Float64(d * d))) / abs(d)) * abs(w0)); else tmp = Float64(abs(w0) * sqrt(fma(h, Float64(Float64(Float64(-0.25 * t_3) * Float64(t_0 / Float64(d * d))) / l), 1.0))); end return Float64(copysign(1.0, w0) * 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[Max[N[Abs[M], $MachinePrecision], N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * t$95$0), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 * t$95$1), $MachinePrecision]}, Block[{t$95$4 = N[(t$95$2 / d), $MachinePrecision]}, Block[{t$95$5 = N[(N[Abs[w0], $MachinePrecision] * N[Sqrt[N[(1.0 - N[(N[Power[N[(N[(t$95$0 * t$95$1), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[w0]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[t$95$5, 2e+306], N[(N[Abs[w0], $MachinePrecision] * N[Sqrt[N[(N[(h / l), $MachinePrecision] * N[(N[(t$95$4 * t$95$4), $MachinePrecision] * -0.25), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$5, Infinity], N[(N[(N[Sqrt[N[(N[(N[(t$95$3 * t$95$0), $MachinePrecision] * -0.25), $MachinePrecision] * N[(h / l), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Abs[d], $MachinePrecision]), $MachinePrecision] * N[Abs[w0], $MachinePrecision]), $MachinePrecision], N[(N[Abs[w0], $MachinePrecision] * N[Sqrt[N[(h * N[(N[(N[(-0.25 * t$95$3), $MachinePrecision] * N[(t$95$0 / N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]]]]]]]
\begin{array}{l}
t_0 := \mathsf{min}\left(\left|M\right|, \left|D\right|\right)\\
t_1 := \mathsf{max}\left(\left|M\right|, \left|D\right|\right)\\
t_2 := t\_1 \cdot t\_0\\
t_3 := t\_2 \cdot t\_1\\
t_4 := \frac{t\_2}{d}\\
t_5 := \left|w0\right| \cdot \sqrt{1 - {\left(\frac{t\_0 \cdot t\_1}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}\\
\mathsf{copysign}\left(1, w0\right) \cdot \begin{array}{l}
\mathbf{if}\;t\_5 \leq 2 \cdot 10^{+306}:\\
\;\;\;\;\left|w0\right| \cdot \sqrt{\mathsf{fma}\left(\frac{h}{\ell}, \left(t\_4 \cdot t\_4\right) \cdot -0.25, 1\right)}\\
\mathbf{elif}\;t\_5 \leq \infty:\\
\;\;\;\;\frac{\sqrt{\mathsf{fma}\left(\left(t\_3 \cdot t\_0\right) \cdot -0.25, \frac{h}{\ell}, d \cdot d\right)}}{\left|d\right|} \cdot \left|w0\right|\\
\mathbf{else}:\\
\;\;\;\;\left|w0\right| \cdot \sqrt{\mathsf{fma}\left(h, \frac{\left(-0.25 \cdot t\_3\right) \cdot \frac{t\_0}{d \cdot d}}{\ell}, 1\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))))) < 2e306Initial program 80.4%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
associate-*r/N/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
lift-*.f64N/A
lift-*.f64N/A
swap-sqrN/A
Applied rewrites64.9%
Applied rewrites65.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6480.4%
Applied rewrites80.4%
if 2e306 < (*.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))))) < +inf.0Initial program 80.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6480.4%
Applied rewrites56.3%
Applied rewrites50.5%
if +inf.0 < (*.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.4%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
associate-*r/N/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
lift-*.f64N/A
lift-*.f64N/A
swap-sqrN/A
Applied rewrites64.9%
Applied rewrites65.9%
lift-fma.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6471.0%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6471.0%
Applied rewrites71.0%
(FPCore (w0 M D h l d)
:precision binary64
(let* ((t_0 (fmax (fabs M) (fabs D)))
(t_1 (fmin (fabs M) (fabs D)))
(t_2 (* t_0 t_1))
(t_3 (* (/ t_0 d) t_1)))
(if (<= t_1 5e-80)
(*
w0
(sqrt (fma (/ (* h t_2) (* l (+ d d))) (* (/ -0.5 d) t_2) 1.0)))
(* w0 (sqrt (- 1.0 (* (* (/ h l) t_3) (* t_3 0.25))))))))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 t_2 = t_0 * t_1;
double t_3 = (t_0 / d) * t_1;
double tmp;
if (t_1 <= 5e-80) {
tmp = w0 * sqrt(fma(((h * t_2) / (l * (d + d))), ((-0.5 / d) * t_2), 1.0));
} else {
tmp = w0 * sqrt((1.0 - (((h / l) * t_3) * (t_3 * 0.25))));
}
return tmp;
}
function code(w0, M, D, h, l, d) t_0 = fmax(abs(M), abs(D)) t_1 = fmin(abs(M), abs(D)) t_2 = Float64(t_0 * t_1) t_3 = Float64(Float64(t_0 / d) * t_1) tmp = 0.0 if (t_1 <= 5e-80) tmp = Float64(w0 * sqrt(fma(Float64(Float64(h * t_2) / Float64(l * Float64(d + d))), Float64(Float64(-0.5 / d) * t_2), 1.0))); else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(Float64(h / l) * t_3) * Float64(t_3 * 0.25))))); 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[Min[N[Abs[M], $MachinePrecision], N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(t$95$0 * t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(N[(t$95$0 / d), $MachinePrecision] * t$95$1), $MachinePrecision]}, If[LessEqual[t$95$1, 5e-80], N[(w0 * N[Sqrt[N[(N[(N[(h * t$95$2), $MachinePrecision] / N[(l * N[(d + d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(-0.5 / d), $MachinePrecision] * t$95$2), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(N[(h / l), $MachinePrecision] * t$95$3), $MachinePrecision] * N[(t$95$3 * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $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)\\
t_2 := t\_0 \cdot t\_1\\
t_3 := \frac{t\_0}{d} \cdot t\_1\\
\mathbf{if}\;t\_1 \leq 5 \cdot 10^{-80}:\\
\;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(\frac{h \cdot t\_2}{\ell \cdot \left(d + d\right)}, \frac{-0.5}{d} \cdot t\_2, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \left(\frac{h}{\ell} \cdot t\_3\right) \cdot \left(t\_3 \cdot 0.25\right)}\\
\end{array}
if M < 5e-80Initial program 80.4%
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.3%
if 5e-80 < M Initial program 80.4%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
associate-*r/N/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
lift-*.f64N/A
lift-*.f64N/A
swap-sqrN/A
Applied rewrites64.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
times-fracN/A
lift-*.f64N/A
lift-*.f64N/A
frac-timesN/A
lift-*.f64N/A
associate-*l/N/A
lift-/.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-/l*N/A
associate-*r*N/A
lift-*.f64N/A
associate-/l*N/A
Applied rewrites82.7%
(FPCore (w0 M D h l d)
:precision binary64
(let* ((t_0 (fmax (fabs M) (fabs D))) (t_1 (fmin (fabs M) (fabs D))))
(*
w0
(sqrt
(fma
(* (/ t_1 (+ d d)) t_0)
(/ (* (/ (* (* h t_1) t_0) d) -0.5) 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 = fmin(fabs(M), fabs(D));
return w0 * sqrt(fma(((t_1 / (d + d)) * t_0), (((((h * t_1) * t_0) / d) * -0.5) / l), 1.0));
}
function code(w0, M, D, h, l, d) t_0 = fmax(abs(M), abs(D)) t_1 = fmin(abs(M), abs(D)) return Float64(w0 * sqrt(fma(Float64(Float64(t_1 / Float64(d + d)) * t_0), Float64(Float64(Float64(Float64(Float64(h * t_1) * t_0) / d) * -0.5) / l), 1.0))) 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]}, N[(w0 * N[Sqrt[N[(N[(N[(t$95$1 / N[(d + d), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] * N[(N[(N[(N[(N[(h * t$95$1), $MachinePrecision] * t$95$0), $MachinePrecision] / d), $MachinePrecision] * -0.5), $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 := \mathsf{min}\left(\left|M\right|, \left|D\right|\right)\\
w0 \cdot \sqrt{\mathsf{fma}\left(\frac{t\_1}{d + d} \cdot t\_0, \frac{\frac{\left(h \cdot t\_1\right) \cdot t\_0}{d} \cdot -0.5}{\ell}, 1\right)}
\end{array}
Initial program 80.4%
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 rewrites84.2%
Taylor expanded in M around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6481.2%
Applied rewrites81.2%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f6484.1%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6484.1%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6484.1%
Applied rewrites84.1%
(FPCore (w0 M D h l d)
:precision binary64
(let* ((t_0 (/ (* D M) d)))
(if (<=
(*
w0
(sqrt (- 1.0 (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l)))))
INFINITY)
(* w0 (sqrt (fma (/ h l) (* (* t_0 t_0) -0.25) 1.0)))
(*
w0
(sqrt
(fma h (/ (* (* -0.25 (* (* D M) D)) (/ M (* d d))) l) 1.0))))))double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = (D * M) / d;
double tmp;
if ((w0 * sqrt((1.0 - (pow(((M * D) / (2.0 * d)), 2.0) * (h / l))))) <= ((double) INFINITY)) {
tmp = w0 * sqrt(fma((h / l), ((t_0 * t_0) * -0.25), 1.0));
} else {
tmp = w0 * sqrt(fma(h, (((-0.25 * ((D * M) * D)) * (M / (d * d))) / l), 1.0));
}
return tmp;
}
function code(w0, M, D, h, l, d) t_0 = Float64(Float64(D * M) / d) tmp = 0.0 if (Float64(w0 * sqrt(Float64(1.0 - Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l))))) <= Inf) tmp = Float64(w0 * sqrt(fma(Float64(h / l), Float64(Float64(t_0 * t_0) * -0.25), 1.0))); else tmp = Float64(w0 * sqrt(fma(h, Float64(Float64(Float64(-0.25 * Float64(Float64(D * M) * D)) * Float64(M / Float64(d * d))) / l), 1.0))); end return tmp end
code[w0_, M_, D_, h_, l_, d_] := Block[{t$95$0 = N[(N[(D * M), $MachinePrecision] / d), $MachinePrecision]}, If[LessEqual[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], Infinity], N[(w0 * N[Sqrt[N[(N[(h / l), $MachinePrecision] * N[(N[(t$95$0 * t$95$0), $MachinePrecision] * -0.25), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(h * N[(N[(N[(-0.25 * N[(N[(D * M), $MachinePrecision] * D), $MachinePrecision]), $MachinePrecision] * N[(M / N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_0 := \frac{D \cdot M}{d}\\
\mathbf{if}\;w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \leq \infty:\\
\;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(\frac{h}{\ell}, \left(t\_0 \cdot t\_0\right) \cdot -0.25, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(h, \frac{\left(-0.25 \cdot \left(\left(D \cdot M\right) \cdot D\right)\right) \cdot \frac{M}{d \cdot d}}{\ell}, 1\right)}\\
\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))))) < +inf.0Initial program 80.4%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
associate-*r/N/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
lift-*.f64N/A
lift-*.f64N/A
swap-sqrN/A
Applied rewrites64.9%
Applied rewrites65.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6480.4%
Applied rewrites80.4%
if +inf.0 < (*.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.4%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
associate-*r/N/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
lift-*.f64N/A
lift-*.f64N/A
swap-sqrN/A
Applied rewrites64.9%
Applied rewrites65.9%
lift-fma.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6471.0%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6471.0%
Applied rewrites71.0%
(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+54)
(*
w0
(sqrt
(-
1.0
(/ (* (* (* (* (* t_0 t_1) t_0) t_1) (/ 0.25 d)) h) (* d l)))))
(* w0 (sqrt 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+54) {
tmp = w0 * sqrt((1.0 - ((((((t_0 * t_1) * t_0) * t_1) * (0.25 / d)) * h) / (d * l))));
} 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) :: 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+54)) then
tmp = w0 * sqrt((1.0d0 - ((((((t_0 * t_1) * t_0) * t_1) * (0.25d0 / d_1)) * h) / (d_1 * l))))
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 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+54) {
tmp = w0 * Math.sqrt((1.0 - ((((((t_0 * t_1) * t_0) * t_1) * (0.25 / d)) * h) / (d * l))));
} else {
tmp = w0 * Math.sqrt(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+54: tmp = w0 * math.sqrt((1.0 - ((((((t_0 * t_1) * t_0) * t_1) * (0.25 / d)) * h) / (d * l)))) else: tmp = w0 * math.sqrt(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+54) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(Float64(Float64(Float64(Float64(t_0 * t_1) * t_0) * t_1) * Float64(0.25 / d)) * h) / Float64(d * l))))); else tmp = Float64(w0 * sqrt(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+54) tmp = w0 * sqrt((1.0 - ((((((t_0 * t_1) * t_0) * t_1) * (0.25 / d)) * h) / (d * l)))); else tmp = w0 * sqrt(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+54], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(N[(N[(N[(N[(t$95$0 * t$95$1), $MachinePrecision] * t$95$0), $MachinePrecision] * t$95$1), $MachinePrecision] * N[(0.25 / d), $MachinePrecision]), $MachinePrecision] * h), $MachinePrecision] / N[(d * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[1.0], $MachinePrecision]), $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^{+54}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{\left(\left(\left(\left(t\_0 \cdot t\_1\right) \cdot t\_0\right) \cdot t\_1\right) \cdot \frac{0.25}{d}\right) \cdot h}{d \cdot \ell}}\\
\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)) < -2.0000000000000002e54Initial program 80.4%
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
associate-*r/N/A
lift-/.f64N/A
frac-timesN/A
lower-/.f64N/A
Applied rewrites64.4%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
lift-*.f64N/A
unswap-sqrN/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6477.2%
Applied rewrites77.2%
if -2.0000000000000002e54 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 80.4%
Taylor expanded in M around 0
Applied rewrites67.5%
(FPCore (w0 M D h l d)
:precision binary64
(if (<= (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l)) -0.04)
(*
w0
(sqrt
(- 1.0 (* (* (/ h l) (* D M)) (* (/ 0.25 (* d d)) (* D M))))))
(* w0 (sqrt 1.0))))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)) <= -0.04) {
tmp = w0 * sqrt((1.0 - (((h / l) * (D * M)) * ((0.25 / (d * d)) * (D * M)))));
} 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 (((((m * d) / (2.0d0 * d_1)) ** 2.0d0) * (h / l)) <= (-0.04d0)) then
tmp = w0 * sqrt((1.0d0 - (((h / l) * (d * m)) * ((0.25d0 / (d_1 * d_1)) * (d * m)))))
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(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -0.04) {
tmp = w0 * Math.sqrt((1.0 - (((h / l) * (D * M)) * ((0.25 / (d * d)) * (D * M)))));
} else {
tmp = w0 * Math.sqrt(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)) <= -0.04: tmp = w0 * math.sqrt((1.0 - (((h / l) * (D * M)) * ((0.25 / (d * d)) * (D * M))))) else: tmp = w0 * math.sqrt(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)) <= -0.04) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(Float64(h / l) * Float64(D * M)) * Float64(Float64(0.25 / Float64(d * d)) * Float64(D * M)))))); 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 (((((M * D) / (2.0 * d)) ^ 2.0) * (h / l)) <= -0.04) tmp = w0 * sqrt((1.0 - (((h / l) * (D * M)) * ((0.25 / (d * d)) * (D * M))))); 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[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -0.04], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(N[(h / l), $MachinePrecision] * N[(D * M), $MachinePrecision]), $MachinePrecision] * N[(N[(0.25 / N[(d * d), $MachinePrecision]), $MachinePrecision] * N[(D * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[1.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -0.04:\\
\;\;\;\;w0 \cdot \sqrt{1 - \left(\frac{h}{\ell} \cdot \left(D \cdot M\right)\right) \cdot \left(\frac{0.25}{d \cdot d} \cdot \left(D \cdot M\right)\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)) < -0.040000000000000001Initial program 80.4%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-/.f64N/A
mult-flipN/A
associate-*l*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites71.4%
if -0.040000000000000001 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 80.4%
Taylor expanded in M around 0
Applied rewrites67.5%
(FPCore (w0 M D h l d) :precision binary64 (if (<= (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l)) -0.04) (* w0 (sqrt (fma (/ h l) (* (* (* (/ M (* d d)) (* D M)) D) -0.25) 1.0))) (* w0 (sqrt 1.0))))
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)) <= -0.04) {
tmp = w0 * sqrt(fma((h / l), ((((M / (d * d)) * (D * M)) * D) * -0.25), 1.0));
} else {
tmp = w0 * sqrt(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)) <= -0.04) tmp = Float64(w0 * sqrt(fma(Float64(h / l), Float64(Float64(Float64(Float64(M / Float64(d * d)) * Float64(D * M)) * D) * -0.25), 1.0))); else tmp = Float64(w0 * sqrt(1.0)); end return tmp end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -0.04], N[(w0 * N[Sqrt[N[(N[(h / l), $MachinePrecision] * N[(N[(N[(N[(M / N[(d * d), $MachinePrecision]), $MachinePrecision] * N[(D * M), $MachinePrecision]), $MachinePrecision] * D), $MachinePrecision] * -0.25), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[1.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -0.04:\\
\;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(\frac{h}{\ell}, \left(\left(\frac{M}{d \cdot d} \cdot \left(D \cdot M\right)\right) \cdot D\right) \cdot -0.25, 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)) < -0.040000000000000001Initial program 80.4%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
associate-*r/N/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
lift-*.f64N/A
lift-*.f64N/A
swap-sqrN/A
Applied rewrites64.9%
Applied rewrites65.9%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6469.6%
Applied rewrites69.6%
if -0.040000000000000001 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 80.4%
Taylor expanded in M around 0
Applied rewrites67.5%
(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+54)
(*
(sqrt
(+
(/ (* (* (* (* (* t_0 t_1) t_0) t_1) -0.25) h) (* (* l d) d))
1.0))
w0)
(* w0 (sqrt 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+54) {
tmp = sqrt((((((((t_0 * t_1) * t_0) * t_1) * -0.25) * h) / ((l * d) * d)) + 1.0)) * 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) :: 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+54)) then
tmp = sqrt((((((((t_0 * t_1) * t_0) * t_1) * (-0.25d0)) * h) / ((l * d_1) * d_1)) + 1.0d0)) * 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 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+54) {
tmp = Math.sqrt((((((((t_0 * t_1) * t_0) * t_1) * -0.25) * h) / ((l * d) * d)) + 1.0)) * w0;
} else {
tmp = w0 * Math.sqrt(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+54: tmp = math.sqrt((((((((t_0 * t_1) * t_0) * t_1) * -0.25) * h) / ((l * d) * d)) + 1.0)) * w0 else: tmp = w0 * math.sqrt(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+54) tmp = Float64(sqrt(Float64(Float64(Float64(Float64(Float64(Float64(Float64(t_0 * t_1) * t_0) * t_1) * -0.25) * h) / Float64(Float64(l * d) * d)) + 1.0)) * w0); else tmp = Float64(w0 * sqrt(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+54) tmp = sqrt((((((((t_0 * t_1) * t_0) * t_1) * -0.25) * h) / ((l * d) * d)) + 1.0)) * w0; else tmp = w0 * sqrt(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+54], N[(N[Sqrt[N[(N[(N[(N[(N[(N[(N[(t$95$0 * t$95$1), $MachinePrecision] * t$95$0), $MachinePrecision] * t$95$1), $MachinePrecision] * -0.25), $MachinePrecision] * h), $MachinePrecision] / N[(N[(l * d), $MachinePrecision] * d), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision] * w0), $MachinePrecision], N[(w0 * N[Sqrt[1.0], $MachinePrecision]), $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^{+54}:\\
\;\;\;\;\sqrt{\frac{\left(\left(\left(\left(t\_0 \cdot t\_1\right) \cdot t\_0\right) \cdot t\_1\right) \cdot -0.25\right) \cdot h}{\left(\ell \cdot d\right) \cdot d} + 1} \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)) < -2.0000000000000002e54Initial program 80.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6480.4%
Applied rewrites56.3%
lift-/.f64N/A
frac-2negN/A
lower-/.f64N/A
Applied rewrites71.5%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites71.5%
if -2.0000000000000002e54 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 80.4%
Taylor expanded in M around 0
Applied rewrites67.5%
(FPCore (w0 M D h l d)
:precision binary64
(let* ((t_0 (fmax M (fabs D))) (t_1 (fmin M (fabs D))))
(if (<= (* (pow (/ (* t_1 t_0) (* 2.0 d)) 2.0) (/ h l)) -1e+17)
(*
w0
(sqrt
(fma
(* (* t_0 t_1) t_0)
(/ (* (* -0.25 t_1) h) (* (* d d) l))
1.0)))
(* w0 (sqrt 1.0)))))double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = fmax(M, fabs(D));
double t_1 = fmin(M, fabs(D));
double tmp;
if ((pow(((t_1 * t_0) / (2.0 * d)), 2.0) * (h / l)) <= -1e+17) {
tmp = w0 * sqrt(fma(((t_0 * t_1) * t_0), (((-0.25 * t_1) * h) / ((d * d) * l)), 1.0));
} else {
tmp = w0 * sqrt(1.0);
}
return tmp;
}
function code(w0, M, D, h, l, d) t_0 = fmax(M, abs(D)) t_1 = fmin(M, abs(D)) tmp = 0.0 if (Float64((Float64(Float64(t_1 * t_0) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) <= -1e+17) tmp = Float64(w0 * sqrt(fma(Float64(Float64(t_0 * t_1) * t_0), Float64(Float64(Float64(-0.25 * t_1) * h) / Float64(Float64(d * d) * 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[Max[M, N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Min[M, 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], -1e+17], N[(w0 * N[Sqrt[N[(N[(N[(t$95$0 * t$95$1), $MachinePrecision] * t$95$0), $MachinePrecision] * N[(N[(N[(-0.25 * t$95$1), $MachinePrecision] * h), $MachinePrecision] / N[(N[(d * d), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[1.0], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \mathsf{max}\left(M, \left|D\right|\right)\\
t_1 := \mathsf{min}\left(M, \left|D\right|\right)\\
\mathbf{if}\;{\left(\frac{t\_1 \cdot t\_0}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -1 \cdot 10^{+17}:\\
\;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(\left(t\_0 \cdot t\_1\right) \cdot t\_0, \frac{\left(-0.25 \cdot t\_1\right) \cdot h}{\left(d \cdot d\right) \cdot \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)) < -1e17Initial program 80.4%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
associate-*r/N/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
lift-*.f64N/A
lift-*.f64N/A
swap-sqrN/A
Applied rewrites64.9%
Applied rewrites65.9%
lift-fma.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
associate-*l*N/A
lower-fma.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-/.f64N/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6467.3%
Applied rewrites67.3%
if -1e17 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 80.4%
Taylor expanded in M around 0
Applied rewrites67.5%
(FPCore (w0 M D h l d) :precision binary64 (if (<= (* (pow (/ (* M D) (* 2.0 (fabs d))) 2.0) (/ h l)) -5e+142) (* (/ w0 (fabs (fabs d))) (fabs d)) (* w0 (sqrt 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)) <= -5e+142) {
tmp = (w0 / fabs(fabs(d))) * 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 (((((m * d) / (2.0d0 * abs(d_1))) ** 2.0d0) * (h / l)) <= (-5d+142)) then
tmp = (w0 / abs(abs(d_1))) * 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(((M * D) / (2.0 * Math.abs(d))), 2.0) * (h / l)) <= -5e+142) {
tmp = (w0 / Math.abs(Math.abs(d))) * 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(((M * D) / (2.0 * math.fabs(d))), 2.0) * (h / l)) <= -5e+142: tmp = (w0 / math.fabs(math.fabs(d))) * 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(M * D) / Float64(2.0 * abs(d))) ^ 2.0) * Float64(h / l)) <= -5e+142) tmp = Float64(Float64(w0 / abs(abs(d))) * 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 (((((M * D) / (2.0 * abs(d))) ^ 2.0) * (h / l)) <= -5e+142) tmp = (w0 / abs(abs(d))) * 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[(M * D), $MachinePrecision] / N[(2.0 * N[Abs[d], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -5e+142], N[(N[(w0 / N[Abs[N[Abs[d], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Abs[d], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[1.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot \left|d\right|}\right)}^{2} \cdot \frac{h}{\ell} \leq -5 \cdot 10^{+142}:\\
\;\;\;\;\frac{w0}{\left|\left|d\right|\right|} \cdot \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)) < -5.0000000000000001e142Initial program 80.4%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
associate-*r/N/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
lift-*.f64N/A
lift-*.f64N/A
swap-sqrN/A
Applied rewrites64.9%
lift-sqrt.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
sub-to-fractionN/A
sqrt-divN/A
lower-unsound-sqrt.f64N/A
lower-sqrt.f64N/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lower-unsound-/.f64N/A
Applied rewrites50.5%
Taylor expanded in d around inf
lower-/.f64N/A
lower-*.f64N/A
lower-fabs.f6427.4%
Applied rewrites27.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6429.9%
Applied rewrites29.9%
if -5.0000000000000001e142 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 80.4%
Taylor expanded in M around 0
Applied rewrites67.5%
(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.4%
Taylor expanded in M around 0
Applied rewrites67.5%
herbie shell --seed 2025214
(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))))))