
(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 11 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) D))
(t_1 (fmax (fabs M) D))
(t_2 (* (/ t_1 d) t_0))
(t_3 (* t_1 t_0)))
(if (<= l -4e-310)
(* w0 (/ (sqrt (fma t_2 (* (* t_2 0.25) h) (- l))) (sqrt (- l))))
(if (<= l 5e+131)
(* w0 (/ (sqrt (- (* 1.0 l) (* (* (* 0.25 t_2) t_2) h))) (sqrt l)))
(*
w0
(sqrt (- 1.0 (/ (* (/ (* h t_3) (* l (+ d d))) t_3) (+ d d)))))))))double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = fmin(fabs(M), D);
double t_1 = fmax(fabs(M), D);
double t_2 = (t_1 / d) * t_0;
double t_3 = t_1 * t_0;
double tmp;
if (l <= -4e-310) {
tmp = w0 * (sqrt(fma(t_2, ((t_2 * 0.25) * h), -l)) / sqrt(-l));
} else if (l <= 5e+131) {
tmp = w0 * (sqrt(((1.0 * l) - (((0.25 * t_2) * t_2) * h))) / sqrt(l));
} else {
tmp = w0 * sqrt((1.0 - ((((h * t_3) / (l * (d + d))) * t_3) / (d + d))));
}
return tmp;
}
function code(w0, M, D, h, l, d) t_0 = fmin(abs(M), D) t_1 = fmax(abs(M), D) t_2 = Float64(Float64(t_1 / d) * t_0) t_3 = Float64(t_1 * t_0) tmp = 0.0 if (l <= -4e-310) tmp = Float64(w0 * Float64(sqrt(fma(t_2, Float64(Float64(t_2 * 0.25) * h), Float64(-l))) / sqrt(Float64(-l)))); elseif (l <= 5e+131) tmp = Float64(w0 * Float64(sqrt(Float64(Float64(1.0 * l) - Float64(Float64(Float64(0.25 * t_2) * t_2) * h))) / sqrt(l))); else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(Float64(Float64(h * t_3) / Float64(l * Float64(d + d))) * t_3) / Float64(d + d))))); end return tmp end
code[w0_, M_, D_, h_, l_, d_] := Block[{t$95$0 = N[Min[N[Abs[M], $MachinePrecision], D], $MachinePrecision]}, Block[{t$95$1 = N[Max[N[Abs[M], $MachinePrecision], D], $MachinePrecision]}, Block[{t$95$2 = N[(N[(t$95$1 / d), $MachinePrecision] * t$95$0), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$1 * t$95$0), $MachinePrecision]}, If[LessEqual[l, -4e-310], N[(w0 * N[(N[Sqrt[N[(t$95$2 * N[(N[(t$95$2 * 0.25), $MachinePrecision] * h), $MachinePrecision] + (-l)), $MachinePrecision]], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 5e+131], N[(w0 * N[(N[Sqrt[N[(N[(1.0 * l), $MachinePrecision] - N[(N[(N[(0.25 * t$95$2), $MachinePrecision] * t$95$2), $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(N[(N[(h * t$95$3), $MachinePrecision] / N[(l * N[(d + d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$3), $MachinePrecision] / N[(d + d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
t_0 := \mathsf{min}\left(\left|M\right|, D\right)\\
t_1 := \mathsf{max}\left(\left|M\right|, D\right)\\
t_2 := \frac{t\_1}{d} \cdot t\_0\\
t_3 := t\_1 \cdot t\_0\\
\mathbf{if}\;\ell \leq -4 \cdot 10^{-310}:\\
\;\;\;\;w0 \cdot \frac{\sqrt{\mathsf{fma}\left(t\_2, \left(t\_2 \cdot 0.25\right) \cdot h, -\ell\right)}}{\sqrt{-\ell}}\\
\mathbf{elif}\;\ell \leq 5 \cdot 10^{+131}:\\
\;\;\;\;w0 \cdot \frac{\sqrt{1 \cdot \ell - \left(\left(0.25 \cdot t\_2\right) \cdot t\_2\right) \cdot h}}{\sqrt{\ell}}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{\frac{h \cdot t\_3}{\ell \cdot \left(d + d\right)} \cdot t\_3}{d + d}}\\
\end{array}
if l < -3.9999999999999878e-310Initial program 80.9%
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.4%
Applied rewrites44.1%
lift-fma.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-lft-identity45.4%
Applied rewrites45.4%
if -3.9999999999999878e-310 < l < 5e131Initial program 80.9%
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.4%
Applied rewrites43.4%
if 5e131 < l Initial program 80.9%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites84.0%
(FPCore (w0 M D h l d)
:precision binary64
(let* ((t_0 (fmin (fabs M) D))
(t_1 (fmax (fabs M) D))
(t_2 (* t_0 t_1))
(t_3 (/ (* t_1 t_0) (fabs d))))
(if (<=
(sqrt (- 1.0 (* (pow (/ t_2 (* 2.0 (fabs d))) 2.0) (/ h l))))
2e+124)
(* w0 (sqrt (- 1.0 (* (/ (* t_3 t_3) 4.0) (/ h l)))))
(*
w0
(/
(sqrt
(fma
2.0
(fabs d)
(/ (* (* (* t_2 h) t_0) t_1) (* (* -2.0 (fabs d)) l))))
(sqrt (+ (fabs d) (fabs d))))))))double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = fmin(fabs(M), D);
double t_1 = fmax(fabs(M), D);
double t_2 = t_0 * t_1;
double t_3 = (t_1 * t_0) / fabs(d);
double tmp;
if (sqrt((1.0 - (pow((t_2 / (2.0 * fabs(d))), 2.0) * (h / l)))) <= 2e+124) {
tmp = w0 * sqrt((1.0 - (((t_3 * t_3) / 4.0) * (h / l))));
} else {
tmp = w0 * (sqrt(fma(2.0, fabs(d), ((((t_2 * h) * t_0) * t_1) / ((-2.0 * fabs(d)) * l)))) / sqrt((fabs(d) + fabs(d))));
}
return tmp;
}
function code(w0, M, D, h, l, d) t_0 = fmin(abs(M), D) t_1 = fmax(abs(M), D) t_2 = Float64(t_0 * t_1) t_3 = Float64(Float64(t_1 * t_0) / abs(d)) tmp = 0.0 if (sqrt(Float64(1.0 - Float64((Float64(t_2 / Float64(2.0 * abs(d))) ^ 2.0) * Float64(h / l)))) <= 2e+124) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(Float64(t_3 * t_3) / 4.0) * Float64(h / l))))); else tmp = Float64(w0 * Float64(sqrt(fma(2.0, abs(d), Float64(Float64(Float64(Float64(t_2 * h) * t_0) * t_1) / Float64(Float64(-2.0 * abs(d)) * l)))) / sqrt(Float64(abs(d) + abs(d))))); end return tmp end
code[w0_, M_, D_, h_, l_, d_] := Block[{t$95$0 = N[Min[N[Abs[M], $MachinePrecision], D], $MachinePrecision]}, Block[{t$95$1 = N[Max[N[Abs[M], $MachinePrecision], D], $MachinePrecision]}, Block[{t$95$2 = N[(t$95$0 * t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(N[(t$95$1 * t$95$0), $MachinePrecision] / N[Abs[d], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[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], 2e+124], N[(w0 * 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], N[(w0 * N[(N[Sqrt[N[(2.0 * N[Abs[d], $MachinePrecision] + N[(N[(N[(N[(t$95$2 * h), $MachinePrecision] * t$95$0), $MachinePrecision] * t$95$1), $MachinePrecision] / N[(N[(-2.0 * N[Abs[d], $MachinePrecision]), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(N[Abs[d], $MachinePrecision] + N[Abs[d], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
t_0 := \mathsf{min}\left(\left|M\right|, D\right)\\
t_1 := \mathsf{max}\left(\left|M\right|, D\right)\\
t_2 := t\_0 \cdot t\_1\\
t_3 := \frac{t\_1 \cdot t\_0}{\left|d\right|}\\
\mathbf{if}\;\sqrt{1 - {\left(\frac{t\_2}{2 \cdot \left|d\right|}\right)}^{2} \cdot \frac{h}{\ell}} \leq 2 \cdot 10^{+124}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{t\_3 \cdot t\_3}{4} \cdot \frac{h}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \frac{\sqrt{\mathsf{fma}\left(2, \left|d\right|, \frac{\left(\left(t\_2 \cdot h\right) \cdot t\_0\right) \cdot t\_1}{\left(-2 \cdot \left|d\right|\right) \cdot \ell}\right)}}{\sqrt{\left|d\right| + \left|d\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)))) < 1.9999999999999999e124Initial program 80.9%
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 rewrites81.2%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
*-commutativeN/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6480.3%
Applied rewrites80.3%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
*-commutativeN/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6480.9%
Applied rewrites80.9%
if 1.9999999999999999e124 < (sqrt.f64 (-.f64 #s(literal 1 binary64) (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)))) Initial program 80.9%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites84.0%
lift-sqrt.f64N/A
lift--.f64N/A
lift-/.f64N/A
sub-to-fractionN/A
sqrt-divN/A
lower-unsound-/.f64N/A
Applied rewrites39.9%
(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 (<= (pow (/ (* t_1 t_0) (* 2.0 d)) 2.0) 5e+138)
(* w0 (sqrt (- 1.0 (/ (* (* (* 0.25 t_3) t_3) h) l))))
(* w0 (sqrt (- 1.0 (/ (* (/ (* h t_2) (* l (+ d d))) t_2) (+ d d))))))))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 (pow(((t_1 * t_0) / (2.0 * d)), 2.0) <= 5e+138) {
tmp = w0 * sqrt((1.0 - ((((0.25 * t_3) * t_3) * h) / l)));
} else {
tmp = w0 * sqrt((1.0 - ((((h * t_2) / (l * (d + d))) * t_2) / (d + d))));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(w0, m, d, h, l, d_1)
use fmin_fmax_functions
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_1
real(8) :: 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_0 * t_1
t_3 = (t_0 / d_1) * t_1
if ((((t_1 * t_0) / (2.0d0 * d_1)) ** 2.0d0) <= 5d+138) then
tmp = w0 * sqrt((1.0d0 - ((((0.25d0 * t_3) * t_3) * h) / l)))
else
tmp = w0 * sqrt((1.0d0 - ((((h * t_2) / (l * (d_1 + d_1))) * t_2) / (d_1 + d_1))))
end if
code = tmp
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = fmax(Math.abs(M), Math.abs(D));
double t_1 = fmin(Math.abs(M), Math.abs(D));
double t_2 = t_0 * t_1;
double t_3 = (t_0 / d) * t_1;
double tmp;
if (Math.pow(((t_1 * t_0) / (2.0 * d)), 2.0) <= 5e+138) {
tmp = w0 * Math.sqrt((1.0 - ((((0.25 * t_3) * t_3) * h) / l)));
} else {
tmp = w0 * Math.sqrt((1.0 - ((((h * t_2) / (l * (d + d))) * t_2) / (d + d))));
}
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_0 * t_1 t_3 = (t_0 / d) * t_1 tmp = 0 if math.pow(((t_1 * t_0) / (2.0 * d)), 2.0) <= 5e+138: tmp = w0 * math.sqrt((1.0 - ((((0.25 * t_3) * t_3) * h) / l))) else: tmp = w0 * math.sqrt((1.0 - ((((h * t_2) / (l * (d + d))) * t_2) / (d + d)))) 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 ((Float64(Float64(t_1 * t_0) / Float64(2.0 * d)) ^ 2.0) <= 5e+138) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(Float64(Float64(0.25 * t_3) * t_3) * h) / l)))); else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(Float64(Float64(h * t_2) / Float64(l * Float64(d + d))) * t_2) / Float64(d + d))))); 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_0 * t_1; t_3 = (t_0 / d) * t_1; tmp = 0.0; if ((((t_1 * t_0) / (2.0 * d)) ^ 2.0) <= 5e+138) tmp = w0 * sqrt((1.0 - ((((0.25 * t_3) * t_3) * h) / l))); else tmp = w0 * sqrt((1.0 - ((((h * t_2) / (l * (d + d))) * t_2) / (d + d)))); 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$0 * t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(N[(t$95$0 / d), $MachinePrecision] * t$95$1), $MachinePrecision]}, If[LessEqual[N[Power[N[(N[(t$95$1 * t$95$0), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], 5e+138], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(N[(N[(0.25 * t$95$3), $MachinePrecision] * t$95$3), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(N[(N[(h * t$95$2), $MachinePrecision] / N[(l * N[(d + d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision] / N[(d + d), $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}\;{\left(\frac{t\_1 \cdot t\_0}{2 \cdot d}\right)}^{2} \leq 5 \cdot 10^{+138}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{\left(\left(0.25 \cdot t\_3\right) \cdot t\_3\right) \cdot h}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{\frac{h \cdot t\_2}{\ell \cdot \left(d + d\right)} \cdot t\_2}{d + d}}\\
\end{array}
if (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) < 5.0000000000000002e138Initial program 80.9%
lift-pow.f64N/A
unpow2N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
frac-timesN/A
lift-*.f64N/A
lower-/.f64N/A
Applied rewrites79.4%
Applied rewrites86.3%
if 5.0000000000000002e138 < (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) Initial program 80.9%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites84.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_1 (fabs d)) t_0)))
(if (<= (/ (* t_0 t_1) (* 2.0 (fabs d))) 2e+69)
(* w0 (sqrt (- 1.0 (/ (* (* (* 0.25 t_3) t_3) h) l))))
(*
w0
(sqrt
(fma
(/ (* h t_2) (* l (+ (fabs d) (fabs d))))
(* (/ -0.5 (fabs d)) t_2)
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_1 / fabs(d)) * t_0;
double tmp;
if (((t_0 * t_1) / (2.0 * fabs(d))) <= 2e+69) {
tmp = w0 * sqrt((1.0 - ((((0.25 * t_3) * t_3) * h) / l)));
} else {
tmp = w0 * sqrt(fma(((h * t_2) / (l * (fabs(d) + fabs(d)))), ((-0.5 / fabs(d)) * t_2), 1.0));
}
return 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(Float64(t_1 / abs(d)) * t_0) tmp = 0.0 if (Float64(Float64(t_0 * t_1) / Float64(2.0 * abs(d))) <= 2e+69) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(Float64(Float64(0.25 * t_3) * t_3) * h) / l)))); else tmp = Float64(w0 * sqrt(fma(Float64(Float64(h * t_2) / Float64(l * Float64(abs(d) + abs(d)))), Float64(Float64(-0.5 / abs(d)) * t_2), 1.0))); end return tmp end
code[w0_, M_, D_, h_, l_, d_] := Block[{t$95$0 = N[Min[N[Abs[M], $MachinePrecision], N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[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[(N[(t$95$1 / N[Abs[d], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]}, If[LessEqual[N[(N[(t$95$0 * t$95$1), $MachinePrecision] / N[(2.0 * N[Abs[d], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2e+69], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(N[(N[(0.25 * t$95$3), $MachinePrecision] * t$95$3), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(N[(N[(h * t$95$2), $MachinePrecision] / N[(l * N[(N[Abs[d], $MachinePrecision] + N[Abs[d], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(-0.5 / N[Abs[d], $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision] + 1.0), $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 := \frac{t\_1}{\left|d\right|} \cdot t\_0\\
\mathbf{if}\;\frac{t\_0 \cdot t\_1}{2 \cdot \left|d\right|} \leq 2 \cdot 10^{+69}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{\left(\left(0.25 \cdot t\_3\right) \cdot t\_3\right) \cdot h}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(\frac{h \cdot t\_2}{\ell \cdot \left(\left|d\right| + \left|d\right|\right)}, \frac{-0.5}{\left|d\right|} \cdot t\_2, 1\right)}\\
\end{array}
if (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) < 2.0000000000000001e69Initial program 80.9%
lift-pow.f64N/A
unpow2N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
frac-timesN/A
lift-*.f64N/A
lower-/.f64N/A
Applied rewrites79.4%
Applied rewrites86.3%
if 2.0000000000000001e69 < (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) Initial program 80.9%
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.4%
(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_0 t_1))
(t_3 (* (/ t_1 (fabs d)) t_0)))
(if (<= (/ t_2 (* 2.0 (fabs d))) 1e+89)
(* w0 (sqrt (- 1.0 (/ (* (* (* 0.25 t_3) t_3) h) l))))
(*
w0
(sqrt
(- 1.0 (/ (/ (* (* (* t_2 0.25) t_2) h) (* (fabs d) l)) (fabs d))))))))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_0 * t_1;
double t_3 = (t_1 / fabs(d)) * t_0;
double tmp;
if ((t_2 / (2.0 * fabs(d))) <= 1e+89) {
tmp = w0 * sqrt((1.0 - ((((0.25 * t_3) * t_3) * h) / l)));
} else {
tmp = w0 * sqrt((1.0 - (((((t_2 * 0.25) * t_2) * h) / (fabs(d) * l)) / fabs(d))));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(w0, m, d, h, l, d_1)
use fmin_fmax_functions
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = fmin(abs(m), abs(d))
t_1 = fmax(abs(m), abs(d))
t_2 = t_0 * t_1
t_3 = (t_1 / abs(d_1)) * t_0
if ((t_2 / (2.0d0 * abs(d_1))) <= 1d+89) then
tmp = w0 * sqrt((1.0d0 - ((((0.25d0 * t_3) * t_3) * h) / l)))
else
tmp = w0 * sqrt((1.0d0 - (((((t_2 * 0.25d0) * t_2) * h) / (abs(d_1) * l)) / abs(d_1))))
end if
code = tmp
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = fmin(Math.abs(M), Math.abs(D));
double t_1 = fmax(Math.abs(M), Math.abs(D));
double t_2 = t_0 * t_1;
double t_3 = (t_1 / Math.abs(d)) * t_0;
double tmp;
if ((t_2 / (2.0 * Math.abs(d))) <= 1e+89) {
tmp = w0 * Math.sqrt((1.0 - ((((0.25 * t_3) * t_3) * h) / l)));
} else {
tmp = w0 * Math.sqrt((1.0 - (((((t_2 * 0.25) * t_2) * h) / (Math.abs(d) * l)) / Math.abs(d))));
}
return tmp;
}
def code(w0, M, D, h, l, d): t_0 = fmin(math.fabs(M), math.fabs(D)) t_1 = fmax(math.fabs(M), math.fabs(D)) t_2 = t_0 * t_1 t_3 = (t_1 / math.fabs(d)) * t_0 tmp = 0 if (t_2 / (2.0 * math.fabs(d))) <= 1e+89: tmp = w0 * math.sqrt((1.0 - ((((0.25 * t_3) * t_3) * h) / l))) else: tmp = w0 * math.sqrt((1.0 - (((((t_2 * 0.25) * t_2) * h) / (math.fabs(d) * l)) / math.fabs(d)))) return 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_0 * t_1) t_3 = Float64(Float64(t_1 / abs(d)) * t_0) tmp = 0.0 if (Float64(t_2 / Float64(2.0 * abs(d))) <= 1e+89) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(Float64(Float64(0.25 * t_3) * t_3) * h) / l)))); else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(Float64(Float64(Float64(t_2 * 0.25) * t_2) * h) / Float64(abs(d) * l)) / abs(d))))); end return tmp end
function tmp_2 = code(w0, M, D, h, l, d) t_0 = min(abs(M), abs(D)); t_1 = max(abs(M), abs(D)); t_2 = t_0 * t_1; t_3 = (t_1 / abs(d)) * t_0; tmp = 0.0; if ((t_2 / (2.0 * abs(d))) <= 1e+89) tmp = w0 * sqrt((1.0 - ((((0.25 * t_3) * t_3) * h) / l))); else tmp = w0 * sqrt((1.0 - (((((t_2 * 0.25) * t_2) * h) / (abs(d) * l)) / abs(d)))); end tmp_2 = 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$0 * t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(N[(t$95$1 / N[Abs[d], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]}, If[LessEqual[N[(t$95$2 / N[(2.0 * N[Abs[d], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1e+89], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(N[(N[(0.25 * t$95$3), $MachinePrecision] * t$95$3), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(N[(N[(N[(t$95$2 * 0.25), $MachinePrecision] * t$95$2), $MachinePrecision] * h), $MachinePrecision] / N[(N[Abs[d], $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] / N[Abs[d], $MachinePrecision]), $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\_0 \cdot t\_1\\
t_3 := \frac{t\_1}{\left|d\right|} \cdot t\_0\\
\mathbf{if}\;\frac{t\_2}{2 \cdot \left|d\right|} \leq 10^{+89}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{\left(\left(0.25 \cdot t\_3\right) \cdot t\_3\right) \cdot h}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{\frac{\left(\left(t\_2 \cdot 0.25\right) \cdot t\_2\right) \cdot h}{\left|d\right| \cdot \ell}}{\left|d\right|}}\\
\end{array}
if (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) < 9.9999999999999999e88Initial program 80.9%
lift-pow.f64N/A
unpow2N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
frac-timesN/A
lift-*.f64N/A
lower-/.f64N/A
Applied rewrites79.4%
Applied rewrites86.3%
if 9.9999999999999999e88 < (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) Initial program 80.9%
lift-pow.f64N/A
unpow2N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
frac-timesN/A
lift-*.f64N/A
lower-/.f64N/A
Applied rewrites79.4%
Applied rewrites86.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
Applied rewrites77.9%
(FPCore (w0 M D h l d)
:precision binary64
(let* ((t_0 (fmax (fabs M) D))
(t_1 (fmin (fabs M) D))
(t_2 (* t_1 t_0))
(t_3 (* (/ t_0 d) t_1)))
(if (<= (- 1.0 (* (pow (/ t_2 (* 2.0 d)) 2.0) (/ h l))) 1e+214)
(* (sqrt (fma (* (* t_3 t_3) -0.25) (/ h l) 1.0)) w0)
(* w0 (sqrt (- 1.0 (/ (/ (* (* (* t_2 0.25) t_2) h) (* d l)) d)))))))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 t_2 = t_1 * t_0;
double t_3 = (t_0 / d) * t_1;
double tmp;
if ((1.0 - (pow((t_2 / (2.0 * d)), 2.0) * (h / l))) <= 1e+214) {
tmp = sqrt(fma(((t_3 * t_3) * -0.25), (h / l), 1.0)) * w0;
} else {
tmp = w0 * sqrt((1.0 - (((((t_2 * 0.25) * t_2) * h) / (d * l)) / d)));
}
return tmp;
}
function code(w0, M, D, h, l, d) t_0 = fmax(abs(M), D) t_1 = fmin(abs(M), D) t_2 = Float64(t_1 * t_0) t_3 = Float64(Float64(t_0 / d) * t_1) tmp = 0.0 if (Float64(1.0 - Float64((Float64(t_2 / Float64(2.0 * d)) ^ 2.0) * Float64(h / l))) <= 1e+214) tmp = Float64(sqrt(fma(Float64(Float64(t_3 * t_3) * -0.25), Float64(h / l), 1.0)) * w0); else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(Float64(Float64(Float64(t_2 * 0.25) * t_2) * h) / Float64(d * l)) / d)))); end return 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]}, Block[{t$95$2 = N[(t$95$1 * t$95$0), $MachinePrecision]}, Block[{t$95$3 = N[(N[(t$95$0 / d), $MachinePrecision] * t$95$1), $MachinePrecision]}, If[LessEqual[N[(1.0 - N[(N[Power[N[(t$95$2 / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1e+214], N[(N[Sqrt[N[(N[(N[(t$95$3 * t$95$3), $MachinePrecision] * -0.25), $MachinePrecision] * N[(h / l), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision] * w0), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(N[(N[(N[(t$95$2 * 0.25), $MachinePrecision] * t$95$2), $MachinePrecision] * h), $MachinePrecision] / N[(d * l), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]], $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)\\
t_2 := t\_1 \cdot t\_0\\
t_3 := \frac{t\_0}{d} \cdot t\_1\\
\mathbf{if}\;1 - {\left(\frac{t\_2}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq 10^{+214}:\\
\;\;\;\;\sqrt{\mathsf{fma}\left(\left(t\_3 \cdot t\_3\right) \cdot -0.25, \frac{h}{\ell}, 1\right)} \cdot w0\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{\frac{\left(\left(t\_2 \cdot 0.25\right) \cdot t\_2\right) \cdot h}{d \cdot \ell}}{d}}\\
\end{array}
if (-.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))) < 9.9999999999999995e213Initial program 80.9%
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 rewrites81.2%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6481.2%
Applied rewrites61.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
lift-/.f64N/A
lift-/.f64N/A
unswap-sqrN/A
lift-*.f64N/A
lift-*.f64N/A
lower-*.f6481.2%
Applied rewrites81.2%
if 9.9999999999999995e213 < (-.f64 #s(literal 1 binary64) (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l))) Initial program 80.9%
lift-pow.f64N/A
unpow2N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
frac-timesN/A
lift-*.f64N/A
lower-/.f64N/A
Applied rewrites79.4%
Applied rewrites86.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
Applied rewrites77.9%
(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 d) t_1)))
(if (<= (- 1.0 (* (pow (/ (* t_1 t_0) (* 2.0 d)) 2.0) (/ h l))) 1e+214)
(* (sqrt (fma (* (* t_2 t_2) -0.25) (/ h l) 1.0)) w0)
(*
w0
(sqrt
(-
1.0
(/ (* (/ (* (* (* (* t_0 t_0) t_1) t_1) 0.25) d) h) (* d l))))))))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 / d) * t_1;
double tmp;
if ((1.0 - (pow(((t_1 * t_0) / (2.0 * d)), 2.0) * (h / l))) <= 1e+214) {
tmp = sqrt(fma(((t_2 * t_2) * -0.25), (h / l), 1.0)) * w0;
} else {
tmp = w0 * sqrt((1.0 - (((((((t_0 * t_0) * t_1) * t_1) * 0.25) / d) * h) / (d * l))));
}
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_0 / d) * t_1) tmp = 0.0 if (Float64(1.0 - Float64((Float64(Float64(t_1 * t_0) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l))) <= 1e+214) tmp = Float64(sqrt(fma(Float64(Float64(t_2 * t_2) * -0.25), Float64(h / l), 1.0)) * w0); else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(Float64(Float64(Float64(Float64(Float64(t_0 * t_0) * t_1) * t_1) * 0.25) / d) * h) / Float64(d * l))))); 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$0 / d), $MachinePrecision] * t$95$1), $MachinePrecision]}, If[LessEqual[N[(1.0 - 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]), $MachinePrecision], 1e+214], N[(N[Sqrt[N[(N[(N[(t$95$2 * t$95$2), $MachinePrecision] * -0.25), $MachinePrecision] * N[(h / l), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision] * w0), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(N[(N[(N[(N[(N[(t$95$0 * t$95$0), $MachinePrecision] * t$95$1), $MachinePrecision] * t$95$1), $MachinePrecision] * 0.25), $MachinePrecision] / d), $MachinePrecision] * h), $MachinePrecision] / N[(d * l), $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 := \frac{t\_0}{d} \cdot t\_1\\
\mathbf{if}\;1 - {\left(\frac{t\_1 \cdot t\_0}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq 10^{+214}:\\
\;\;\;\;\sqrt{\mathsf{fma}\left(\left(t\_2 \cdot t\_2\right) \cdot -0.25, \frac{h}{\ell}, 1\right)} \cdot w0\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{\frac{\left(\left(\left(t\_0 \cdot t\_0\right) \cdot t\_1\right) \cdot t\_1\right) \cdot 0.25}{d} \cdot h}{d \cdot \ell}}\\
\end{array}
if (-.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))) < 9.9999999999999995e213Initial program 80.9%
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 rewrites81.2%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6481.2%
Applied rewrites61.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
lift-/.f64N/A
lift-/.f64N/A
unswap-sqrN/A
lift-*.f64N/A
lift-*.f64N/A
lower-*.f6481.2%
Applied rewrites81.2%
if 9.9999999999999995e213 < (-.f64 #s(literal 1 binary64) (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l))) Initial program 80.9%
lift-*.f64N/A
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.1%
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
lower-*.f64N/A
lower-*.f6476.9%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lower-*.f6471.1%
Applied rewrites71.1%
(FPCore (w0 M D h l d)
:precision binary64
(let* ((t_0 (fmax (fabs M) D))
(t_1 (fmin (fabs M) D))
(t_2 (* (/ t_0 d) t_1)))
(if (<= (* (pow (/ (* t_1 t_0) (* 2.0 d)) 2.0) (/ h l)) -0.01)
(* (sqrt (fma (* (* t_2 t_2) -0.25) (/ h l) 1.0)) w0)
(* w0 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 t_2 = (t_0 / d) * t_1;
double tmp;
if ((pow(((t_1 * t_0) / (2.0 * d)), 2.0) * (h / l)) <= -0.01) {
tmp = sqrt(fma(((t_2 * t_2) * -0.25), (h / l), 1.0)) * w0;
} else {
tmp = w0 * 1.0;
}
return tmp;
}
function code(w0, M, D, h, l, d) t_0 = fmax(abs(M), D) t_1 = fmin(abs(M), D) t_2 = Float64(Float64(t_0 / d) * t_1) tmp = 0.0 if (Float64((Float64(Float64(t_1 * t_0) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) <= -0.01) tmp = Float64(sqrt(fma(Float64(Float64(t_2 * t_2) * -0.25), Float64(h / l), 1.0)) * w0); else tmp = Float64(w0 * 1.0); end return 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]}, Block[{t$95$2 = N[(N[(t$95$0 / d), $MachinePrecision] * t$95$1), $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], -0.01], N[(N[Sqrt[N[(N[(N[(t$95$2 * t$95$2), $MachinePrecision] * -0.25), $MachinePrecision] * N[(h / l), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision] * w0), $MachinePrecision], N[(w0 * 1.0), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := \mathsf{max}\left(\left|M\right|, D\right)\\
t_1 := \mathsf{min}\left(\left|M\right|, D\right)\\
t_2 := \frac{t\_0}{d} \cdot t\_1\\
\mathbf{if}\;{\left(\frac{t\_1 \cdot t\_0}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -0.01:\\
\;\;\;\;\sqrt{\mathsf{fma}\left(\left(t\_2 \cdot t\_2\right) \cdot -0.25, \frac{h}{\ell}, 1\right)} \cdot w0\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot 1\\
\end{array}
if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -0.01Initial program 80.9%
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 rewrites81.2%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6481.2%
Applied rewrites61.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
lift-/.f64N/A
lift-/.f64N/A
unswap-sqrN/A
lift-*.f64N/A
lift-*.f64N/A
lower-*.f6481.2%
Applied rewrites81.2%
if -0.01 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 80.9%
Taylor expanded in M around 0
Applied rewrites67.3%
(FPCore (w0 M D h l d) :precision binary64 (if (<= (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l)) -5e+23) (* w0 (sqrt (fma -0.25 (/ (/ (* (* M D) (* (* M D) h)) (* d d)) l) 1.0))) (* w0 1.0)))
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -5e+23) {
tmp = w0 * sqrt(fma(-0.25, ((((M * D) * ((M * D) * h)) / (d * d)) / l), 1.0));
} else {
tmp = w0 * 1.0;
}
return tmp;
}
function code(w0, M, D, h, l, d) tmp = 0.0 if (Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) <= -5e+23) tmp = Float64(w0 * sqrt(fma(-0.25, Float64(Float64(Float64(Float64(M * D) * Float64(Float64(M * D) * h)) / Float64(d * d)) / l), 1.0))); else tmp = Float64(w0 * 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], -5e+23], N[(w0 * N[Sqrt[N[(-0.25 * N[(N[(N[(N[(M * D), $MachinePrecision] * N[(N[(M * D), $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision] / N[(d * d), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * 1.0), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -5 \cdot 10^{+23}:\\
\;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(-0.25, \frac{\frac{\left(M \cdot D\right) \cdot \left(\left(M \cdot D\right) \cdot h\right)}{d \cdot d}}{\ell}, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot 1\\
\end{array}
if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -4.9999999999999999e23Initial program 80.9%
lift-pow.f64N/A
unpow2N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
frac-timesN/A
lift-*.f64N/A
lower-/.f64N/A
Applied rewrites79.4%
Applied rewrites86.3%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
Applied rewrites74.2%
if -4.9999999999999999e23 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 80.9%
Taylor expanded in M around 0
Applied rewrites67.3%
(FPCore (w0 M D h l d)
:precision binary64
(let* ((t_0 (fmax (fabs M) D)) (t_1 (fmin (fabs M) D)) (t_2 (* t_1 t_0)))
(if (<= (* (pow (/ t_2 (* 2.0 d)) 2.0) (/ h l)) -1e+46)
(* (sqrt (fma (* (* (* t_2 (/ t_0 (* d d))) t_1) -0.25) (/ h l) 1.0)) w0)
(* w0 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 t_2 = t_1 * t_0;
double tmp;
if ((pow((t_2 / (2.0 * d)), 2.0) * (h / l)) <= -1e+46) {
tmp = sqrt(fma((((t_2 * (t_0 / (d * d))) * t_1) * -0.25), (h / l), 1.0)) * w0;
} else {
tmp = w0 * 1.0;
}
return tmp;
}
function code(w0, M, D, h, l, d) t_0 = fmax(abs(M), D) t_1 = fmin(abs(M), D) t_2 = Float64(t_1 * t_0) tmp = 0.0 if (Float64((Float64(t_2 / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) <= -1e+46) tmp = Float64(sqrt(fma(Float64(Float64(Float64(t_2 * Float64(t_0 / Float64(d * d))) * t_1) * -0.25), Float64(h / l), 1.0)) * w0); else tmp = Float64(w0 * 1.0); end return 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]}, Block[{t$95$2 = N[(t$95$1 * t$95$0), $MachinePrecision]}, If[LessEqual[N[(N[Power[N[(t$95$2 / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -1e+46], N[(N[Sqrt[N[(N[(N[(N[(t$95$2 * N[(t$95$0 / N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] * -0.25), $MachinePrecision] * N[(h / l), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision] * w0), $MachinePrecision], N[(w0 * 1.0), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := \mathsf{max}\left(\left|M\right|, D\right)\\
t_1 := \mathsf{min}\left(\left|M\right|, D\right)\\
t_2 := t\_1 \cdot t\_0\\
\mathbf{if}\;{\left(\frac{t\_2}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -1 \cdot 10^{+46}:\\
\;\;\;\;\sqrt{\mathsf{fma}\left(\left(\left(t\_2 \cdot \frac{t\_0}{d \cdot d}\right) \cdot t\_1\right) \cdot -0.25, \frac{h}{\ell}, 1\right)} \cdot w0\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot 1\\
\end{array}
if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -9.9999999999999999e45Initial program 80.9%
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 rewrites81.2%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6481.2%
Applied rewrites61.8%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
lift-*.f64N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6470.3%
Applied rewrites70.3%
if -9.9999999999999999e45 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 80.9%
Taylor expanded in M around 0
Applied rewrites67.3%
(FPCore (w0 M D h l d) :precision binary64 (* w0 1.0))
double code(double w0, double M, double D, double h, double l, double d) {
return w0 * 1.0;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(w0, m, d, h, l, d_1)
use fmin_fmax_functions
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_1
code = w0 * 1.0d0
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
return w0 * 1.0;
}
def code(w0, M, D, h, l, d): return w0 * 1.0
function code(w0, M, D, h, l, d) return Float64(w0 * 1.0) end
function tmp = code(w0, M, D, h, l, d) tmp = w0 * 1.0; end
code[w0_, M_, D_, h_, l_, d_] := N[(w0 * 1.0), $MachinePrecision]
w0 \cdot 1
Initial program 80.9%
Taylor expanded in M around 0
Applied rewrites67.3%
herbie shell --seed 2025189
(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))))))