
(FPCore (d h l M D) :precision binary64 (* (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))) (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
double code(double d, double h, double l, double M, double D) {
return (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.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(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
end function
public static double code(double d, double h, double l, double M, double D) {
return (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
def code(d, h, l, M, D): return (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))
function code(d, h, l, M, D) return Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) end
function tmp = code(d, h, l, M, D) tmp = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); end
code[d_, h_, l_, M_, D_] := N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)
Herbie found 17 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (d h l M D) :precision binary64 (* (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))) (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
double code(double d, double h, double l, double M, double D) {
return (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.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(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
end function
public static double code(double d, double h, double l, double M, double D) {
return (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
def code(d, h, l, M, D): return (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))
function code(d, h, l, M, D) return Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) end
function tmp = code(d, h, l, M, D) tmp = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); end
code[d_, h_, l_, M_, D_] := N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (/ (* M D) d))
(t_1
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
(t_2 (* (sqrt (/ d l)) (sqrt (/ d h))))
(t_3
(*
(fma (/ (* h (* D M)) (* (- l) (+ d d))) (* 0.25 (/ (* D M) d)) 1.0)
(/ (fabs d) (sqrt (* h l))))))
(if (<= t_1 -2e-158)
(* t_2 (fma (* t_0 0.25) (* (* (/ D (+ d d)) M) (/ (- h) l)) 1.0))
(if (<= t_1 0.0)
t_3
(if (<= t_1 5e+187)
(* t_2 (fma (/ h l) (* -0.125 (/ (* t_0 (* M D)) d)) 1.0))
t_3)))))double code(double d, double h, double l, double M, double D) {
double t_0 = (M * D) / d;
double t_1 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double t_2 = sqrt((d / l)) * sqrt((d / h));
double t_3 = fma(((h * (D * M)) / (-l * (d + d))), (0.25 * ((D * M) / d)), 1.0) * (fabs(d) / sqrt((h * l)));
double tmp;
if (t_1 <= -2e-158) {
tmp = t_2 * fma((t_0 * 0.25), (((D / (d + d)) * M) * (-h / l)), 1.0);
} else if (t_1 <= 0.0) {
tmp = t_3;
} else if (t_1 <= 5e+187) {
tmp = t_2 * fma((h / l), (-0.125 * ((t_0 * (M * D)) / d)), 1.0);
} else {
tmp = t_3;
}
return tmp;
}
function code(d, h, l, M, D) t_0 = Float64(Float64(M * D) / d) t_1 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) t_2 = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) t_3 = Float64(fma(Float64(Float64(h * Float64(D * M)) / Float64(Float64(-l) * Float64(d + d))), Float64(0.25 * Float64(Float64(D * M) / d)), 1.0) * Float64(abs(d) / sqrt(Float64(h * l)))) tmp = 0.0 if (t_1 <= -2e-158) tmp = Float64(t_2 * fma(Float64(t_0 * 0.25), Float64(Float64(Float64(D / Float64(d + d)) * M) * Float64(Float64(-h) / l)), 1.0)); elseif (t_1 <= 0.0) tmp = t_3; elseif (t_1 <= 5e+187) tmp = Float64(t_2 * fma(Float64(h / l), Float64(-0.125 * Float64(Float64(t_0 * Float64(M * D)) / d)), 1.0)); else tmp = t_3; end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(M * D), $MachinePrecision] / d), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(N[(h * N[(D * M), $MachinePrecision]), $MachinePrecision] / N[((-l) * N[(d + d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(0.25 * N[(N[(D * M), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e-158], N[(t$95$2 * N[(N[(t$95$0 * 0.25), $MachinePrecision] * N[(N[(N[(D / N[(d + d), $MachinePrecision]), $MachinePrecision] * M), $MachinePrecision] * N[((-h) / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.0], t$95$3, If[LessEqual[t$95$1, 5e+187], N[(t$95$2 * N[(N[(h / l), $MachinePrecision] * N[(-0.125 * N[(N[(t$95$0 * N[(M * D), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], t$95$3]]]]]]]
\begin{array}{l}
t_0 := \frac{M \cdot D}{d}\\
t_1 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
t_2 := \sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
t_3 := \mathsf{fma}\left(\frac{h \cdot \left(D \cdot M\right)}{\left(-\ell\right) \cdot \left(d + d\right)}, 0.25 \cdot \frac{D \cdot M}{d}, 1\right) \cdot \frac{\left|d\right|}{\sqrt{h \cdot \ell}}\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{-158}:\\
\;\;\;\;t\_2 \cdot \mathsf{fma}\left(t\_0 \cdot 0.25, \left(\frac{D}{d + d} \cdot M\right) \cdot \frac{-h}{\ell}, 1\right)\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+187}:\\
\;\;\;\;t\_2 \cdot \mathsf{fma}\left(\frac{h}{\ell}, -0.125 \cdot \frac{t\_0 \cdot \left(M \cdot D\right)}{d}, 1\right)\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -2.00000000000000013e-158Initial program 66.4%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-neg-outN/A
distribute-rgt-neg-inN/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites66.9%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.9
lift-/.f64N/A
metadata-eval66.9
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6466.9
lift-/.f64N/A
metadata-eval66.9
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6466.9
Applied rewrites66.9%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
count-2-revN/A
*-commutativeN/A
times-fracN/A
lift-/.f64N/A
lower-*.f64N/A
metadata-eval66.9
Applied rewrites66.9%
if -2.00000000000000013e-158 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -0.0 or 5.0000000000000001e187 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 66.4%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-neg-outN/A
distribute-rgt-neg-inN/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites66.9%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.9
lift-/.f64N/A
metadata-eval66.9
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6466.9
lift-/.f64N/A
metadata-eval66.9
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6466.9
Applied rewrites66.9%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
count-2-revN/A
*-commutativeN/A
times-fracN/A
lift-/.f64N/A
lower-*.f64N/A
metadata-eval66.9
Applied rewrites66.9%
Applied rewrites74.8%
if -0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 5.0000000000000001e187Initial program 66.4%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-neg-outN/A
distribute-rgt-neg-inN/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites66.9%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.9
lift-/.f64N/A
metadata-eval66.9
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6466.9
lift-/.f64N/A
metadata-eval66.9
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6466.9
Applied rewrites66.9%
Applied rewrites65.9%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0
(- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
(if (<=
(* (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))) t_0)
5e+187)
(* (* (sqrt (/ d l)) (sqrt (/ d h))) t_0)
(*
(fma (/ (* h (* D M)) (* (- l) (+ d d))) (* 0.25 (/ (* D M) d)) 1.0)
(/ (fabs d) (sqrt (* h l)))))))double code(double d, double h, double l, double M, double D) {
double t_0 = 1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l));
double tmp;
if (((pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * t_0) <= 5e+187) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * t_0;
} else {
tmp = fma(((h * (D * M)) / (-l * (d + d))), (0.25 * ((D * M) / d)), 1.0) * (fabs(d) / sqrt((h * l)));
}
return tmp;
}
function code(d, h, l, M, D) t_0 = Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l))) tmp = 0.0 if (Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * t_0) <= 5e+187) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * t_0); else tmp = Float64(fma(Float64(Float64(h * Float64(D * M)) / Float64(Float64(-l) * Float64(d + d))), Float64(0.25 * Float64(Float64(D * M) / d)), 1.0) * Float64(abs(d) / sqrt(Float64(h * l)))); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], 5e+187], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[(N[(N[(h * N[(D * M), $MachinePrecision]), $MachinePrecision] / N[((-l) * N[(d + d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(0.25 * N[(N[(D * M), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_0 := 1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\\
\mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot t\_0 \leq 5 \cdot 10^{+187}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{h \cdot \left(D \cdot M\right)}{\left(-\ell\right) \cdot \left(d + d\right)}, 0.25 \cdot \frac{D \cdot M}{d}, 1\right) \cdot \frac{\left|d\right|}{\sqrt{h \cdot \ell}}\\
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 5.0000000000000001e187Initial program 66.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.4
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4
Applied rewrites66.4%
if 5.0000000000000001e187 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 66.4%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-neg-outN/A
distribute-rgt-neg-inN/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites66.9%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.9
lift-/.f64N/A
metadata-eval66.9
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6466.9
lift-/.f64N/A
metadata-eval66.9
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6466.9
Applied rewrites66.9%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
count-2-revN/A
*-commutativeN/A
times-fracN/A
lift-/.f64N/A
lower-*.f64N/A
metadata-eval66.9
Applied rewrites66.9%
Applied rewrites74.8%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
(t_1 (/ (fabs d) (sqrt (* h l)))))
(if (<= t_0 0.0)
(*
t_1
(fma (* (/ (* M D) d) 0.25) (* (* (/ D (+ d d)) M) (/ (- h) l)) 1.0))
(if (<= t_0 5e+187)
(* (* (sqrt (/ d l)) (sqrt (/ d h))) 1.0)
(*
(fma (/ (* h (* D M)) (* (- l) (+ d d))) (* 0.25 (/ (* D M) d)) 1.0)
t_1)))))double code(double d, double h, double l, double M, double D) {
double t_0 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double t_1 = fabs(d) / sqrt((h * l));
double tmp;
if (t_0 <= 0.0) {
tmp = t_1 * fma((((M * D) / d) * 0.25), (((D / (d + d)) * M) * (-h / l)), 1.0);
} else if (t_0 <= 5e+187) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0;
} else {
tmp = fma(((h * (D * M)) / (-l * (d + d))), (0.25 * ((D * M) / d)), 1.0) * t_1;
}
return tmp;
}
function code(d, h, l, M, D) t_0 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) t_1 = Float64(abs(d) / sqrt(Float64(h * l))) tmp = 0.0 if (t_0 <= 0.0) tmp = Float64(t_1 * fma(Float64(Float64(Float64(M * D) / d) * 0.25), Float64(Float64(Float64(D / Float64(d + d)) * M) * Float64(Float64(-h) / l)), 1.0)); elseif (t_0 <= 5e+187) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * 1.0); else tmp = Float64(fma(Float64(Float64(h * Float64(D * M)) / Float64(Float64(-l) * Float64(d + d))), Float64(0.25 * Float64(Float64(D * M) / d)), 1.0) * t_1); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 0.0], N[(t$95$1 * N[(N[(N[(N[(M * D), $MachinePrecision] / d), $MachinePrecision] * 0.25), $MachinePrecision] * N[(N[(N[(D / N[(d + d), $MachinePrecision]), $MachinePrecision] * M), $MachinePrecision] * N[((-h) / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e+187], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], N[(N[(N[(N[(h * N[(D * M), $MachinePrecision]), $MachinePrecision] / N[((-l) * N[(d + d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(0.25 * N[(N[(D * M), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * t$95$1), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
t_1 := \frac{\left|d\right|}{\sqrt{h \cdot \ell}}\\
\mathbf{if}\;t\_0 \leq 0:\\
\;\;\;\;t\_1 \cdot \mathsf{fma}\left(\frac{M \cdot D}{d} \cdot 0.25, \left(\frac{D}{d + d} \cdot M\right) \cdot \frac{-h}{\ell}, 1\right)\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+187}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot 1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{h \cdot \left(D \cdot M\right)}{\left(-\ell\right) \cdot \left(d + d\right)}, 0.25 \cdot \frac{D \cdot M}{d}, 1\right) \cdot t\_1\\
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -0.0Initial program 66.4%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-neg-outN/A
distribute-rgt-neg-inN/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites66.9%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.9
lift-/.f64N/A
metadata-eval66.9
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6466.9
lift-/.f64N/A
metadata-eval66.9
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6466.9
Applied rewrites66.9%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
count-2-revN/A
*-commutativeN/A
times-fracN/A
lift-/.f64N/A
lower-*.f64N/A
metadata-eval66.9
Applied rewrites66.9%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f32N/A
lower-sqrt.f32N/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lower-unsound-/.f64N/A
lower-fabs.f64N/A
lower-unsound-sqrt.f6469.8
Applied rewrites69.8%
if -0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 5.0000000000000001e187Initial program 66.4%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-neg-outN/A
distribute-rgt-neg-inN/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites66.9%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.9
lift-/.f64N/A
metadata-eval66.9
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6466.9
lift-/.f64N/A
metadata-eval66.9
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6466.9
Applied rewrites66.9%
Taylor expanded in d around inf
Applied rewrites38.9%
if 5.0000000000000001e187 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 66.4%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-neg-outN/A
distribute-rgt-neg-inN/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites66.9%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.9
lift-/.f64N/A
metadata-eval66.9
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6466.9
lift-/.f64N/A
metadata-eval66.9
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6466.9
Applied rewrites66.9%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
count-2-revN/A
*-commutativeN/A
times-fracN/A
lift-/.f64N/A
lower-*.f64N/A
metadata-eval66.9
Applied rewrites66.9%
Applied rewrites74.8%
(FPCore (d h l M D)
:precision binary64
(if (<=
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l))))
5e+187)
(*
(* (sqrt (/ d l)) (sqrt (/ d h)))
(fma (/ h l) (* -0.125 (/ (* (/ (* M D) d) (* M D)) d)) 1.0))
(*
(fma (/ (* h (* D M)) (* (- l) (+ d d))) (* 0.25 (/ (* D M) d)) 1.0)
(/ (fabs d) (sqrt (* h l))))))double code(double d, double h, double l, double M, double D) {
double tmp;
if (((pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))) <= 5e+187) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * fma((h / l), (-0.125 * ((((M * D) / d) * (M * D)) / d)), 1.0);
} else {
tmp = fma(((h * (D * M)) / (-l * (d + d))), (0.25 * ((D * M) / d)), 1.0) * (fabs(d) / sqrt((h * l)));
}
return tmp;
}
function code(d, h, l, M, D) tmp = 0.0 if (Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) <= 5e+187) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * fma(Float64(h / l), Float64(-0.125 * Float64(Float64(Float64(Float64(M * D) / d) * Float64(M * D)) / d)), 1.0)); else tmp = Float64(fma(Float64(Float64(h * Float64(D * M)) / Float64(Float64(-l) * Float64(d + d))), Float64(0.25 * Float64(Float64(D * M) / d)), 1.0) * Float64(abs(d) / sqrt(Float64(h * l)))); end return tmp end
code[d_, h_, l_, M_, D_] := If[LessEqual[N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 5e+187], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * N[(-0.125 * N[(N[(N[(N[(M * D), $MachinePrecision] / d), $MachinePrecision] * N[(M * D), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(h * N[(D * M), $MachinePrecision]), $MachinePrecision] / N[((-l) * N[(d + d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(0.25 * N[(N[(D * M), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq 5 \cdot 10^{+187}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \mathsf{fma}\left(\frac{h}{\ell}, -0.125 \cdot \frac{\frac{M \cdot D}{d} \cdot \left(M \cdot D\right)}{d}, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{h \cdot \left(D \cdot M\right)}{\left(-\ell\right) \cdot \left(d + d\right)}, 0.25 \cdot \frac{D \cdot M}{d}, 1\right) \cdot \frac{\left|d\right|}{\sqrt{h \cdot \ell}}\\
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 5.0000000000000001e187Initial program 66.4%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-neg-outN/A
distribute-rgt-neg-inN/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites66.9%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.9
lift-/.f64N/A
metadata-eval66.9
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6466.9
lift-/.f64N/A
metadata-eval66.9
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6466.9
Applied rewrites66.9%
Applied rewrites65.9%
if 5.0000000000000001e187 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 66.4%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-neg-outN/A
distribute-rgt-neg-inN/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites66.9%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.9
lift-/.f64N/A
metadata-eval66.9
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6466.9
lift-/.f64N/A
metadata-eval66.9
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6466.9
Applied rewrites66.9%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
count-2-revN/A
*-commutativeN/A
times-fracN/A
lift-/.f64N/A
lower-*.f64N/A
metadata-eval66.9
Applied rewrites66.9%
Applied rewrites74.8%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
(t_1
(*
(fma (/ (* h (* D M)) (* (- l) (+ d d))) (* 0.25 (/ (* D M) d)) 1.0)
(/ (fabs d) (sqrt (* h l))))))
(if (<= t_0 0.0)
t_1
(if (<= t_0 5e+187) (* (* (sqrt (/ d l)) (sqrt (/ d h))) 1.0) t_1))))double code(double d, double h, double l, double M, double D) {
double t_0 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double t_1 = fma(((h * (D * M)) / (-l * (d + d))), (0.25 * ((D * M) / d)), 1.0) * (fabs(d) / sqrt((h * l)));
double tmp;
if (t_0 <= 0.0) {
tmp = t_1;
} else if (t_0 <= 5e+187) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0;
} else {
tmp = t_1;
}
return tmp;
}
function code(d, h, l, M, D) t_0 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) t_1 = Float64(fma(Float64(Float64(h * Float64(D * M)) / Float64(Float64(-l) * Float64(d + d))), Float64(0.25 * Float64(Float64(D * M) / d)), 1.0) * Float64(abs(d) / sqrt(Float64(h * l)))) tmp = 0.0 if (t_0 <= 0.0) tmp = t_1; elseif (t_0 <= 5e+187) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * 1.0); else tmp = t_1; end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(N[(h * N[(D * M), $MachinePrecision]), $MachinePrecision] / N[((-l) * N[(d + d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(0.25 * N[(N[(D * M), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 0.0], t$95$1, If[LessEqual[t$95$0, 5e+187], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
t_0 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
t_1 := \mathsf{fma}\left(\frac{h \cdot \left(D \cdot M\right)}{\left(-\ell\right) \cdot \left(d + d\right)}, 0.25 \cdot \frac{D \cdot M}{d}, 1\right) \cdot \frac{\left|d\right|}{\sqrt{h \cdot \ell}}\\
\mathbf{if}\;t\_0 \leq 0:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+187}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot 1\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -0.0 or 5.0000000000000001e187 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 66.4%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-neg-outN/A
distribute-rgt-neg-inN/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites66.9%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.9
lift-/.f64N/A
metadata-eval66.9
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6466.9
lift-/.f64N/A
metadata-eval66.9
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6466.9
Applied rewrites66.9%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
count-2-revN/A
*-commutativeN/A
times-fracN/A
lift-/.f64N/A
lower-*.f64N/A
metadata-eval66.9
Applied rewrites66.9%
Applied rewrites74.8%
if -0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 5.0000000000000001e187Initial program 66.4%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-neg-outN/A
distribute-rgt-neg-inN/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites66.9%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.9
lift-/.f64N/A
metadata-eval66.9
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6466.9
lift-/.f64N/A
metadata-eval66.9
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6466.9
Applied rewrites66.9%
Taylor expanded in d around inf
Applied rewrites38.9%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(-
1.0
(* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l))))))
(if (<= t_0 -5e-151)
(*
(fma (* -0.125 (/ (* (/ (* M D) d) (* M D)) d)) (/ h l) 1.0)
(sqrt (* (/ d (* h l)) d)))
(if (<= t_0 0.0)
(/ (* -1.0 (* d (* l (sqrt (/ 1.0 (* h l)))))) l)
(if (<= t_0 5e+213)
(* (* (sqrt (/ d l)) (sqrt (/ d h))) 1.0)
(*
(/ (fabs d) (sqrt (* h l)))
(/ (- l (* (* (* 0.125 (/ (* (* D M) D) (* d d))) M) h)) l)))))))double code(double d, double h, double l, double M, double D) {
double t_0 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double tmp;
if (t_0 <= -5e-151) {
tmp = fma((-0.125 * ((((M * D) / d) * (M * D)) / d)), (h / l), 1.0) * sqrt(((d / (h * l)) * d));
} else if (t_0 <= 0.0) {
tmp = (-1.0 * (d * (l * sqrt((1.0 / (h * l)))))) / l;
} else if (t_0 <= 5e+213) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0;
} else {
tmp = (fabs(d) / sqrt((h * l))) * ((l - (((0.125 * (((D * M) * D) / (d * d))) * M) * h)) / l);
}
return tmp;
}
function code(d, h, l, M, D) t_0 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) tmp = 0.0 if (t_0 <= -5e-151) tmp = Float64(fma(Float64(-0.125 * Float64(Float64(Float64(Float64(M * D) / d) * Float64(M * D)) / d)), Float64(h / l), 1.0) * sqrt(Float64(Float64(d / Float64(h * l)) * d))); elseif (t_0 <= 0.0) tmp = Float64(Float64(-1.0 * Float64(d * Float64(l * sqrt(Float64(1.0 / Float64(h * l)))))) / l); elseif (t_0 <= 5e+213) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * 1.0); else tmp = Float64(Float64(abs(d) / sqrt(Float64(h * l))) * Float64(Float64(l - Float64(Float64(Float64(0.125 * Float64(Float64(Float64(D * M) * D) / Float64(d * d))) * M) * h)) / l)); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -5e-151], N[(N[(N[(-0.125 * N[(N[(N[(N[(M * D), $MachinePrecision] / d), $MachinePrecision] * N[(M * D), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(N[(d / N[(h * l), $MachinePrecision]), $MachinePrecision] * d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(N[(-1.0 * N[(d * N[(l * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision], If[LessEqual[t$95$0, 5e+213], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], N[(N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(l - N[(N[(N[(0.125 * N[(N[(N[(D * M), $MachinePrecision] * D), $MachinePrecision] / N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * M), $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-151}:\\
\;\;\;\;\mathsf{fma}\left(-0.125 \cdot \frac{\frac{M \cdot D}{d} \cdot \left(M \cdot D\right)}{d}, \frac{h}{\ell}, 1\right) \cdot \sqrt{\frac{d}{h \cdot \ell} \cdot d}\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\frac{-1 \cdot \left(d \cdot \left(\ell \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)\right)}{\ell}\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+213}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot 1\\
\mathbf{else}:\\
\;\;\;\;\frac{\left|d\right|}{\sqrt{h \cdot \ell}} \cdot \frac{\ell - \left(\left(0.125 \cdot \frac{\left(D \cdot M\right) \cdot D}{d \cdot d}\right) \cdot M\right) \cdot h}{\ell}\\
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -5.00000000000000003e-151Initial program 66.4%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-neg-outN/A
distribute-rgt-neg-inN/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites66.9%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.9
lift-/.f64N/A
metadata-eval66.9
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6466.9
lift-/.f64N/A
metadata-eval66.9
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6466.9
Applied rewrites66.9%
Applied rewrites50.6%
if -5.00000000000000003e-151 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -0.0Initial program 66.4%
Applied rewrites43.0%
Taylor expanded in d around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6423.0
Applied rewrites23.0%
if -0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 4.9999999999999998e213Initial program 66.4%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-neg-outN/A
distribute-rgt-neg-inN/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites66.9%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.9
lift-/.f64N/A
metadata-eval66.9
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6466.9
lift-/.f64N/A
metadata-eval66.9
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6466.9
Applied rewrites66.9%
Taylor expanded in d around inf
Applied rewrites38.9%
if 4.9999999999999998e213 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 66.4%
Applied rewrites43.0%
Applied rewrites60.4%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (/ (fabs d) (sqrt (* h l))))
(t_1 (- l (* (* (* 0.125 (/ (* (* D M) D) (* d d))) M) h)))
(t_2
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(-
1.0
(* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l))))))
(if (<= t_2 -5e-151)
(/ (* t_0 t_1) l)
(if (<= t_2 0.0)
(/ (* -1.0 (* d (* l (sqrt (/ 1.0 (* h l)))))) l)
(if (<= t_2 5e+213)
(* (* (sqrt (/ d l)) (sqrt (/ d h))) 1.0)
(* t_0 (/ t_1 l)))))))double code(double d, double h, double l, double M, double D) {
double t_0 = fabs(d) / sqrt((h * l));
double t_1 = l - (((0.125 * (((D * M) * D) / (d * d))) * M) * h);
double t_2 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double tmp;
if (t_2 <= -5e-151) {
tmp = (t_0 * t_1) / l;
} else if (t_2 <= 0.0) {
tmp = (-1.0 * (d * (l * sqrt((1.0 / (h * l)))))) / l;
} else if (t_2 <= 5e+213) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0;
} else {
tmp = t_0 * (t_1 / l);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = abs(d) / sqrt((h * l))
t_1 = l - (((0.125d0 * (((d_1 * m) * d_1) / (d * d))) * m) * h)
t_2 = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
if (t_2 <= (-5d-151)) then
tmp = (t_0 * t_1) / l
else if (t_2 <= 0.0d0) then
tmp = ((-1.0d0) * (d * (l * sqrt((1.0d0 / (h * l)))))) / l
else if (t_2 <= 5d+213) then
tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0d0
else
tmp = t_0 * (t_1 / l)
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.abs(d) / Math.sqrt((h * l));
double t_1 = l - (((0.125 * (((D * M) * D) / (d * d))) * M) * h);
double t_2 = (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double tmp;
if (t_2 <= -5e-151) {
tmp = (t_0 * t_1) / l;
} else if (t_2 <= 0.0) {
tmp = (-1.0 * (d * (l * Math.sqrt((1.0 / (h * l)))))) / l;
} else if (t_2 <= 5e+213) {
tmp = (Math.sqrt((d / l)) * Math.sqrt((d / h))) * 1.0;
} else {
tmp = t_0 * (t_1 / l);
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.fabs(d) / math.sqrt((h * l)) t_1 = l - (((0.125 * (((D * M) * D) / (d * d))) * M) * h) t_2 = (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l))) tmp = 0 if t_2 <= -5e-151: tmp = (t_0 * t_1) / l elif t_2 <= 0.0: tmp = (-1.0 * (d * (l * math.sqrt((1.0 / (h * l)))))) / l elif t_2 <= 5e+213: tmp = (math.sqrt((d / l)) * math.sqrt((d / h))) * 1.0 else: tmp = t_0 * (t_1 / l) return tmp
function code(d, h, l, M, D) t_0 = Float64(abs(d) / sqrt(Float64(h * l))) t_1 = Float64(l - Float64(Float64(Float64(0.125 * Float64(Float64(Float64(D * M) * D) / Float64(d * d))) * M) * h)) t_2 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) tmp = 0.0 if (t_2 <= -5e-151) tmp = Float64(Float64(t_0 * t_1) / l); elseif (t_2 <= 0.0) tmp = Float64(Float64(-1.0 * Float64(d * Float64(l * sqrt(Float64(1.0 / Float64(h * l)))))) / l); elseif (t_2 <= 5e+213) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * 1.0); else tmp = Float64(t_0 * Float64(t_1 / l)); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = abs(d) / sqrt((h * l)); t_1 = l - (((0.125 * (((D * M) * D) / (d * d))) * M) * h); t_2 = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); tmp = 0.0; if (t_2 <= -5e-151) tmp = (t_0 * t_1) / l; elseif (t_2 <= 0.0) tmp = (-1.0 * (d * (l * sqrt((1.0 / (h * l)))))) / l; elseif (t_2 <= 5e+213) tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0; else tmp = t_0 * (t_1 / l); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(l - N[(N[(N[(0.125 * N[(N[(N[(D * M), $MachinePrecision] * D), $MachinePrecision] / N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * M), $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e-151], N[(N[(t$95$0 * t$95$1), $MachinePrecision] / l), $MachinePrecision], If[LessEqual[t$95$2, 0.0], N[(N[(-1.0 * N[(d * N[(l * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision], If[LessEqual[t$95$2, 5e+213], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], N[(t$95$0 * N[(t$95$1 / l), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
t_0 := \frac{\left|d\right|}{\sqrt{h \cdot \ell}}\\
t_1 := \ell - \left(\left(0.125 \cdot \frac{\left(D \cdot M\right) \cdot D}{d \cdot d}\right) \cdot M\right) \cdot h\\
t_2 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{-151}:\\
\;\;\;\;\frac{t\_0 \cdot t\_1}{\ell}\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;\frac{-1 \cdot \left(d \cdot \left(\ell \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)\right)}{\ell}\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+213}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot 1\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \frac{t\_1}{\ell}\\
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -5.00000000000000003e-151Initial program 66.4%
Applied rewrites43.0%
Applied rewrites56.3%
if -5.00000000000000003e-151 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -0.0Initial program 66.4%
Applied rewrites43.0%
Taylor expanded in d around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6423.0
Applied rewrites23.0%
if -0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 4.9999999999999998e213Initial program 66.4%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-neg-outN/A
distribute-rgt-neg-inN/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites66.9%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.9
lift-/.f64N/A
metadata-eval66.9
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6466.9
lift-/.f64N/A
metadata-eval66.9
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6466.9
Applied rewrites66.9%
Taylor expanded in d around inf
Applied rewrites38.9%
if 4.9999999999999998e213 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 66.4%
Applied rewrites43.0%
Applied rewrites60.4%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
(t_1
(*
(/ (fabs d) (sqrt (* h l)))
(/ (- l (* (* (* 0.125 (/ (* (* D M) D) (* d d))) M) h)) l))))
(if (<= t_0 -5e-151)
t_1
(if (<= t_0 0.0)
(/ (* -1.0 (* d (* l (sqrt (/ 1.0 (* h l)))))) l)
(if (<= t_0 5e+213) (* (* (sqrt (/ d l)) (sqrt (/ d h))) 1.0) t_1)))))double code(double d, double h, double l, double M, double D) {
double t_0 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double t_1 = (fabs(d) / sqrt((h * l))) * ((l - (((0.125 * (((D * M) * D) / (d * d))) * M) * h)) / l);
double tmp;
if (t_0 <= -5e-151) {
tmp = t_1;
} else if (t_0 <= 0.0) {
tmp = (-1.0 * (d * (l * sqrt((1.0 / (h * l)))))) / l;
} else if (t_0 <= 5e+213) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0;
} else {
tmp = t_1;
}
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(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
t_1 = (abs(d) / sqrt((h * l))) * ((l - (((0.125d0 * (((d_1 * m) * d_1) / (d * d))) * m) * h)) / l)
if (t_0 <= (-5d-151)) then
tmp = t_1
else if (t_0 <= 0.0d0) then
tmp = ((-1.0d0) * (d * (l * sqrt((1.0d0 / (h * l)))))) / l
else if (t_0 <= 5d+213) then
tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0d0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double t_1 = (Math.abs(d) / Math.sqrt((h * l))) * ((l - (((0.125 * (((D * M) * D) / (d * d))) * M) * h)) / l);
double tmp;
if (t_0 <= -5e-151) {
tmp = t_1;
} else if (t_0 <= 0.0) {
tmp = (-1.0 * (d * (l * Math.sqrt((1.0 / (h * l)))))) / l;
} else if (t_0 <= 5e+213) {
tmp = (Math.sqrt((d / l)) * Math.sqrt((d / h))) * 1.0;
} else {
tmp = t_1;
}
return tmp;
}
def code(d, h, l, M, D): t_0 = (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l))) t_1 = (math.fabs(d) / math.sqrt((h * l))) * ((l - (((0.125 * (((D * M) * D) / (d * d))) * M) * h)) / l) tmp = 0 if t_0 <= -5e-151: tmp = t_1 elif t_0 <= 0.0: tmp = (-1.0 * (d * (l * math.sqrt((1.0 / (h * l)))))) / l elif t_0 <= 5e+213: tmp = (math.sqrt((d / l)) * math.sqrt((d / h))) * 1.0 else: tmp = t_1 return tmp
function code(d, h, l, M, D) t_0 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) t_1 = Float64(Float64(abs(d) / sqrt(Float64(h * l))) * Float64(Float64(l - Float64(Float64(Float64(0.125 * Float64(Float64(Float64(D * M) * D) / Float64(d * d))) * M) * h)) / l)) tmp = 0.0 if (t_0 <= -5e-151) tmp = t_1; elseif (t_0 <= 0.0) tmp = Float64(Float64(-1.0 * Float64(d * Float64(l * sqrt(Float64(1.0 / Float64(h * l)))))) / l); elseif (t_0 <= 5e+213) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * 1.0); else tmp = t_1; end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); t_1 = (abs(d) / sqrt((h * l))) * ((l - (((0.125 * (((D * M) * D) / (d * d))) * M) * h)) / l); tmp = 0.0; if (t_0 <= -5e-151) tmp = t_1; elseif (t_0 <= 0.0) tmp = (-1.0 * (d * (l * sqrt((1.0 / (h * l)))))) / l; elseif (t_0 <= 5e+213) tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0; else tmp = t_1; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(l - N[(N[(N[(0.125 * N[(N[(N[(D * M), $MachinePrecision] * D), $MachinePrecision] / N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * M), $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -5e-151], t$95$1, If[LessEqual[t$95$0, 0.0], N[(N[(-1.0 * N[(d * N[(l * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision], If[LessEqual[t$95$0, 5e+213], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
t_0 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
t_1 := \frac{\left|d\right|}{\sqrt{h \cdot \ell}} \cdot \frac{\ell - \left(\left(0.125 \cdot \frac{\left(D \cdot M\right) \cdot D}{d \cdot d}\right) \cdot M\right) \cdot h}{\ell}\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-151}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\frac{-1 \cdot \left(d \cdot \left(\ell \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)\right)}{\ell}\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+213}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot 1\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -5.00000000000000003e-151 or 4.9999999999999998e213 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 66.4%
Applied rewrites43.0%
Applied rewrites60.4%
if -5.00000000000000003e-151 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -0.0Initial program 66.4%
Applied rewrites43.0%
Taylor expanded in d around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6423.0
Applied rewrites23.0%
if -0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 4.9999999999999998e213Initial program 66.4%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-neg-outN/A
distribute-rgt-neg-inN/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites66.9%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.9
lift-/.f64N/A
metadata-eval66.9
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6466.9
lift-/.f64N/A
metadata-eval66.9
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6466.9
Applied rewrites66.9%
Taylor expanded in d around inf
Applied rewrites38.9%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d h)))
(t_1 (sqrt (/ d l)))
(t_2
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(-
1.0
(* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l))))))
(if (<= t_2 -5e-151)
(/ (* -1.0 (* h (* t_0 (sqrt (sqrt (* (/ d l) (/ d l))))))) h)
(if (<= t_2 0.0)
(/ (* -1.0 (* d (* l (sqrt (/ 1.0 (* h l)))))) l)
(if (<= t_2 INFINITY)
(* (* t_1 t_0) 1.0)
(/ (* (* -1.0 (* d (sqrt (/ h d)))) t_1) h))))))double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / h));
double t_1 = sqrt((d / l));
double t_2 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double tmp;
if (t_2 <= -5e-151) {
tmp = (-1.0 * (h * (t_0 * sqrt(sqrt(((d / l) * (d / l))))))) / h;
} else if (t_2 <= 0.0) {
tmp = (-1.0 * (d * (l * sqrt((1.0 / (h * l)))))) / l;
} else if (t_2 <= ((double) INFINITY)) {
tmp = (t_1 * t_0) * 1.0;
} else {
tmp = ((-1.0 * (d * sqrt((h / d)))) * t_1) / h;
}
return tmp;
}
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((d / h));
double t_1 = Math.sqrt((d / l));
double t_2 = (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double tmp;
if (t_2 <= -5e-151) {
tmp = (-1.0 * (h * (t_0 * Math.sqrt(Math.sqrt(((d / l) * (d / l))))))) / h;
} else if (t_2 <= 0.0) {
tmp = (-1.0 * (d * (l * Math.sqrt((1.0 / (h * l)))))) / l;
} else if (t_2 <= Double.POSITIVE_INFINITY) {
tmp = (t_1 * t_0) * 1.0;
} else {
tmp = ((-1.0 * (d * Math.sqrt((h / d)))) * t_1) / h;
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.sqrt((d / h)) t_1 = math.sqrt((d / l)) t_2 = (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l))) tmp = 0 if t_2 <= -5e-151: tmp = (-1.0 * (h * (t_0 * math.sqrt(math.sqrt(((d / l) * (d / l))))))) / h elif t_2 <= 0.0: tmp = (-1.0 * (d * (l * math.sqrt((1.0 / (h * l)))))) / l elif t_2 <= math.inf: tmp = (t_1 * t_0) * 1.0 else: tmp = ((-1.0 * (d * math.sqrt((h / d)))) * t_1) / h return tmp
function code(d, h, l, M, D) t_0 = sqrt(Float64(d / h)) t_1 = sqrt(Float64(d / l)) t_2 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) tmp = 0.0 if (t_2 <= -5e-151) tmp = Float64(Float64(-1.0 * Float64(h * Float64(t_0 * sqrt(sqrt(Float64(Float64(d / l) * Float64(d / l))))))) / h); elseif (t_2 <= 0.0) tmp = Float64(Float64(-1.0 * Float64(d * Float64(l * sqrt(Float64(1.0 / Float64(h * l)))))) / l); elseif (t_2 <= Inf) tmp = Float64(Float64(t_1 * t_0) * 1.0); else tmp = Float64(Float64(Float64(-1.0 * Float64(d * sqrt(Float64(h / d)))) * t_1) / h); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = sqrt((d / h)); t_1 = sqrt((d / l)); t_2 = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); tmp = 0.0; if (t_2 <= -5e-151) tmp = (-1.0 * (h * (t_0 * sqrt(sqrt(((d / l) * (d / l))))))) / h; elseif (t_2 <= 0.0) tmp = (-1.0 * (d * (l * sqrt((1.0 / (h * l)))))) / l; elseif (t_2 <= Inf) tmp = (t_1 * t_0) * 1.0; else tmp = ((-1.0 * (d * sqrt((h / d)))) * t_1) / h; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e-151], N[(N[(-1.0 * N[(h * N[(t$95$0 * N[Sqrt[N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], If[LessEqual[t$95$2, 0.0], N[(N[(-1.0 * N[(d * N[(l * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision], If[LessEqual[t$95$2, Infinity], N[(N[(t$95$1 * t$95$0), $MachinePrecision] * 1.0), $MachinePrecision], N[(N[(N[(-1.0 * N[(d * N[Sqrt[N[(h / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] / h), $MachinePrecision]]]]]]]
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h}}\\
t_1 := \sqrt{\frac{d}{\ell}}\\
t_2 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{-151}:\\
\;\;\;\;\frac{-1 \cdot \left(h \cdot \left(t\_0 \cdot \sqrt{\sqrt{\frac{d}{\ell} \cdot \frac{d}{\ell}}}\right)\right)}{h}\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;\frac{-1 \cdot \left(d \cdot \left(\ell \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)\right)}{\ell}\\
\mathbf{elif}\;t\_2 \leq \infty:\\
\;\;\;\;\left(t\_1 \cdot t\_0\right) \cdot 1\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(-1 \cdot \left(d \cdot \sqrt{\frac{h}{d}}\right)\right) \cdot t\_1}{h}\\
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -5.00000000000000003e-151Initial program 66.4%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.6
Applied rewrites23.6%
Taylor expanded in h around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f649.6
Applied rewrites9.6%
rem-square-sqrtN/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6413.7
Applied rewrites13.7%
if -5.00000000000000003e-151 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -0.0Initial program 66.4%
Applied rewrites43.0%
Taylor expanded in d around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6423.0
Applied rewrites23.0%
if -0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < +inf.0Initial program 66.4%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-neg-outN/A
distribute-rgt-neg-inN/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites66.9%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.9
lift-/.f64N/A
metadata-eval66.9
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6466.9
lift-/.f64N/A
metadata-eval66.9
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6466.9
Applied rewrites66.9%
Taylor expanded in d around inf
Applied rewrites38.9%
if +inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 66.4%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.6
Applied rewrites23.6%
Taylor expanded in d around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6411.5
Applied rewrites11.5%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d l)))
(t_1
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(-
1.0
(* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l))))))
(if (<= t_1 -5e-151)
(/ (* (sqrt (* (/ d (* h l)) d)) (- h)) h)
(if (<= t_1 0.0)
(/ (* -1.0 (* d (* l (sqrt (/ 1.0 (* h l)))))) l)
(if (<= t_1 INFINITY)
(* (* t_0 (sqrt (/ d h))) 1.0)
(/ (* (* -1.0 (* d (sqrt (/ h d)))) t_0) h))))))double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / l));
double t_1 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double tmp;
if (t_1 <= -5e-151) {
tmp = (sqrt(((d / (h * l)) * d)) * -h) / h;
} else if (t_1 <= 0.0) {
tmp = (-1.0 * (d * (l * sqrt((1.0 / (h * l)))))) / l;
} else if (t_1 <= ((double) INFINITY)) {
tmp = (t_0 * sqrt((d / h))) * 1.0;
} else {
tmp = ((-1.0 * (d * sqrt((h / d)))) * t_0) / h;
}
return tmp;
}
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((d / l));
double t_1 = (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double tmp;
if (t_1 <= -5e-151) {
tmp = (Math.sqrt(((d / (h * l)) * d)) * -h) / h;
} else if (t_1 <= 0.0) {
tmp = (-1.0 * (d * (l * Math.sqrt((1.0 / (h * l)))))) / l;
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = (t_0 * Math.sqrt((d / h))) * 1.0;
} else {
tmp = ((-1.0 * (d * Math.sqrt((h / d)))) * t_0) / h;
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.sqrt((d / l)) t_1 = (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l))) tmp = 0 if t_1 <= -5e-151: tmp = (math.sqrt(((d / (h * l)) * d)) * -h) / h elif t_1 <= 0.0: tmp = (-1.0 * (d * (l * math.sqrt((1.0 / (h * l)))))) / l elif t_1 <= math.inf: tmp = (t_0 * math.sqrt((d / h))) * 1.0 else: tmp = ((-1.0 * (d * math.sqrt((h / d)))) * t_0) / h return tmp
function code(d, h, l, M, D) t_0 = sqrt(Float64(d / l)) t_1 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) tmp = 0.0 if (t_1 <= -5e-151) tmp = Float64(Float64(sqrt(Float64(Float64(d / Float64(h * l)) * d)) * Float64(-h)) / h); elseif (t_1 <= 0.0) tmp = Float64(Float64(-1.0 * Float64(d * Float64(l * sqrt(Float64(1.0 / Float64(h * l)))))) / l); elseif (t_1 <= Inf) tmp = Float64(Float64(t_0 * sqrt(Float64(d / h))) * 1.0); else tmp = Float64(Float64(Float64(-1.0 * Float64(d * sqrt(Float64(h / d)))) * t_0) / h); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = sqrt((d / l)); t_1 = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); tmp = 0.0; if (t_1 <= -5e-151) tmp = (sqrt(((d / (h * l)) * d)) * -h) / h; elseif (t_1 <= 0.0) tmp = (-1.0 * (d * (l * sqrt((1.0 / (h * l)))))) / l; elseif (t_1 <= Inf) tmp = (t_0 * sqrt((d / h))) * 1.0; else tmp = ((-1.0 * (d * sqrt((h / d)))) * t_0) / h; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e-151], N[(N[(N[Sqrt[N[(N[(d / N[(h * l), $MachinePrecision]), $MachinePrecision] * d), $MachinePrecision]], $MachinePrecision] * (-h)), $MachinePrecision] / h), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(N[(-1.0 * N[(d * N[(l * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(N[(t$95$0 * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], N[(N[(N[(-1.0 * N[(d * N[Sqrt[N[(h / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] / h), $MachinePrecision]]]]]]
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
t_1 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{-151}:\\
\;\;\;\;\frac{\sqrt{\frac{d}{h \cdot \ell} \cdot d} \cdot \left(-h\right)}{h}\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;\frac{-1 \cdot \left(d \cdot \left(\ell \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)\right)}{\ell}\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\left(t\_0 \cdot \sqrt{\frac{d}{h}}\right) \cdot 1\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(-1 \cdot \left(d \cdot \sqrt{\frac{h}{d}}\right)\right) \cdot t\_0}{h}\\
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -5.00000000000000003e-151Initial program 66.4%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.6
Applied rewrites23.6%
Taylor expanded in h around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f649.6
Applied rewrites9.6%
lift-*.f64N/A
mul-1-negN/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lift-neg.f64N/A
lower-*.f649.6
Applied rewrites13.6%
if -5.00000000000000003e-151 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -0.0Initial program 66.4%
Applied rewrites43.0%
Taylor expanded in d around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6423.0
Applied rewrites23.0%
if -0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < +inf.0Initial program 66.4%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-neg-outN/A
distribute-rgt-neg-inN/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites66.9%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.9
lift-/.f64N/A
metadata-eval66.9
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6466.9
lift-/.f64N/A
metadata-eval66.9
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6466.9
Applied rewrites66.9%
Taylor expanded in d around inf
Applied rewrites38.9%
if +inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 66.4%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.6
Applied rewrites23.6%
Taylor expanded in d around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6411.5
Applied rewrites11.5%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(-
1.0
(* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l))))))
(if (<= t_0 -5e-151)
(/ (* (sqrt (* (/ d (* h l)) d)) (- h)) h)
(if (<= t_0 0.0)
(/ (* -1.0 (* d (* l (sqrt (/ 1.0 (* h l)))))) l)
(* (* (sqrt (/ d l)) (sqrt (/ d h))) 1.0)))))double code(double d, double h, double l, double M, double D) {
double t_0 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double tmp;
if (t_0 <= -5e-151) {
tmp = (sqrt(((d / (h * l)) * d)) * -h) / h;
} else if (t_0 <= 0.0) {
tmp = (-1.0 * (d * (l * sqrt((1.0 / (h * l)))))) / l;
} else {
tmp = (sqrt((d / l)) * sqrt((d / h))) * 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(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
if (t_0 <= (-5d-151)) then
tmp = (sqrt(((d / (h * l)) * d)) * -h) / h
else if (t_0 <= 0.0d0) then
tmp = ((-1.0d0) * (d * (l * sqrt((1.0d0 / (h * l)))))) / l
else
tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0d0
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double tmp;
if (t_0 <= -5e-151) {
tmp = (Math.sqrt(((d / (h * l)) * d)) * -h) / h;
} else if (t_0 <= 0.0) {
tmp = (-1.0 * (d * (l * Math.sqrt((1.0 / (h * l)))))) / l;
} else {
tmp = (Math.sqrt((d / l)) * Math.sqrt((d / h))) * 1.0;
}
return tmp;
}
def code(d, h, l, M, D): t_0 = (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l))) tmp = 0 if t_0 <= -5e-151: tmp = (math.sqrt(((d / (h * l)) * d)) * -h) / h elif t_0 <= 0.0: tmp = (-1.0 * (d * (l * math.sqrt((1.0 / (h * l)))))) / l else: tmp = (math.sqrt((d / l)) * math.sqrt((d / h))) * 1.0 return tmp
function code(d, h, l, M, D) t_0 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) tmp = 0.0 if (t_0 <= -5e-151) tmp = Float64(Float64(sqrt(Float64(Float64(d / Float64(h * l)) * d)) * Float64(-h)) / h); elseif (t_0 <= 0.0) tmp = Float64(Float64(-1.0 * Float64(d * Float64(l * sqrt(Float64(1.0 / Float64(h * l)))))) / l); else tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * 1.0); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); tmp = 0.0; if (t_0 <= -5e-151) tmp = (sqrt(((d / (h * l)) * d)) * -h) / h; elseif (t_0 <= 0.0) tmp = (-1.0 * (d * (l * sqrt((1.0 / (h * l)))))) / l; else tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -5e-151], N[(N[(N[Sqrt[N[(N[(d / N[(h * l), $MachinePrecision]), $MachinePrecision] * d), $MachinePrecision]], $MachinePrecision] * (-h)), $MachinePrecision] / h), $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(N[(-1.0 * N[(d * N[(l * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-151}:\\
\;\;\;\;\frac{\sqrt{\frac{d}{h \cdot \ell} \cdot d} \cdot \left(-h\right)}{h}\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\frac{-1 \cdot \left(d \cdot \left(\ell \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)\right)}{\ell}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot 1\\
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -5.00000000000000003e-151Initial program 66.4%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.6
Applied rewrites23.6%
Taylor expanded in h around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f649.6
Applied rewrites9.6%
lift-*.f64N/A
mul-1-negN/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lift-neg.f64N/A
lower-*.f649.6
Applied rewrites13.6%
if -5.00000000000000003e-151 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -0.0Initial program 66.4%
Applied rewrites43.0%
Taylor expanded in d around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6423.0
Applied rewrites23.0%
if -0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 66.4%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-neg-outN/A
distribute-rgt-neg-inN/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites66.9%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.9
lift-/.f64N/A
metadata-eval66.9
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6466.9
lift-/.f64N/A
metadata-eval66.9
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6466.9
Applied rewrites66.9%
Taylor expanded in d around inf
Applied rewrites38.9%
(FPCore (d h l M D)
:precision binary64
(if (<=
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l))))
-2e-158)
(/ (* (sqrt (* (/ d (* h l)) d)) (- h)) h)
(* (* (sqrt (/ d l)) (sqrt (/ d h))) 1.0)))double code(double d, double h, double l, double M, double D) {
double tmp;
if (((pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))) <= -2e-158) {
tmp = (sqrt(((d / (h * l)) * d)) * -h) / h;
} else {
tmp = (sqrt((d / l)) * sqrt((d / h))) * 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(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (((((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))) <= (-2d-158)) then
tmp = (sqrt(((d / (h * l)) * d)) * -h) / h
else
tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0d0
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (((Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))) <= -2e-158) {
tmp = (Math.sqrt(((d / (h * l)) * d)) * -h) / h;
} else {
tmp = (Math.sqrt((d / l)) * Math.sqrt((d / h))) * 1.0;
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if ((math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))) <= -2e-158: tmp = (math.sqrt(((d / (h * l)) * d)) * -h) / h else: tmp = (math.sqrt((d / l)) * math.sqrt((d / h))) * 1.0 return tmp
function code(d, h, l, M, D) tmp = 0.0 if (Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) <= -2e-158) tmp = Float64(Float64(sqrt(Float64(Float64(d / Float64(h * l)) * d)) * Float64(-h)) / h); else tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * 1.0); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (((((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l)))) <= -2e-158) tmp = (sqrt(((d / (h * l)) * d)) * -h) / h; else tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -2e-158], N[(N[(N[Sqrt[N[(N[(d / N[(h * l), $MachinePrecision]), $MachinePrecision] * d), $MachinePrecision]], $MachinePrecision] * (-h)), $MachinePrecision] / h), $MachinePrecision], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq -2 \cdot 10^{-158}:\\
\;\;\;\;\frac{\sqrt{\frac{d}{h \cdot \ell} \cdot d} \cdot \left(-h\right)}{h}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot 1\\
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -2.00000000000000013e-158Initial program 66.4%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.6
Applied rewrites23.6%
Taylor expanded in h around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f649.6
Applied rewrites9.6%
lift-*.f64N/A
mul-1-negN/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lift-neg.f64N/A
lower-*.f649.6
Applied rewrites13.6%
if -2.00000000000000013e-158 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 66.4%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-neg-outN/A
distribute-rgt-neg-inN/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites66.9%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.9
lift-/.f64N/A
metadata-eval66.9
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6466.9
lift-/.f64N/A
metadata-eval66.9
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6466.9
Applied rewrites66.9%
Taylor expanded in d around inf
Applied rewrites38.9%
(FPCore (d h l M D)
:precision binary64
(if (<=
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l))))
0.0)
(/ (* -1.0 (* d (sqrt (/ h l)))) h)
(* (* (sqrt (/ d l)) (sqrt (/ d h))) 1.0)))double code(double d, double h, double l, double M, double D) {
double tmp;
if (((pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))) <= 0.0) {
tmp = (-1.0 * (d * sqrt((h / l)))) / h;
} else {
tmp = (sqrt((d / l)) * sqrt((d / h))) * 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(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (((((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))) <= 0.0d0) then
tmp = ((-1.0d0) * (d * sqrt((h / l)))) / h
else
tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0d0
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (((Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))) <= 0.0) {
tmp = (-1.0 * (d * Math.sqrt((h / l)))) / h;
} else {
tmp = (Math.sqrt((d / l)) * Math.sqrt((d / h))) * 1.0;
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if ((math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))) <= 0.0: tmp = (-1.0 * (d * math.sqrt((h / l)))) / h else: tmp = (math.sqrt((d / l)) * math.sqrt((d / h))) * 1.0 return tmp
function code(d, h, l, M, D) tmp = 0.0 if (Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) <= 0.0) tmp = Float64(Float64(-1.0 * Float64(d * sqrt(Float64(h / l)))) / h); else tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * 1.0); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (((((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l)))) <= 0.0) tmp = (-1.0 * (d * sqrt((h / l)))) / h; else tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0], N[(N[(-1.0 * N[(d * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq 0:\\
\;\;\;\;\frac{-1 \cdot \left(d \cdot \sqrt{\frac{h}{\ell}}\right)}{h}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot 1\\
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -0.0Initial program 66.4%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.6
Applied rewrites23.6%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6421.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6421.2
Applied rewrites21.2%
Taylor expanded in d around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6413.3
Applied rewrites13.3%
if -0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 66.4%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-neg-outN/A
distribute-rgt-neg-inN/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites66.9%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.9
lift-/.f64N/A
metadata-eval66.9
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6466.9
lift-/.f64N/A
metadata-eval66.9
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6466.9
Applied rewrites66.9%
Taylor expanded in d around inf
Applied rewrites38.9%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* d (sqrt (/ h l))))
(t_1
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
(t_2 (/ (* -1.0 t_0) h)))
(if (<= t_1 -2e-158) t_2 (if (<= t_1 INFINITY) (/ t_0 h) t_2))))double code(double d, double h, double l, double M, double D) {
double t_0 = d * sqrt((h / l));
double t_1 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double t_2 = (-1.0 * t_0) / h;
double tmp;
if (t_1 <= -2e-158) {
tmp = t_2;
} else if (t_1 <= ((double) INFINITY)) {
tmp = t_0 / h;
} else {
tmp = t_2;
}
return tmp;
}
public static double code(double d, double h, double l, double M, double D) {
double t_0 = d * Math.sqrt((h / l));
double t_1 = (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double t_2 = (-1.0 * t_0) / h;
double tmp;
if (t_1 <= -2e-158) {
tmp = t_2;
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_0 / h;
} else {
tmp = t_2;
}
return tmp;
}
def code(d, h, l, M, D): t_0 = d * math.sqrt((h / l)) t_1 = (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l))) t_2 = (-1.0 * t_0) / h tmp = 0 if t_1 <= -2e-158: tmp = t_2 elif t_1 <= math.inf: tmp = t_0 / h else: tmp = t_2 return tmp
function code(d, h, l, M, D) t_0 = Float64(d * sqrt(Float64(h / l))) t_1 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) t_2 = Float64(Float64(-1.0 * t_0) / h) tmp = 0.0 if (t_1 <= -2e-158) tmp = t_2; elseif (t_1 <= Inf) tmp = Float64(t_0 / h); else tmp = t_2; end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = d * sqrt((h / l)); t_1 = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); t_2 = (-1.0 * t_0) / h; tmp = 0.0; if (t_1 <= -2e-158) tmp = t_2; elseif (t_1 <= Inf) tmp = t_0 / h; else tmp = t_2; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(d * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(-1.0 * t$95$0), $MachinePrecision] / h), $MachinePrecision]}, If[LessEqual[t$95$1, -2e-158], t$95$2, If[LessEqual[t$95$1, Infinity], N[(t$95$0 / h), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
t_0 := d \cdot \sqrt{\frac{h}{\ell}}\\
t_1 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
t_2 := \frac{-1 \cdot t\_0}{h}\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{-158}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\frac{t\_0}{h}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -2.00000000000000013e-158 or +inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 66.4%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.6
Applied rewrites23.6%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6421.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6421.2
Applied rewrites21.2%
Taylor expanded in d around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6413.3
Applied rewrites13.3%
if -2.00000000000000013e-158 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < +inf.0Initial program 66.4%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.6
Applied rewrites23.6%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6421.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6421.2
Applied rewrites21.2%
Taylor expanded in d around 0
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6436.9
Applied rewrites36.9%
(FPCore (d h l M D) :precision binary64 (if (<= h 5e-295) (* -1.0 (* d (sqrt (/ 1.0 (* h l))))) (/ (* d (/ (sqrt h) (sqrt l))) h)))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= 5e-295) {
tmp = -1.0 * (d * sqrt((1.0 / (h * l))));
} else {
tmp = (d * (sqrt(h) / sqrt(l))) / h;
}
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(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (h <= 5d-295) then
tmp = (-1.0d0) * (d * sqrt((1.0d0 / (h * l))))
else
tmp = (d * (sqrt(h) / sqrt(l))) / h
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= 5e-295) {
tmp = -1.0 * (d * Math.sqrt((1.0 / (h * l))));
} else {
tmp = (d * (Math.sqrt(h) / Math.sqrt(l))) / h;
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if h <= 5e-295: tmp = -1.0 * (d * math.sqrt((1.0 / (h * l)))) else: tmp = (d * (math.sqrt(h) / math.sqrt(l))) / h return tmp
function code(d, h, l, M, D) tmp = 0.0 if (h <= 5e-295) tmp = Float64(-1.0 * Float64(d * sqrt(Float64(1.0 / Float64(h * l))))); else tmp = Float64(Float64(d * Float64(sqrt(h) / sqrt(l))) / h); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (h <= 5e-295) tmp = -1.0 * (d * sqrt((1.0 / (h * l)))); else tmp = (d * (sqrt(h) / sqrt(l))) / h; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[h, 5e-295], N[(-1.0 * N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d * N[(N[Sqrt[h], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;h \leq 5 \cdot 10^{-295}:\\
\;\;\;\;-1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d \cdot \frac{\sqrt{h}}{\sqrt{\ell}}}{h}\\
\end{array}
if h < 5.00000000000000008e-295Initial program 66.4%
Applied rewrites43.0%
Taylor expanded in d around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6425.9
Applied rewrites25.9%
if 5.00000000000000008e-295 < h Initial program 66.4%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.6
Applied rewrites23.6%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6421.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6421.2
Applied rewrites21.2%
Taylor expanded in d around 0
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6436.9
Applied rewrites36.9%
lift-sqrt.f64N/A
lift-/.f64N/A
sqrt-divN/A
lower-unsound-/.f64N/A
lower-unsound-sqrt.f64N/A
lower-unsound-sqrt.f6422.0
Applied rewrites22.0%
(FPCore (d h l M D) :precision binary64 (if (<= d 2.3e-307) (/ (* d (sqrt (/ h l))) h) (/ (* d (/ (sqrt h) (sqrt l))) h)))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= 2.3e-307) {
tmp = (d * sqrt((h / l))) / h;
} else {
tmp = (d * (sqrt(h) / sqrt(l))) / h;
}
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(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (d <= 2.3d-307) then
tmp = (d * sqrt((h / l))) / h
else
tmp = (d * (sqrt(h) / sqrt(l))) / h
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= 2.3e-307) {
tmp = (d * Math.sqrt((h / l))) / h;
} else {
tmp = (d * (Math.sqrt(h) / Math.sqrt(l))) / h;
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if d <= 2.3e-307: tmp = (d * math.sqrt((h / l))) / h else: tmp = (d * (math.sqrt(h) / math.sqrt(l))) / h return tmp
function code(d, h, l, M, D) tmp = 0.0 if (d <= 2.3e-307) tmp = Float64(Float64(d * sqrt(Float64(h / l))) / h); else tmp = Float64(Float64(d * Float64(sqrt(h) / sqrt(l))) / h); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (d <= 2.3e-307) tmp = (d * sqrt((h / l))) / h; else tmp = (d * (sqrt(h) / sqrt(l))) / h; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[d, 2.3e-307], N[(N[(d * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[(N[(d * N[(N[Sqrt[h], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;d \leq 2.3 \cdot 10^{-307}:\\
\;\;\;\;\frac{d \cdot \sqrt{\frac{h}{\ell}}}{h}\\
\mathbf{else}:\\
\;\;\;\;\frac{d \cdot \frac{\sqrt{h}}{\sqrt{\ell}}}{h}\\
\end{array}
if d < 2.2999999999999999e-307Initial program 66.4%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.6
Applied rewrites23.6%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6421.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6421.2
Applied rewrites21.2%
Taylor expanded in d around 0
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6436.9
Applied rewrites36.9%
if 2.2999999999999999e-307 < d Initial program 66.4%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.6
Applied rewrites23.6%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6421.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6421.2
Applied rewrites21.2%
Taylor expanded in d around 0
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6436.9
Applied rewrites36.9%
lift-sqrt.f64N/A
lift-/.f64N/A
sqrt-divN/A
lower-unsound-/.f64N/A
lower-unsound-sqrt.f64N/A
lower-unsound-sqrt.f6422.0
Applied rewrites22.0%
(FPCore (d h l M D) :precision binary64 (/ (* d (sqrt (/ h l))) h))
double code(double d, double h, double l, double M, double D) {
return (d * sqrt((h / l))) / h;
}
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(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = (d * sqrt((h / l))) / h
end function
public static double code(double d, double h, double l, double M, double D) {
return (d * Math.sqrt((h / l))) / h;
}
def code(d, h, l, M, D): return (d * math.sqrt((h / l))) / h
function code(d, h, l, M, D) return Float64(Float64(d * sqrt(Float64(h / l))) / h) end
function tmp = code(d, h, l, M, D) tmp = (d * sqrt((h / l))) / h; end
code[d_, h_, l_, M_, D_] := N[(N[(d * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]
\frac{d \cdot \sqrt{\frac{h}{\ell}}}{h}
Initial program 66.4%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.6
Applied rewrites23.6%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6421.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6421.2
Applied rewrites21.2%
Taylor expanded in d around 0
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6436.9
Applied rewrites36.9%
herbie shell --seed 2025170
(FPCore (d h l M D)
:name "Henrywood and Agarwal, Equation (12)"
:precision binary64
(* (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))) (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))