
(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 7 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 (fmax (fabs M) (fabs D)))
(t_1 (fmin (fabs M) (fabs D)))
(t_2
(sqrt
(-
1.0
(* (pow (/ (* t_1 t_0) (* 2.0 (fabs d))) 2.0) (/ h l))))))
(if (<= t_2 1e+115)
(* w0 t_2)
(if (<= t_2 INFINITY)
(*
(* t_0 (* (fabs t_1) (sqrt (* -0.25 (/ h l)))))
(/ w0 (fabs d)))
(*
w0
(sqrt
(fma
(* (/ t_1 (+ (fabs d) (fabs d))) t_0)
(* -0.5 (/ (* t_0 (* t_1 h)) (* (fabs d) 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));
double t_2 = sqrt((1.0 - (pow(((t_1 * t_0) / (2.0 * fabs(d))), 2.0) * (h / l))));
double tmp;
if (t_2 <= 1e+115) {
tmp = w0 * t_2;
} else if (t_2 <= ((double) INFINITY)) {
tmp = (t_0 * (fabs(t_1) * sqrt((-0.25 * (h / l))))) * (w0 / fabs(d));
} else {
tmp = w0 * sqrt(fma(((t_1 / (fabs(d) + fabs(d))) * t_0), (-0.5 * ((t_0 * (t_1 * h)) / (fabs(d) * l))), 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)) t_2 = sqrt(Float64(1.0 - Float64((Float64(Float64(t_1 * t_0) / Float64(2.0 * abs(d))) ^ 2.0) * Float64(h / l)))) tmp = 0.0 if (t_2 <= 1e+115) tmp = Float64(w0 * t_2); elseif (t_2 <= Inf) tmp = Float64(Float64(t_0 * Float64(abs(t_1) * sqrt(Float64(-0.25 * Float64(h / l))))) * Float64(w0 / abs(d))); else tmp = Float64(w0 * sqrt(fma(Float64(Float64(t_1 / Float64(abs(d) + abs(d))) * t_0), Float64(-0.5 * Float64(Float64(t_0 * Float64(t_1 * h)) / Float64(abs(d) * l))), 1.0))); end return tmp end
code[w0_, M_, D_, h_, l_, d_] := Block[{t$95$0 = N[Max[N[Abs[M], $MachinePrecision], N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Min[N[Abs[M], $MachinePrecision], N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 - N[(N[Power[N[(N[(t$95$1 * t$95$0), $MachinePrecision] / N[(2.0 * N[Abs[d], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$2, 1e+115], N[(w0 * t$95$2), $MachinePrecision], If[LessEqual[t$95$2, Infinity], N[(N[(t$95$0 * N[(N[Abs[t$95$1], $MachinePrecision] * N[Sqrt[N[(-0.25 * N[(h / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(w0 / N[Abs[d], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(N[(N[(t$95$1 / N[(N[Abs[d], $MachinePrecision] + N[Abs[d], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] * N[(-0.5 * N[(N[(t$95$0 * N[(t$95$1 * h), $MachinePrecision]), $MachinePrecision] / N[(N[Abs[d], $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]), $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)\\
t_2 := \sqrt{1 - {\left(\frac{t\_1 \cdot t\_0}{2 \cdot \left|d\right|}\right)}^{2} \cdot \frac{h}{\ell}}\\
\mathbf{if}\;t\_2 \leq 10^{+115}:\\
\;\;\;\;w0 \cdot t\_2\\
\mathbf{elif}\;t\_2 \leq \infty:\\
\;\;\;\;\left(t\_0 \cdot \left(\left|t\_1\right| \cdot \sqrt{-0.25 \cdot \frac{h}{\ell}}\right)\right) \cdot \frac{w0}{\left|d\right|}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(\frac{t\_1}{\left|d\right| + \left|d\right|} \cdot t\_0, -0.5 \cdot \frac{t\_0 \cdot \left(t\_1 \cdot h\right)}{\left|d\right| \cdot \ell}, 1\right)}\\
\end{array}
if (sqrt.f64 (-.f64 #s(literal 1 binary64) (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)))) < 1e115Initial program 80.1%
if 1e115 < (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.1%
Taylor expanded in d around 0
lower-/.f64N/A
Applied rewrites9.3%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
Applied rewrites8.9%
lift-sqrt.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
associate-*l*N/A
sqrt-prodN/A
lower-unsound-sqrt.f64N/A
lower-sqrt.f64N/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lower-unsound-*.f64N/A
lower-fabs.f64N/A
lower-unsound-sqrt.f64N/A
lower-*.f64N/A
lower-/.f6410.6%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6410.6%
Applied rewrites10.6%
Taylor expanded in D around 0
lower-*.f64N/A
lower-*.f64N/A
lower-fabs.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-/.f6412.4%
Applied rewrites12.4%
if +inf.0 < (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.1%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-neg-outN/A
distribute-rgt-neg-inN/A
lift-/.f64N/A
distribute-neg-frac2N/A
associate-/l*N/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites83.9%
Taylor expanded in M around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6481.3%
Applied rewrites81.3%
(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_1 (+ (fabs d) (fabs d))) t_0))
(t_3
(sqrt
(-
1.0
(* (pow (/ (* t_1 t_0) (* 2.0 (fabs d))) 2.0) (/ h l))))))
(if (<= t_3 1e+115)
(*
w0
(sqrt
(fma (* (/ h l) (* (/ -0.5 (fabs d)) (* t_0 t_1))) t_2 1.0)))
(if (<= t_3 INFINITY)
(*
(* t_0 (* (fabs t_1) (sqrt (* -0.25 (/ h l)))))
(/ w0 (fabs d)))
(*
w0
(sqrt
(fma
t_2
(* -0.5 (/ (* t_0 (* t_1 h)) (* (fabs d) 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));
double t_2 = (t_1 / (fabs(d) + fabs(d))) * t_0;
double t_3 = sqrt((1.0 - (pow(((t_1 * t_0) / (2.0 * fabs(d))), 2.0) * (h / l))));
double tmp;
if (t_3 <= 1e+115) {
tmp = w0 * sqrt(fma(((h / l) * ((-0.5 / fabs(d)) * (t_0 * t_1))), t_2, 1.0));
} else if (t_3 <= ((double) INFINITY)) {
tmp = (t_0 * (fabs(t_1) * sqrt((-0.25 * (h / l))))) * (w0 / fabs(d));
} else {
tmp = w0 * sqrt(fma(t_2, (-0.5 * ((t_0 * (t_1 * h)) / (fabs(d) * l))), 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)) t_2 = Float64(Float64(t_1 / Float64(abs(d) + abs(d))) * t_0) t_3 = sqrt(Float64(1.0 - Float64((Float64(Float64(t_1 * t_0) / Float64(2.0 * abs(d))) ^ 2.0) * Float64(h / l)))) tmp = 0.0 if (t_3 <= 1e+115) tmp = Float64(w0 * sqrt(fma(Float64(Float64(h / l) * Float64(Float64(-0.5 / abs(d)) * Float64(t_0 * t_1))), t_2, 1.0))); elseif (t_3 <= Inf) tmp = Float64(Float64(t_0 * Float64(abs(t_1) * sqrt(Float64(-0.25 * Float64(h / l))))) * Float64(w0 / abs(d))); else tmp = Float64(w0 * sqrt(fma(t_2, Float64(-0.5 * Float64(Float64(t_0 * Float64(t_1 * h)) / Float64(abs(d) * l))), 1.0))); end return tmp end
code[w0_, M_, D_, h_, l_, d_] := Block[{t$95$0 = N[Max[N[Abs[M], $MachinePrecision], N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Min[N[Abs[M], $MachinePrecision], N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(t$95$1 / N[(N[Abs[d], $MachinePrecision] + N[Abs[d], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(1.0 - N[(N[Power[N[(N[(t$95$1 * t$95$0), $MachinePrecision] / N[(2.0 * N[Abs[d], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$3, 1e+115], N[(w0 * N[Sqrt[N[(N[(N[(h / l), $MachinePrecision] * N[(N[(-0.5 / N[Abs[d], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$2 + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, Infinity], N[(N[(t$95$0 * N[(N[Abs[t$95$1], $MachinePrecision] * N[Sqrt[N[(-0.25 * N[(h / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(w0 / N[Abs[d], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(t$95$2 * N[(-0.5 * N[(N[(t$95$0 * N[(t$95$1 * h), $MachinePrecision]), $MachinePrecision] / N[(N[Abs[d], $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]), $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)\\
t_2 := \frac{t\_1}{\left|d\right| + \left|d\right|} \cdot t\_0\\
t_3 := \sqrt{1 - {\left(\frac{t\_1 \cdot t\_0}{2 \cdot \left|d\right|}\right)}^{2} \cdot \frac{h}{\ell}}\\
\mathbf{if}\;t\_3 \leq 10^{+115}:\\
\;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(\frac{h}{\ell} \cdot \left(\frac{-0.5}{\left|d\right|} \cdot \left(t\_0 \cdot t\_1\right)\right), t\_2, 1\right)}\\
\mathbf{elif}\;t\_3 \leq \infty:\\
\;\;\;\;\left(t\_0 \cdot \left(\left|t\_1\right| \cdot \sqrt{-0.25 \cdot \frac{h}{\ell}}\right)\right) \cdot \frac{w0}{\left|d\right|}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(t\_2, -0.5 \cdot \frac{t\_0 \cdot \left(t\_1 \cdot h\right)}{\left|d\right| \cdot \ell}, 1\right)}\\
\end{array}
if (sqrt.f64 (-.f64 #s(literal 1 binary64) (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)))) < 1e115Initial program 80.1%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
distribute-lft-neg-inN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites81.2%
if 1e115 < (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.1%
Taylor expanded in d around 0
lower-/.f64N/A
Applied rewrites9.3%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
Applied rewrites8.9%
lift-sqrt.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
associate-*l*N/A
sqrt-prodN/A
lower-unsound-sqrt.f64N/A
lower-sqrt.f64N/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lower-unsound-*.f64N/A
lower-fabs.f64N/A
lower-unsound-sqrt.f64N/A
lower-*.f64N/A
lower-/.f6410.6%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6410.6%
Applied rewrites10.6%
Taylor expanded in D around 0
lower-*.f64N/A
lower-*.f64N/A
lower-fabs.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-/.f6412.4%
Applied rewrites12.4%
if +inf.0 < (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.1%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-neg-outN/A
distribute-rgt-neg-inN/A
lift-/.f64N/A
distribute-neg-frac2N/A
associate-/l*N/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites83.9%
Taylor expanded in M around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6481.3%
Applied rewrites81.3%
(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 (fabs d)) t_0))
(t_3
(*
(fabs w0)
(sqrt
(-
1.0
(* (pow (/ (* t_0 t_1) (* 2.0 (fabs d))) 2.0) (/ h l)))))))
(*
(copysign 1.0 w0)
(if (<= t_3 5e+306)
(* (fabs w0) (sqrt (- 1.0 (* (/ (* t_2 t_2) 4.0) (/ h l)))))
(if (<= t_3 INFINITY)
(*
(* t_1 (* (fabs t_0) (sqrt (* -0.25 (/ h l)))))
(/ (fabs w0) (fabs d)))
(*
(fabs w0)
(sqrt
(fma
(* (/ t_0 (+ (fabs d) (fabs d))) t_1)
(* -0.5 (/ (* t_1 (* t_0 h)) (* (fabs 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 / fabs(d)) * t_0;
double t_3 = fabs(w0) * sqrt((1.0 - (pow(((t_0 * t_1) / (2.0 * fabs(d))), 2.0) * (h / l))));
double tmp;
if (t_3 <= 5e+306) {
tmp = fabs(w0) * sqrt((1.0 - (((t_2 * t_2) / 4.0) * (h / l))));
} else if (t_3 <= ((double) INFINITY)) {
tmp = (t_1 * (fabs(t_0) * sqrt((-0.25 * (h / l))))) * (fabs(w0) / fabs(d));
} else {
tmp = fabs(w0) * sqrt(fma(((t_0 / (fabs(d) + fabs(d))) * t_1), (-0.5 * ((t_1 * (t_0 * h)) / (fabs(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(Float64(t_1 / abs(d)) * t_0) t_3 = Float64(abs(w0) * sqrt(Float64(1.0 - Float64((Float64(Float64(t_0 * t_1) / Float64(2.0 * abs(d))) ^ 2.0) * Float64(h / l))))) tmp = 0.0 if (t_3 <= 5e+306) tmp = Float64(abs(w0) * sqrt(Float64(1.0 - Float64(Float64(Float64(t_2 * t_2) / 4.0) * Float64(h / l))))); elseif (t_3 <= Inf) tmp = Float64(Float64(t_1 * Float64(abs(t_0) * sqrt(Float64(-0.25 * Float64(h / l))))) * Float64(abs(w0) / abs(d))); else tmp = Float64(abs(w0) * sqrt(fma(Float64(Float64(t_0 / Float64(abs(d) + abs(d))) * t_1), Float64(-0.5 * Float64(Float64(t_1 * Float64(t_0 * h)) / Float64(abs(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[(N[(t$95$1 / N[Abs[d], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]}, Block[{t$95$3 = 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 * N[Abs[d], $MachinePrecision]), $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$3, 5e+306], N[(N[Abs[w0], $MachinePrecision] * N[Sqrt[N[(1.0 - N[(N[(N[(t$95$2 * t$95$2), $MachinePrecision] / 4.0), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, Infinity], N[(N[(t$95$1 * N[(N[Abs[t$95$0], $MachinePrecision] * N[Sqrt[N[(-0.25 * N[(h / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Abs[w0], $MachinePrecision] / N[Abs[d], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Abs[w0], $MachinePrecision] * N[Sqrt[N[(N[(N[(t$95$0 / N[(N[Abs[d], $MachinePrecision] + N[Abs[d], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] * N[(-0.5 * N[(N[(t$95$1 * N[(t$95$0 * h), $MachinePrecision]), $MachinePrecision] / N[(N[Abs[d], $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]), $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}{\left|d\right|} \cdot t\_0\\
t_3 := \left|w0\right| \cdot \sqrt{1 - {\left(\frac{t\_0 \cdot t\_1}{2 \cdot \left|d\right|}\right)}^{2} \cdot \frac{h}{\ell}}\\
\mathsf{copysign}\left(1, w0\right) \cdot \begin{array}{l}
\mathbf{if}\;t\_3 \leq 5 \cdot 10^{+306}:\\
\;\;\;\;\left|w0\right| \cdot \sqrt{1 - \frac{t\_2 \cdot t\_2}{4} \cdot \frac{h}{\ell}}\\
\mathbf{elif}\;t\_3 \leq \infty:\\
\;\;\;\;\left(t\_1 \cdot \left(\left|t\_0\right| \cdot \sqrt{-0.25 \cdot \frac{h}{\ell}}\right)\right) \cdot \frac{\left|w0\right|}{\left|d\right|}\\
\mathbf{else}:\\
\;\;\;\;\left|w0\right| \cdot \sqrt{\mathsf{fma}\left(\frac{t\_0}{\left|d\right| + \left|d\right|} \cdot t\_1, -0.5 \cdot \frac{t\_1 \cdot \left(t\_0 \cdot h\right)}{\left|d\right| \cdot \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))))) < 4.9999999999999999e306Initial program 80.1%
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.1%
if 4.9999999999999999e306 < (*.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.1%
Taylor expanded in d around 0
lower-/.f64N/A
Applied rewrites9.3%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
Applied rewrites8.9%
lift-sqrt.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
associate-*l*N/A
sqrt-prodN/A
lower-unsound-sqrt.f64N/A
lower-sqrt.f64N/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lower-unsound-*.f64N/A
lower-fabs.f64N/A
lower-unsound-sqrt.f64N/A
lower-*.f64N/A
lower-/.f6410.6%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6410.6%
Applied rewrites10.6%
Taylor expanded in D around 0
lower-*.f64N/A
lower-*.f64N/A
lower-fabs.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-/.f6412.4%
Applied rewrites12.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.1%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-neg-outN/A
distribute-rgt-neg-inN/A
lift-/.f64N/A
distribute-neg-frac2N/A
associate-/l*N/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites83.9%
Taylor expanded in M around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6481.3%
Applied rewrites81.3%
(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_0 t_1))
(t_3 (* (/ t_1 (fabs d)) t_0))
(t_4
(*
(fabs w0)
(sqrt
(- 1.0 (* (pow (/ t_2 (* 2.0 (fabs d))) 2.0) (/ h l)))))))
(*
(copysign 1.0 w0)
(if (<= t_4 5e+306)
(* (fabs w0) (sqrt (- 1.0 (* (/ (* t_3 t_3) 4.0) (/ h l)))))
(if (<= t_4 INFINITY)
(*
(* t_1 (* (fabs t_0) (sqrt (* -0.25 (/ h l)))))
(/ (fabs w0) (fabs d)))
(*
(fabs w0)
(sqrt
(-
1.0
(*
t_2
(/ (* (/ 0.25 (fabs d)) (* t_2 h)) (* (fabs d) l)))))))))))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_0 * t_1;
double t_3 = (t_1 / fabs(d)) * t_0;
double t_4 = fabs(w0) * sqrt((1.0 - (pow((t_2 / (2.0 * fabs(d))), 2.0) * (h / l))));
double tmp;
if (t_4 <= 5e+306) {
tmp = fabs(w0) * sqrt((1.0 - (((t_3 * t_3) / 4.0) * (h / l))));
} else if (t_4 <= ((double) INFINITY)) {
tmp = (t_1 * (fabs(t_0) * sqrt((-0.25 * (h / l))))) * (fabs(w0) / fabs(d));
} else {
tmp = fabs(w0) * sqrt((1.0 - (t_2 * (((0.25 / fabs(d)) * (t_2 * h)) / (fabs(d) * l)))));
}
return copysign(1.0, w0) * tmp;
}
public static double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = fmin(M, Math.abs(D));
double t_1 = fmax(M, Math.abs(D));
double t_2 = t_0 * t_1;
double t_3 = (t_1 / Math.abs(d)) * t_0;
double t_4 = Math.abs(w0) * Math.sqrt((1.0 - (Math.pow((t_2 / (2.0 * Math.abs(d))), 2.0) * (h / l))));
double tmp;
if (t_4 <= 5e+306) {
tmp = Math.abs(w0) * Math.sqrt((1.0 - (((t_3 * t_3) / 4.0) * (h / l))));
} else if (t_4 <= Double.POSITIVE_INFINITY) {
tmp = (t_1 * (Math.abs(t_0) * Math.sqrt((-0.25 * (h / l))))) * (Math.abs(w0) / Math.abs(d));
} else {
tmp = Math.abs(w0) * Math.sqrt((1.0 - (t_2 * (((0.25 / Math.abs(d)) * (t_2 * h)) / (Math.abs(d) * l)))));
}
return Math.copySign(1.0, w0) * tmp;
}
def code(w0, M, D, h, l, d): t_0 = fmin(M, math.fabs(D)) t_1 = fmax(M, math.fabs(D)) t_2 = t_0 * t_1 t_3 = (t_1 / math.fabs(d)) * t_0 t_4 = math.fabs(w0) * math.sqrt((1.0 - (math.pow((t_2 / (2.0 * math.fabs(d))), 2.0) * (h / l)))) tmp = 0 if t_4 <= 5e+306: tmp = math.fabs(w0) * math.sqrt((1.0 - (((t_3 * t_3) / 4.0) * (h / l)))) elif t_4 <= math.inf: tmp = (t_1 * (math.fabs(t_0) * math.sqrt((-0.25 * (h / l))))) * (math.fabs(w0) / math.fabs(d)) else: tmp = math.fabs(w0) * math.sqrt((1.0 - (t_2 * (((0.25 / math.fabs(d)) * (t_2 * h)) / (math.fabs(d) * l))))) return math.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(t_0 * t_1) t_3 = Float64(Float64(t_1 / abs(d)) * t_0) t_4 = Float64(abs(w0) * sqrt(Float64(1.0 - Float64((Float64(t_2 / Float64(2.0 * abs(d))) ^ 2.0) * Float64(h / l))))) tmp = 0.0 if (t_4 <= 5e+306) tmp = Float64(abs(w0) * sqrt(Float64(1.0 - Float64(Float64(Float64(t_3 * t_3) / 4.0) * Float64(h / l))))); elseif (t_4 <= Inf) tmp = Float64(Float64(t_1 * Float64(abs(t_0) * sqrt(Float64(-0.25 * Float64(h / l))))) * Float64(abs(w0) / abs(d))); else tmp = Float64(abs(w0) * sqrt(Float64(1.0 - Float64(t_2 * Float64(Float64(Float64(0.25 / abs(d)) * Float64(t_2 * h)) / Float64(abs(d) * l)))))); end return Float64(copysign(1.0, w0) * tmp) end
function tmp_2 = code(w0, M, D, h, l, d) t_0 = min(M, abs(D)); t_1 = max(M, abs(D)); t_2 = t_0 * t_1; t_3 = (t_1 / abs(d)) * t_0; t_4 = abs(w0) * sqrt((1.0 - (((t_2 / (2.0 * abs(d))) ^ 2.0) * (h / l)))); tmp = 0.0; if (t_4 <= 5e+306) tmp = abs(w0) * sqrt((1.0 - (((t_3 * t_3) / 4.0) * (h / l)))); elseif (t_4 <= Inf) tmp = (t_1 * (abs(t_0) * sqrt((-0.25 * (h / l))))) * (abs(w0) / abs(d)); else tmp = abs(w0) * sqrt((1.0 - (t_2 * (((0.25 / abs(d)) * (t_2 * h)) / (abs(d) * l))))); end tmp_2 = (sign(w0) * abs(1.0)) * 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[(t$95$0 * t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(N[(t$95$1 / N[Abs[d], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]}, Block[{t$95$4 = N[(N[Abs[w0], $MachinePrecision] * N[Sqrt[N[(1.0 - N[(N[Power[N[(t$95$2 / N[(2.0 * N[Abs[d], $MachinePrecision]), $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$4, 5e+306], N[(N[Abs[w0], $MachinePrecision] * N[Sqrt[N[(1.0 - N[(N[(N[(t$95$3 * t$95$3), $MachinePrecision] / 4.0), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, Infinity], N[(N[(t$95$1 * N[(N[Abs[t$95$0], $MachinePrecision] * N[Sqrt[N[(-0.25 * N[(h / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Abs[w0], $MachinePrecision] / N[Abs[d], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Abs[w0], $MachinePrecision] * N[Sqrt[N[(1.0 - N[(t$95$2 * N[(N[(N[(0.25 / N[Abs[d], $MachinePrecision]), $MachinePrecision] * N[(t$95$2 * h), $MachinePrecision]), $MachinePrecision] / N[(N[Abs[d], $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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 := t\_0 \cdot t\_1\\
t_3 := \frac{t\_1}{\left|d\right|} \cdot t\_0\\
t_4 := \left|w0\right| \cdot \sqrt{1 - {\left(\frac{t\_2}{2 \cdot \left|d\right|}\right)}^{2} \cdot \frac{h}{\ell}}\\
\mathsf{copysign}\left(1, w0\right) \cdot \begin{array}{l}
\mathbf{if}\;t\_4 \leq 5 \cdot 10^{+306}:\\
\;\;\;\;\left|w0\right| \cdot \sqrt{1 - \frac{t\_3 \cdot t\_3}{4} \cdot \frac{h}{\ell}}\\
\mathbf{elif}\;t\_4 \leq \infty:\\
\;\;\;\;\left(t\_1 \cdot \left(\left|t\_0\right| \cdot \sqrt{-0.25 \cdot \frac{h}{\ell}}\right)\right) \cdot \frac{\left|w0\right|}{\left|d\right|}\\
\mathbf{else}:\\
\;\;\;\;\left|w0\right| \cdot \sqrt{1 - t\_2 \cdot \frac{\frac{0.25}{\left|d\right|} \cdot \left(t\_2 \cdot h\right)}{\left|d\right| \cdot \ell}}\\
\end{array}
\end{array}
if (*.f64 w0 (sqrt.f64 (-.f64 #s(literal 1 binary64) (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l))))) < 4.9999999999999999e306Initial program 80.1%
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.1%
if 4.9999999999999999e306 < (*.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.1%
Taylor expanded in d around 0
lower-/.f64N/A
Applied rewrites9.3%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
Applied rewrites8.9%
lift-sqrt.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
associate-*l*N/A
sqrt-prodN/A
lower-unsound-sqrt.f64N/A
lower-sqrt.f64N/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lower-unsound-*.f64N/A
lower-fabs.f64N/A
lower-unsound-sqrt.f64N/A
lower-*.f64N/A
lower-/.f6410.6%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6410.6%
Applied rewrites10.6%
Taylor expanded in D around 0
lower-*.f64N/A
lower-*.f64N/A
lower-fabs.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-/.f6412.4%
Applied rewrites12.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.1%
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
associate-*r*N/A
lower-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6470.9%
Applied rewrites70.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
unswap-sqrN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6483.2%
Applied rewrites83.2%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6484.2%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6484.2%
lift-*.f64N/A
*-commutativeN/A
lift-*.f6484.2%
Applied rewrites84.2%
(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_1 t_0))
(t_3 (* (pow (/ t_2 (* 2.0 (fabs d))) 2.0) (/ h l))))
(if (<= t_3 -2e+240)
(*
(* t_0 (* (fabs t_1) (sqrt (* -0.25 (/ h l)))))
(/ w0 (fabs d)))
(if (<= t_3 -5e-12)
(*
w0
(sqrt
(-
1.0
(* t_2 (/ (* (/ 0.25 (fabs d)) (* t_2 h)) (* (fabs 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 t_2 = t_1 * t_0;
double t_3 = pow((t_2 / (2.0 * fabs(d))), 2.0) * (h / l);
double tmp;
if (t_3 <= -2e+240) {
tmp = (t_0 * (fabs(t_1) * sqrt((-0.25 * (h / l))))) * (w0 / fabs(d));
} else if (t_3 <= -5e-12) {
tmp = w0 * sqrt((1.0 - (t_2 * (((0.25 / fabs(d)) * (t_2 * h)) / (fabs(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) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = fmax(abs(m), abs(d))
t_1 = fmin(abs(m), abs(d))
t_2 = t_1 * t_0
t_3 = ((t_2 / (2.0d0 * abs(d_1))) ** 2.0d0) * (h / l)
if (t_3 <= (-2d+240)) then
tmp = (t_0 * (abs(t_1) * sqrt(((-0.25d0) * (h / l))))) * (w0 / abs(d_1))
else if (t_3 <= (-5d-12)) then
tmp = w0 * sqrt((1.0d0 - (t_2 * (((0.25d0 / abs(d_1)) * (t_2 * h)) / (abs(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 t_2 = t_1 * t_0;
double t_3 = Math.pow((t_2 / (2.0 * Math.abs(d))), 2.0) * (h / l);
double tmp;
if (t_3 <= -2e+240) {
tmp = (t_0 * (Math.abs(t_1) * Math.sqrt((-0.25 * (h / l))))) * (w0 / Math.abs(d));
} else if (t_3 <= -5e-12) {
tmp = w0 * Math.sqrt((1.0 - (t_2 * (((0.25 / Math.abs(d)) * (t_2 * h)) / (Math.abs(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)) t_2 = t_1 * t_0 t_3 = math.pow((t_2 / (2.0 * math.fabs(d))), 2.0) * (h / l) tmp = 0 if t_3 <= -2e+240: tmp = (t_0 * (math.fabs(t_1) * math.sqrt((-0.25 * (h / l))))) * (w0 / math.fabs(d)) elif t_3 <= -5e-12: tmp = w0 * math.sqrt((1.0 - (t_2 * (((0.25 / math.fabs(d)) * (t_2 * h)) / (math.fabs(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)) t_2 = Float64(t_1 * t_0) t_3 = Float64((Float64(t_2 / Float64(2.0 * abs(d))) ^ 2.0) * Float64(h / l)) tmp = 0.0 if (t_3 <= -2e+240) tmp = Float64(Float64(t_0 * Float64(abs(t_1) * sqrt(Float64(-0.25 * Float64(h / l))))) * Float64(w0 / abs(d))); elseif (t_3 <= -5e-12) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(t_2 * Float64(Float64(Float64(0.25 / abs(d)) * Float64(t_2 * h)) / Float64(abs(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)); t_2 = t_1 * t_0; t_3 = ((t_2 / (2.0 * abs(d))) ^ 2.0) * (h / l); tmp = 0.0; if (t_3 <= -2e+240) tmp = (t_0 * (abs(t_1) * sqrt((-0.25 * (h / l))))) * (w0 / abs(d)); elseif (t_3 <= -5e-12) tmp = w0 * sqrt((1.0 - (t_2 * (((0.25 / abs(d)) * (t_2 * h)) / (abs(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]}, Block[{t$95$2 = N[(t$95$1 * t$95$0), $MachinePrecision]}, Block[{t$95$3 = N[(N[Power[N[(t$95$2 / N[(2.0 * N[Abs[d], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, -2e+240], N[(N[(t$95$0 * N[(N[Abs[t$95$1], $MachinePrecision] * N[Sqrt[N[(-0.25 * N[(h / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(w0 / N[Abs[d], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, -5e-12], N[(w0 * N[Sqrt[N[(1.0 - N[(t$95$2 * N[(N[(N[(0.25 / N[Abs[d], $MachinePrecision]), $MachinePrecision] * N[(t$95$2 * h), $MachinePrecision]), $MachinePrecision] / N[(N[Abs[d], $MachinePrecision] * l), $MachinePrecision]), $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)\\
t_2 := t\_1 \cdot t\_0\\
t_3 := {\left(\frac{t\_2}{2 \cdot \left|d\right|}\right)}^{2} \cdot \frac{h}{\ell}\\
\mathbf{if}\;t\_3 \leq -2 \cdot 10^{+240}:\\
\;\;\;\;\left(t\_0 \cdot \left(\left|t\_1\right| \cdot \sqrt{-0.25 \cdot \frac{h}{\ell}}\right)\right) \cdot \frac{w0}{\left|d\right|}\\
\mathbf{elif}\;t\_3 \leq -5 \cdot 10^{-12}:\\
\;\;\;\;w0 \cdot \sqrt{1 - t\_2 \cdot \frac{\frac{0.25}{\left|d\right|} \cdot \left(t\_2 \cdot h\right)}{\left|d\right| \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)) < -2e240Initial program 80.1%
Taylor expanded in d around 0
lower-/.f64N/A
Applied rewrites9.3%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
Applied rewrites8.9%
lift-sqrt.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
associate-*l*N/A
sqrt-prodN/A
lower-unsound-sqrt.f64N/A
lower-sqrt.f64N/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lower-unsound-*.f64N/A
lower-fabs.f64N/A
lower-unsound-sqrt.f64N/A
lower-*.f64N/A
lower-/.f6410.6%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6410.6%
Applied rewrites10.6%
Taylor expanded in D around 0
lower-*.f64N/A
lower-*.f64N/A
lower-fabs.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-/.f6412.4%
Applied rewrites12.4%
if -2e240 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -4.9999999999999997e-12Initial program 80.1%
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
associate-*r*N/A
lower-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6470.9%
Applied rewrites70.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
unswap-sqrN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6483.2%
Applied rewrites83.2%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6484.2%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6484.2%
lift-*.f64N/A
*-commutativeN/A
lift-*.f6484.2%
Applied rewrites84.2%
if -4.9999999999999997e-12 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 80.1%
Taylor expanded in M around 0
Applied rewrites68.8%
(FPCore (w0 M D h l d)
:precision binary64
(let* ((t_0 (fmax (fabs M) D)) (t_1 (fmin (fabs M) D)))
(if (<=
(* (pow (/ (* t_1 t_0) (* 2.0 (fabs d))) 2.0) (/ h l))
-2000.0)
(/
(* t_0 (* w0 (* (fabs t_1) (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 t_0 = fmax(fabs(M), D);
double t_1 = fmin(fabs(M), D);
double tmp;
if ((pow(((t_1 * t_0) / (2.0 * fabs(d))), 2.0) * (h / l)) <= -2000.0) {
tmp = (t_0 * (w0 * (fabs(t_1) * 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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = fmax(abs(m), d)
t_1 = fmin(abs(m), d)
if (((((t_1 * t_0) / (2.0d0 * abs(d_1))) ** 2.0d0) * (h / l)) <= (-2000.0d0)) then
tmp = (t_0 * (w0 * (abs(t_1) * 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 t_0 = fmax(Math.abs(M), D);
double t_1 = fmin(Math.abs(M), D);
double tmp;
if ((Math.pow(((t_1 * t_0) / (2.0 * Math.abs(d))), 2.0) * (h / l)) <= -2000.0) {
tmp = (t_0 * (w0 * (Math.abs(t_1) * 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): t_0 = fmax(math.fabs(M), D) t_1 = fmin(math.fabs(M), D) tmp = 0 if (math.pow(((t_1 * t_0) / (2.0 * math.fabs(d))), 2.0) * (h / l)) <= -2000.0: tmp = (t_0 * (w0 * (math.fabs(t_1) * 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) t_0 = fmax(abs(M), D) t_1 = fmin(abs(M), D) tmp = 0.0 if (Float64((Float64(Float64(t_1 * t_0) / Float64(2.0 * abs(d))) ^ 2.0) * Float64(h / l)) <= -2000.0) tmp = Float64(Float64(t_0 * Float64(w0 * Float64(abs(t_1) * 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) t_0 = max(abs(M), D); t_1 = min(abs(M), D); tmp = 0.0; if (((((t_1 * t_0) / (2.0 * abs(d))) ^ 2.0) * (h / l)) <= -2000.0) tmp = (t_0 * (w0 * (abs(t_1) * 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_] := Block[{t$95$0 = N[Max[N[Abs[M], $MachinePrecision], D], $MachinePrecision]}, Block[{t$95$1 = N[Min[N[Abs[M], $MachinePrecision], D], $MachinePrecision]}, If[LessEqual[N[(N[Power[N[(N[(t$95$1 * t$95$0), $MachinePrecision] / N[(2.0 * N[Abs[d], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -2000.0], N[(N[(t$95$0 * N[(w0 * N[(N[Abs[t$95$1], $MachinePrecision] * 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}
t_0 := \mathsf{max}\left(\left|M\right|, D\right)\\
t_1 := \mathsf{min}\left(\left|M\right|, D\right)\\
\mathbf{if}\;{\left(\frac{t\_1 \cdot t\_0}{2 \cdot \left|d\right|}\right)}^{2} \cdot \frac{h}{\ell} \leq -2000:\\
\;\;\;\;\frac{t\_0 \cdot \left(w0 \cdot \left(\left|t\_1\right| \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)) < -2e3Initial program 80.1%
Taylor expanded in d around 0
lower-/.f64N/A
Applied rewrites9.3%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
Applied rewrites8.9%
lift-sqrt.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
associate-*l*N/A
sqrt-prodN/A
lower-unsound-sqrt.f64N/A
lower-sqrt.f64N/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lower-unsound-*.f64N/A
lower-fabs.f64N/A
lower-unsound-sqrt.f64N/A
lower-*.f64N/A
lower-/.f6410.6%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6410.6%
Applied rewrites10.6%
Taylor expanded in D around 0
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-fabs.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-/.f6412.8%
Applied rewrites12.8%
if -2e3 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 80.1%
Taylor expanded in M around 0
Applied rewrites68.8%
(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.1%
Taylor expanded in M around 0
Applied rewrites68.8%
herbie shell --seed 2025213
(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))))))