
(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
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(-
1.0
(* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l))))))
(if (<= t_0 INFINITY)
t_0
(/
(/
(fma
(* -0.125 (pow (* D M) 2.0))
(pow (/ h l) 1.5)
(* (sqrt (/ h l)) (* d d)))
d)
h))))
double code(double d, double h, double l, double M, double D) {
double t_0 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double tmp;
if (t_0 <= ((double) INFINITY)) {
tmp = t_0;
} else {
tmp = (fma((-0.125 * pow((D * M), 2.0)), pow((h / l), 1.5), (sqrt((h / l)) * (d * d))) / d) / h;
}
return tmp;
}
function code(d, h, l, M, D) t_0 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) tmp = 0.0 if (t_0 <= Inf) tmp = t_0; else tmp = Float64(Float64(fma(Float64(-0.125 * (Float64(D * M) ^ 2.0)), (Float64(h / l) ^ 1.5), Float64(sqrt(Float64(h / l)) * Float64(d * d))) / d) / h); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, Infinity], t$95$0, N[(N[(N[(N[(-0.125 * N[Power[N[(D * M), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[Power[N[(h / l), $MachinePrecision], 1.5], $MachinePrecision] + N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] * N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] / h), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{if}\;t\_0 \leq \infty:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(-0.125 \cdot {\left(D \cdot M\right)}^{2}, {\left(\frac{h}{\ell}\right)}^{1.5}, \sqrt{\frac{h}{\ell}} \cdot \left(d \cdot d\right)\right)}{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)))) < +inf.0Initial program 84.9%
if +inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 0.0%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites25.2%
Taylor expanded in d around 0
lower-/.f64N/A
Applied rewrites30.5%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
(t_1 (* (sqrt (/ h l)) d)))
(if (<= t_0 -5e-213)
(*
(- 1.0 (* (* (/ h l) (pow (* (/ D d) (* M 0.5)) 2.0)) 0.5))
(sqrt (* (/ d l) (/ d h))))
(if (<= t_0 INFINITY)
(/ t_1 h)
(/
(fma (* -0.125 (/ (* (* D M) (* D M)) d)) (sqrt (pow (/ h l) 3.0)) t_1)
h)))))
double code(double d, double h, double l, double M, double D) {
double t_0 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double t_1 = sqrt((h / l)) * d;
double tmp;
if (t_0 <= -5e-213) {
tmp = (1.0 - (((h / l) * pow(((D / d) * (M * 0.5)), 2.0)) * 0.5)) * sqrt(((d / l) * (d / h)));
} else if (t_0 <= ((double) INFINITY)) {
tmp = t_1 / h;
} else {
tmp = fma((-0.125 * (((D * M) * (D * M)) / d)), sqrt(pow((h / l), 3.0)), t_1) / h;
}
return tmp;
}
function code(d, h, l, M, D) t_0 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) t_1 = Float64(sqrt(Float64(h / l)) * d) tmp = 0.0 if (t_0 <= -5e-213) tmp = Float64(Float64(1.0 - Float64(Float64(Float64(h / l) * (Float64(Float64(D / d) * Float64(M * 0.5)) ^ 2.0)) * 0.5)) * sqrt(Float64(Float64(d / l) * Float64(d / h)))); elseif (t_0 <= Inf) tmp = Float64(t_1 / h); else tmp = Float64(fma(Float64(-0.125 * Float64(Float64(Float64(D * M) * Float64(D * M)) / d)), sqrt((Float64(h / l) ^ 3.0)), t_1) / h); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision]}, If[LessEqual[t$95$0, -5e-213], N[(N[(1.0 - N[(N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D / d), $MachinePrecision] * N[(M * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, Infinity], N[(t$95$1 / h), $MachinePrecision], N[(N[(N[(-0.125 * N[(N[(N[(D * M), $MachinePrecision] * N[(D * M), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[Power[N[(h / l), $MachinePrecision], 3.0], $MachinePrecision]], $MachinePrecision] + t$95$1), $MachinePrecision] / h), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
t_1 := \sqrt{\frac{h}{\ell}} \cdot d\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-213}:\\
\;\;\;\;\left(1 - \left(\frac{h}{\ell} \cdot {\left(\frac{D}{d} \cdot \left(M \cdot 0.5\right)\right)}^{2}\right) \cdot 0.5\right) \cdot \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\
\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;\frac{t\_1}{h}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-0.125 \cdot \frac{\left(D \cdot M\right) \cdot \left(D \cdot M\right)}{d}, \sqrt{{\left(\frac{h}{\ell}\right)}^{3}}, t\_1\right)}{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)))) < -4.99999999999999977e-213Initial program 88.4%
lift-/.f64N/A
lift-pow.f64N/A
sqr-powN/A
lower-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-evalN/A
lower-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-evalN/A
lower-pow.f64N/A
lift-/.f6488.5
Applied rewrites88.5%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
associate-*l*N/A
lower-*.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lower-*.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
lift-/.f6488.5
Applied rewrites88.5%
Applied rewrites76.2%
Taylor expanded in M around 0
*-commutativeN/A
lower-*.f6476.2
Applied rewrites76.2%
if -4.99999999999999977e-213 < (*.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 81.5%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites64.3%
Taylor expanded in d around inf
*-commutativeN/A
lift-/.f64N/A
lift-sqrt.f64N/A
lift-*.f6481.1
Applied rewrites81.1%
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%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites25.2%
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
lower-*.f64N/A
lift-*.f64N/A
lift-*.f6425.2
Applied rewrites25.2%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
(t_1 (* (sqrt (/ h l)) d)))
(if (<= t_0 -5e-213)
(*
(- 1.0 (* (* (/ h l) (pow (* (/ D d) (* M 0.5)) 2.0)) 0.5))
(sqrt (* (/ d l) (/ d h))))
(if (<= t_0 INFINITY)
(/ t_1 h)
(/
(fma (* -0.125 (* (* D D) (/ (* M M) d))) (sqrt (pow (/ h l) 3.0)) t_1)
h)))))
double code(double d, double h, double l, double M, double D) {
double t_0 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double t_1 = sqrt((h / l)) * d;
double tmp;
if (t_0 <= -5e-213) {
tmp = (1.0 - (((h / l) * pow(((D / d) * (M * 0.5)), 2.0)) * 0.5)) * sqrt(((d / l) * (d / h)));
} else if (t_0 <= ((double) INFINITY)) {
tmp = t_1 / h;
} else {
tmp = fma((-0.125 * ((D * D) * ((M * M) / d))), sqrt(pow((h / l), 3.0)), t_1) / h;
}
return tmp;
}
function code(d, h, l, M, D) t_0 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) t_1 = Float64(sqrt(Float64(h / l)) * d) tmp = 0.0 if (t_0 <= -5e-213) tmp = Float64(Float64(1.0 - Float64(Float64(Float64(h / l) * (Float64(Float64(D / d) * Float64(M * 0.5)) ^ 2.0)) * 0.5)) * sqrt(Float64(Float64(d / l) * Float64(d / h)))); elseif (t_0 <= Inf) tmp = Float64(t_1 / h); else tmp = Float64(fma(Float64(-0.125 * Float64(Float64(D * D) * Float64(Float64(M * M) / d))), sqrt((Float64(h / l) ^ 3.0)), t_1) / h); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision]}, If[LessEqual[t$95$0, -5e-213], N[(N[(1.0 - N[(N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D / d), $MachinePrecision] * N[(M * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, Infinity], N[(t$95$1 / h), $MachinePrecision], N[(N[(N[(-0.125 * N[(N[(D * D), $MachinePrecision] * N[(N[(M * M), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[Power[N[(h / l), $MachinePrecision], 3.0], $MachinePrecision]], $MachinePrecision] + t$95$1), $MachinePrecision] / h), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
t_1 := \sqrt{\frac{h}{\ell}} \cdot d\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-213}:\\
\;\;\;\;\left(1 - \left(\frac{h}{\ell} \cdot {\left(\frac{D}{d} \cdot \left(M \cdot 0.5\right)\right)}^{2}\right) \cdot 0.5\right) \cdot \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\
\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;\frac{t\_1}{h}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-0.125 \cdot \left(\left(D \cdot D\right) \cdot \frac{M \cdot M}{d}\right), \sqrt{{\left(\frac{h}{\ell}\right)}^{3}}, t\_1\right)}{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)))) < -4.99999999999999977e-213Initial program 88.4%
lift-/.f64N/A
lift-pow.f64N/A
sqr-powN/A
lower-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-evalN/A
lower-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-evalN/A
lower-pow.f64N/A
lift-/.f6488.5
Applied rewrites88.5%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
associate-*l*N/A
lower-*.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lower-*.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
lift-/.f6488.5
Applied rewrites88.5%
Applied rewrites76.2%
Taylor expanded in M around 0
*-commutativeN/A
lower-*.f6476.2
Applied rewrites76.2%
if -4.99999999999999977e-213 < (*.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 81.5%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites64.3%
Taylor expanded in d around inf
*-commutativeN/A
lift-/.f64N/A
lift-sqrt.f64N/A
lift-*.f6481.1
Applied rewrites81.1%
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%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites25.2%
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
unpow-prod-downN/A
associate-/l*N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6424.7
Applied rewrites24.7%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(-
1.0
(* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l))))))
(if (<= t_0 -5e-213)
(*
(- 1.0 (* (* (/ h l) (pow (* (/ D d) (* M 0.5)) 2.0)) 0.5))
(sqrt (* (/ d l) (/ d h))))
(if (<= t_0 INFINITY)
(/ (* (sqrt (/ h l)) d) h)
(*
(* -0.125 (/ (* (pow (* D M) 2.0) -1.0) d))
(sqrt (/ h (* (* l l) l))))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double tmp;
if (t_0 <= -5e-213) {
tmp = (1.0 - (((h / l) * pow(((D / d) * (M * 0.5)), 2.0)) * 0.5)) * sqrt(((d / l) * (d / h)));
} else if (t_0 <= ((double) INFINITY)) {
tmp = (sqrt((h / l)) * d) / h;
} else {
tmp = (-0.125 * ((pow((D * M), 2.0) * -1.0) / d)) * sqrt((h / ((l * l) * l)));
}
return tmp;
}
public static double code(double d, double h, double l, double M, double D) {
double t_0 = (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double tmp;
if (t_0 <= -5e-213) {
tmp = (1.0 - (((h / l) * Math.pow(((D / d) * (M * 0.5)), 2.0)) * 0.5)) * Math.sqrt(((d / l) * (d / h)));
} else if (t_0 <= Double.POSITIVE_INFINITY) {
tmp = (Math.sqrt((h / l)) * d) / h;
} else {
tmp = (-0.125 * ((Math.pow((D * M), 2.0) * -1.0) / d)) * Math.sqrt((h / ((l * l) * l)));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l))) tmp = 0 if t_0 <= -5e-213: tmp = (1.0 - (((h / l) * math.pow(((D / d) * (M * 0.5)), 2.0)) * 0.5)) * math.sqrt(((d / l) * (d / h))) elif t_0 <= math.inf: tmp = (math.sqrt((h / l)) * d) / h else: tmp = (-0.125 * ((math.pow((D * M), 2.0) * -1.0) / d)) * math.sqrt((h / ((l * l) * l))) return tmp
function code(d, h, l, M, D) t_0 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) tmp = 0.0 if (t_0 <= -5e-213) tmp = Float64(Float64(1.0 - Float64(Float64(Float64(h / l) * (Float64(Float64(D / d) * Float64(M * 0.5)) ^ 2.0)) * 0.5)) * sqrt(Float64(Float64(d / l) * Float64(d / h)))); elseif (t_0 <= Inf) tmp = Float64(Float64(sqrt(Float64(h / l)) * d) / h); else tmp = Float64(Float64(-0.125 * Float64(Float64((Float64(D * M) ^ 2.0) * -1.0) / d)) * sqrt(Float64(h / Float64(Float64(l * l) * l)))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); tmp = 0.0; if (t_0 <= -5e-213) tmp = (1.0 - (((h / l) * (((D / d) * (M * 0.5)) ^ 2.0)) * 0.5)) * sqrt(((d / l) * (d / h))); elseif (t_0 <= Inf) tmp = (sqrt((h / l)) * d) / h; else tmp = (-0.125 * ((((D * M) ^ 2.0) * -1.0) / d)) * sqrt((h / ((l * l) * l))); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -5e-213], N[(N[(1.0 - N[(N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D / d), $MachinePrecision] * N[(M * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, Infinity], N[(N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision] / h), $MachinePrecision], N[(N[(-0.125 * N[(N[(N[Power[N[(D * M), $MachinePrecision], 2.0], $MachinePrecision] * -1.0), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(h / N[(N[(l * l), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-213}:\\
\;\;\;\;\left(1 - \left(\frac{h}{\ell} \cdot {\left(\frac{D}{d} \cdot \left(M \cdot 0.5\right)\right)}^{2}\right) \cdot 0.5\right) \cdot \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\
\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;\frac{\sqrt{\frac{h}{\ell}} \cdot d}{h}\\
\mathbf{else}:\\
\;\;\;\;\left(-0.125 \cdot \frac{{\left(D \cdot M\right)}^{2} \cdot -1}{d}\right) \cdot \sqrt{\frac{h}{\left(\ell \cdot \ell\right) \cdot \ell}}\\
\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)))) < -4.99999999999999977e-213Initial program 88.4%
lift-/.f64N/A
lift-pow.f64N/A
sqr-powN/A
lower-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-evalN/A
lower-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-evalN/A
lower-pow.f64N/A
lift-/.f6488.5
Applied rewrites88.5%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
associate-*l*N/A
lower-*.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lower-*.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
lift-/.f6488.5
Applied rewrites88.5%
Applied rewrites76.2%
Taylor expanded in M around 0
*-commutativeN/A
lower-*.f6476.2
Applied rewrites76.2%
if -4.99999999999999977e-213 < (*.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 81.5%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites64.3%
Taylor expanded in d around inf
*-commutativeN/A
lift-/.f64N/A
lift-sqrt.f64N/A
lift-*.f6481.1
Applied rewrites81.1%
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-/.f64N/A
lift-pow.f64N/A
sqr-powN/A
lower-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-evalN/A
lower-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-evalN/A
lower-pow.f64N/A
lift-/.f640.0
Applied rewrites0.0%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
associate-*l*N/A
lower-*.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lower-*.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
lift-/.f640.0
Applied rewrites0.0%
Taylor expanded in h around -inf
Applied rewrites19.9%
lift-pow.f64N/A
unpow3N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6419.9
Applied rewrites19.9%
Final simplification69.3%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (pow (* D M) 2.0))
(t_1
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(-
1.0
(* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l))))))
(if (<= t_1 -1e-68)
(*
(- 1.0 (* (* (/ (* t_0 h) (* (* d d) l)) 0.25) 0.5))
(sqrt (* (/ d l) (/ d h))))
(if (<= t_1 INFINITY)
(/ (* (sqrt (/ h l)) d) h)
(* (* -0.125 (/ (* t_0 -1.0) d)) (sqrt (/ h (* (* l l) l))))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = pow((D * M), 2.0);
double t_1 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double tmp;
if (t_1 <= -1e-68) {
tmp = (1.0 - ((((t_0 * h) / ((d * d) * l)) * 0.25) * 0.5)) * sqrt(((d / l) * (d / h)));
} else if (t_1 <= ((double) INFINITY)) {
tmp = (sqrt((h / l)) * d) / h;
} else {
tmp = (-0.125 * ((t_0 * -1.0) / d)) * sqrt((h / ((l * l) * l)));
}
return tmp;
}
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.pow((D * M), 2.0);
double t_1 = (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double tmp;
if (t_1 <= -1e-68) {
tmp = (1.0 - ((((t_0 * h) / ((d * d) * l)) * 0.25) * 0.5)) * Math.sqrt(((d / l) * (d / h)));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = (Math.sqrt((h / l)) * d) / h;
} else {
tmp = (-0.125 * ((t_0 * -1.0) / d)) * Math.sqrt((h / ((l * l) * l)));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.pow((D * M), 2.0) t_1 = (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l))) tmp = 0 if t_1 <= -1e-68: tmp = (1.0 - ((((t_0 * h) / ((d * d) * l)) * 0.25) * 0.5)) * math.sqrt(((d / l) * (d / h))) elif t_1 <= math.inf: tmp = (math.sqrt((h / l)) * d) / h else: tmp = (-0.125 * ((t_0 * -1.0) / d)) * math.sqrt((h / ((l * l) * l))) return tmp
function code(d, h, l, M, D) t_0 = Float64(D * M) ^ 2.0 t_1 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) tmp = 0.0 if (t_1 <= -1e-68) tmp = Float64(Float64(1.0 - Float64(Float64(Float64(Float64(t_0 * h) / Float64(Float64(d * d) * l)) * 0.25) * 0.5)) * sqrt(Float64(Float64(d / l) * Float64(d / h)))); elseif (t_1 <= Inf) tmp = Float64(Float64(sqrt(Float64(h / l)) * d) / h); else tmp = Float64(Float64(-0.125 * Float64(Float64(t_0 * -1.0) / d)) * sqrt(Float64(h / Float64(Float64(l * l) * l)))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = (D * M) ^ 2.0; t_1 = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); tmp = 0.0; if (t_1 <= -1e-68) tmp = (1.0 - ((((t_0 * h) / ((d * d) * l)) * 0.25) * 0.5)) * sqrt(((d / l) * (d / h))); elseif (t_1 <= Inf) tmp = (sqrt((h / l)) * d) / h; else tmp = (-0.125 * ((t_0 * -1.0) / d)) * sqrt((h / ((l * l) * l))); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Power[N[(D * M), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e-68], N[(N[(1.0 - N[(N[(N[(N[(t$95$0 * h), $MachinePrecision] / N[(N[(d * d), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] * 0.25), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision] / h), $MachinePrecision], N[(N[(-0.125 * N[(N[(t$95$0 * -1.0), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(h / N[(N[(l * l), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(D \cdot M\right)}^{2}\\
t_1 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{-68}:\\
\;\;\;\;\left(1 - \left(\frac{t\_0 \cdot h}{\left(d \cdot d\right) \cdot \ell} \cdot 0.25\right) \cdot 0.5\right) \cdot \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\frac{\sqrt{\frac{h}{\ell}} \cdot d}{h}\\
\mathbf{else}:\\
\;\;\;\;\left(-0.125 \cdot \frac{t\_0 \cdot -1}{d}\right) \cdot \sqrt{\frac{h}{\left(\ell \cdot \ell\right) \cdot \ell}}\\
\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.00000000000000007e-68Initial program 88.3%
lift-/.f64N/A
lift-pow.f64N/A
sqr-powN/A
lower-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-evalN/A
lower-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-evalN/A
lower-pow.f64N/A
lift-/.f6488.3
Applied rewrites88.3%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
associate-*l*N/A
lower-*.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lower-*.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
lift-/.f6488.3
Applied rewrites88.3%
Applied rewrites77.6%
Taylor expanded in d around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
associate-*r*N/A
lower-*.f64N/A
unpow-prod-downN/A
lift-pow.f64N/A
lift-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6458.6
Applied rewrites58.6%
if -1.00000000000000007e-68 < (*.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 81.8%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites64.1%
Taylor expanded in d around inf
*-commutativeN/A
lift-/.f64N/A
lift-sqrt.f64N/A
lift-*.f6479.7
Applied rewrites79.7%
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-/.f64N/A
lift-pow.f64N/A
sqr-powN/A
lower-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-evalN/A
lower-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-evalN/A
lower-pow.f64N/A
lift-/.f640.0
Applied rewrites0.0%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
associate-*l*N/A
lower-*.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lower-*.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
lift-/.f640.0
Applied rewrites0.0%
Taylor expanded in h around -inf
Applied rewrites19.9%
lift-pow.f64N/A
unpow3N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6419.9
Applied rewrites19.9%
Final simplification61.5%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (/ (pow (* D M) 2.0) d))
(t_1
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(-
1.0
(* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l))))))
(if (<= t_1 -5e-213)
(* (* -0.125 t_0) (sqrt (/ h (* (* l l) l))))
(if (<= t_1 INFINITY)
(/ (* (sqrt (/ h l)) d) h)
(/ (* (* (sqrt (* l h)) t_0) -0.125) (* l l))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = pow((D * M), 2.0) / d;
double t_1 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double tmp;
if (t_1 <= -5e-213) {
tmp = (-0.125 * t_0) * sqrt((h / ((l * l) * l)));
} else if (t_1 <= ((double) INFINITY)) {
tmp = (sqrt((h / l)) * d) / h;
} else {
tmp = ((sqrt((l * h)) * t_0) * -0.125) / (l * l);
}
return tmp;
}
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.pow((D * M), 2.0) / d;
double t_1 = (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double tmp;
if (t_1 <= -5e-213) {
tmp = (-0.125 * t_0) * Math.sqrt((h / ((l * l) * l)));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = (Math.sqrt((h / l)) * d) / h;
} else {
tmp = ((Math.sqrt((l * h)) * t_0) * -0.125) / (l * l);
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.pow((D * M), 2.0) / d t_1 = (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l))) tmp = 0 if t_1 <= -5e-213: tmp = (-0.125 * t_0) * math.sqrt((h / ((l * l) * l))) elif t_1 <= math.inf: tmp = (math.sqrt((h / l)) * d) / h else: tmp = ((math.sqrt((l * h)) * t_0) * -0.125) / (l * l) return tmp
function code(d, h, l, M, D) t_0 = Float64((Float64(D * M) ^ 2.0) / d) t_1 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) tmp = 0.0 if (t_1 <= -5e-213) tmp = Float64(Float64(-0.125 * t_0) * sqrt(Float64(h / Float64(Float64(l * l) * l)))); elseif (t_1 <= Inf) tmp = Float64(Float64(sqrt(Float64(h / l)) * d) / h); else tmp = Float64(Float64(Float64(sqrt(Float64(l * h)) * t_0) * -0.125) / Float64(l * l)); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = ((D * M) ^ 2.0) / d; t_1 = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); tmp = 0.0; if (t_1 <= -5e-213) tmp = (-0.125 * t_0) * sqrt((h / ((l * l) * l))); elseif (t_1 <= Inf) tmp = (sqrt((h / l)) * d) / h; else tmp = ((sqrt((l * h)) * t_0) * -0.125) / (l * l); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[Power[N[(D * M), $MachinePrecision], 2.0], $MachinePrecision] / d), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e-213], N[(N[(-0.125 * t$95$0), $MachinePrecision] * N[Sqrt[N[(h / N[(N[(l * l), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision] / h), $MachinePrecision], N[(N[(N[(N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision] * -0.125), $MachinePrecision] / N[(l * l), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{{\left(D \cdot M\right)}^{2}}{d}\\
t_1 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{-213}:\\
\;\;\;\;\left(-0.125 \cdot t\_0\right) \cdot \sqrt{\frac{h}{\left(\ell \cdot \ell\right) \cdot \ell}}\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\frac{\sqrt{\frac{h}{\ell}} \cdot d}{h}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(\sqrt{\ell \cdot h} \cdot t\_0\right) \cdot -0.125}{\ell \cdot \ell}\\
\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)))) < -4.99999999999999977e-213Initial program 88.4%
Taylor expanded in d around 0
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f64N/A
pow-prod-downN/A
*-commutativeN/A
lower-pow.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-pow.f6438.9
Applied rewrites38.9%
lift-pow.f64N/A
unpow3N/A
lower-*.f64N/A
lift-*.f6438.9
Applied rewrites38.9%
if -4.99999999999999977e-213 < (*.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 81.5%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites64.3%
Taylor expanded in d around inf
*-commutativeN/A
lift-/.f64N/A
lift-sqrt.f64N/A
lift-*.f6481.1
Applied rewrites81.1%
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%
Taylor expanded in l around 0
lower-/.f64N/A
Applied rewrites12.3%
Taylor expanded in d around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-*.f64N/A
unpow-prod-downN/A
lift-pow.f64N/A
lift-*.f64N/A
lift-/.f6417.3
Applied rewrites17.3%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(-
1.0
(* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l))))))
(if (<= t_0 -5e-213)
(* (* -0.125 (/ (pow (* D M) 2.0) d)) (sqrt (/ h (* (* l l) l))))
(if (<= t_0 INFINITY)
(/ (* (sqrt (/ h l)) d) h)
(/ (/ (* (sqrt (/ (pow l 3.0) h)) d) l) l)))))
double code(double d, double h, double l, double M, double D) {
double t_0 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double tmp;
if (t_0 <= -5e-213) {
tmp = (-0.125 * (pow((D * M), 2.0) / d)) * sqrt((h / ((l * l) * l)));
} else if (t_0 <= ((double) INFINITY)) {
tmp = (sqrt((h / l)) * d) / h;
} else {
tmp = ((sqrt((pow(l, 3.0) / h)) * d) / l) / l;
}
return tmp;
}
public static double code(double d, double h, double l, double M, double D) {
double t_0 = (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double tmp;
if (t_0 <= -5e-213) {
tmp = (-0.125 * (Math.pow((D * M), 2.0) / d)) * Math.sqrt((h / ((l * l) * l)));
} else if (t_0 <= Double.POSITIVE_INFINITY) {
tmp = (Math.sqrt((h / l)) * d) / h;
} else {
tmp = ((Math.sqrt((Math.pow(l, 3.0) / h)) * d) / l) / l;
}
return tmp;
}
def code(d, h, l, M, D): t_0 = (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l))) tmp = 0 if t_0 <= -5e-213: tmp = (-0.125 * (math.pow((D * M), 2.0) / d)) * math.sqrt((h / ((l * l) * l))) elif t_0 <= math.inf: tmp = (math.sqrt((h / l)) * d) / h else: tmp = ((math.sqrt((math.pow(l, 3.0) / h)) * d) / l) / l return tmp
function code(d, h, l, M, D) t_0 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) tmp = 0.0 if (t_0 <= -5e-213) tmp = Float64(Float64(-0.125 * Float64((Float64(D * M) ^ 2.0) / d)) * sqrt(Float64(h / Float64(Float64(l * l) * l)))); elseif (t_0 <= Inf) tmp = Float64(Float64(sqrt(Float64(h / l)) * d) / h); else tmp = Float64(Float64(Float64(sqrt(Float64((l ^ 3.0) / h)) * d) / l) / l); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); tmp = 0.0; if (t_0 <= -5e-213) tmp = (-0.125 * (((D * M) ^ 2.0) / d)) * sqrt((h / ((l * l) * l))); elseif (t_0 <= Inf) tmp = (sqrt((h / l)) * d) / h; else tmp = ((sqrt(((l ^ 3.0) / h)) * d) / l) / l; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -5e-213], N[(N[(-0.125 * N[(N[Power[N[(D * M), $MachinePrecision], 2.0], $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(h / N[(N[(l * l), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, Infinity], N[(N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision] / h), $MachinePrecision], N[(N[(N[(N[Sqrt[N[(N[Power[l, 3.0], $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision] / l), $MachinePrecision] / l), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-213}:\\
\;\;\;\;\left(-0.125 \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}\right) \cdot \sqrt{\frac{h}{\left(\ell \cdot \ell\right) \cdot \ell}}\\
\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;\frac{\sqrt{\frac{h}{\ell}} \cdot d}{h}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\sqrt{\frac{{\ell}^{3}}{h}} \cdot d}{\ell}}{\ell}\\
\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)))) < -4.99999999999999977e-213Initial program 88.4%
Taylor expanded in d around 0
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f64N/A
pow-prod-downN/A
*-commutativeN/A
lower-pow.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-pow.f6438.9
Applied rewrites38.9%
lift-pow.f64N/A
unpow3N/A
lower-*.f64N/A
lift-*.f6438.9
Applied rewrites38.9%
if -4.99999999999999977e-213 < (*.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 81.5%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites64.3%
Taylor expanded in d around inf
*-commutativeN/A
lift-/.f64N/A
lift-sqrt.f64N/A
lift-*.f6481.1
Applied rewrites81.1%
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%
Taylor expanded in l around 0
lower-/.f64N/A
Applied rewrites12.3%
Taylor expanded in d around inf
*-commutativeN/A
lift-pow.f64N/A
lift-/.f64N/A
lift-sqrt.f64N/A
lift-*.f645.5
Applied rewrites5.5%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6416.8
Applied rewrites16.8%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(-
1.0
(* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l))))))
(if (<= t_0 -4e-98)
(* (* (* (/ (* M M) d) -0.125) (sqrt (/ h (pow l 3.0)))) (* D D))
(if (<= t_0 INFINITY)
(/ (* (sqrt (/ h l)) d) h)
(/ (/ (* (sqrt (/ (pow l 3.0) h)) d) l) l)))))
double code(double d, double h, double l, double M, double D) {
double t_0 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double tmp;
if (t_0 <= -4e-98) {
tmp = ((((M * M) / d) * -0.125) * sqrt((h / pow(l, 3.0)))) * (D * D);
} else if (t_0 <= ((double) INFINITY)) {
tmp = (sqrt((h / l)) * d) / h;
} else {
tmp = ((sqrt((pow(l, 3.0) / h)) * d) / l) / l;
}
return tmp;
}
public static double code(double d, double h, double l, double M, double D) {
double t_0 = (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double tmp;
if (t_0 <= -4e-98) {
tmp = ((((M * M) / d) * -0.125) * Math.sqrt((h / Math.pow(l, 3.0)))) * (D * D);
} else if (t_0 <= Double.POSITIVE_INFINITY) {
tmp = (Math.sqrt((h / l)) * d) / h;
} else {
tmp = ((Math.sqrt((Math.pow(l, 3.0) / h)) * d) / l) / l;
}
return tmp;
}
def code(d, h, l, M, D): t_0 = (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l))) tmp = 0 if t_0 <= -4e-98: tmp = ((((M * M) / d) * -0.125) * math.sqrt((h / math.pow(l, 3.0)))) * (D * D) elif t_0 <= math.inf: tmp = (math.sqrt((h / l)) * d) / h else: tmp = ((math.sqrt((math.pow(l, 3.0) / h)) * d) / l) / l return tmp
function code(d, h, l, M, D) t_0 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) tmp = 0.0 if (t_0 <= -4e-98) tmp = Float64(Float64(Float64(Float64(Float64(M * M) / d) * -0.125) * sqrt(Float64(h / (l ^ 3.0)))) * Float64(D * D)); elseif (t_0 <= Inf) tmp = Float64(Float64(sqrt(Float64(h / l)) * d) / h); else tmp = Float64(Float64(Float64(sqrt(Float64((l ^ 3.0) / h)) * d) / l) / l); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); tmp = 0.0; if (t_0 <= -4e-98) tmp = ((((M * M) / d) * -0.125) * sqrt((h / (l ^ 3.0)))) * (D * D); elseif (t_0 <= Inf) tmp = (sqrt((h / l)) * d) / h; else tmp = ((sqrt(((l ^ 3.0) / h)) * d) / l) / l; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -4e-98], N[(N[(N[(N[(N[(M * M), $MachinePrecision] / d), $MachinePrecision] * -0.125), $MachinePrecision] * N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, Infinity], N[(N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision] / h), $MachinePrecision], N[(N[(N[(N[Sqrt[N[(N[Power[l, 3.0], $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision] / l), $MachinePrecision] / l), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{if}\;t\_0 \leq -4 \cdot 10^{-98}:\\
\;\;\;\;\left(\left(\frac{M \cdot M}{d} \cdot -0.125\right) \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right) \cdot \left(D \cdot D\right)\\
\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;\frac{\sqrt{\frac{h}{\ell}} \cdot d}{h}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\sqrt{\frac{{\ell}^{3}}{h}} \cdot d}{\ell}}{\ell}\\
\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.99999999999999976e-98Initial program 88.3%
Taylor expanded in D around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites23.7%
Taylor expanded in d around 0
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-sqrt.f6430.3
Applied rewrites30.3%
if -3.99999999999999976e-98 < (*.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 81.6%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites64.6%
Taylor expanded in d around inf
*-commutativeN/A
lift-/.f64N/A
lift-sqrt.f64N/A
lift-*.f6480.4
Applied rewrites80.4%
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%
Taylor expanded in l around 0
lower-/.f64N/A
Applied rewrites12.3%
Taylor expanded in d around inf
*-commutativeN/A
lift-pow.f64N/A
lift-/.f64N/A
lift-sqrt.f64N/A
lift-*.f645.5
Applied rewrites5.5%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6416.8
Applied rewrites16.8%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ h l)))
(t_1
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(-
1.0
(* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l))))))
(if (<= t_1 -5e-213)
(/ (* (- d) t_0) h)
(if (<= t_1 INFINITY)
(/ (* t_0 d) h)
(/ (/ (* (sqrt (/ (pow l 3.0) h)) d) l) l)))))
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((h / l));
double t_1 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double tmp;
if (t_1 <= -5e-213) {
tmp = (-d * t_0) / h;
} else if (t_1 <= ((double) INFINITY)) {
tmp = (t_0 * d) / h;
} else {
tmp = ((sqrt((pow(l, 3.0) / h)) * d) / l) / l;
}
return tmp;
}
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((h / l));
double t_1 = (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double tmp;
if (t_1 <= -5e-213) {
tmp = (-d * t_0) / h;
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = (t_0 * d) / h;
} else {
tmp = ((Math.sqrt((Math.pow(l, 3.0) / h)) * d) / l) / l;
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.sqrt((h / l)) t_1 = (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l))) tmp = 0 if t_1 <= -5e-213: tmp = (-d * t_0) / h elif t_1 <= math.inf: tmp = (t_0 * d) / h else: tmp = ((math.sqrt((math.pow(l, 3.0) / h)) * d) / l) / l return tmp
function code(d, h, l, M, D) t_0 = sqrt(Float64(h / l)) t_1 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) tmp = 0.0 if (t_1 <= -5e-213) tmp = Float64(Float64(Float64(-d) * t_0) / h); elseif (t_1 <= Inf) tmp = Float64(Float64(t_0 * d) / h); else tmp = Float64(Float64(Float64(sqrt(Float64((l ^ 3.0) / h)) * d) / l) / l); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = sqrt((h / l)); t_1 = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); tmp = 0.0; if (t_1 <= -5e-213) tmp = (-d * t_0) / h; elseif (t_1 <= Inf) tmp = (t_0 * d) / h; else tmp = ((sqrt(((l ^ 3.0) / h)) * d) / l) / l; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e-213], N[(N[((-d) * t$95$0), $MachinePrecision] / h), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(N[(t$95$0 * d), $MachinePrecision] / h), $MachinePrecision], N[(N[(N[(N[Sqrt[N[(N[Power[l, 3.0], $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision] / l), $MachinePrecision] / l), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\frac{h}{\ell}}\\
t_1 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{-213}:\\
\;\;\;\;\frac{\left(-d\right) \cdot t\_0}{h}\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\frac{t\_0 \cdot d}{h}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\sqrt{\frac{{\ell}^{3}}{h}} \cdot d}{\ell}}{\ell}\\
\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)))) < -4.99999999999999977e-213Initial program 88.4%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites52.6%
Taylor expanded in l around -inf
sqrt-pow2N/A
metadata-evalN/A
metadata-evalN/A
*-commutativeN/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
lift-/.f64N/A
lift-sqrt.f6428.3
Applied rewrites28.3%
if -4.99999999999999977e-213 < (*.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 81.5%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites64.3%
Taylor expanded in d around inf
*-commutativeN/A
lift-/.f64N/A
lift-sqrt.f64N/A
lift-*.f6481.1
Applied rewrites81.1%
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%
Taylor expanded in l around 0
lower-/.f64N/A
Applied rewrites12.3%
Taylor expanded in d around inf
*-commutativeN/A
lift-pow.f64N/A
lift-/.f64N/A
lift-sqrt.f64N/A
lift-*.f645.5
Applied rewrites5.5%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6416.8
Applied rewrites16.8%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ h l)))
(t_1
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(-
1.0
(* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l))))))
(if (or (<= t_1 -5e-213) (not (<= t_1 INFINITY)))
(/ (* (- d) t_0) h)
(/ (* t_0 d) h))))
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((h / l));
double t_1 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double tmp;
if ((t_1 <= -5e-213) || !(t_1 <= ((double) INFINITY))) {
tmp = (-d * t_0) / h;
} else {
tmp = (t_0 * d) / h;
}
return tmp;
}
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((h / l));
double t_1 = (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double tmp;
if ((t_1 <= -5e-213) || !(t_1 <= Double.POSITIVE_INFINITY)) {
tmp = (-d * t_0) / h;
} else {
tmp = (t_0 * d) / h;
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.sqrt((h / l)) t_1 = (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l))) tmp = 0 if (t_1 <= -5e-213) or not (t_1 <= math.inf): tmp = (-d * t_0) / h else: tmp = (t_0 * d) / h return tmp
function code(d, h, l, M, D) t_0 = sqrt(Float64(h / l)) t_1 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) tmp = 0.0 if ((t_1 <= -5e-213) || !(t_1 <= Inf)) tmp = Float64(Float64(Float64(-d) * t_0) / h); else tmp = Float64(Float64(t_0 * d) / h); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = sqrt((h / l)); t_1 = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); tmp = 0.0; if ((t_1 <= -5e-213) || ~((t_1 <= Inf))) tmp = (-d * t_0) / h; else tmp = (t_0 * d) / h; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -5e-213], N[Not[LessEqual[t$95$1, Infinity]], $MachinePrecision]], N[(N[((-d) * t$95$0), $MachinePrecision] / h), $MachinePrecision], N[(N[(t$95$0 * d), $MachinePrecision] / h), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\frac{h}{\ell}}\\
t_1 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{-213} \lor \neg \left(t\_1 \leq \infty\right):\\
\;\;\;\;\frac{\left(-d\right) \cdot t\_0}{h}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0 \cdot 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)))) < -4.99999999999999977e-213 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 63.9%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites45.0%
Taylor expanded in l around -inf
sqrt-pow2N/A
metadata-evalN/A
metadata-evalN/A
*-commutativeN/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
lift-/.f64N/A
lift-sqrt.f6425.1
Applied rewrites25.1%
if -4.99999999999999977e-213 < (*.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 81.5%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites64.3%
Taylor expanded in d around inf
*-commutativeN/A
lift-/.f64N/A
lift-sqrt.f64N/A
lift-*.f6481.1
Applied rewrites81.1%
Final simplification48.7%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (pow (/ d h) 0.25)) (t_1 (pow (/ (* M D) (* 2.0 d)) 2.0)))
(if (<=
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(- 1.0 (* (* (/ 1.0 2.0) t_1) (/ h l))))
INFINITY)
(* (* t_0 (* t_0 (sqrt (/ d l)))) (- 1.0 (* (* 0.5 t_1) (/ h l))))
(/
(/
(fma
(* -0.125 (pow (* D M) 2.0))
(pow (/ h l) 1.5)
(* (sqrt (/ h l)) (* d d)))
d)
h))))
double code(double d, double h, double l, double M, double D) {
double t_0 = pow((d / h), 0.25);
double t_1 = pow(((M * D) / (2.0 * d)), 2.0);
double tmp;
if (((pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * t_1) * (h / l)))) <= ((double) INFINITY)) {
tmp = (t_0 * (t_0 * sqrt((d / l)))) * (1.0 - ((0.5 * t_1) * (h / l)));
} else {
tmp = (fma((-0.125 * pow((D * M), 2.0)), pow((h / l), 1.5), (sqrt((h / l)) * (d * d))) / d) / h;
}
return tmp;
}
function code(d, h, l, M, D) t_0 = Float64(d / h) ^ 0.25 t_1 = Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0 tmp = 0.0 if (Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * t_1) * Float64(h / l)))) <= Inf) tmp = Float64(Float64(t_0 * Float64(t_0 * sqrt(Float64(d / l)))) * Float64(1.0 - Float64(Float64(0.5 * t_1) * Float64(h / l)))); else tmp = Float64(Float64(fma(Float64(-0.125 * (Float64(D * M) ^ 2.0)), (Float64(h / l) ^ 1.5), Float64(sqrt(Float64(h / l)) * Float64(d * d))) / d) / h); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Power[N[(d / h), $MachinePrecision], 0.25], $MachinePrecision]}, Block[{t$95$1 = 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[(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] * t$95$1), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(t$95$0 * N[(t$95$0 * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(0.5 * t$95$1), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(-0.125 * N[Power[N[(D * M), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[Power[N[(h / l), $MachinePrecision], 1.5], $MachinePrecision] + N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] * N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] / h), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\frac{d}{h}\right)}^{0.25}\\
t_1 := {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\\
\mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot t\_1\right) \cdot \frac{h}{\ell}\right) \leq \infty:\\
\;\;\;\;\left(t\_0 \cdot \left(t\_0 \cdot \sqrt{\frac{d}{\ell}}\right)\right) \cdot \left(1 - \left(0.5 \cdot t\_1\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(-0.125 \cdot {\left(D \cdot M\right)}^{2}, {\left(\frac{h}{\ell}\right)}^{1.5}, \sqrt{\frac{h}{\ell}} \cdot \left(d \cdot d\right)\right)}{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)))) < +inf.0Initial program 84.9%
lift-/.f64N/A
lift-pow.f64N/A
sqr-powN/A
lower-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-evalN/A
lower-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-evalN/A
lower-pow.f64N/A
lift-/.f6484.9
Applied rewrites84.9%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
associate-*l*N/A
lower-*.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lower-*.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
lift-/.f6484.9
Applied rewrites84.9%
lift-/.f64N/A
metadata-eval84.9
Applied rewrites84.9%
if +inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 0.0%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites25.2%
Taylor expanded in d around 0
lower-/.f64N/A
Applied rewrites30.5%
(FPCore (d h l M D)
:precision binary64
(if (<=
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l))))
INFINITY)
(*
(sqrt (/ d h))
(*
(sqrt (/ d l))
(- 1.0 (* (/ h l) (* (pow (* (/ M 2.0) (/ D d)) 2.0) 0.5)))))
(/
(/
(fma
(* -0.125 (pow (* D M) 2.0))
(pow (/ h l) 1.5)
(* (sqrt (/ h l)) (* d d)))
d)
h)))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (((pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))) <= ((double) INFINITY)) {
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 - ((h / l) * (pow(((M / 2.0) * (D / d)), 2.0) * 0.5))));
} else {
tmp = (fma((-0.125 * pow((D * M), 2.0)), pow((h / l), 1.5), (sqrt((h / l)) * (d * d))) / d) / h;
}
return tmp;
}
function code(d, h, l, M, D) tmp = 0.0 if (Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) <= Inf) tmp = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * Float64(1.0 - Float64(Float64(h / l) * Float64((Float64(Float64(M / 2.0) * Float64(D / d)) ^ 2.0) * 0.5))))); else tmp = Float64(Float64(fma(Float64(-0.125 * (Float64(D * M) ^ 2.0)), (Float64(h / l) ^ 1.5), Float64(sqrt(Float64(h / l)) * Float64(d * d))) / d) / h); end return tmp end
code[d_, h_, l_, M_, D_] := If[LessEqual[N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(-0.125 * N[Power[N[(D * M), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[Power[N[(h / l), $MachinePrecision], 1.5], $MachinePrecision] + N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] * N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] / h), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq \infty:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - \frac{h}{\ell} \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot 0.5\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(-0.125 \cdot {\left(D \cdot M\right)}^{2}, {\left(\frac{h}{\ell}\right)}^{1.5}, \sqrt{\frac{h}{\ell}} \cdot \left(d \cdot d\right)\right)}{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)))) < +inf.0Initial program 84.9%
Applied rewrites84.2%
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%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites25.2%
Taylor expanded in d around 0
lower-/.f64N/A
Applied rewrites30.5%
(FPCore (d h l M D)
:precision binary64
(if (<=
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l))))
INFINITY)
(*
(sqrt (/ d h))
(*
(sqrt (/ d l))
(- 1.0 (* (/ h l) (* (pow (* (/ M 2.0) (/ D d)) 2.0) 0.5)))))
(/
(fma
(* -0.125 (/ (* (* D M) (* D M)) d))
(sqrt (pow (/ h l) 3.0))
(* (sqrt (/ h l)) d))
h)))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (((pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))) <= ((double) INFINITY)) {
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 - ((h / l) * (pow(((M / 2.0) * (D / d)), 2.0) * 0.5))));
} else {
tmp = fma((-0.125 * (((D * M) * (D * M)) / d)), sqrt(pow((h / l), 3.0)), (sqrt((h / l)) * d)) / h;
}
return tmp;
}
function code(d, h, l, M, D) tmp = 0.0 if (Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) <= Inf) tmp = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * Float64(1.0 - Float64(Float64(h / l) * Float64((Float64(Float64(M / 2.0) * Float64(D / d)) ^ 2.0) * 0.5))))); else tmp = Float64(fma(Float64(-0.125 * Float64(Float64(Float64(D * M) * Float64(D * M)) / d)), sqrt((Float64(h / l) ^ 3.0)), Float64(sqrt(Float64(h / l)) * d)) / h); end return tmp end
code[d_, h_, l_, M_, D_] := If[LessEqual[N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(-0.125 * N[(N[(N[(D * M), $MachinePrecision] * N[(D * M), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[Power[N[(h / l), $MachinePrecision], 3.0], $MachinePrecision]], $MachinePrecision] + N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq \infty:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - \frac{h}{\ell} \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot 0.5\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-0.125 \cdot \frac{\left(D \cdot M\right) \cdot \left(D \cdot M\right)}{d}, \sqrt{{\left(\frac{h}{\ell}\right)}^{3}}, \sqrt{\frac{h}{\ell}} \cdot d\right)}{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)))) < +inf.0Initial program 84.9%
Applied rewrites84.2%
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%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites25.2%
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
lower-*.f64N/A
lift-*.f64N/A
lift-*.f6425.2
Applied rewrites25.2%
(FPCore (d h l M D)
:precision binary64
(if (<=
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l))))
INFINITY)
(*
(- 1.0 (* (/ h l) (* (pow (* (* 0.5 M) (/ D d)) 2.0) 0.5)))
(* (sqrt (/ d l)) (sqrt (/ d h))))
(/
(fma
(* -0.125 (/ (* (* D M) (* D M)) d))
(sqrt (pow (/ h l) 3.0))
(* (sqrt (/ h l)) d))
h)))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (((pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))) <= ((double) INFINITY)) {
tmp = (1.0 - ((h / l) * (pow(((0.5 * M) * (D / d)), 2.0) * 0.5))) * (sqrt((d / l)) * sqrt((d / h)));
} else {
tmp = fma((-0.125 * (((D * M) * (D * M)) / d)), sqrt(pow((h / l), 3.0)), (sqrt((h / l)) * d)) / h;
}
return tmp;
}
function code(d, h, l, M, D) tmp = 0.0 if (Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) <= Inf) tmp = Float64(Float64(1.0 - Float64(Float64(h / l) * Float64((Float64(Float64(0.5 * M) * Float64(D / d)) ^ 2.0) * 0.5))) * Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h)))); else tmp = Float64(fma(Float64(-0.125 * Float64(Float64(Float64(D * M) * Float64(D * M)) / d)), sqrt((Float64(h / l) ^ 3.0)), Float64(sqrt(Float64(h / l)) * d)) / h); end return tmp end
code[d_, h_, l_, M_, D_] := If[LessEqual[N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(0.5 * M), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(-0.125 * N[(N[(N[(D * M), $MachinePrecision] * N[(D * M), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[Power[N[(h / l), $MachinePrecision], 3.0], $MachinePrecision]], $MachinePrecision] + N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq \infty:\\
\;\;\;\;\left(1 - \frac{h}{\ell} \cdot \left({\left(\left(0.5 \cdot M\right) \cdot \frac{D}{d}\right)}^{2} \cdot 0.5\right)\right) \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-0.125 \cdot \frac{\left(D \cdot M\right) \cdot \left(D \cdot M\right)}{d}, \sqrt{{\left(\frac{h}{\ell}\right)}^{3}}, \sqrt{\frac{h}{\ell}} \cdot d\right)}{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)))) < +inf.0Initial program 84.9%
Applied rewrites84.2%
Taylor expanded in M around 0
metadata-evalN/A
lower-*.f64N/A
metadata-eval84.2
Applied rewrites84.2%
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%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites25.2%
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
lower-*.f64N/A
lift-*.f64N/A
lift-*.f6425.2
Applied rewrites25.2%
(FPCore (d h l M D)
:precision binary64
(if (<=
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l))))
-5e-213)
(* (sqrt (/ 1.0 (* l h))) d)
(/ (* (sqrt (/ h l)) d) h)))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (((pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))) <= -5e-213) {
tmp = sqrt((1.0 / (l * h))) * d;
} else {
tmp = (sqrt((h / l)) * 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) :: tmp
if (((((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))) <= (-5d-213)) then
tmp = sqrt((1.0d0 / (l * h))) * d
else
tmp = (sqrt((h / l)) * d) / h
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (((Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))) <= -5e-213) {
tmp = Math.sqrt((1.0 / (l * h))) * d;
} else {
tmp = (Math.sqrt((h / l)) * d) / h;
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if ((math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))) <= -5e-213: tmp = math.sqrt((1.0 / (l * h))) * d else: tmp = (math.sqrt((h / l)) * d) / h return tmp
function code(d, h, l, M, D) tmp = 0.0 if (Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) <= -5e-213) tmp = Float64(sqrt(Float64(1.0 / Float64(l * h))) * d); else tmp = Float64(Float64(sqrt(Float64(h / l)) * d) / h); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (((((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l)))) <= -5e-213) tmp = sqrt((1.0 / (l * h))) * d; else tmp = (sqrt((h / l)) * d) / h; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -5e-213], N[(N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision], N[(N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision] / h), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq -5 \cdot 10^{-213}:\\
\;\;\;\;\sqrt{\frac{1}{\ell \cdot h}} \cdot d\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{\frac{h}{\ell}} \cdot 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)))) < -4.99999999999999977e-213Initial program 88.4%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
*-commutativeN/A
lower-*.f6411.3
Applied rewrites11.3%
lift-*.f64N/A
lift-pow.f64N/A
unpow-1N/A
lower-/.f64N/A
lift-*.f6411.3
Applied rewrites11.3%
if -4.99999999999999977e-213 < (*.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 59.0%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites53.5%
Taylor expanded in d around inf
*-commutativeN/A
lift-/.f64N/A
lift-sqrt.f64N/A
lift-*.f6459.9
Applied rewrites59.9%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (pow (* D M) 2.0)) (t_1 (sqrt (/ h (* (* l l) l)))))
(if (<= l -7.4e-38)
(* (- d) (pow (* l h) -0.5))
(if (<= l -1.25e-303)
(* (* -0.125 (/ (* t_0 -1.0) d)) t_1)
(if (<= l 2.15e+43)
(* (* -0.125 (/ t_0 d)) t_1)
(* (/ 1.0 (* (sqrt l) (sqrt h))) d))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = pow((D * M), 2.0);
double t_1 = sqrt((h / ((l * l) * l)));
double tmp;
if (l <= -7.4e-38) {
tmp = -d * pow((l * h), -0.5);
} else if (l <= -1.25e-303) {
tmp = (-0.125 * ((t_0 * -1.0) / d)) * t_1;
} else if (l <= 2.15e+43) {
tmp = (-0.125 * (t_0 / d)) * t_1;
} else {
tmp = (1.0 / (sqrt(l) * sqrt(h))) * d;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (d_1 * m) ** 2.0d0
t_1 = sqrt((h / ((l * l) * l)))
if (l <= (-7.4d-38)) then
tmp = -d * ((l * h) ** (-0.5d0))
else if (l <= (-1.25d-303)) then
tmp = ((-0.125d0) * ((t_0 * (-1.0d0)) / d)) * t_1
else if (l <= 2.15d+43) then
tmp = ((-0.125d0) * (t_0 / d)) * t_1
else
tmp = (1.0d0 / (sqrt(l) * sqrt(h))) * d
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 * M), 2.0);
double t_1 = Math.sqrt((h / ((l * l) * l)));
double tmp;
if (l <= -7.4e-38) {
tmp = -d * Math.pow((l * h), -0.5);
} else if (l <= -1.25e-303) {
tmp = (-0.125 * ((t_0 * -1.0) / d)) * t_1;
} else if (l <= 2.15e+43) {
tmp = (-0.125 * (t_0 / d)) * t_1;
} else {
tmp = (1.0 / (Math.sqrt(l) * Math.sqrt(h))) * d;
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.pow((D * M), 2.0) t_1 = math.sqrt((h / ((l * l) * l))) tmp = 0 if l <= -7.4e-38: tmp = -d * math.pow((l * h), -0.5) elif l <= -1.25e-303: tmp = (-0.125 * ((t_0 * -1.0) / d)) * t_1 elif l <= 2.15e+43: tmp = (-0.125 * (t_0 / d)) * t_1 else: tmp = (1.0 / (math.sqrt(l) * math.sqrt(h))) * d return tmp
function code(d, h, l, M, D) t_0 = Float64(D * M) ^ 2.0 t_1 = sqrt(Float64(h / Float64(Float64(l * l) * l))) tmp = 0.0 if (l <= -7.4e-38) tmp = Float64(Float64(-d) * (Float64(l * h) ^ -0.5)); elseif (l <= -1.25e-303) tmp = Float64(Float64(-0.125 * Float64(Float64(t_0 * -1.0) / d)) * t_1); elseif (l <= 2.15e+43) tmp = Float64(Float64(-0.125 * Float64(t_0 / d)) * t_1); else tmp = Float64(Float64(1.0 / Float64(sqrt(l) * sqrt(h))) * d); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = (D * M) ^ 2.0; t_1 = sqrt((h / ((l * l) * l))); tmp = 0.0; if (l <= -7.4e-38) tmp = -d * ((l * h) ^ -0.5); elseif (l <= -1.25e-303) tmp = (-0.125 * ((t_0 * -1.0) / d)) * t_1; elseif (l <= 2.15e+43) tmp = (-0.125 * (t_0 / d)) * t_1; else tmp = (1.0 / (sqrt(l) * sqrt(h))) * d; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Power[N[(D * M), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(h / N[(N[(l * l), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -7.4e-38], N[((-d) * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -1.25e-303], N[(N[(-0.125 * N[(N[(t$95$0 * -1.0), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[l, 2.15e+43], N[(N[(-0.125 * N[(t$95$0 / d), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision], N[(N[(1.0 / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * d), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(D \cdot M\right)}^{2}\\
t_1 := \sqrt{\frac{h}{\left(\ell \cdot \ell\right) \cdot \ell}}\\
\mathbf{if}\;\ell \leq -7.4 \cdot 10^{-38}:\\
\;\;\;\;\left(-d\right) \cdot {\left(\ell \cdot h\right)}^{-0.5}\\
\mathbf{elif}\;\ell \leq -1.25 \cdot 10^{-303}:\\
\;\;\;\;\left(-0.125 \cdot \frac{t\_0 \cdot -1}{d}\right) \cdot t\_1\\
\mathbf{elif}\;\ell \leq 2.15 \cdot 10^{+43}:\\
\;\;\;\;\left(-0.125 \cdot \frac{t\_0}{d}\right) \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{\ell} \cdot \sqrt{h}} \cdot d\\
\end{array}
\end{array}
if l < -7.4e-38Initial program 53.0%
lift-/.f64N/A
lift-pow.f64N/A
sqr-powN/A
lower-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-evalN/A
lower-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-evalN/A
lower-pow.f64N/A
lift-/.f6453.0
Applied rewrites53.0%
Taylor expanded in l around -inf
pow-prod-upN/A
metadata-evalN/A
metadata-evalN/A
sqrt-pow2N/A
metadata-evalN/A
metadata-evalN/A
*-commutativeN/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
inv-powN/A
*-commutativeN/A
sqrt-pow1N/A
lower-pow.f64N/A
lift-*.f64N/A
metadata-eval44.2
Applied rewrites44.2%
if -7.4e-38 < l < -1.25e-303Initial program 80.9%
lift-/.f64N/A
lift-pow.f64N/A
sqr-powN/A
lower-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-evalN/A
lower-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-evalN/A
lower-pow.f64N/A
lift-/.f6480.8
Applied rewrites80.8%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
associate-*l*N/A
lower-*.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lower-*.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
lift-/.f6480.8
Applied rewrites80.8%
Taylor expanded in h around -inf
Applied rewrites64.5%
lift-pow.f64N/A
unpow3N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6464.5
Applied rewrites64.5%
if -1.25e-303 < l < 2.15e43Initial program 82.0%
Taylor expanded in d around 0
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f64N/A
pow-prod-downN/A
*-commutativeN/A
lower-pow.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-pow.f6456.6
Applied rewrites56.6%
lift-pow.f64N/A
unpow3N/A
lower-*.f64N/A
lift-*.f6456.6
Applied rewrites56.6%
if 2.15e43 < l Initial program 70.0%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
*-commutativeN/A
lower-*.f6451.2
Applied rewrites51.2%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
*-commutativeN/A
inv-powN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-*.f6451.1
Applied rewrites51.1%
lift-*.f64N/A
lift-sqrt.f64N/A
sqrt-prodN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6460.9
Applied rewrites60.9%
Final simplification56.1%
(FPCore (d h l M D) :precision binary64 (* (sqrt (/ 1.0 (* l h))) d))
double code(double d, double h, double l, double M, double D) {
return sqrt((1.0 / (l * h))) * 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((1.0d0 / (l * h))) * d
end function
public static double code(double d, double h, double l, double M, double D) {
return Math.sqrt((1.0 / (l * h))) * d;
}
def code(d, h, l, M, D): return math.sqrt((1.0 / (l * h))) * d
function code(d, h, l, M, D) return Float64(sqrt(Float64(1.0 / Float64(l * h))) * d) end
function tmp = code(d, h, l, M, D) tmp = sqrt((1.0 / (l * h))) * d; end
code[d_, h_, l_, M_, D_] := N[(N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\frac{1}{\ell \cdot h}} \cdot d
\end{array}
Initial program 71.3%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
*-commutativeN/A
lower-*.f6425.7
Applied rewrites25.7%
lift-*.f64N/A
lift-pow.f64N/A
unpow-1N/A
lower-/.f64N/A
lift-*.f6425.7
Applied rewrites25.7%
herbie shell --seed 2025043
(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)))))