
(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]
\begin{array}{l}
\\
\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)
\end{array}
Sampling outcomes in binary64 precision:
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]
\begin{array}{l}
\\
\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)
\end{array}
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (fabs (/ d (sqrt (* l h)))))
(t_1 (pow (/ (* M D) (* 2.0 d)) 2.0))
(t_2
(*
(* (pow (/ d h) (pow 2.0 -1.0)) (pow (/ d l) (pow 2.0 -1.0)))
(- 1.0 (* (* (pow 2.0 -1.0) t_1) (/ h l))))))
(if (<= t_2 1e-187)
(* t_0 (- 1.0 (* (* 0.5 t_1) (/ h l))))
(if (<= t_2 2e+220)
(* (sqrt (/ d l)) (sqrt (/ d h)))
(* t_0 (- 1.0 (/ (* (pow (* (/ D 2.0) (/ M d)) 2.0) (* 0.5 h)) l)))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = fabs((d / sqrt((l * h))));
double t_1 = pow(((M * D) / (2.0 * d)), 2.0);
double t_2 = (pow((d / h), pow(2.0, -1.0)) * pow((d / l), pow(2.0, -1.0))) * (1.0 - ((pow(2.0, -1.0) * t_1) * (h / l)));
double tmp;
if (t_2 <= 1e-187) {
tmp = t_0 * (1.0 - ((0.5 * t_1) * (h / l)));
} else if (t_2 <= 2e+220) {
tmp = sqrt((d / l)) * sqrt((d / h));
} else {
tmp = t_0 * (1.0 - ((pow(((D / 2.0) * (M / d)), 2.0) * (0.5 * h)) / l));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(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((l * h))))
t_1 = ((m * d_1) / (2.0d0 * d)) ** 2.0d0
t_2 = (((d / h) ** (2.0d0 ** (-1.0d0))) * ((d / l) ** (2.0d0 ** (-1.0d0)))) * (1.0d0 - (((2.0d0 ** (-1.0d0)) * t_1) * (h / l)))
if (t_2 <= 1d-187) then
tmp = t_0 * (1.0d0 - ((0.5d0 * t_1) * (h / l)))
else if (t_2 <= 2d+220) then
tmp = sqrt((d / l)) * sqrt((d / h))
else
tmp = t_0 * (1.0d0 - (((((d_1 / 2.0d0) * (m / d)) ** 2.0d0) * (0.5d0 * h)) / 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((l * h))));
double t_1 = Math.pow(((M * D) / (2.0 * d)), 2.0);
double t_2 = (Math.pow((d / h), Math.pow(2.0, -1.0)) * Math.pow((d / l), Math.pow(2.0, -1.0))) * (1.0 - ((Math.pow(2.0, -1.0) * t_1) * (h / l)));
double tmp;
if (t_2 <= 1e-187) {
tmp = t_0 * (1.0 - ((0.5 * t_1) * (h / l)));
} else if (t_2 <= 2e+220) {
tmp = Math.sqrt((d / l)) * Math.sqrt((d / h));
} else {
tmp = t_0 * (1.0 - ((Math.pow(((D / 2.0) * (M / d)), 2.0) * (0.5 * h)) / l));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.fabs((d / math.sqrt((l * h)))) t_1 = math.pow(((M * D) / (2.0 * d)), 2.0) t_2 = (math.pow((d / h), math.pow(2.0, -1.0)) * math.pow((d / l), math.pow(2.0, -1.0))) * (1.0 - ((math.pow(2.0, -1.0) * t_1) * (h / l))) tmp = 0 if t_2 <= 1e-187: tmp = t_0 * (1.0 - ((0.5 * t_1) * (h / l))) elif t_2 <= 2e+220: tmp = math.sqrt((d / l)) * math.sqrt((d / h)) else: tmp = t_0 * (1.0 - ((math.pow(((D / 2.0) * (M / d)), 2.0) * (0.5 * h)) / l)) return tmp
function code(d, h, l, M, D) t_0 = abs(Float64(d / sqrt(Float64(l * h)))) t_1 = Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0 t_2 = Float64(Float64((Float64(d / h) ^ (2.0 ^ -1.0)) * (Float64(d / l) ^ (2.0 ^ -1.0))) * Float64(1.0 - Float64(Float64((2.0 ^ -1.0) * t_1) * Float64(h / l)))) tmp = 0.0 if (t_2 <= 1e-187) tmp = Float64(t_0 * Float64(1.0 - Float64(Float64(0.5 * t_1) * Float64(h / l)))); elseif (t_2 <= 2e+220) tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))); else tmp = Float64(t_0 * Float64(1.0 - Float64(Float64((Float64(Float64(D / 2.0) * Float64(M / d)) ^ 2.0) * Float64(0.5 * h)) / l))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = abs((d / sqrt((l * h)))); t_1 = ((M * D) / (2.0 * d)) ^ 2.0; t_2 = (((d / h) ^ (2.0 ^ -1.0)) * ((d / l) ^ (2.0 ^ -1.0))) * (1.0 - (((2.0 ^ -1.0) * t_1) * (h / l))); tmp = 0.0; if (t_2 <= 1e-187) tmp = t_0 * (1.0 - ((0.5 * t_1) * (h / l))); elseif (t_2 <= 2e+220) tmp = sqrt((d / l)) * sqrt((d / h)); else tmp = t_0 * (1.0 - (((((D / 2.0) * (M / d)) ^ 2.0) * (0.5 * h)) / l)); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[Power[2.0, -1.0], $MachinePrecision] * t$95$1), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, 1e-187], N[(t$95$0 * N[(1.0 - N[(N[(0.5 * t$95$1), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 2e+220], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(1.0 - N[(N[(N[Power[N[(N[(D / 2.0), $MachinePrecision] * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(0.5 * h), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\
t_1 := {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\\
t_2 := \left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot t\_1\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{if}\;t\_2 \leq 10^{-187}:\\
\;\;\;\;t\_0 \cdot \left(1 - \left(0.5 \cdot t\_1\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+220}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \left(1 - \frac{{\left(\frac{D}{2} \cdot \frac{M}{d}\right)}^{2} \cdot \left(0.5 \cdot h\right)}{\ell}\right)\\
\end{array}
\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)))) < 1e-187Initial program 76.8%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6476.8
Applied rewrites76.8%
lift-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6476.8
Applied rewrites76.8%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
*-commutativeN/A
lift-*.f64N/A
rem-square-sqrtN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
rem-sqrt-squareN/A
lower-fabs.f6465.4
lift-sqrt.f64N/A
lift-*.f64N/A
sqrt-prodN/A
lift-/.f64N/A
sqrt-divN/A
lift-/.f64N/A
sqrt-divN/A
frac-timesN/A
rem-square-sqrtN/A
sqrt-prodN/A
lift-*.f64N/A
lift-sqrt.f64N/A
Applied rewrites77.8%
lift-/.f64N/A
metadata-eval77.8
Applied rewrites77.8%
if 1e-187 < (*.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)))) < 2e220Initial program 97.5%
Applied rewrites91.2%
Taylor expanded in d around -inf
mul-1-negN/A
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
mul-1-negN/A
remove-double-negN/A
lower-sqrt.f64N/A
lower-/.f6497.5
Applied rewrites97.5%
if 2e220 < (*.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 20.7%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6420.7
Applied rewrites20.7%
lift-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6420.7
Applied rewrites20.7%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
*-commutativeN/A
lift-*.f64N/A
rem-square-sqrtN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
rem-sqrt-squareN/A
lower-fabs.f6419.6
lift-sqrt.f64N/A
lift-*.f64N/A
sqrt-prodN/A
lift-/.f64N/A
sqrt-divN/A
lift-/.f64N/A
sqrt-divN/A
frac-timesN/A
rem-square-sqrtN/A
sqrt-prodN/A
lift-*.f64N/A
lift-sqrt.f64N/A
Applied rewrites51.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites68.0%
Final simplification79.2%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* (fabs (/ d (sqrt (* l h)))) 1.0))
(t_1
(*
(* (pow (/ d h) (pow 2.0 -1.0)) (pow (/ d l) (pow 2.0 -1.0)))
(-
1.0
(* (* (pow 2.0 -1.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
(t_2
(*
(* h -0.125)
(/
(* (* (* (fabs d) (sqrt (/ (pow h -1.0) l))) (* M M)) (* D D))
(* (* d d) l)))))
(if (<= t_1 -4e-76)
t_2
(if (<= t_1 1e-187)
t_0
(if (<= t_1 2e+220)
(* (sqrt (/ d l)) (sqrt (/ d h)))
(if (<= t_1 INFINITY) t_0 t_2))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = fabs((d / sqrt((l * h)))) * 1.0;
double t_1 = (pow((d / h), pow(2.0, -1.0)) * pow((d / l), pow(2.0, -1.0))) * (1.0 - ((pow(2.0, -1.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double t_2 = (h * -0.125) * ((((fabs(d) * sqrt((pow(h, -1.0) / l))) * (M * M)) * (D * D)) / ((d * d) * l));
double tmp;
if (t_1 <= -4e-76) {
tmp = t_2;
} else if (t_1 <= 1e-187) {
tmp = t_0;
} else if (t_1 <= 2e+220) {
tmp = sqrt((d / l)) * sqrt((d / h));
} else if (t_1 <= ((double) INFINITY)) {
tmp = t_0;
} else {
tmp = t_2;
}
return tmp;
}
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.abs((d / Math.sqrt((l * h)))) * 1.0;
double t_1 = (Math.pow((d / h), Math.pow(2.0, -1.0)) * Math.pow((d / l), Math.pow(2.0, -1.0))) * (1.0 - ((Math.pow(2.0, -1.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double t_2 = (h * -0.125) * ((((Math.abs(d) * Math.sqrt((Math.pow(h, -1.0) / l))) * (M * M)) * (D * D)) / ((d * d) * l));
double tmp;
if (t_1 <= -4e-76) {
tmp = t_2;
} else if (t_1 <= 1e-187) {
tmp = t_0;
} else if (t_1 <= 2e+220) {
tmp = Math.sqrt((d / l)) * Math.sqrt((d / h));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_0;
} else {
tmp = t_2;
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.fabs((d / math.sqrt((l * h)))) * 1.0 t_1 = (math.pow((d / h), math.pow(2.0, -1.0)) * math.pow((d / l), math.pow(2.0, -1.0))) * (1.0 - ((math.pow(2.0, -1.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l))) t_2 = (h * -0.125) * ((((math.fabs(d) * math.sqrt((math.pow(h, -1.0) / l))) * (M * M)) * (D * D)) / ((d * d) * l)) tmp = 0 if t_1 <= -4e-76: tmp = t_2 elif t_1 <= 1e-187: tmp = t_0 elif t_1 <= 2e+220: tmp = math.sqrt((d / l)) * math.sqrt((d / h)) elif t_1 <= math.inf: tmp = t_0 else: tmp = t_2 return tmp
function code(d, h, l, M, D) t_0 = Float64(abs(Float64(d / sqrt(Float64(l * h)))) * 1.0) t_1 = Float64(Float64((Float64(d / h) ^ (2.0 ^ -1.0)) * (Float64(d / l) ^ (2.0 ^ -1.0))) * Float64(1.0 - Float64(Float64((2.0 ^ -1.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) t_2 = Float64(Float64(h * -0.125) * Float64(Float64(Float64(Float64(abs(d) * sqrt(Float64((h ^ -1.0) / l))) * Float64(M * M)) * Float64(D * D)) / Float64(Float64(d * d) * l))) tmp = 0.0 if (t_1 <= -4e-76) tmp = t_2; elseif (t_1 <= 1e-187) tmp = t_0; elseif (t_1 <= 2e+220) tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))); elseif (t_1 <= Inf) tmp = t_0; else tmp = t_2; end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = abs((d / sqrt((l * h)))) * 1.0; t_1 = (((d / h) ^ (2.0 ^ -1.0)) * ((d / l) ^ (2.0 ^ -1.0))) * (1.0 - (((2.0 ^ -1.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); t_2 = (h * -0.125) * ((((abs(d) * sqrt(((h ^ -1.0) / l))) * (M * M)) * (D * D)) / ((d * d) * l)); tmp = 0.0; if (t_1 <= -4e-76) tmp = t_2; elseif (t_1 <= 1e-187) tmp = t_0; elseif (t_1 <= 2e+220) tmp = sqrt((d / l)) * sqrt((d / h)); elseif (t_1 <= Inf) tmp = t_0; else tmp = t_2; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[Power[2.0, -1.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[(h * -0.125), $MachinePrecision] * N[(N[(N[(N[(N[Abs[d], $MachinePrecision] * N[Sqrt[N[(N[Power[h, -1.0], $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(M * M), $MachinePrecision]), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision] / N[(N[(d * d), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -4e-76], t$95$2, If[LessEqual[t$95$1, 1e-187], t$95$0, If[LessEqual[t$95$1, 2e+220], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], t$95$0, t$95$2]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left|\frac{d}{\sqrt{\ell \cdot h}}\right| \cdot 1\\
t_1 := \left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
t_2 := \left(h \cdot -0.125\right) \cdot \frac{\left(\left(\left|d\right| \cdot \sqrt{\frac{{h}^{-1}}{\ell}}\right) \cdot \left(M \cdot M\right)\right) \cdot \left(D \cdot D\right)}{\left(d \cdot d\right) \cdot \ell}\\
\mathbf{if}\;t\_1 \leq -4 \cdot 10^{-76}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 10^{-187}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+220}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\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)))) < -3.99999999999999971e-76 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 50.3%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6450.3
Applied rewrites50.3%
lift-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6450.3
Applied rewrites50.3%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
*-commutativeN/A
lift-*.f64N/A
rem-square-sqrtN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
rem-sqrt-squareN/A
lower-fabs.f6444.5
lift-sqrt.f64N/A
lift-*.f64N/A
sqrt-prodN/A
lift-/.f64N/A
sqrt-divN/A
lift-/.f64N/A
sqrt-divN/A
frac-timesN/A
rem-square-sqrtN/A
sqrt-prodN/A
lift-*.f64N/A
lift-sqrt.f64N/A
Applied rewrites57.4%
Taylor expanded in d around 0
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
associate-*l/N/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites39.4%
if -3.99999999999999971e-76 < (*.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)))) < 1e-187 or 2e220 < (*.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 56.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6456.4
Applied rewrites56.4%
lift-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6456.4
Applied rewrites56.4%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
*-commutativeN/A
lift-*.f64N/A
rem-square-sqrtN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
rem-sqrt-squareN/A
lower-fabs.f6446.8
lift-sqrt.f64N/A
lift-*.f64N/A
sqrt-prodN/A
lift-/.f64N/A
sqrt-divN/A
lift-/.f64N/A
sqrt-divN/A
frac-timesN/A
rem-square-sqrtN/A
sqrt-prodN/A
lift-*.f64N/A
lift-sqrt.f64N/A
Applied rewrites90.7%
Taylor expanded in d around inf
Applied rewrites90.7%
if 1e-187 < (*.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)))) < 2e220Initial program 97.5%
Applied rewrites91.2%
Taylor expanded in d around -inf
mul-1-negN/A
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
mul-1-negN/A
remove-double-negN/A
lower-sqrt.f64N/A
lower-/.f6497.5
Applied rewrites97.5%
Final simplification63.7%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (fabs (/ d (sqrt (* l h)))))
(t_1 (sqrt (/ d h)))
(t_2 (sqrt (/ d l)))
(t_3 (* -0.125 (/ (/ (* D D) d) d)))
(t_4
(*
(* (pow (/ d h) (pow 2.0 -1.0)) (pow (/ d l) (pow 2.0 -1.0)))
(-
1.0
(* (* (pow 2.0 -1.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
(t_5 (* t_0 1.0)))
(if (<= t_4 -4e-76)
(* (* t_1 t_2) (+ 1.0 (* (* t_3 (/ h l)) (* M M))))
(if (<= t_4 1e-187)
t_5
(if (<= t_4 2e+220)
(* t_2 t_1)
(if (<= t_4 INFINITY)
t_5
(* t_0 (fma t_3 (* h (/ (* M M) l)) 1.0))))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = fabs((d / sqrt((l * h))));
double t_1 = sqrt((d / h));
double t_2 = sqrt((d / l));
double t_3 = -0.125 * (((D * D) / d) / d);
double t_4 = (pow((d / h), pow(2.0, -1.0)) * pow((d / l), pow(2.0, -1.0))) * (1.0 - ((pow(2.0, -1.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double t_5 = t_0 * 1.0;
double tmp;
if (t_4 <= -4e-76) {
tmp = (t_1 * t_2) * (1.0 + ((t_3 * (h / l)) * (M * M)));
} else if (t_4 <= 1e-187) {
tmp = t_5;
} else if (t_4 <= 2e+220) {
tmp = t_2 * t_1;
} else if (t_4 <= ((double) INFINITY)) {
tmp = t_5;
} else {
tmp = t_0 * fma(t_3, (h * ((M * M) / l)), 1.0);
}
return tmp;
}
function code(d, h, l, M, D) t_0 = abs(Float64(d / sqrt(Float64(l * h)))) t_1 = sqrt(Float64(d / h)) t_2 = sqrt(Float64(d / l)) t_3 = Float64(-0.125 * Float64(Float64(Float64(D * D) / d) / d)) t_4 = Float64(Float64((Float64(d / h) ^ (2.0 ^ -1.0)) * (Float64(d / l) ^ (2.0 ^ -1.0))) * Float64(1.0 - Float64(Float64((2.0 ^ -1.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) t_5 = Float64(t_0 * 1.0) tmp = 0.0 if (t_4 <= -4e-76) tmp = Float64(Float64(t_1 * t_2) * Float64(1.0 + Float64(Float64(t_3 * Float64(h / l)) * Float64(M * M)))); elseif (t_4 <= 1e-187) tmp = t_5; elseif (t_4 <= 2e+220) tmp = Float64(t_2 * t_1); elseif (t_4 <= Inf) tmp = t_5; else tmp = Float64(t_0 * fma(t_3, Float64(h * Float64(Float64(M * M) / l)), 1.0)); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(-0.125 * N[(N[(N[(D * D), $MachinePrecision] / d), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[Power[2.0, -1.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$5 = N[(t$95$0 * 1.0), $MachinePrecision]}, If[LessEqual[t$95$4, -4e-76], N[(N[(t$95$1 * t$95$2), $MachinePrecision] * N[(1.0 + N[(N[(t$95$3 * N[(h / l), $MachinePrecision]), $MachinePrecision] * N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, 1e-187], t$95$5, If[LessEqual[t$95$4, 2e+220], N[(t$95$2 * t$95$1), $MachinePrecision], If[LessEqual[t$95$4, Infinity], t$95$5, N[(t$95$0 * N[(t$95$3 * N[(h * N[(N[(M * M), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\
t_1 := \sqrt{\frac{d}{h}}\\
t_2 := \sqrt{\frac{d}{\ell}}\\
t_3 := -0.125 \cdot \frac{\frac{D \cdot D}{d}}{d}\\
t_4 := \left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
t_5 := t\_0 \cdot 1\\
\mathbf{if}\;t\_4 \leq -4 \cdot 10^{-76}:\\
\;\;\;\;\left(t\_1 \cdot t\_2\right) \cdot \left(1 + \left(t\_3 \cdot \frac{h}{\ell}\right) \cdot \left(M \cdot M\right)\right)\\
\mathbf{elif}\;t\_4 \leq 10^{-187}:\\
\;\;\;\;t\_5\\
\mathbf{elif}\;t\_4 \leq 2 \cdot 10^{+220}:\\
\;\;\;\;t\_2 \cdot t\_1\\
\mathbf{elif}\;t\_4 \leq \infty:\\
\;\;\;\;t\_5\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \mathsf{fma}\left(t\_3, h \cdot \frac{M \cdot M}{\ell}, 1\right)\\
\end{array}
\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)))) < -3.99999999999999971e-76Initial program 82.7%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6482.7
Applied rewrites82.7%
lift-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6482.7
Applied rewrites82.7%
Taylor expanded in M around inf
fp-cancel-sub-sign-invN/A
distribute-rgt-inN/A
lft-mult-inverseN/A
lower-+.f64N/A
lower-*.f64N/A
Applied rewrites59.5%
if -3.99999999999999971e-76 < (*.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)))) < 1e-187 or 2e220 < (*.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 56.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6456.4
Applied rewrites56.4%
lift-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6456.4
Applied rewrites56.4%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
*-commutativeN/A
lift-*.f64N/A
rem-square-sqrtN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
rem-sqrt-squareN/A
lower-fabs.f6446.8
lift-sqrt.f64N/A
lift-*.f64N/A
sqrt-prodN/A
lift-/.f64N/A
sqrt-divN/A
lift-/.f64N/A
sqrt-divN/A
frac-timesN/A
rem-square-sqrtN/A
sqrt-prodN/A
lift-*.f64N/A
lift-sqrt.f64N/A
Applied rewrites90.7%
Taylor expanded in d around inf
Applied rewrites90.7%
if 1e-187 < (*.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)))) < 2e220Initial program 97.5%
Applied rewrites91.2%
Taylor expanded in d around -inf
mul-1-negN/A
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
mul-1-negN/A
remove-double-negN/A
lower-sqrt.f64N/A
lower-/.f6497.5
Applied rewrites97.5%
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 0.0%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f640.0
Applied rewrites0.0%
lift-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f640.0
Applied rewrites0.0%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
*-commutativeN/A
lift-*.f64N/A
rem-square-sqrtN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
rem-sqrt-squareN/A
lower-fabs.f640.0
lift-sqrt.f64N/A
lift-*.f64N/A
sqrt-prodN/A
lift-/.f64N/A
sqrt-divN/A
lift-/.f64N/A
sqrt-divN/A
frac-timesN/A
rem-square-sqrtN/A
sqrt-prodN/A
lift-*.f64N/A
lift-sqrt.f64N/A
Applied rewrites27.3%
Taylor expanded in d around 0
Applied rewrites50.4%
Final simplification72.9%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (fabs (/ d (sqrt (* l h)))))
(t_1 (sqrt (/ d h)))
(t_2 (sqrt (/ d l)))
(t_3 (* -0.125 (/ (/ (* D D) d) d)))
(t_4
(*
(* (pow (/ d h) (pow 2.0 -1.0)) (pow (/ d l) (pow 2.0 -1.0)))
(-
1.0
(* (* (pow 2.0 -1.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
(t_5 (* t_0 1.0)))
(if (<= t_4 -4e-76)
(* (* t_1 t_2) (fma t_3 (/ (* (* M M) h) l) 1.0))
(if (<= t_4 1e-187)
t_5
(if (<= t_4 2e+220)
(* t_2 t_1)
(if (<= t_4 INFINITY)
t_5
(* t_0 (fma t_3 (* h (/ (* M M) l)) 1.0))))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = fabs((d / sqrt((l * h))));
double t_1 = sqrt((d / h));
double t_2 = sqrt((d / l));
double t_3 = -0.125 * (((D * D) / d) / d);
double t_4 = (pow((d / h), pow(2.0, -1.0)) * pow((d / l), pow(2.0, -1.0))) * (1.0 - ((pow(2.0, -1.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double t_5 = t_0 * 1.0;
double tmp;
if (t_4 <= -4e-76) {
tmp = (t_1 * t_2) * fma(t_3, (((M * M) * h) / l), 1.0);
} else if (t_4 <= 1e-187) {
tmp = t_5;
} else if (t_4 <= 2e+220) {
tmp = t_2 * t_1;
} else if (t_4 <= ((double) INFINITY)) {
tmp = t_5;
} else {
tmp = t_0 * fma(t_3, (h * ((M * M) / l)), 1.0);
}
return tmp;
}
function code(d, h, l, M, D) t_0 = abs(Float64(d / sqrt(Float64(l * h)))) t_1 = sqrt(Float64(d / h)) t_2 = sqrt(Float64(d / l)) t_3 = Float64(-0.125 * Float64(Float64(Float64(D * D) / d) / d)) t_4 = Float64(Float64((Float64(d / h) ^ (2.0 ^ -1.0)) * (Float64(d / l) ^ (2.0 ^ -1.0))) * Float64(1.0 - Float64(Float64((2.0 ^ -1.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) t_5 = Float64(t_0 * 1.0) tmp = 0.0 if (t_4 <= -4e-76) tmp = Float64(Float64(t_1 * t_2) * fma(t_3, Float64(Float64(Float64(M * M) * h) / l), 1.0)); elseif (t_4 <= 1e-187) tmp = t_5; elseif (t_4 <= 2e+220) tmp = Float64(t_2 * t_1); elseif (t_4 <= Inf) tmp = t_5; else tmp = Float64(t_0 * fma(t_3, Float64(h * Float64(Float64(M * M) / l)), 1.0)); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(-0.125 * N[(N[(N[(D * D), $MachinePrecision] / d), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[Power[2.0, -1.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$5 = N[(t$95$0 * 1.0), $MachinePrecision]}, If[LessEqual[t$95$4, -4e-76], N[(N[(t$95$1 * t$95$2), $MachinePrecision] * N[(t$95$3 * N[(N[(N[(M * M), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, 1e-187], t$95$5, If[LessEqual[t$95$4, 2e+220], N[(t$95$2 * t$95$1), $MachinePrecision], If[LessEqual[t$95$4, Infinity], t$95$5, N[(t$95$0 * N[(t$95$3 * N[(h * N[(N[(M * M), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\
t_1 := \sqrt{\frac{d}{h}}\\
t_2 := \sqrt{\frac{d}{\ell}}\\
t_3 := -0.125 \cdot \frac{\frac{D \cdot D}{d}}{d}\\
t_4 := \left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
t_5 := t\_0 \cdot 1\\
\mathbf{if}\;t\_4 \leq -4 \cdot 10^{-76}:\\
\;\;\;\;\left(t\_1 \cdot t\_2\right) \cdot \mathsf{fma}\left(t\_3, \frac{\left(M \cdot M\right) \cdot h}{\ell}, 1\right)\\
\mathbf{elif}\;t\_4 \leq 10^{-187}:\\
\;\;\;\;t\_5\\
\mathbf{elif}\;t\_4 \leq 2 \cdot 10^{+220}:\\
\;\;\;\;t\_2 \cdot t\_1\\
\mathbf{elif}\;t\_4 \leq \infty:\\
\;\;\;\;t\_5\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \mathsf{fma}\left(t\_3, h \cdot \frac{M \cdot M}{\ell}, 1\right)\\
\end{array}
\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)))) < -3.99999999999999971e-76Initial program 82.7%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6482.7
Applied rewrites82.7%
lift-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6482.7
Applied rewrites82.7%
Taylor expanded in d around 0
div-subN/A
*-inversesN/A
associate-*r/N/A
associate-/r*N/A
*-commutativeN/A
associate-*r/N/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
times-fracN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites55.9%
if -3.99999999999999971e-76 < (*.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)))) < 1e-187 or 2e220 < (*.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 56.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6456.4
Applied rewrites56.4%
lift-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6456.4
Applied rewrites56.4%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
*-commutativeN/A
lift-*.f64N/A
rem-square-sqrtN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
rem-sqrt-squareN/A
lower-fabs.f6446.8
lift-sqrt.f64N/A
lift-*.f64N/A
sqrt-prodN/A
lift-/.f64N/A
sqrt-divN/A
lift-/.f64N/A
sqrt-divN/A
frac-timesN/A
rem-square-sqrtN/A
sqrt-prodN/A
lift-*.f64N/A
lift-sqrt.f64N/A
Applied rewrites90.7%
Taylor expanded in d around inf
Applied rewrites90.7%
if 1e-187 < (*.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)))) < 2e220Initial program 97.5%
Applied rewrites91.2%
Taylor expanded in d around -inf
mul-1-negN/A
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
mul-1-negN/A
remove-double-negN/A
lower-sqrt.f64N/A
lower-/.f6497.5
Applied rewrites97.5%
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 0.0%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f640.0
Applied rewrites0.0%
lift-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f640.0
Applied rewrites0.0%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
*-commutativeN/A
lift-*.f64N/A
rem-square-sqrtN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
rem-sqrt-squareN/A
lower-fabs.f640.0
lift-sqrt.f64N/A
lift-*.f64N/A
sqrt-prodN/A
lift-/.f64N/A
sqrt-divN/A
lift-/.f64N/A
sqrt-divN/A
frac-timesN/A
rem-square-sqrtN/A
sqrt-prodN/A
lift-*.f64N/A
lift-sqrt.f64N/A
Applied rewrites27.3%
Taylor expanded in d around 0
Applied rewrites50.4%
Final simplification71.7%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (fabs (/ d (sqrt (* l h)))))
(t_1 (sqrt (/ d h)))
(t_2 (sqrt (/ d l)))
(t_3 (* -0.125 (/ (/ (* D D) d) d)))
(t_4
(*
(* (pow (/ d h) (pow 2.0 -1.0)) (pow (/ d l) (pow 2.0 -1.0)))
(-
1.0
(* (* (pow 2.0 -1.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
(t_5 (* t_0 1.0)))
(if (<= t_4 -4e-76)
(* (* t_1 t_2) (* t_3 (/ (* (* M M) h) l)))
(if (<= t_4 1e-187)
t_5
(if (<= t_4 2e+220)
(* t_2 t_1)
(if (<= t_4 INFINITY)
t_5
(* t_0 (fma t_3 (* h (/ (* M M) l)) 1.0))))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = fabs((d / sqrt((l * h))));
double t_1 = sqrt((d / h));
double t_2 = sqrt((d / l));
double t_3 = -0.125 * (((D * D) / d) / d);
double t_4 = (pow((d / h), pow(2.0, -1.0)) * pow((d / l), pow(2.0, -1.0))) * (1.0 - ((pow(2.0, -1.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double t_5 = t_0 * 1.0;
double tmp;
if (t_4 <= -4e-76) {
tmp = (t_1 * t_2) * (t_3 * (((M * M) * h) / l));
} else if (t_4 <= 1e-187) {
tmp = t_5;
} else if (t_4 <= 2e+220) {
tmp = t_2 * t_1;
} else if (t_4 <= ((double) INFINITY)) {
tmp = t_5;
} else {
tmp = t_0 * fma(t_3, (h * ((M * M) / l)), 1.0);
}
return tmp;
}
function code(d, h, l, M, D) t_0 = abs(Float64(d / sqrt(Float64(l * h)))) t_1 = sqrt(Float64(d / h)) t_2 = sqrt(Float64(d / l)) t_3 = Float64(-0.125 * Float64(Float64(Float64(D * D) / d) / d)) t_4 = Float64(Float64((Float64(d / h) ^ (2.0 ^ -1.0)) * (Float64(d / l) ^ (2.0 ^ -1.0))) * Float64(1.0 - Float64(Float64((2.0 ^ -1.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) t_5 = Float64(t_0 * 1.0) tmp = 0.0 if (t_4 <= -4e-76) tmp = Float64(Float64(t_1 * t_2) * Float64(t_3 * Float64(Float64(Float64(M * M) * h) / l))); elseif (t_4 <= 1e-187) tmp = t_5; elseif (t_4 <= 2e+220) tmp = Float64(t_2 * t_1); elseif (t_4 <= Inf) tmp = t_5; else tmp = Float64(t_0 * fma(t_3, Float64(h * Float64(Float64(M * M) / l)), 1.0)); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(-0.125 * N[(N[(N[(D * D), $MachinePrecision] / d), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[Power[2.0, -1.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$5 = N[(t$95$0 * 1.0), $MachinePrecision]}, If[LessEqual[t$95$4, -4e-76], N[(N[(t$95$1 * t$95$2), $MachinePrecision] * N[(t$95$3 * N[(N[(N[(M * M), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, 1e-187], t$95$5, If[LessEqual[t$95$4, 2e+220], N[(t$95$2 * t$95$1), $MachinePrecision], If[LessEqual[t$95$4, Infinity], t$95$5, N[(t$95$0 * N[(t$95$3 * N[(h * N[(N[(M * M), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\
t_1 := \sqrt{\frac{d}{h}}\\
t_2 := \sqrt{\frac{d}{\ell}}\\
t_3 := -0.125 \cdot \frac{\frac{D \cdot D}{d}}{d}\\
t_4 := \left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
t_5 := t\_0 \cdot 1\\
\mathbf{if}\;t\_4 \leq -4 \cdot 10^{-76}:\\
\;\;\;\;\left(t\_1 \cdot t\_2\right) \cdot \left(t\_3 \cdot \frac{\left(M \cdot M\right) \cdot h}{\ell}\right)\\
\mathbf{elif}\;t\_4 \leq 10^{-187}:\\
\;\;\;\;t\_5\\
\mathbf{elif}\;t\_4 \leq 2 \cdot 10^{+220}:\\
\;\;\;\;t\_2 \cdot t\_1\\
\mathbf{elif}\;t\_4 \leq \infty:\\
\;\;\;\;t\_5\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \mathsf{fma}\left(t\_3, h \cdot \frac{M \cdot M}{\ell}, 1\right)\\
\end{array}
\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)))) < -3.99999999999999971e-76Initial program 82.7%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6482.7
Applied rewrites82.7%
lift-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6482.7
Applied rewrites82.7%
Taylor expanded in d around 0
times-fracN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6455.3
Applied rewrites55.3%
if -3.99999999999999971e-76 < (*.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)))) < 1e-187 or 2e220 < (*.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 56.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6456.4
Applied rewrites56.4%
lift-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6456.4
Applied rewrites56.4%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
*-commutativeN/A
lift-*.f64N/A
rem-square-sqrtN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
rem-sqrt-squareN/A
lower-fabs.f6446.8
lift-sqrt.f64N/A
lift-*.f64N/A
sqrt-prodN/A
lift-/.f64N/A
sqrt-divN/A
lift-/.f64N/A
sqrt-divN/A
frac-timesN/A
rem-square-sqrtN/A
sqrt-prodN/A
lift-*.f64N/A
lift-sqrt.f64N/A
Applied rewrites90.7%
Taylor expanded in d around inf
Applied rewrites90.7%
if 1e-187 < (*.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)))) < 2e220Initial program 97.5%
Applied rewrites91.2%
Taylor expanded in d around -inf
mul-1-negN/A
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
mul-1-negN/A
remove-double-negN/A
lower-sqrt.f64N/A
lower-/.f6497.5
Applied rewrites97.5%
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 0.0%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f640.0
Applied rewrites0.0%
lift-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f640.0
Applied rewrites0.0%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
*-commutativeN/A
lift-*.f64N/A
rem-square-sqrtN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
rem-sqrt-squareN/A
lower-fabs.f640.0
lift-sqrt.f64N/A
lift-*.f64N/A
sqrt-prodN/A
lift-/.f64N/A
sqrt-divN/A
lift-/.f64N/A
sqrt-divN/A
frac-timesN/A
rem-square-sqrtN/A
sqrt-prodN/A
lift-*.f64N/A
lift-sqrt.f64N/A
Applied rewrites27.3%
Taylor expanded in d around 0
Applied rewrites50.4%
Final simplification71.5%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0
(*
(* (pow (/ d h) (pow 2.0 -1.0)) (pow (/ d l) (pow 2.0 -1.0)))
(-
1.0
(* (* (pow 2.0 -1.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
(t_1 (fabs (/ d (sqrt (* l h)))))
(t_2
(* t_1 (fma (* -0.125 (/ (/ (* D D) d) d)) (* h (/ (* M M) l)) 1.0)))
(t_3 (* t_1 1.0)))
(if (<= t_0 -4e-76)
t_2
(if (<= t_0 1e-187)
t_3
(if (<= t_0 2e+220)
(* (sqrt (/ d l)) (sqrt (/ d h)))
(if (<= t_0 INFINITY) t_3 t_2))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = (pow((d / h), pow(2.0, -1.0)) * pow((d / l), pow(2.0, -1.0))) * (1.0 - ((pow(2.0, -1.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double t_1 = fabs((d / sqrt((l * h))));
double t_2 = t_1 * fma((-0.125 * (((D * D) / d) / d)), (h * ((M * M) / l)), 1.0);
double t_3 = t_1 * 1.0;
double tmp;
if (t_0 <= -4e-76) {
tmp = t_2;
} else if (t_0 <= 1e-187) {
tmp = t_3;
} else if (t_0 <= 2e+220) {
tmp = sqrt((d / l)) * sqrt((d / h));
} else if (t_0 <= ((double) INFINITY)) {
tmp = t_3;
} else {
tmp = t_2;
}
return tmp;
}
function code(d, h, l, M, D) t_0 = Float64(Float64((Float64(d / h) ^ (2.0 ^ -1.0)) * (Float64(d / l) ^ (2.0 ^ -1.0))) * Float64(1.0 - Float64(Float64((2.0 ^ -1.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) t_1 = abs(Float64(d / sqrt(Float64(l * h)))) t_2 = Float64(t_1 * fma(Float64(-0.125 * Float64(Float64(Float64(D * D) / d) / d)), Float64(h * Float64(Float64(M * M) / l)), 1.0)) t_3 = Float64(t_1 * 1.0) tmp = 0.0 if (t_0 <= -4e-76) tmp = t_2; elseif (t_0 <= 1e-187) tmp = t_3; elseif (t_0 <= 2e+220) tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))); elseif (t_0 <= Inf) tmp = t_3; else tmp = t_2; end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[Power[2.0, -1.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[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * N[(N[(-0.125 * N[(N[(N[(D * D), $MachinePrecision] / d), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[(h * N[(N[(M * M), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$1 * 1.0), $MachinePrecision]}, If[LessEqual[t$95$0, -4e-76], t$95$2, If[LessEqual[t$95$0, 1e-187], t$95$3, If[LessEqual[t$95$0, 2e+220], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, Infinity], t$95$3, t$95$2]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
t_1 := \left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\
t_2 := t\_1 \cdot \mathsf{fma}\left(-0.125 \cdot \frac{\frac{D \cdot D}{d}}{d}, h \cdot \frac{M \cdot M}{\ell}, 1\right)\\
t_3 := t\_1 \cdot 1\\
\mathbf{if}\;t\_0 \leq -4 \cdot 10^{-76}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_0 \leq 10^{-187}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+220}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;t\_3\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\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)))) < -3.99999999999999971e-76 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 50.3%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6450.3
Applied rewrites50.3%
lift-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6450.3
Applied rewrites50.3%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
*-commutativeN/A
lift-*.f64N/A
rem-square-sqrtN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
rem-sqrt-squareN/A
lower-fabs.f6444.5
lift-sqrt.f64N/A
lift-*.f64N/A
sqrt-prodN/A
lift-/.f64N/A
sqrt-divN/A
lift-/.f64N/A
sqrt-divN/A
frac-timesN/A
rem-square-sqrtN/A
sqrt-prodN/A
lift-*.f64N/A
lift-sqrt.f64N/A
Applied rewrites57.4%
Taylor expanded in d around 0
Applied rewrites52.3%
if -3.99999999999999971e-76 < (*.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)))) < 1e-187 or 2e220 < (*.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 56.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6456.4
Applied rewrites56.4%
lift-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6456.4
Applied rewrites56.4%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
*-commutativeN/A
lift-*.f64N/A
rem-square-sqrtN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
rem-sqrt-squareN/A
lower-fabs.f6446.8
lift-sqrt.f64N/A
lift-*.f64N/A
sqrt-prodN/A
lift-/.f64N/A
sqrt-divN/A
lift-/.f64N/A
sqrt-divN/A
frac-timesN/A
rem-square-sqrtN/A
sqrt-prodN/A
lift-*.f64N/A
lift-sqrt.f64N/A
Applied rewrites90.7%
Taylor expanded in d around inf
Applied rewrites90.7%
if 1e-187 < (*.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)))) < 2e220Initial program 97.5%
Applied rewrites91.2%
Taylor expanded in d around -inf
mul-1-negN/A
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
mul-1-negN/A
remove-double-negN/A
lower-sqrt.f64N/A
lower-/.f6497.5
Applied rewrites97.5%
Final simplification70.9%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0
(*
(* (pow (/ d h) (pow 2.0 -1.0)) (pow (/ d l) (pow 2.0 -1.0)))
(-
1.0
(* (* (pow 2.0 -1.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
(t_1 (fabs (/ d (sqrt (* l h)))))
(t_2 (* t_1 (* (* h -0.125) (* (/ (* D D) l) (/ (/ (* M M) d) d)))))
(t_3 (* t_1 1.0)))
(if (<= t_0 -4e-76)
t_2
(if (<= t_0 1e-187)
t_3
(if (<= t_0 2e+220)
(* (sqrt (/ d l)) (sqrt (/ d h)))
(if (<= t_0 INFINITY) t_3 t_2))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = (pow((d / h), pow(2.0, -1.0)) * pow((d / l), pow(2.0, -1.0))) * (1.0 - ((pow(2.0, -1.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double t_1 = fabs((d / sqrt((l * h))));
double t_2 = t_1 * ((h * -0.125) * (((D * D) / l) * (((M * M) / d) / d)));
double t_3 = t_1 * 1.0;
double tmp;
if (t_0 <= -4e-76) {
tmp = t_2;
} else if (t_0 <= 1e-187) {
tmp = t_3;
} else if (t_0 <= 2e+220) {
tmp = sqrt((d / l)) * sqrt((d / h));
} else if (t_0 <= ((double) INFINITY)) {
tmp = t_3;
} else {
tmp = t_2;
}
return tmp;
}
public static double code(double d, double h, double l, double M, double D) {
double t_0 = (Math.pow((d / h), Math.pow(2.0, -1.0)) * Math.pow((d / l), Math.pow(2.0, -1.0))) * (1.0 - ((Math.pow(2.0, -1.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double t_1 = Math.abs((d / Math.sqrt((l * h))));
double t_2 = t_1 * ((h * -0.125) * (((D * D) / l) * (((M * M) / d) / d)));
double t_3 = t_1 * 1.0;
double tmp;
if (t_0 <= -4e-76) {
tmp = t_2;
} else if (t_0 <= 1e-187) {
tmp = t_3;
} else if (t_0 <= 2e+220) {
tmp = Math.sqrt((d / l)) * Math.sqrt((d / h));
} else if (t_0 <= Double.POSITIVE_INFINITY) {
tmp = t_3;
} else {
tmp = t_2;
}
return tmp;
}
def code(d, h, l, M, D): t_0 = (math.pow((d / h), math.pow(2.0, -1.0)) * math.pow((d / l), math.pow(2.0, -1.0))) * (1.0 - ((math.pow(2.0, -1.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l))) t_1 = math.fabs((d / math.sqrt((l * h)))) t_2 = t_1 * ((h * -0.125) * (((D * D) / l) * (((M * M) / d) / d))) t_3 = t_1 * 1.0 tmp = 0 if t_0 <= -4e-76: tmp = t_2 elif t_0 <= 1e-187: tmp = t_3 elif t_0 <= 2e+220: tmp = math.sqrt((d / l)) * math.sqrt((d / h)) elif t_0 <= math.inf: tmp = t_3 else: tmp = t_2 return tmp
function code(d, h, l, M, D) t_0 = Float64(Float64((Float64(d / h) ^ (2.0 ^ -1.0)) * (Float64(d / l) ^ (2.0 ^ -1.0))) * Float64(1.0 - Float64(Float64((2.0 ^ -1.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) t_1 = abs(Float64(d / sqrt(Float64(l * h)))) t_2 = Float64(t_1 * Float64(Float64(h * -0.125) * Float64(Float64(Float64(D * D) / l) * Float64(Float64(Float64(M * M) / d) / d)))) t_3 = Float64(t_1 * 1.0) tmp = 0.0 if (t_0 <= -4e-76) tmp = t_2; elseif (t_0 <= 1e-187) tmp = t_3; elseif (t_0 <= 2e+220) tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))); elseif (t_0 <= Inf) tmp = t_3; else tmp = t_2; end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = (((d / h) ^ (2.0 ^ -1.0)) * ((d / l) ^ (2.0 ^ -1.0))) * (1.0 - (((2.0 ^ -1.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); t_1 = abs((d / sqrt((l * h)))); t_2 = t_1 * ((h * -0.125) * (((D * D) / l) * (((M * M) / d) / d))); t_3 = t_1 * 1.0; tmp = 0.0; if (t_0 <= -4e-76) tmp = t_2; elseif (t_0 <= 1e-187) tmp = t_3; elseif (t_0 <= 2e+220) tmp = sqrt((d / l)) * sqrt((d / h)); elseif (t_0 <= Inf) tmp = t_3; else tmp = t_2; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[Power[2.0, -1.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[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * N[(N[(h * -0.125), $MachinePrecision] * N[(N[(N[(D * D), $MachinePrecision] / l), $MachinePrecision] * N[(N[(N[(M * M), $MachinePrecision] / d), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$1 * 1.0), $MachinePrecision]}, If[LessEqual[t$95$0, -4e-76], t$95$2, If[LessEqual[t$95$0, 1e-187], t$95$3, If[LessEqual[t$95$0, 2e+220], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, Infinity], t$95$3, t$95$2]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
t_1 := \left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\
t_2 := t\_1 \cdot \left(\left(h \cdot -0.125\right) \cdot \left(\frac{D \cdot D}{\ell} \cdot \frac{\frac{M \cdot M}{d}}{d}\right)\right)\\
t_3 := t\_1 \cdot 1\\
\mathbf{if}\;t\_0 \leq -4 \cdot 10^{-76}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_0 \leq 10^{-187}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+220}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;t\_3\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\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)))) < -3.99999999999999971e-76 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 50.3%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6450.3
Applied rewrites50.3%
lift-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6450.3
Applied rewrites50.3%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
*-commutativeN/A
lift-*.f64N/A
rem-square-sqrtN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
rem-sqrt-squareN/A
lower-fabs.f6444.5
lift-sqrt.f64N/A
lift-*.f64N/A
sqrt-prodN/A
lift-/.f64N/A
sqrt-divN/A
lift-/.f64N/A
sqrt-divN/A
frac-timesN/A
rem-square-sqrtN/A
sqrt-prodN/A
lift-*.f64N/A
lift-sqrt.f64N/A
Applied rewrites57.4%
Taylor expanded in d around 0
associate-*r/N/A
associate-*r*N/A
associate-*r*N/A
associate-*l/N/A
associate-*r/N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6449.4
Applied rewrites49.4%
if -3.99999999999999971e-76 < (*.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)))) < 1e-187 or 2e220 < (*.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 56.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6456.4
Applied rewrites56.4%
lift-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6456.4
Applied rewrites56.4%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
*-commutativeN/A
lift-*.f64N/A
rem-square-sqrtN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
rem-sqrt-squareN/A
lower-fabs.f6446.8
lift-sqrt.f64N/A
lift-*.f64N/A
sqrt-prodN/A
lift-/.f64N/A
sqrt-divN/A
lift-/.f64N/A
sqrt-divN/A
frac-timesN/A
rem-square-sqrtN/A
sqrt-prodN/A
lift-*.f64N/A
lift-sqrt.f64N/A
Applied rewrites90.7%
Taylor expanded in d around inf
Applied rewrites90.7%
if 1e-187 < (*.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)))) < 2e220Initial program 97.5%
Applied rewrites91.2%
Taylor expanded in d around -inf
mul-1-negN/A
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
mul-1-negN/A
remove-double-negN/A
lower-sqrt.f64N/A
lower-/.f6497.5
Applied rewrites97.5%
Final simplification69.3%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (fabs (/ d (sqrt (* l h)))))
(t_1 (pow (/ (* M D) (* 2.0 d)) 2.0))
(t_2
(*
(* (pow (/ d h) (pow 2.0 -1.0)) (pow (/ d l) (pow 2.0 -1.0)))
(- 1.0 (* (* (pow 2.0 -1.0) t_1) (/ h l))))))
(if (<= t_2 1e-187)
(* t_0 (- 1.0 (* (* 0.5 t_1) (/ h l))))
(if (<= t_2 2e+220)
(* (sqrt (/ d l)) (sqrt (/ d h)))
(if (<= t_2 INFINITY)
(* t_0 1.0)
(*
t_0
(fma (* -0.125 (/ (/ (* D D) d) d)) (* h (/ (* M M) l)) 1.0)))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = fabs((d / sqrt((l * h))));
double t_1 = pow(((M * D) / (2.0 * d)), 2.0);
double t_2 = (pow((d / h), pow(2.0, -1.0)) * pow((d / l), pow(2.0, -1.0))) * (1.0 - ((pow(2.0, -1.0) * t_1) * (h / l)));
double tmp;
if (t_2 <= 1e-187) {
tmp = t_0 * (1.0 - ((0.5 * t_1) * (h / l)));
} else if (t_2 <= 2e+220) {
tmp = sqrt((d / l)) * sqrt((d / h));
} else if (t_2 <= ((double) INFINITY)) {
tmp = t_0 * 1.0;
} else {
tmp = t_0 * fma((-0.125 * (((D * D) / d) / d)), (h * ((M * M) / l)), 1.0);
}
return tmp;
}
function code(d, h, l, M, D) t_0 = abs(Float64(d / sqrt(Float64(l * h)))) t_1 = Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0 t_2 = Float64(Float64((Float64(d / h) ^ (2.0 ^ -1.0)) * (Float64(d / l) ^ (2.0 ^ -1.0))) * Float64(1.0 - Float64(Float64((2.0 ^ -1.0) * t_1) * Float64(h / l)))) tmp = 0.0 if (t_2 <= 1e-187) tmp = Float64(t_0 * Float64(1.0 - Float64(Float64(0.5 * t_1) * Float64(h / l)))); elseif (t_2 <= 2e+220) tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))); elseif (t_2 <= Inf) tmp = Float64(t_0 * 1.0); else tmp = Float64(t_0 * fma(Float64(-0.125 * Float64(Float64(Float64(D * D) / d) / d)), Float64(h * Float64(Float64(M * M) / l)), 1.0)); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[Power[2.0, -1.0], $MachinePrecision] * t$95$1), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, 1e-187], N[(t$95$0 * N[(1.0 - N[(N[(0.5 * t$95$1), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 2e+220], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, Infinity], N[(t$95$0 * 1.0), $MachinePrecision], N[(t$95$0 * N[(N[(-0.125 * N[(N[(N[(D * D), $MachinePrecision] / d), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[(h * N[(N[(M * M), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\
t_1 := {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\\
t_2 := \left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot t\_1\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{if}\;t\_2 \leq 10^{-187}:\\
\;\;\;\;t\_0 \cdot \left(1 - \left(0.5 \cdot t\_1\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+220}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;t\_2 \leq \infty:\\
\;\;\;\;t\_0 \cdot 1\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \mathsf{fma}\left(-0.125 \cdot \frac{\frac{D \cdot D}{d}}{d}, h \cdot \frac{M \cdot M}{\ell}, 1\right)\\
\end{array}
\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)))) < 1e-187Initial program 76.8%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6476.8
Applied rewrites76.8%
lift-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6476.8
Applied rewrites76.8%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
*-commutativeN/A
lift-*.f64N/A
rem-square-sqrtN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
rem-sqrt-squareN/A
lower-fabs.f6465.4
lift-sqrt.f64N/A
lift-*.f64N/A
sqrt-prodN/A
lift-/.f64N/A
sqrt-divN/A
lift-/.f64N/A
sqrt-divN/A
frac-timesN/A
rem-square-sqrtN/A
sqrt-prodN/A
lift-*.f64N/A
lift-sqrt.f64N/A
Applied rewrites77.8%
lift-/.f64N/A
metadata-eval77.8
Applied rewrites77.8%
if 1e-187 < (*.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)))) < 2e220Initial program 97.5%
Applied rewrites91.2%
Taylor expanded in d around -inf
mul-1-negN/A
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
mul-1-negN/A
remove-double-negN/A
lower-sqrt.f64N/A
lower-/.f6497.5
Applied rewrites97.5%
if 2e220 < (*.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 59.3%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6459.3
Applied rewrites59.3%
lift-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6459.3
Applied rewrites59.3%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
*-commutativeN/A
lift-*.f64N/A
rem-square-sqrtN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
rem-sqrt-squareN/A
lower-fabs.f6456.2
lift-sqrt.f64N/A
lift-*.f64N/A
sqrt-prodN/A
lift-/.f64N/A
sqrt-divN/A
lift-/.f64N/A
sqrt-divN/A
frac-timesN/A
rem-square-sqrtN/A
sqrt-prodN/A
lift-*.f64N/A
lift-sqrt.f64N/A
Applied rewrites96.8%
Taylor expanded in d around inf
Applied rewrites96.8%
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 0.0%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f640.0
Applied rewrites0.0%
lift-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f640.0
Applied rewrites0.0%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
*-commutativeN/A
lift-*.f64N/A
rem-square-sqrtN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
rem-sqrt-squareN/A
lower-fabs.f640.0
lift-sqrt.f64N/A
lift-*.f64N/A
sqrt-prodN/A
lift-/.f64N/A
sqrt-divN/A
lift-/.f64N/A
sqrt-divN/A
frac-timesN/A
rem-square-sqrtN/A
sqrt-prodN/A
lift-*.f64N/A
lift-sqrt.f64N/A
Applied rewrites27.3%
Taylor expanded in d around 0
Applied rewrites50.4%
Final simplification78.8%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0
(*
(* (pow (/ d h) (pow 2.0 -1.0)) (pow (/ d l) (pow 2.0 -1.0)))
(-
1.0
(* (* (pow 2.0 -1.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l))))))
(if (<= t_0 -2e-70)
(* (* (* (* (* M M) D) (/ D d)) 0.125) (/ (sqrt (/ h l)) (fabs l)))
(if (or (<= t_0 1e-187) (not (<= t_0 2e+220)))
(* (fabs (/ d (sqrt (* l h)))) 1.0)
(* (sqrt (/ d l)) (sqrt (/ d h)))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = (pow((d / h), pow(2.0, -1.0)) * pow((d / l), pow(2.0, -1.0))) * (1.0 - ((pow(2.0, -1.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double tmp;
if (t_0 <= -2e-70) {
tmp = ((((M * M) * D) * (D / d)) * 0.125) * (sqrt((h / l)) / fabs(l));
} else if ((t_0 <= 1e-187) || !(t_0 <= 2e+220)) {
tmp = fabs((d / sqrt((l * h)))) * 1.0;
} else {
tmp = sqrt((d / l)) * sqrt((d / 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) :: t_0
real(8) :: tmp
t_0 = (((d / h) ** (2.0d0 ** (-1.0d0))) * ((d / l) ** (2.0d0 ** (-1.0d0)))) * (1.0d0 - (((2.0d0 ** (-1.0d0)) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
if (t_0 <= (-2d-70)) then
tmp = ((((m * m) * d_1) * (d_1 / d)) * 0.125d0) * (sqrt((h / l)) / abs(l))
else if ((t_0 <= 1d-187) .or. (.not. (t_0 <= 2d+220))) then
tmp = abs((d / sqrt((l * h)))) * 1.0d0
else
tmp = sqrt((d / l)) * sqrt((d / h))
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), Math.pow(2.0, -1.0)) * Math.pow((d / l), Math.pow(2.0, -1.0))) * (1.0 - ((Math.pow(2.0, -1.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double tmp;
if (t_0 <= -2e-70) {
tmp = ((((M * M) * D) * (D / d)) * 0.125) * (Math.sqrt((h / l)) / Math.abs(l));
} else if ((t_0 <= 1e-187) || !(t_0 <= 2e+220)) {
tmp = Math.abs((d / Math.sqrt((l * h)))) * 1.0;
} else {
tmp = Math.sqrt((d / l)) * Math.sqrt((d / h));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = (math.pow((d / h), math.pow(2.0, -1.0)) * math.pow((d / l), math.pow(2.0, -1.0))) * (1.0 - ((math.pow(2.0, -1.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l))) tmp = 0 if t_0 <= -2e-70: tmp = ((((M * M) * D) * (D / d)) * 0.125) * (math.sqrt((h / l)) / math.fabs(l)) elif (t_0 <= 1e-187) or not (t_0 <= 2e+220): tmp = math.fabs((d / math.sqrt((l * h)))) * 1.0 else: tmp = math.sqrt((d / l)) * math.sqrt((d / h)) return tmp
function code(d, h, l, M, D) t_0 = Float64(Float64((Float64(d / h) ^ (2.0 ^ -1.0)) * (Float64(d / l) ^ (2.0 ^ -1.0))) * Float64(1.0 - Float64(Float64((2.0 ^ -1.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) tmp = 0.0 if (t_0 <= -2e-70) tmp = Float64(Float64(Float64(Float64(Float64(M * M) * D) * Float64(D / d)) * 0.125) * Float64(sqrt(Float64(h / l)) / abs(l))); elseif ((t_0 <= 1e-187) || !(t_0 <= 2e+220)) tmp = Float64(abs(Float64(d / sqrt(Float64(l * h)))) * 1.0); else tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = (((d / h) ^ (2.0 ^ -1.0)) * ((d / l) ^ (2.0 ^ -1.0))) * (1.0 - (((2.0 ^ -1.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); tmp = 0.0; if (t_0 <= -2e-70) tmp = ((((M * M) * D) * (D / d)) * 0.125) * (sqrt((h / l)) / abs(l)); elseif ((t_0 <= 1e-187) || ~((t_0 <= 2e+220))) tmp = abs((d / sqrt((l * h)))) * 1.0; else tmp = sqrt((d / l)) * sqrt((d / h)); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[Power[2.0, -1.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, -2e-70], N[(N[(N[(N[(N[(M * M), $MachinePrecision] * D), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * 0.125), $MachinePrecision] * N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] / N[Abs[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[t$95$0, 1e-187], N[Not[LessEqual[t$95$0, 2e+220]], $MachinePrecision]], N[(N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{-70}:\\
\;\;\;\;\left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot \frac{D}{d}\right) \cdot 0.125\right) \cdot \frac{\sqrt{\frac{h}{\ell}}}{\left|\ell\right|}\\
\mathbf{elif}\;t\_0 \leq 10^{-187} \lor \neg \left(t\_0 \leq 2 \cdot 10^{+220}\right):\\
\;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right| \cdot 1\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\end{array}
\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)))) < -1.99999999999999999e-70Initial program 82.5%
Taylor expanded in h around -inf
Applied rewrites27.4%
Applied rewrites35.5%
if -1.99999999999999999e-70 < (*.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)))) < 1e-187 or 2e220 < (*.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 27.6%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6427.6
Applied rewrites27.6%
lift-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6427.6
Applied rewrites27.6%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
*-commutativeN/A
lift-*.f64N/A
rem-square-sqrtN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
rem-sqrt-squareN/A
lower-fabs.f6423.0
lift-sqrt.f64N/A
lift-*.f64N/A
sqrt-prodN/A
lift-/.f64N/A
sqrt-divN/A
lift-/.f64N/A
sqrt-divN/A
frac-timesN/A
rem-square-sqrtN/A
sqrt-prodN/A
lift-*.f64N/A
lift-sqrt.f64N/A
Applied rewrites57.9%
Taylor expanded in d around inf
Applied rewrites53.7%
if 1e-187 < (*.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)))) < 2e220Initial program 97.5%
Applied rewrites91.2%
Taylor expanded in d around -inf
mul-1-negN/A
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
mul-1-negN/A
remove-double-negN/A
lower-sqrt.f64N/A
lower-/.f6497.5
Applied rewrites97.5%
Final simplification58.2%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0
(*
(* (pow (/ d h) (pow 2.0 -1.0)) (pow (/ d l) (pow 2.0 -1.0)))
(-
1.0
(* (* (pow 2.0 -1.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l))))))
(if (<= t_0 -4e-76)
(/ (* (- d) (sqrt (/ h l))) h)
(if (or (<= t_0 1e-187) (not (<= t_0 2e+220)))
(* (fabs (/ d (sqrt (* l h)))) 1.0)
(* (sqrt (/ d l)) (sqrt (/ d h)))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = (pow((d / h), pow(2.0, -1.0)) * pow((d / l), pow(2.0, -1.0))) * (1.0 - ((pow(2.0, -1.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double tmp;
if (t_0 <= -4e-76) {
tmp = (-d * sqrt((h / l))) / h;
} else if ((t_0 <= 1e-187) || !(t_0 <= 2e+220)) {
tmp = fabs((d / sqrt((l * h)))) * 1.0;
} else {
tmp = sqrt((d / l)) * sqrt((d / 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) :: t_0
real(8) :: tmp
t_0 = (((d / h) ** (2.0d0 ** (-1.0d0))) * ((d / l) ** (2.0d0 ** (-1.0d0)))) * (1.0d0 - (((2.0d0 ** (-1.0d0)) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
if (t_0 <= (-4d-76)) then
tmp = (-d * sqrt((h / l))) / h
else if ((t_0 <= 1d-187) .or. (.not. (t_0 <= 2d+220))) then
tmp = abs((d / sqrt((l * h)))) * 1.0d0
else
tmp = sqrt((d / l)) * sqrt((d / h))
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), Math.pow(2.0, -1.0)) * Math.pow((d / l), Math.pow(2.0, -1.0))) * (1.0 - ((Math.pow(2.0, -1.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double tmp;
if (t_0 <= -4e-76) {
tmp = (-d * Math.sqrt((h / l))) / h;
} else if ((t_0 <= 1e-187) || !(t_0 <= 2e+220)) {
tmp = Math.abs((d / Math.sqrt((l * h)))) * 1.0;
} else {
tmp = Math.sqrt((d / l)) * Math.sqrt((d / h));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = (math.pow((d / h), math.pow(2.0, -1.0)) * math.pow((d / l), math.pow(2.0, -1.0))) * (1.0 - ((math.pow(2.0, -1.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l))) tmp = 0 if t_0 <= -4e-76: tmp = (-d * math.sqrt((h / l))) / h elif (t_0 <= 1e-187) or not (t_0 <= 2e+220): tmp = math.fabs((d / math.sqrt((l * h)))) * 1.0 else: tmp = math.sqrt((d / l)) * math.sqrt((d / h)) return tmp
function code(d, h, l, M, D) t_0 = Float64(Float64((Float64(d / h) ^ (2.0 ^ -1.0)) * (Float64(d / l) ^ (2.0 ^ -1.0))) * Float64(1.0 - Float64(Float64((2.0 ^ -1.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) tmp = 0.0 if (t_0 <= -4e-76) tmp = Float64(Float64(Float64(-d) * sqrt(Float64(h / l))) / h); elseif ((t_0 <= 1e-187) || !(t_0 <= 2e+220)) tmp = Float64(abs(Float64(d / sqrt(Float64(l * h)))) * 1.0); else tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = (((d / h) ^ (2.0 ^ -1.0)) * ((d / l) ^ (2.0 ^ -1.0))) * (1.0 - (((2.0 ^ -1.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); tmp = 0.0; if (t_0 <= -4e-76) tmp = (-d * sqrt((h / l))) / h; elseif ((t_0 <= 1e-187) || ~((t_0 <= 2e+220))) tmp = abs((d / sqrt((l * h)))) * 1.0; else tmp = sqrt((d / l)) * sqrt((d / h)); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[Power[2.0, -1.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, -4e-76], N[(N[((-d) * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], If[Or[LessEqual[t$95$0, 1e-187], N[Not[LessEqual[t$95$0, 2e+220]], $MachinePrecision]], N[(N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{if}\;t\_0 \leq -4 \cdot 10^{-76}:\\
\;\;\;\;\frac{\left(-d\right) \cdot \sqrt{\frac{h}{\ell}}}{h}\\
\mathbf{elif}\;t\_0 \leq 10^{-187} \lor \neg \left(t\_0 \leq 2 \cdot 10^{+220}\right):\\
\;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right| \cdot 1\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\end{array}
\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)))) < -3.99999999999999971e-76Initial program 82.7%
Applied rewrites29.2%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites15.6%
Taylor expanded in l around -inf
Applied rewrites19.6%
if -3.99999999999999971e-76 < (*.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)))) < 1e-187 or 2e220 < (*.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 26.9%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6426.9
Applied rewrites26.9%
lift-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6426.9
Applied rewrites26.9%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
*-commutativeN/A
lift-*.f64N/A
rem-square-sqrtN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
rem-sqrt-squareN/A
lower-fabs.f6422.3
lift-sqrt.f64N/A
lift-*.f64N/A
sqrt-prodN/A
lift-/.f64N/A
sqrt-divN/A
lift-/.f64N/A
sqrt-divN/A
frac-timesN/A
rem-square-sqrtN/A
sqrt-prodN/A
lift-*.f64N/A
lift-sqrt.f64N/A
Applied rewrites57.5%
Taylor expanded in d around inf
Applied rewrites54.2%
if 1e-187 < (*.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)))) < 2e220Initial program 97.5%
Applied rewrites91.2%
Taylor expanded in d around -inf
mul-1-negN/A
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
mul-1-negN/A
remove-double-negN/A
lower-sqrt.f64N/A
lower-/.f6497.5
Applied rewrites97.5%
Final simplification52.9%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (pow (/ (* M D) (* 2.0 d)) 2.0)))
(if (<=
(*
(* (pow (/ d h) (pow 2.0 -1.0)) (pow (/ d l) (pow 2.0 -1.0)))
(- 1.0 (* (* (pow 2.0 -1.0) t_0) (/ h l))))
2e+220)
(* (* (sqrt (/ d h)) (sqrt (/ d l))) (- 1.0 (* (* 0.5 t_0) (/ h l))))
(*
(fabs (/ d (sqrt (* l h))))
(- 1.0 (/ (* (pow (* (/ D 2.0) (/ M d)) 2.0) (* 0.5 h)) l))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = pow(((M * D) / (2.0 * d)), 2.0);
double tmp;
if (((pow((d / h), pow(2.0, -1.0)) * pow((d / l), pow(2.0, -1.0))) * (1.0 - ((pow(2.0, -1.0) * t_0) * (h / l)))) <= 2e+220) {
tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0 - ((0.5 * t_0) * (h / l)));
} else {
tmp = fabs((d / sqrt((l * h)))) * (1.0 - ((pow(((D / 2.0) * (M / d)), 2.0) * (0.5 * h)) / l));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(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 = ((m * d_1) / (2.0d0 * d)) ** 2.0d0
if (((((d / h) ** (2.0d0 ** (-1.0d0))) * ((d / l) ** (2.0d0 ** (-1.0d0)))) * (1.0d0 - (((2.0d0 ** (-1.0d0)) * t_0) * (h / l)))) <= 2d+220) then
tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0d0 - ((0.5d0 * t_0) * (h / l)))
else
tmp = abs((d / sqrt((l * h)))) * (1.0d0 - (((((d_1 / 2.0d0) * (m / d)) ** 2.0d0) * (0.5d0 * h)) / 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.pow(((M * D) / (2.0 * d)), 2.0);
double tmp;
if (((Math.pow((d / h), Math.pow(2.0, -1.0)) * Math.pow((d / l), Math.pow(2.0, -1.0))) * (1.0 - ((Math.pow(2.0, -1.0) * t_0) * (h / l)))) <= 2e+220) {
tmp = (Math.sqrt((d / h)) * Math.sqrt((d / l))) * (1.0 - ((0.5 * t_0) * (h / l)));
} else {
tmp = Math.abs((d / Math.sqrt((l * h)))) * (1.0 - ((Math.pow(((D / 2.0) * (M / d)), 2.0) * (0.5 * h)) / l));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.pow(((M * D) / (2.0 * d)), 2.0) tmp = 0 if ((math.pow((d / h), math.pow(2.0, -1.0)) * math.pow((d / l), math.pow(2.0, -1.0))) * (1.0 - ((math.pow(2.0, -1.0) * t_0) * (h / l)))) <= 2e+220: tmp = (math.sqrt((d / h)) * math.sqrt((d / l))) * (1.0 - ((0.5 * t_0) * (h / l))) else: tmp = math.fabs((d / math.sqrt((l * h)))) * (1.0 - ((math.pow(((D / 2.0) * (M / d)), 2.0) * (0.5 * h)) / l)) return tmp
function code(d, h, l, M, D) t_0 = Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0 tmp = 0.0 if (Float64(Float64((Float64(d / h) ^ (2.0 ^ -1.0)) * (Float64(d / l) ^ (2.0 ^ -1.0))) * Float64(1.0 - Float64(Float64((2.0 ^ -1.0) * t_0) * Float64(h / l)))) <= 2e+220) tmp = Float64(Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))) * Float64(1.0 - Float64(Float64(0.5 * t_0) * Float64(h / l)))); else tmp = Float64(abs(Float64(d / sqrt(Float64(l * h)))) * Float64(1.0 - Float64(Float64((Float64(Float64(D / 2.0) * Float64(M / d)) ^ 2.0) * Float64(0.5 * h)) / l))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = ((M * D) / (2.0 * d)) ^ 2.0; tmp = 0.0; if (((((d / h) ^ (2.0 ^ -1.0)) * ((d / l) ^ (2.0 ^ -1.0))) * (1.0 - (((2.0 ^ -1.0) * t_0) * (h / l)))) <= 2e+220) tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0 - ((0.5 * t_0) * (h / l))); else tmp = abs((d / sqrt((l * h)))) * (1.0 - (((((D / 2.0) * (M / d)) ^ 2.0) * (0.5 * h)) / l)); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[N[(N[(N[Power[N[(d / h), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[Power[2.0, -1.0], $MachinePrecision] * t$95$0), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2e+220], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(0.5 * t$95$0), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(N[(N[Power[N[(N[(D / 2.0), $MachinePrecision] * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(0.5 * h), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\\
\mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot t\_0\right) \cdot \frac{h}{\ell}\right) \leq 2 \cdot 10^{+220}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \left(0.5 \cdot t\_0\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right| \cdot \left(1 - \frac{{\left(\frac{D}{2} \cdot \frac{M}{d}\right)}^{2} \cdot \left(0.5 \cdot h\right)}{\ell}\right)\\
\end{array}
\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)))) < 2e220Initial program 84.3%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6484.3
Applied rewrites84.3%
lift-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6484.3
Applied rewrites84.3%
lift-/.f64N/A
metadata-eval84.3
Applied rewrites84.3%
if 2e220 < (*.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 20.7%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6420.7
Applied rewrites20.7%
lift-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6420.7
Applied rewrites20.7%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
*-commutativeN/A
lift-*.f64N/A
rem-square-sqrtN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
rem-sqrt-squareN/A
lower-fabs.f6419.6
lift-sqrt.f64N/A
lift-*.f64N/A
sqrt-prodN/A
lift-/.f64N/A
sqrt-divN/A
lift-/.f64N/A
sqrt-divN/A
frac-timesN/A
rem-square-sqrtN/A
sqrt-prodN/A
lift-*.f64N/A
lift-sqrt.f64N/A
Applied rewrites51.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites68.0%
Final simplification78.8%
(FPCore (d h l M D)
:precision binary64
(if (<=
(*
(* (pow (/ d h) (pow 2.0 -1.0)) (pow (/ d l) (pow 2.0 -1.0)))
(- 1.0 (* (* (pow 2.0 -1.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l))))
-4e-76)
(* (- d) (sqrt (pow (* l h) -1.0)))
(* (fabs (/ d (sqrt (* l h)))) 1.0)))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (((pow((d / h), pow(2.0, -1.0)) * pow((d / l), pow(2.0, -1.0))) * (1.0 - ((pow(2.0, -1.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))) <= -4e-76) {
tmp = -d * sqrt(pow((l * h), -1.0));
} else {
tmp = fabs((d / sqrt((l * 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) ** (2.0d0 ** (-1.0d0))) * ((d / l) ** (2.0d0 ** (-1.0d0)))) * (1.0d0 - (((2.0d0 ** (-1.0d0)) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))) <= (-4d-76)) then
tmp = -d * sqrt(((l * h) ** (-1.0d0)))
else
tmp = abs((d / sqrt((l * 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), Math.pow(2.0, -1.0)) * Math.pow((d / l), Math.pow(2.0, -1.0))) * (1.0 - ((Math.pow(2.0, -1.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))) <= -4e-76) {
tmp = -d * Math.sqrt(Math.pow((l * h), -1.0));
} else {
tmp = Math.abs((d / Math.sqrt((l * h)))) * 1.0;
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if ((math.pow((d / h), math.pow(2.0, -1.0)) * math.pow((d / l), math.pow(2.0, -1.0))) * (1.0 - ((math.pow(2.0, -1.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))) <= -4e-76: tmp = -d * math.sqrt(math.pow((l * h), -1.0)) else: tmp = math.fabs((d / math.sqrt((l * h)))) * 1.0 return tmp
function code(d, h, l, M, D) tmp = 0.0 if (Float64(Float64((Float64(d / h) ^ (2.0 ^ -1.0)) * (Float64(d / l) ^ (2.0 ^ -1.0))) * Float64(1.0 - Float64(Float64((2.0 ^ -1.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) <= -4e-76) tmp = Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0))); else tmp = Float64(abs(Float64(d / sqrt(Float64(l * h)))) * 1.0); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (((((d / h) ^ (2.0 ^ -1.0)) * ((d / l) ^ (2.0 ^ -1.0))) * (1.0 - (((2.0 ^ -1.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l)))) <= -4e-76) tmp = -d * sqrt(((l * h) ^ -1.0)); else tmp = abs((d / sqrt((l * 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[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[Power[2.0, -1.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], -4e-76], N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq -4 \cdot 10^{-76}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right| \cdot 1\\
\end{array}
\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)))) < -3.99999999999999971e-76Initial program 82.7%
Taylor expanded in l around -inf
*-commutativeN/A
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
*-commutativeN/A
*-commutativeN/A
mul-1-negN/A
*-commutativeN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f649.1
Applied rewrites9.1%
if -3.99999999999999971e-76 < (*.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 52.8%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6452.8
Applied rewrites52.8%
lift-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6452.8
Applied rewrites52.8%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
*-commutativeN/A
lift-*.f64N/A
rem-square-sqrtN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
rem-sqrt-squareN/A
lower-fabs.f6444.9
lift-sqrt.f64N/A
lift-*.f64N/A
sqrt-prodN/A
lift-/.f64N/A
sqrt-divN/A
lift-/.f64N/A
sqrt-divN/A
frac-timesN/A
rem-square-sqrtN/A
sqrt-prodN/A
lift-*.f64N/A
lift-sqrt.f64N/A
Applied rewrites65.4%
Taylor expanded in d around inf
Applied rewrites63.3%
Final simplification44.9%
(FPCore (d h l M D)
:precision binary64
(if (<=
(*
(* (pow (/ d h) (pow 2.0 -1.0)) (pow (/ d l) (pow 2.0 -1.0)))
(- 1.0 (* (* (pow 2.0 -1.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l))))
-4e-76)
(/ (* (- d) (sqrt (/ h l))) h)
(* (fabs (/ d (sqrt (* l h)))) 1.0)))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (((pow((d / h), pow(2.0, -1.0)) * pow((d / l), pow(2.0, -1.0))) * (1.0 - ((pow(2.0, -1.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))) <= -4e-76) {
tmp = (-d * sqrt((h / l))) / h;
} else {
tmp = fabs((d / sqrt((l * 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) ** (2.0d0 ** (-1.0d0))) * ((d / l) ** (2.0d0 ** (-1.0d0)))) * (1.0d0 - (((2.0d0 ** (-1.0d0)) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))) <= (-4d-76)) then
tmp = (-d * sqrt((h / l))) / h
else
tmp = abs((d / sqrt((l * 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), Math.pow(2.0, -1.0)) * Math.pow((d / l), Math.pow(2.0, -1.0))) * (1.0 - ((Math.pow(2.0, -1.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))) <= -4e-76) {
tmp = (-d * Math.sqrt((h / l))) / h;
} else {
tmp = Math.abs((d / Math.sqrt((l * h)))) * 1.0;
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if ((math.pow((d / h), math.pow(2.0, -1.0)) * math.pow((d / l), math.pow(2.0, -1.0))) * (1.0 - ((math.pow(2.0, -1.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))) <= -4e-76: tmp = (-d * math.sqrt((h / l))) / h else: tmp = math.fabs((d / math.sqrt((l * h)))) * 1.0 return tmp
function code(d, h, l, M, D) tmp = 0.0 if (Float64(Float64((Float64(d / h) ^ (2.0 ^ -1.0)) * (Float64(d / l) ^ (2.0 ^ -1.0))) * Float64(1.0 - Float64(Float64((2.0 ^ -1.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) <= -4e-76) tmp = Float64(Float64(Float64(-d) * sqrt(Float64(h / l))) / h); else tmp = Float64(abs(Float64(d / sqrt(Float64(l * h)))) * 1.0); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (((((d / h) ^ (2.0 ^ -1.0)) * ((d / l) ^ (2.0 ^ -1.0))) * (1.0 - (((2.0 ^ -1.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l)))) <= -4e-76) tmp = (-d * sqrt((h / l))) / h; else tmp = abs((d / sqrt((l * 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[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[Power[2.0, -1.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], -4e-76], N[(N[((-d) * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[(N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq -4 \cdot 10^{-76}:\\
\;\;\;\;\frac{\left(-d\right) \cdot \sqrt{\frac{h}{\ell}}}{h}\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right| \cdot 1\\
\end{array}
\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)))) < -3.99999999999999971e-76Initial program 82.7%
Applied rewrites29.2%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites15.6%
Taylor expanded in l around -inf
Applied rewrites19.6%
if -3.99999999999999971e-76 < (*.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 52.8%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6452.8
Applied rewrites52.8%
lift-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6452.8
Applied rewrites52.8%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
*-commutativeN/A
lift-*.f64N/A
rem-square-sqrtN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
rem-sqrt-squareN/A
lower-fabs.f6444.9
lift-sqrt.f64N/A
lift-*.f64N/A
sqrt-prodN/A
lift-/.f64N/A
sqrt-divN/A
lift-/.f64N/A
sqrt-divN/A
frac-timesN/A
rem-square-sqrtN/A
sqrt-prodN/A
lift-*.f64N/A
lift-sqrt.f64N/A
Applied rewrites65.4%
Taylor expanded in d around inf
Applied rewrites63.3%
Final simplification48.4%
(FPCore (d h l M D) :precision binary64 (if (<= d 1.95e-277) (* (- d) (sqrt (pow (* l h) -1.0))) (/ d (* (sqrt l) (sqrt h)))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= 1.95e-277) {
tmp = -d * sqrt(pow((l * h), -1.0));
} else {
tmp = d / (sqrt(l) * sqrt(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 <= 1.95d-277) then
tmp = -d * sqrt(((l * h) ** (-1.0d0)))
else
tmp = d / (sqrt(l) * sqrt(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 <= 1.95e-277) {
tmp = -d * Math.sqrt(Math.pow((l * h), -1.0));
} else {
tmp = d / (Math.sqrt(l) * Math.sqrt(h));
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if d <= 1.95e-277: tmp = -d * math.sqrt(math.pow((l * h), -1.0)) else: tmp = d / (math.sqrt(l) * math.sqrt(h)) return tmp
function code(d, h, l, M, D) tmp = 0.0 if (d <= 1.95e-277) tmp = Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0))); else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (d <= 1.95e-277) tmp = -d * sqrt(((l * h) ^ -1.0)); else tmp = d / (sqrt(l) * sqrt(h)); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[d, 1.95e-277], N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d \leq 1.95 \cdot 10^{-277}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if d < 1.94999999999999993e-277Initial program 62.5%
Taylor expanded in l around -inf
*-commutativeN/A
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
*-commutativeN/A
*-commutativeN/A
mul-1-negN/A
*-commutativeN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6441.8
Applied rewrites41.8%
if 1.94999999999999993e-277 < d Initial program 63.5%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6442.0
Applied rewrites42.0%
Applied rewrites42.5%
Applied rewrites42.6%
Applied rewrites48.7%
Final simplification44.9%
(FPCore (d h l M D) :precision binary64 (if (<= l 4.1e-209) (* (- d) (sqrt (pow (* l h) -1.0))) (/ d (sqrt (* l h)))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 4.1e-209) {
tmp = -d * sqrt(pow((l * h), -1.0));
} else {
tmp = d / 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 (l <= 4.1d-209) then
tmp = -d * sqrt(((l * h) ** (-1.0d0)))
else
tmp = d / 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 (l <= 4.1e-209) {
tmp = -d * Math.sqrt(Math.pow((l * h), -1.0));
} else {
tmp = d / Math.sqrt((l * h));
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if l <= 4.1e-209: tmp = -d * math.sqrt(math.pow((l * h), -1.0)) else: tmp = d / math.sqrt((l * h)) return tmp
function code(d, h, l, M, D) tmp = 0.0 if (l <= 4.1e-209) tmp = Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0))); else tmp = Float64(d / sqrt(Float64(l * h))); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (l <= 4.1e-209) tmp = -d * sqrt(((l * h) ^ -1.0)); else tmp = d / sqrt((l * h)); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[l, 4.1e-209], N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 4.1 \cdot 10^{-209}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell \cdot h}}\\
\end{array}
\end{array}
if l < 4.09999999999999977e-209Initial program 64.3%
Taylor expanded in l around -inf
*-commutativeN/A
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
*-commutativeN/A
*-commutativeN/A
mul-1-negN/A
*-commutativeN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6441.7
Applied rewrites41.7%
if 4.09999999999999977e-209 < l Initial program 61.0%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6443.2
Applied rewrites43.2%
Applied rewrites43.8%
Applied rewrites43.9%
Final simplification42.6%
(FPCore (d h l M D) :precision binary64 (* (sqrt (pow (* l h) -1.0)) d))
double code(double d, double h, double l, double M, double D) {
return sqrt(pow((l * h), -1.0)) * d;
}
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 = sqrt(((l * h) ** (-1.0d0))) * d
end function
public static double code(double d, double h, double l, double M, double D) {
return Math.sqrt(Math.pow((l * h), -1.0)) * d;
}
def code(d, h, l, M, D): return math.sqrt(math.pow((l * h), -1.0)) * d
function code(d, h, l, M, D) return Float64(sqrt((Float64(l * h) ^ -1.0)) * d) end
function tmp = code(d, h, l, M, D) tmp = sqrt(((l * h) ^ -1.0)) * d; end
code[d_, h_, l_, M_, D_] := N[(N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{{\left(\ell \cdot h\right)}^{-1}} \cdot d
\end{array}
Initial program 62.9%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6423.2
Applied rewrites23.2%
Final simplification23.2%
(FPCore (d h l M D) :precision binary64 (/ d (sqrt (* l h))))
double code(double d, double h, double l, double M, double D) {
return d / sqrt((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((l * h))
end function
public static double code(double d, double h, double l, double M, double D) {
return d / Math.sqrt((l * h));
}
def code(d, h, l, M, D): return d / math.sqrt((l * h))
function code(d, h, l, M, D) return Float64(d / sqrt(Float64(l * h))) end
function tmp = code(d, h, l, M, D) tmp = d / sqrt((l * h)); end
code[d_, h_, l_, M_, D_] := N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{d}{\sqrt{\ell \cdot h}}
\end{array}
Initial program 62.9%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6423.2
Applied rewrites23.2%
Applied rewrites23.1%
Applied rewrites23.1%
herbie shell --seed 2024363
(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)))))