
(FPCore (d h l M D) :precision binary64 (* (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))) (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
double code(double d, double h, double l, double M, double D) {
return (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
end function
public static double code(double d, double h, double l, double M, double D) {
return (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
def code(d, h, l, M, D): return (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))
function code(d, h, l, M, D) return Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) end
function tmp = code(d, h, l, M, D) tmp = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); end
code[d_, h_, l_, M_, D_] := N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)
Herbie found 17 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (d h l M D) :precision binary64 (* (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))) (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
double code(double d, double h, double l, double M, double D) {
return (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
end function
public static double code(double d, double h, double l, double M, double D) {
return (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
def code(d, h, l, M, D): return (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))
function code(d, h, l, M, D) return Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) end
function tmp = code(d, h, l, M, D) tmp = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); end
code[d_, h_, l_, M_, D_] := N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (/ D (+ d d))) (t_1 (* t_0 M)))
(if (<= l -2e-91)
(*
(* (sqrt (/ d l)) (/ (sqrt (- d)) (sqrt (- h))))
(- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l))))
(if (<= l 7e-302)
(*
(/ (fabs d) (sqrt (* h l)))
(- 1.0 (/ (* (* (/ (* M D) d) 0.25) (* (* M t_0) h)) l)))
(*
(/ (fabs d) (* (sqrt l) (sqrt h)))
(- 1.0 (* (* t_1 (* t_1 0.5)) (/ h l))))))))double code(double d, double h, double l, double M, double D) {
double t_0 = D / (d + d);
double t_1 = t_0 * M;
double tmp;
if (l <= -2e-91) {
tmp = (sqrt((d / l)) * (sqrt(-d) / sqrt(-h))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
} else if (l <= 7e-302) {
tmp = (fabs(d) / sqrt((h * l))) * (1.0 - (((((M * D) / d) * 0.25) * ((M * t_0) * h)) / l));
} else {
tmp = (fabs(d) / (sqrt(l) * sqrt(h))) * (1.0 - ((t_1 * (t_1 * 0.5)) * (h / l)));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = d_1 / (d + d)
t_1 = t_0 * m
if (l <= (-2d-91)) then
tmp = (sqrt((d / l)) * (sqrt(-d) / sqrt(-h))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
else if (l <= 7d-302) then
tmp = (abs(d) / sqrt((h * l))) * (1.0d0 - (((((m * d_1) / d) * 0.25d0) * ((m * t_0) * h)) / l))
else
tmp = (abs(d) / (sqrt(l) * sqrt(h))) * (1.0d0 - ((t_1 * (t_1 * 0.5d0)) * (h / l)))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = D / (d + d);
double t_1 = t_0 * M;
double tmp;
if (l <= -2e-91) {
tmp = (Math.sqrt((d / l)) * (Math.sqrt(-d) / Math.sqrt(-h))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
} else if (l <= 7e-302) {
tmp = (Math.abs(d) / Math.sqrt((h * l))) * (1.0 - (((((M * D) / d) * 0.25) * ((M * t_0) * h)) / l));
} else {
tmp = (Math.abs(d) / (Math.sqrt(l) * Math.sqrt(h))) * (1.0 - ((t_1 * (t_1 * 0.5)) * (h / l)));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = D / (d + d) t_1 = t_0 * M tmp = 0 if l <= -2e-91: tmp = (math.sqrt((d / l)) * (math.sqrt(-d) / math.sqrt(-h))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l))) elif l <= 7e-302: tmp = (math.fabs(d) / math.sqrt((h * l))) * (1.0 - (((((M * D) / d) * 0.25) * ((M * t_0) * h)) / l)) else: tmp = (math.fabs(d) / (math.sqrt(l) * math.sqrt(h))) * (1.0 - ((t_1 * (t_1 * 0.5)) * (h / l))) return tmp
function code(d, h, l, M, D) t_0 = Float64(D / Float64(d + d)) t_1 = Float64(t_0 * M) tmp = 0.0 if (l <= -2e-91) tmp = Float64(Float64(sqrt(Float64(d / l)) * Float64(sqrt(Float64(-d)) / sqrt(Float64(-h)))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))); elseif (l <= 7e-302) tmp = Float64(Float64(abs(d) / sqrt(Float64(h * l))) * Float64(1.0 - Float64(Float64(Float64(Float64(Float64(M * D) / d) * 0.25) * Float64(Float64(M * t_0) * h)) / l))); else tmp = Float64(Float64(abs(d) / Float64(sqrt(l) * sqrt(h))) * Float64(1.0 - Float64(Float64(t_1 * Float64(t_1 * 0.5)) * Float64(h / l)))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = D / (d + d); t_1 = t_0 * M; tmp = 0.0; if (l <= -2e-91) tmp = (sqrt((d / l)) * (sqrt(-d) / sqrt(-h))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); elseif (l <= 7e-302) tmp = (abs(d) / sqrt((h * l))) * (1.0 - (((((M * D) / d) * 0.25) * ((M * t_0) * h)) / l)); else tmp = (abs(d) / (sqrt(l) * sqrt(h))) * (1.0 - ((t_1 * (t_1 * 0.5)) * (h / l))); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(D / N[(d + d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * M), $MachinePrecision]}, If[LessEqual[l, -2e-91], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $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[l, 7e-302], N[(N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(N[(M * D), $MachinePrecision] / d), $MachinePrecision] * 0.25), $MachinePrecision] * N[(N[(M * t$95$0), $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Abs[d], $MachinePrecision] / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(t$95$1 * N[(t$95$1 * 0.5), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := \frac{D}{d + d}\\
t_1 := t\_0 \cdot M\\
\mathbf{if}\;\ell \leq -2 \cdot 10^{-91}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \frac{\sqrt{-d}}{\sqrt{-h}}\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{elif}\;\ell \leq 7 \cdot 10^{-302}:\\
\;\;\;\;\frac{\left|d\right|}{\sqrt{h \cdot \ell}} \cdot \left(1 - \frac{\left(\frac{M \cdot D}{d} \cdot 0.25\right) \cdot \left(\left(M \cdot t\_0\right) \cdot h\right)}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\left|d\right|}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(1 - \left(t\_1 \cdot \left(t\_1 \cdot 0.5\right)\right) \cdot \frac{h}{\ell}\right)\\
\end{array}
if l < -2e-91Initial program 66.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.7%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.7%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.7%
Applied rewrites66.7%
lift-sqrt.f64N/A
lift-/.f64N/A
frac-2negN/A
sqrt-divN/A
lower-unsound-/.f64N/A
lower-unsound-sqrt.f64N/A
lower-neg.f64N/A
lower-unsound-sqrt.f64N/A
lower-neg.f6438.5%
Applied rewrites38.5%
if -2e-91 < l < 7.0000000000000003e-302Initial program 66.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.7%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.7%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.7%
Applied rewrites66.7%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-*.f6465.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6466.2%
lift-*.f64N/A
count-2-revN/A
lower-+.f6466.2%
Applied rewrites66.2%
lift-*.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f64N/A
lower-sqrt.f64N/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lower-unsound-/.f64N/A
lower-fabs.f64N/A
lower-unsound-sqrt.f6469.9%
Applied rewrites69.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites76.2%
if 7.0000000000000003e-302 < l Initial program 66.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.7%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.7%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.7%
Applied rewrites66.7%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-*.f6465.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6466.2%
lift-*.f64N/A
count-2-revN/A
lower-+.f6466.2%
Applied rewrites66.2%
lift-*.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f64N/A
lower-sqrt.f64N/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lower-unsound-/.f64N/A
lower-fabs.f64N/A
lower-unsound-sqrt.f6469.9%
Applied rewrites69.9%
lift-sqrt.f64N/A
lift-*.f64N/A
*-commutativeN/A
sqrt-prodN/A
lower-unsound-sqrt.f64N/A
lower-unsound-*.f64N/A
lower-unsound-sqrt.f6439.7%
Applied rewrites39.7%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (/ D (+ d d)))
(t_1
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
(t_2 (* t_0 M)))
(if (<= t_1 0.0)
(*
(* (fabs d) (sqrt (/ 1.0 (* h l))))
(- 1.0 (* (* t_2 (* t_2 0.5)) (/ h l))))
(if (<= t_1 5e+291)
(*
(* (sqrt (/ d l)) (sqrt (/ d h)))
(- 1.0 (* (* t_2 (* 0.25 (/ (* D M) d))) (/ h l))))
(*
(/ (fabs d) (sqrt (* h l)))
(- 1.0 (/ (* (* (/ (* M D) d) 0.25) (* (* M t_0) h)) l)))))))double code(double d, double h, double l, double M, double D) {
double t_0 = D / (d + d);
double t_1 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double t_2 = t_0 * M;
double tmp;
if (t_1 <= 0.0) {
tmp = (fabs(d) * sqrt((1.0 / (h * l)))) * (1.0 - ((t_2 * (t_2 * 0.5)) * (h / l)));
} else if (t_1 <= 5e+291) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - ((t_2 * (0.25 * ((D * M) / d))) * (h / l)));
} else {
tmp = (fabs(d) / sqrt((h * l))) * (1.0 - (((((M * D) / d) * 0.25) * ((M * t_0) * h)) / l));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = d_1 / (d + d)
t_1 = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
t_2 = t_0 * m
if (t_1 <= 0.0d0) then
tmp = (abs(d) * sqrt((1.0d0 / (h * l)))) * (1.0d0 - ((t_2 * (t_2 * 0.5d0)) * (h / l)))
else if (t_1 <= 5d+291) then
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0d0 - ((t_2 * (0.25d0 * ((d_1 * m) / d))) * (h / l)))
else
tmp = (abs(d) / sqrt((h * l))) * (1.0d0 - (((((m * d_1) / d) * 0.25d0) * ((m * t_0) * h)) / l))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = D / (d + 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 t_2 = t_0 * M;
double tmp;
if (t_1 <= 0.0) {
tmp = (Math.abs(d) * Math.sqrt((1.0 / (h * l)))) * (1.0 - ((t_2 * (t_2 * 0.5)) * (h / l)));
} else if (t_1 <= 5e+291) {
tmp = (Math.sqrt((d / l)) * Math.sqrt((d / h))) * (1.0 - ((t_2 * (0.25 * ((D * M) / d))) * (h / l)));
} else {
tmp = (Math.abs(d) / Math.sqrt((h * l))) * (1.0 - (((((M * D) / d) * 0.25) * ((M * t_0) * h)) / l));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = D / (d + 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))) t_2 = t_0 * M tmp = 0 if t_1 <= 0.0: tmp = (math.fabs(d) * math.sqrt((1.0 / (h * l)))) * (1.0 - ((t_2 * (t_2 * 0.5)) * (h / l))) elif t_1 <= 5e+291: tmp = (math.sqrt((d / l)) * math.sqrt((d / h))) * (1.0 - ((t_2 * (0.25 * ((D * M) / d))) * (h / l))) else: tmp = (math.fabs(d) / math.sqrt((h * l))) * (1.0 - (((((M * D) / d) * 0.25) * ((M * t_0) * h)) / l)) return tmp
function code(d, h, l, M, D) t_0 = Float64(D / Float64(d + d)) t_1 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) t_2 = Float64(t_0 * M) tmp = 0.0 if (t_1 <= 0.0) tmp = Float64(Float64(abs(d) * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(1.0 - Float64(Float64(t_2 * Float64(t_2 * 0.5)) * Float64(h / l)))); elseif (t_1 <= 5e+291) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * Float64(1.0 - Float64(Float64(t_2 * Float64(0.25 * Float64(Float64(D * M) / d))) * Float64(h / l)))); else tmp = Float64(Float64(abs(d) / sqrt(Float64(h * l))) * Float64(1.0 - Float64(Float64(Float64(Float64(Float64(M * D) / d) * 0.25) * Float64(Float64(M * t_0) * h)) / l))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = D / (d + 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))); t_2 = t_0 * M; tmp = 0.0; if (t_1 <= 0.0) tmp = (abs(d) * sqrt((1.0 / (h * l)))) * (1.0 - ((t_2 * (t_2 * 0.5)) * (h / l))); elseif (t_1 <= 5e+291) tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - ((t_2 * (0.25 * ((D * M) / d))) * (h / l))); else tmp = (abs(d) / sqrt((h * l))) * (1.0 - (((((M * D) / d) * 0.25) * ((M * t_0) * h)) / l)); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(D / N[(d + d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$0 * M), $MachinePrecision]}, If[LessEqual[t$95$1, 0.0], N[(N[(N[Abs[d], $MachinePrecision] * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(t$95$2 * N[(t$95$2 * 0.5), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+291], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(t$95$2 * N[(0.25 * N[(N[(D * M), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(N[(M * D), $MachinePrecision] / d), $MachinePrecision] * 0.25), $MachinePrecision] * N[(N[(M * t$95$0), $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
t_0 := \frac{D}{d + d}\\
t_1 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
t_2 := t\_0 \cdot M\\
\mathbf{if}\;t\_1 \leq 0:\\
\;\;\;\;\left(\left|d\right| \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(1 - \left(t\_2 \cdot \left(t\_2 \cdot 0.5\right)\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+291}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - \left(t\_2 \cdot \left(0.25 \cdot \frac{D \cdot M}{d}\right)\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\left|d\right|}{\sqrt{h \cdot \ell}} \cdot \left(1 - \frac{\left(\frac{M \cdot D}{d} \cdot 0.25\right) \cdot \left(\left(M \cdot t\_0\right) \cdot h\right)}{\ell}\right)\\
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 0.0Initial program 66.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.7%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.7%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.7%
Applied rewrites66.7%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-*.f6465.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6466.2%
lift-*.f64N/A
count-2-revN/A
lower-+.f6466.2%
Applied rewrites66.2%
lift-*.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
mult-flipN/A
lift-/.f64N/A
sqrt-prodN/A
lower-unsound-sqrt.f64N/A
lower-sqrt.f64N/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lower-unsound-sqrt.f64N/A
lower-unsound-*.f64N/A
lower-fabs.f6469.7%
Applied rewrites69.7%
if 0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 5.0000000000000001e291Initial program 66.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.7%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.7%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.7%
Applied rewrites66.7%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-*.f6465.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6466.2%
lift-*.f64N/A
count-2-revN/A
lower-+.f6466.2%
Applied rewrites66.2%
Taylor expanded in d around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6465.8%
Applied rewrites65.8%
if 5.0000000000000001e291 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 66.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.7%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.7%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.7%
Applied rewrites66.7%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-*.f6465.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6466.2%
lift-*.f64N/A
count-2-revN/A
lower-+.f6466.2%
Applied rewrites66.2%
lift-*.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f64N/A
lower-sqrt.f64N/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lower-unsound-/.f64N/A
lower-fabs.f64N/A
lower-unsound-sqrt.f6469.9%
Applied rewrites69.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites76.2%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (/ (fabs d) (sqrt (* h l))))
(t_1
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
(t_2 (/ D (+ d d)))
(t_3 (* t_2 M)))
(if (<= t_1 0.0)
(* t_0 (- 1.0 (* (* t_3 (* t_3 0.5)) (/ h l))))
(if (<= t_1 5e+291)
(*
(* (sqrt (/ d l)) (sqrt (/ d h)))
(- 1.0 (* (* t_3 (* 0.25 (/ (* D M) d))) (/ h l))))
(* t_0 (- 1.0 (/ (* (* (/ (* M D) d) 0.25) (* (* M t_2) h)) l)))))))double code(double d, double h, double l, double M, double D) {
double t_0 = fabs(d) / sqrt((h * l));
double t_1 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double t_2 = D / (d + d);
double t_3 = t_2 * M;
double tmp;
if (t_1 <= 0.0) {
tmp = t_0 * (1.0 - ((t_3 * (t_3 * 0.5)) * (h / l)));
} else if (t_1 <= 5e+291) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - ((t_3 * (0.25 * ((D * M) / d))) * (h / l)));
} else {
tmp = t_0 * (1.0 - (((((M * D) / d) * 0.25) * ((M * t_2) * h)) / l));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = abs(d) / sqrt((h * l))
t_1 = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
t_2 = d_1 / (d + d)
t_3 = t_2 * m
if (t_1 <= 0.0d0) then
tmp = t_0 * (1.0d0 - ((t_3 * (t_3 * 0.5d0)) * (h / l)))
else if (t_1 <= 5d+291) then
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0d0 - ((t_3 * (0.25d0 * ((d_1 * m) / d))) * (h / l)))
else
tmp = t_0 * (1.0d0 - (((((m * d_1) / d) * 0.25d0) * ((m * t_2) * h)) / l))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.abs(d) / Math.sqrt((h * l));
double t_1 = (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double t_2 = D / (d + d);
double t_3 = t_2 * M;
double tmp;
if (t_1 <= 0.0) {
tmp = t_0 * (1.0 - ((t_3 * (t_3 * 0.5)) * (h / l)));
} else if (t_1 <= 5e+291) {
tmp = (Math.sqrt((d / l)) * Math.sqrt((d / h))) * (1.0 - ((t_3 * (0.25 * ((D * M) / d))) * (h / l)));
} else {
tmp = t_0 * (1.0 - (((((M * D) / d) * 0.25) * ((M * t_2) * h)) / l));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.fabs(d) / math.sqrt((h * l)) t_1 = (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l))) t_2 = D / (d + d) t_3 = t_2 * M tmp = 0 if t_1 <= 0.0: tmp = t_0 * (1.0 - ((t_3 * (t_3 * 0.5)) * (h / l))) elif t_1 <= 5e+291: tmp = (math.sqrt((d / l)) * math.sqrt((d / h))) * (1.0 - ((t_3 * (0.25 * ((D * M) / d))) * (h / l))) else: tmp = t_0 * (1.0 - (((((M * D) / d) * 0.25) * ((M * t_2) * h)) / l)) return tmp
function code(d, h, l, M, D) t_0 = Float64(abs(d) / sqrt(Float64(h * l))) t_1 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) t_2 = Float64(D / Float64(d + d)) t_3 = Float64(t_2 * M) tmp = 0.0 if (t_1 <= 0.0) tmp = Float64(t_0 * Float64(1.0 - Float64(Float64(t_3 * Float64(t_3 * 0.5)) * Float64(h / l)))); elseif (t_1 <= 5e+291) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * Float64(1.0 - Float64(Float64(t_3 * Float64(0.25 * Float64(Float64(D * M) / d))) * Float64(h / l)))); else tmp = Float64(t_0 * Float64(1.0 - Float64(Float64(Float64(Float64(Float64(M * D) / d) * 0.25) * Float64(Float64(M * t_2) * h)) / l))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = abs(d) / sqrt((h * l)); t_1 = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); t_2 = D / (d + d); t_3 = t_2 * M; tmp = 0.0; if (t_1 <= 0.0) tmp = t_0 * (1.0 - ((t_3 * (t_3 * 0.5)) * (h / l))); elseif (t_1 <= 5e+291) tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - ((t_3 * (0.25 * ((D * M) / d))) * (h / l))); else tmp = t_0 * (1.0 - (((((M * D) / d) * 0.25) * ((M * t_2) * h)) / l)); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(D / N[(d + d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 * M), $MachinePrecision]}, If[LessEqual[t$95$1, 0.0], N[(t$95$0 * N[(1.0 - N[(N[(t$95$3 * N[(t$95$3 * 0.5), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+291], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(t$95$3 * N[(0.25 * N[(N[(D * M), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(1.0 - N[(N[(N[(N[(N[(M * D), $MachinePrecision] / d), $MachinePrecision] * 0.25), $MachinePrecision] * N[(N[(M * t$95$2), $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
t_0 := \frac{\left|d\right|}{\sqrt{h \cdot \ell}}\\
t_1 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
t_2 := \frac{D}{d + d}\\
t_3 := t\_2 \cdot M\\
\mathbf{if}\;t\_1 \leq 0:\\
\;\;\;\;t\_0 \cdot \left(1 - \left(t\_3 \cdot \left(t\_3 \cdot 0.5\right)\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+291}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - \left(t\_3 \cdot \left(0.25 \cdot \frac{D \cdot M}{d}\right)\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \left(1 - \frac{\left(\frac{M \cdot D}{d} \cdot 0.25\right) \cdot \left(\left(M \cdot t\_2\right) \cdot h\right)}{\ell}\right)\\
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 0.0Initial program 66.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.7%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.7%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.7%
Applied rewrites66.7%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-*.f6465.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6466.2%
lift-*.f64N/A
count-2-revN/A
lower-+.f6466.2%
Applied rewrites66.2%
lift-*.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f64N/A
lower-sqrt.f64N/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lower-unsound-/.f64N/A
lower-fabs.f64N/A
lower-unsound-sqrt.f6469.9%
Applied rewrites69.9%
if 0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 5.0000000000000001e291Initial program 66.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.7%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.7%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.7%
Applied rewrites66.7%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-*.f6465.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6466.2%
lift-*.f64N/A
count-2-revN/A
lower-+.f6466.2%
Applied rewrites66.2%
Taylor expanded in d around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6465.8%
Applied rewrites65.8%
if 5.0000000000000001e291 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 66.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.7%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.7%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.7%
Applied rewrites66.7%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-*.f6465.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6466.2%
lift-*.f64N/A
count-2-revN/A
lower-+.f6466.2%
Applied rewrites66.2%
lift-*.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f64N/A
lower-sqrt.f64N/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lower-unsound-/.f64N/A
lower-fabs.f64N/A
lower-unsound-sqrt.f6469.9%
Applied rewrites69.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites76.2%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (/ (fabs d) (sqrt (* h l))))
(t_1
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
(t_2 (/ D (+ d d)))
(t_3 (* t_2 M)))
(if (<= t_1 0.0)
(* t_0 (- 1.0 (* (* t_3 (* t_3 0.5)) (/ h l))))
(if (<= t_1 5e+291)
(* (sqrt (/ d h)) (sqrt (/ d l)))
(* t_0 (- 1.0 (/ (* (* (/ (* M D) d) 0.25) (* (* M t_2) h)) l)))))))double code(double d, double h, double l, double M, double D) {
double t_0 = fabs(d) / sqrt((h * l));
double t_1 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double t_2 = D / (d + d);
double t_3 = t_2 * M;
double tmp;
if (t_1 <= 0.0) {
tmp = t_0 * (1.0 - ((t_3 * (t_3 * 0.5)) * (h / l)));
} else if (t_1 <= 5e+291) {
tmp = sqrt((d / h)) * sqrt((d / l));
} else {
tmp = t_0 * (1.0 - (((((M * D) / d) * 0.25) * ((M * t_2) * h)) / l));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = abs(d) / sqrt((h * l))
t_1 = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
t_2 = d_1 / (d + d)
t_3 = t_2 * m
if (t_1 <= 0.0d0) then
tmp = t_0 * (1.0d0 - ((t_3 * (t_3 * 0.5d0)) * (h / l)))
else if (t_1 <= 5d+291) then
tmp = sqrt((d / h)) * sqrt((d / l))
else
tmp = t_0 * (1.0d0 - (((((m * d_1) / d) * 0.25d0) * ((m * t_2) * h)) / l))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.abs(d) / Math.sqrt((h * l));
double t_1 = (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double t_2 = D / (d + d);
double t_3 = t_2 * M;
double tmp;
if (t_1 <= 0.0) {
tmp = t_0 * (1.0 - ((t_3 * (t_3 * 0.5)) * (h / l)));
} else if (t_1 <= 5e+291) {
tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
} else {
tmp = t_0 * (1.0 - (((((M * D) / d) * 0.25) * ((M * t_2) * h)) / l));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.fabs(d) / math.sqrt((h * l)) t_1 = (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l))) t_2 = D / (d + d) t_3 = t_2 * M tmp = 0 if t_1 <= 0.0: tmp = t_0 * (1.0 - ((t_3 * (t_3 * 0.5)) * (h / l))) elif t_1 <= 5e+291: tmp = math.sqrt((d / h)) * math.sqrt((d / l)) else: tmp = t_0 * (1.0 - (((((M * D) / d) * 0.25) * ((M * t_2) * h)) / l)) return tmp
function code(d, h, l, M, D) t_0 = Float64(abs(d) / sqrt(Float64(h * l))) t_1 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) t_2 = Float64(D / Float64(d + d)) t_3 = Float64(t_2 * M) tmp = 0.0 if (t_1 <= 0.0) tmp = Float64(t_0 * Float64(1.0 - Float64(Float64(t_3 * Float64(t_3 * 0.5)) * Float64(h / l)))); elseif (t_1 <= 5e+291) tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); else tmp = Float64(t_0 * Float64(1.0 - Float64(Float64(Float64(Float64(Float64(M * D) / d) * 0.25) * Float64(Float64(M * t_2) * h)) / l))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = abs(d) / sqrt((h * l)); t_1 = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); t_2 = D / (d + d); t_3 = t_2 * M; tmp = 0.0; if (t_1 <= 0.0) tmp = t_0 * (1.0 - ((t_3 * (t_3 * 0.5)) * (h / l))); elseif (t_1 <= 5e+291) tmp = sqrt((d / h)) * sqrt((d / l)); else tmp = t_0 * (1.0 - (((((M * D) / d) * 0.25) * ((M * t_2) * h)) / l)); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(D / N[(d + d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 * M), $MachinePrecision]}, If[LessEqual[t$95$1, 0.0], N[(t$95$0 * N[(1.0 - N[(N[(t$95$3 * N[(t$95$3 * 0.5), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+291], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(1.0 - N[(N[(N[(N[(N[(M * D), $MachinePrecision] / d), $MachinePrecision] * 0.25), $MachinePrecision] * N[(N[(M * t$95$2), $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
t_0 := \frac{\left|d\right|}{\sqrt{h \cdot \ell}}\\
t_1 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
t_2 := \frac{D}{d + d}\\
t_3 := t\_2 \cdot M\\
\mathbf{if}\;t\_1 \leq 0:\\
\;\;\;\;t\_0 \cdot \left(1 - \left(t\_3 \cdot \left(t\_3 \cdot 0.5\right)\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+291}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \left(1 - \frac{\left(\frac{M \cdot D}{d} \cdot 0.25\right) \cdot \left(\left(M \cdot t\_2\right) \cdot h\right)}{\ell}\right)\\
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 0.0Initial program 66.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.7%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.7%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.7%
Applied rewrites66.7%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-*.f6465.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6466.2%
lift-*.f64N/A
count-2-revN/A
lower-+.f6466.2%
Applied rewrites66.2%
lift-*.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f64N/A
lower-sqrt.f64N/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lower-unsound-/.f64N/A
lower-fabs.f64N/A
lower-unsound-sqrt.f6469.9%
Applied rewrites69.9%
if 0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 5.0000000000000001e291Initial program 66.7%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.5%
Applied rewrites23.5%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6423.5%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6421.2%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6421.2%
Applied rewrites21.2%
Taylor expanded in l around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6440.2%
Applied rewrites40.2%
if 5.0000000000000001e291 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 66.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.7%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.7%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.7%
Applied rewrites66.7%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-*.f6465.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6466.2%
lift-*.f64N/A
count-2-revN/A
lower-+.f6466.2%
Applied rewrites66.2%
lift-*.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f64N/A
lower-sqrt.f64N/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lower-unsound-/.f64N/A
lower-fabs.f64N/A
lower-unsound-sqrt.f6469.9%
Applied rewrites69.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites76.2%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (fmax M (fabs D)))
(t_1 (fmin M (fabs D)))
(t_2 (* t_1 t_0))
(t_3
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(- 1.0 (* (* (/ 1.0 2.0) (pow (/ t_2 (* 2.0 d)) 2.0)) (/ h l)))))
(t_4 (* (/ t_2 d) 0.25)))
(if (<= t_3 0.0)
(*
(fabs d)
(/ (fma -0.5 (* (* (* t_4 t_1) (/ t_0 d)) (/ h l)) 1.0) (sqrt (* l h))))
(if (<= t_3 5e+291)
(* (sqrt (/ d h)) (sqrt (/ d l)))
(*
(/ (fabs d) (sqrt (* h l)))
(- 1.0 (/ (* t_4 (* (* t_1 (/ t_0 (+ d d))) h)) l)))))))double code(double d, double h, double l, double M, double D) {
double t_0 = fmax(M, fabs(D));
double t_1 = fmin(M, fabs(D));
double t_2 = t_1 * t_0;
double t_3 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow((t_2 / (2.0 * d)), 2.0)) * (h / l)));
double t_4 = (t_2 / d) * 0.25;
double tmp;
if (t_3 <= 0.0) {
tmp = fabs(d) * (fma(-0.5, (((t_4 * t_1) * (t_0 / d)) * (h / l)), 1.0) / sqrt((l * h)));
} else if (t_3 <= 5e+291) {
tmp = sqrt((d / h)) * sqrt((d / l));
} else {
tmp = (fabs(d) / sqrt((h * l))) * (1.0 - ((t_4 * ((t_1 * (t_0 / (d + d))) * h)) / l));
}
return tmp;
}
function code(d, h, l, M, D) t_0 = fmax(M, abs(D)) t_1 = fmin(M, abs(D)) t_2 = Float64(t_1 * t_0) t_3 = 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(t_2 / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) t_4 = Float64(Float64(t_2 / d) * 0.25) tmp = 0.0 if (t_3 <= 0.0) tmp = Float64(abs(d) * Float64(fma(-0.5, Float64(Float64(Float64(t_4 * t_1) * Float64(t_0 / d)) * Float64(h / l)), 1.0) / sqrt(Float64(l * h)))); elseif (t_3 <= 5e+291) tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); else tmp = Float64(Float64(abs(d) / sqrt(Float64(h * l))) * Float64(1.0 - Float64(Float64(t_4 * Float64(Float64(t_1 * Float64(t_0 / Float64(d + d))) * h)) / l))); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Max[M, N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Min[M, N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * t$95$0), $MachinePrecision]}, Block[{t$95$3 = 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[(t$95$2 / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[(t$95$2 / d), $MachinePrecision] * 0.25), $MachinePrecision]}, If[LessEqual[t$95$3, 0.0], N[(N[Abs[d], $MachinePrecision] * N[(N[(-0.5 * N[(N[(N[(t$95$4 * t$95$1), $MachinePrecision] * N[(t$95$0 / d), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 5e+291], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(t$95$4 * N[(N[(t$95$1 * N[(t$95$0 / N[(d + d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
t_0 := \mathsf{max}\left(M, \left|D\right|\right)\\
t_1 := \mathsf{min}\left(M, \left|D\right|\right)\\
t_2 := t\_1 \cdot t\_0\\
t_3 := \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{t\_2}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
t_4 := \frac{t\_2}{d} \cdot 0.25\\
\mathbf{if}\;t\_3 \leq 0:\\
\;\;\;\;\left|d\right| \cdot \frac{\mathsf{fma}\left(-0.5, \left(\left(t\_4 \cdot t\_1\right) \cdot \frac{t\_0}{d}\right) \cdot \frac{h}{\ell}, 1\right)}{\sqrt{\ell \cdot h}}\\
\mathbf{elif}\;t\_3 \leq 5 \cdot 10^{+291}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left|d\right|}{\sqrt{h \cdot \ell}} \cdot \left(1 - \frac{t\_4 \cdot \left(\left(t\_1 \cdot \frac{t\_0}{d + d}\right) \cdot h\right)}{\ell}\right)\\
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 0.0Initial program 66.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.7%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.7%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.7%
Applied rewrites66.7%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-*.f6465.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6466.2%
lift-*.f64N/A
count-2-revN/A
lower-+.f6466.2%
Applied rewrites66.2%
lift-*.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f64N/A
lower-sqrt.f64N/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lower-unsound-/.f64N/A
lower-fabs.f64N/A
lower-unsound-sqrt.f6469.9%
Applied rewrites69.9%
Applied rewrites69.8%
if 0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 5.0000000000000001e291Initial program 66.7%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.5%
Applied rewrites23.5%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6423.5%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6421.2%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6421.2%
Applied rewrites21.2%
Taylor expanded in l around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6440.2%
Applied rewrites40.2%
if 5.0000000000000001e291 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 66.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.7%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.7%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.7%
Applied rewrites66.7%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-*.f6465.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6466.2%
lift-*.f64N/A
count-2-revN/A
lower-+.f6466.2%
Applied rewrites66.2%
lift-*.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f64N/A
lower-sqrt.f64N/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lower-unsound-/.f64N/A
lower-fabs.f64N/A
lower-unsound-sqrt.f6469.9%
Applied rewrites69.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites76.2%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (/ D (+ d d))) (t_1 (* t_0 M)))
(if (<= h 2.4e-289)
(*
(/ (fabs d) (sqrt (* h l)))
(- 1.0 (/ (* (* (/ (* M D) d) 0.25) (* (* M t_0) h)) l)))
(*
(/ (fabs d) (* (sqrt l) (sqrt h)))
(- 1.0 (* (* t_1 (* t_1 0.5)) (/ h l)))))))double code(double d, double h, double l, double M, double D) {
double t_0 = D / (d + d);
double t_1 = t_0 * M;
double tmp;
if (h <= 2.4e-289) {
tmp = (fabs(d) / sqrt((h * l))) * (1.0 - (((((M * D) / d) * 0.25) * ((M * t_0) * h)) / l));
} else {
tmp = (fabs(d) / (sqrt(l) * sqrt(h))) * (1.0 - ((t_1 * (t_1 * 0.5)) * (h / l)));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = d_1 / (d + d)
t_1 = t_0 * m
if (h <= 2.4d-289) then
tmp = (abs(d) / sqrt((h * l))) * (1.0d0 - (((((m * d_1) / d) * 0.25d0) * ((m * t_0) * h)) / l))
else
tmp = (abs(d) / (sqrt(l) * sqrt(h))) * (1.0d0 - ((t_1 * (t_1 * 0.5d0)) * (h / l)))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = D / (d + d);
double t_1 = t_0 * M;
double tmp;
if (h <= 2.4e-289) {
tmp = (Math.abs(d) / Math.sqrt((h * l))) * (1.0 - (((((M * D) / d) * 0.25) * ((M * t_0) * h)) / l));
} else {
tmp = (Math.abs(d) / (Math.sqrt(l) * Math.sqrt(h))) * (1.0 - ((t_1 * (t_1 * 0.5)) * (h / l)));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = D / (d + d) t_1 = t_0 * M tmp = 0 if h <= 2.4e-289: tmp = (math.fabs(d) / math.sqrt((h * l))) * (1.0 - (((((M * D) / d) * 0.25) * ((M * t_0) * h)) / l)) else: tmp = (math.fabs(d) / (math.sqrt(l) * math.sqrt(h))) * (1.0 - ((t_1 * (t_1 * 0.5)) * (h / l))) return tmp
function code(d, h, l, M, D) t_0 = Float64(D / Float64(d + d)) t_1 = Float64(t_0 * M) tmp = 0.0 if (h <= 2.4e-289) tmp = Float64(Float64(abs(d) / sqrt(Float64(h * l))) * Float64(1.0 - Float64(Float64(Float64(Float64(Float64(M * D) / d) * 0.25) * Float64(Float64(M * t_0) * h)) / l))); else tmp = Float64(Float64(abs(d) / Float64(sqrt(l) * sqrt(h))) * Float64(1.0 - Float64(Float64(t_1 * Float64(t_1 * 0.5)) * Float64(h / l)))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = D / (d + d); t_1 = t_0 * M; tmp = 0.0; if (h <= 2.4e-289) tmp = (abs(d) / sqrt((h * l))) * (1.0 - (((((M * D) / d) * 0.25) * ((M * t_0) * h)) / l)); else tmp = (abs(d) / (sqrt(l) * sqrt(h))) * (1.0 - ((t_1 * (t_1 * 0.5)) * (h / l))); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(D / N[(d + d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * M), $MachinePrecision]}, If[LessEqual[h, 2.4e-289], N[(N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(N[(M * D), $MachinePrecision] / d), $MachinePrecision] * 0.25), $MachinePrecision] * N[(N[(M * t$95$0), $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Abs[d], $MachinePrecision] / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(t$95$1 * N[(t$95$1 * 0.5), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \frac{D}{d + d}\\
t_1 := t\_0 \cdot M\\
\mathbf{if}\;h \leq 2.4 \cdot 10^{-289}:\\
\;\;\;\;\frac{\left|d\right|}{\sqrt{h \cdot \ell}} \cdot \left(1 - \frac{\left(\frac{M \cdot D}{d} \cdot 0.25\right) \cdot \left(\left(M \cdot t\_0\right) \cdot h\right)}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\left|d\right|}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(1 - \left(t\_1 \cdot \left(t\_1 \cdot 0.5\right)\right) \cdot \frac{h}{\ell}\right)\\
\end{array}
if h < 2.3999999999999999e-289Initial program 66.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.7%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.7%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.7%
Applied rewrites66.7%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-*.f6465.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6466.2%
lift-*.f64N/A
count-2-revN/A
lower-+.f6466.2%
Applied rewrites66.2%
lift-*.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f64N/A
lower-sqrt.f64N/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lower-unsound-/.f64N/A
lower-fabs.f64N/A
lower-unsound-sqrt.f6469.9%
Applied rewrites69.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites76.2%
if 2.3999999999999999e-289 < h Initial program 66.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.7%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.7%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.7%
Applied rewrites66.7%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-*.f6465.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6466.2%
lift-*.f64N/A
count-2-revN/A
lower-+.f6466.2%
Applied rewrites66.2%
lift-*.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f64N/A
lower-sqrt.f64N/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lower-unsound-/.f64N/A
lower-fabs.f64N/A
lower-unsound-sqrt.f6469.9%
Applied rewrites69.9%
lift-sqrt.f64N/A
lift-*.f64N/A
*-commutativeN/A
sqrt-prodN/A
lower-unsound-sqrt.f64N/A
lower-unsound-*.f64N/A
lower-unsound-sqrt.f6439.7%
Applied rewrites39.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)))))
(t_1
(*
(fabs d)
(/
(fma -0.5 (* (* (* (* (/ (* M D) d) 0.25) M) (/ D d)) (/ h l)) 1.0)
(sqrt (* l h))))))
(if (<= t_0 0.0)
t_1
(if (<= t_0 5e+291) (* (sqrt (/ d h)) (sqrt (/ d l))) t_1))))double code(double d, double h, double l, double M, double D) {
double t_0 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double t_1 = fabs(d) * (fma(-0.5, ((((((M * D) / d) * 0.25) * M) * (D / d)) * (h / l)), 1.0) / sqrt((l * h)));
double tmp;
if (t_0 <= 0.0) {
tmp = t_1;
} else if (t_0 <= 5e+291) {
tmp = sqrt((d / h)) * sqrt((d / l));
} else {
tmp = t_1;
}
return tmp;
}
function code(d, h, l, M, D) t_0 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) t_1 = Float64(abs(d) * Float64(fma(-0.5, Float64(Float64(Float64(Float64(Float64(Float64(M * D) / d) * 0.25) * M) * Float64(D / d)) * Float64(h / l)), 1.0) / sqrt(Float64(l * h)))) tmp = 0.0 if (t_0 <= 0.0) tmp = t_1; elseif (t_0 <= 5e+291) tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); else tmp = t_1; end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Abs[d], $MachinePrecision] * N[(N[(-0.5 * N[(N[(N[(N[(N[(N[(M * D), $MachinePrecision] / d), $MachinePrecision] * 0.25), $MachinePrecision] * M), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 0.0], t$95$1, If[LessEqual[t$95$0, 5e+291], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
t_0 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
t_1 := \left|d\right| \cdot \frac{\mathsf{fma}\left(-0.5, \left(\left(\left(\frac{M \cdot D}{d} \cdot 0.25\right) \cdot M\right) \cdot \frac{D}{d}\right) \cdot \frac{h}{\ell}, 1\right)}{\sqrt{\ell \cdot h}}\\
\mathbf{if}\;t\_0 \leq 0:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+291}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 0.0 or 5.0000000000000001e291 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 66.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.7%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.7%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.7%
Applied rewrites66.7%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-*.f6465.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6466.2%
lift-*.f64N/A
count-2-revN/A
lower-+.f6466.2%
Applied rewrites66.2%
lift-*.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f64N/A
lower-sqrt.f64N/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lower-unsound-/.f64N/A
lower-fabs.f64N/A
lower-unsound-sqrt.f6469.9%
Applied rewrites69.9%
Applied rewrites69.8%
if 0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 5.0000000000000001e291Initial program 66.7%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.5%
Applied rewrites23.5%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6423.5%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6421.2%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6421.2%
Applied rewrites21.2%
Taylor expanded in l around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6440.2%
Applied rewrites40.2%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (fmin (fabs M) (fabs D)))
(t_1 (fmax (fabs M) (fabs D)))
(t_2
(*
(/ (/ (fabs d) (sqrt (* l h))) d)
(-
d
(* (* (* (/ h (* l d)) 0.5) (* (* 0.25 (* t_1 t_1)) t_0)) t_0))))
(t_3
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(-
1.0
(* (* (/ 1.0 2.0) (pow (/ (* t_0 t_1) (* 2.0 d)) 2.0)) (/ h l))))))
(if (<= t_3 0.0)
t_2
(if (<= t_3 5e+291)
(* (sqrt (/ d h)) (sqrt (/ d l)))
(if (<= t_3 INFINITY) (* (/ (fabs d) (sqrt (* h l))) 1.0) t_2)))))double code(double d, double h, double l, double M, double D) {
double t_0 = fmin(fabs(M), fabs(D));
double t_1 = fmax(fabs(M), fabs(D));
double t_2 = ((fabs(d) / sqrt((l * h))) / d) * (d - ((((h / (l * d)) * 0.5) * ((0.25 * (t_1 * t_1)) * t_0)) * t_0));
double t_3 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((t_0 * t_1) / (2.0 * d)), 2.0)) * (h / l)));
double tmp;
if (t_3 <= 0.0) {
tmp = t_2;
} else if (t_3 <= 5e+291) {
tmp = sqrt((d / h)) * sqrt((d / l));
} else if (t_3 <= ((double) INFINITY)) {
tmp = (fabs(d) / sqrt((h * l))) * 1.0;
} else {
tmp = t_2;
}
return tmp;
}
public static double code(double d, double h, double l, double M, double D) {
double t_0 = fmin(Math.abs(M), Math.abs(D));
double t_1 = fmax(Math.abs(M), Math.abs(D));
double t_2 = ((Math.abs(d) / Math.sqrt((l * h))) / d) * (d - ((((h / (l * d)) * 0.5) * ((0.25 * (t_1 * t_1)) * t_0)) * t_0));
double t_3 = (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((t_0 * t_1) / (2.0 * d)), 2.0)) * (h / l)));
double tmp;
if (t_3 <= 0.0) {
tmp = t_2;
} else if (t_3 <= 5e+291) {
tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
} else if (t_3 <= Double.POSITIVE_INFINITY) {
tmp = (Math.abs(d) / Math.sqrt((h * l))) * 1.0;
} else {
tmp = t_2;
}
return tmp;
}
def code(d, h, l, M, D): t_0 = fmin(math.fabs(M), math.fabs(D)) t_1 = fmax(math.fabs(M), math.fabs(D)) t_2 = ((math.fabs(d) / math.sqrt((l * h))) / d) * (d - ((((h / (l * d)) * 0.5) * ((0.25 * (t_1 * t_1)) * t_0)) * t_0)) t_3 = (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((t_0 * t_1) / (2.0 * d)), 2.0)) * (h / l))) tmp = 0 if t_3 <= 0.0: tmp = t_2 elif t_3 <= 5e+291: tmp = math.sqrt((d / h)) * math.sqrt((d / l)) elif t_3 <= math.inf: tmp = (math.fabs(d) / math.sqrt((h * l))) * 1.0 else: tmp = t_2 return tmp
function code(d, h, l, M, D) t_0 = fmin(abs(M), abs(D)) t_1 = fmax(abs(M), abs(D)) t_2 = Float64(Float64(Float64(abs(d) / sqrt(Float64(l * h))) / d) * Float64(d - Float64(Float64(Float64(Float64(h / Float64(l * d)) * 0.5) * Float64(Float64(0.25 * Float64(t_1 * t_1)) * t_0)) * t_0))) t_3 = 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(t_0 * t_1) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) tmp = 0.0 if (t_3 <= 0.0) tmp = t_2; elseif (t_3 <= 5e+291) tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); elseif (t_3 <= Inf) tmp = Float64(Float64(abs(d) / sqrt(Float64(h * l))) * 1.0); else tmp = t_2; end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = min(abs(M), abs(D)); t_1 = max(abs(M), abs(D)); t_2 = ((abs(d) / sqrt((l * h))) / d) * (d - ((((h / (l * d)) * 0.5) * ((0.25 * (t_1 * t_1)) * t_0)) * t_0)); t_3 = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((t_0 * t_1) / (2.0 * d)) ^ 2.0)) * (h / l))); tmp = 0.0; if (t_3 <= 0.0) tmp = t_2; elseif (t_3 <= 5e+291) tmp = sqrt((d / h)) * sqrt((d / l)); elseif (t_3 <= Inf) tmp = (abs(d) / sqrt((h * l))) * 1.0; else tmp = t_2; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Min[N[Abs[M], $MachinePrecision], N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Max[N[Abs[M], $MachinePrecision], N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] * N[(d - N[(N[(N[(N[(h / N[(l * d), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision] * N[(N[(0.25 * N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = 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[(t$95$0 * t$95$1), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, 0.0], t$95$2, If[LessEqual[t$95$3, 5e+291], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, Infinity], N[(N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], t$95$2]]]]]]]
\begin{array}{l}
t_0 := \mathsf{min}\left(\left|M\right|, \left|D\right|\right)\\
t_1 := \mathsf{max}\left(\left|M\right|, \left|D\right|\right)\\
t_2 := \frac{\frac{\left|d\right|}{\sqrt{\ell \cdot h}}}{d} \cdot \left(d - \left(\left(\frac{h}{\ell \cdot d} \cdot 0.5\right) \cdot \left(\left(0.25 \cdot \left(t\_1 \cdot t\_1\right)\right) \cdot t\_0\right)\right) \cdot t\_0\right)\\
t_3 := \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{t\_0 \cdot t\_1}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{if}\;t\_3 \leq 0:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_3 \leq 5 \cdot 10^{+291}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{elif}\;t\_3 \leq \infty:\\
\;\;\;\;\frac{\left|d\right|}{\sqrt{h \cdot \ell}} \cdot 1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 0.0 or +inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 66.7%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-pow.f64N/A
unpow2N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
associate-*r/N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites52.8%
Applied rewrites21.1%
Applied rewrites64.3%
if 0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 5.0000000000000001e291Initial program 66.7%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.5%
Applied rewrites23.5%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6423.5%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6421.2%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6421.2%
Applied rewrites21.2%
Taylor expanded in l around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6440.2%
Applied rewrites40.2%
if 5.0000000000000001e291 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < +inf.0Initial program 66.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.7%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.7%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.7%
Applied rewrites66.7%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-*.f6465.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6466.2%
lift-*.f64N/A
count-2-revN/A
lower-+.f6466.2%
Applied rewrites66.2%
lift-*.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f64N/A
lower-sqrt.f64N/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lower-unsound-/.f64N/A
lower-fabs.f64N/A
lower-unsound-sqrt.f6469.9%
Applied rewrites69.9%
Taylor expanded in d around inf
Applied rewrites44.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)))))
(t_1 (/ (fabs d) (sqrt (* h l))))
(t_2 (* t_1 1.0))
(t_3
(*
(fma (* -0.5 h) (/ (* (* (* D D) 0.25) (* M M)) (* (* d d) l)) 1.0)
t_1)))
(if (<= t_0 -2e+55)
t_3
(if (<= t_0 0.0)
t_2
(if (<= t_0 5e+291)
(* (sqrt (/ d h)) (sqrt (/ d l)))
(if (<= t_0 INFINITY) t_2 t_3))))))double code(double d, double h, double l, double M, double D) {
double t_0 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double t_1 = fabs(d) / sqrt((h * l));
double t_2 = t_1 * 1.0;
double t_3 = fma((-0.5 * h), ((((D * D) * 0.25) * (M * M)) / ((d * d) * l)), 1.0) * t_1;
double tmp;
if (t_0 <= -2e+55) {
tmp = t_3;
} else if (t_0 <= 0.0) {
tmp = t_2;
} else if (t_0 <= 5e+291) {
tmp = sqrt((d / h)) * sqrt((d / l));
} else if (t_0 <= ((double) INFINITY)) {
tmp = t_2;
} else {
tmp = t_3;
}
return tmp;
}
function code(d, h, l, M, D) t_0 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) t_1 = Float64(abs(d) / sqrt(Float64(h * l))) t_2 = Float64(t_1 * 1.0) t_3 = Float64(fma(Float64(-0.5 * h), Float64(Float64(Float64(Float64(D * D) * 0.25) * Float64(M * M)) / Float64(Float64(d * d) * l)), 1.0) * t_1) tmp = 0.0 if (t_0 <= -2e+55) tmp = t_3; elseif (t_0 <= 0.0) tmp = t_2; elseif (t_0 <= 5e+291) tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); elseif (t_0 <= Inf) tmp = t_2; else tmp = t_3; end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * 1.0), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(-0.5 * h), $MachinePrecision] * N[(N[(N[(N[(D * D), $MachinePrecision] * 0.25), $MachinePrecision] * N[(M * M), $MachinePrecision]), $MachinePrecision] / N[(N[(d * d), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * t$95$1), $MachinePrecision]}, If[LessEqual[t$95$0, -2e+55], t$95$3, If[LessEqual[t$95$0, 0.0], t$95$2, If[LessEqual[t$95$0, 5e+291], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, Infinity], t$95$2, t$95$3]]]]]]]]
\begin{array}{l}
t_0 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
t_1 := \frac{\left|d\right|}{\sqrt{h \cdot \ell}}\\
t_2 := t\_1 \cdot 1\\
t_3 := \mathsf{fma}\left(-0.5 \cdot h, \frac{\left(\left(D \cdot D\right) \cdot 0.25\right) \cdot \left(M \cdot M\right)}{\left(d \cdot d\right) \cdot \ell}, 1\right) \cdot t\_1\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{+55}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+291}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -2e55 or +inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 66.7%
Applied rewrites35.7%
Applied rewrites49.9%
if -2e55 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 0.0 or 5.0000000000000001e291 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < +inf.0Initial program 66.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.7%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.7%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.7%
Applied rewrites66.7%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-*.f6465.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6466.2%
lift-*.f64N/A
count-2-revN/A
lower-+.f6466.2%
Applied rewrites66.2%
lift-*.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f64N/A
lower-sqrt.f64N/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lower-unsound-/.f64N/A
lower-fabs.f64N/A
lower-unsound-sqrt.f6469.9%
Applied rewrites69.9%
Taylor expanded in d around inf
Applied rewrites44.3%
if 0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 5.0000000000000001e291Initial program 66.7%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.5%
Applied rewrites23.5%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6423.5%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6421.2%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6421.2%
Applied rewrites21.2%
Taylor expanded in l around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6440.2%
Applied rewrites40.2%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d l)))
(t_1
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
(t_2 (* (/ (fabs d) (sqrt (* h l))) 1.0)))
(if (<= t_1 -5e-118)
(/ (* (sqrt (* d h)) (* -1.0 (* d (sqrt (/ 1.0 (* d l)))))) h)
(if (<= t_1 0.0)
t_2
(if (<= t_1 5e+291)
(* (sqrt (/ d h)) t_0)
(if (<= t_1 INFINITY)
t_2
(/ (* (* -1.0 (* d (sqrt (/ h d)))) t_0) h)))))))double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / l));
double t_1 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double t_2 = (fabs(d) / sqrt((h * l))) * 1.0;
double tmp;
if (t_1 <= -5e-118) {
tmp = (sqrt((d * h)) * (-1.0 * (d * sqrt((1.0 / (d * l)))))) / h;
} else if (t_1 <= 0.0) {
tmp = t_2;
} else if (t_1 <= 5e+291) {
tmp = sqrt((d / h)) * t_0;
} else if (t_1 <= ((double) INFINITY)) {
tmp = t_2;
} else {
tmp = ((-1.0 * (d * sqrt((h / d)))) * t_0) / h;
}
return tmp;
}
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((d / l));
double t_1 = (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double t_2 = (Math.abs(d) / Math.sqrt((h * l))) * 1.0;
double tmp;
if (t_1 <= -5e-118) {
tmp = (Math.sqrt((d * h)) * (-1.0 * (d * Math.sqrt((1.0 / (d * l)))))) / h;
} else if (t_1 <= 0.0) {
tmp = t_2;
} else if (t_1 <= 5e+291) {
tmp = Math.sqrt((d / h)) * t_0;
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_2;
} else {
tmp = ((-1.0 * (d * Math.sqrt((h / d)))) * t_0) / h;
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.sqrt((d / l)) t_1 = (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l))) t_2 = (math.fabs(d) / math.sqrt((h * l))) * 1.0 tmp = 0 if t_1 <= -5e-118: tmp = (math.sqrt((d * h)) * (-1.0 * (d * math.sqrt((1.0 / (d * l)))))) / h elif t_1 <= 0.0: tmp = t_2 elif t_1 <= 5e+291: tmp = math.sqrt((d / h)) * t_0 elif t_1 <= math.inf: tmp = t_2 else: tmp = ((-1.0 * (d * math.sqrt((h / d)))) * t_0) / h return tmp
function code(d, h, l, M, D) t_0 = sqrt(Float64(d / l)) t_1 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) t_2 = Float64(Float64(abs(d) / sqrt(Float64(h * l))) * 1.0) tmp = 0.0 if (t_1 <= -5e-118) tmp = Float64(Float64(sqrt(Float64(d * h)) * Float64(-1.0 * Float64(d * sqrt(Float64(1.0 / Float64(d * l)))))) / h); elseif (t_1 <= 0.0) tmp = t_2; elseif (t_1 <= 5e+291) tmp = Float64(sqrt(Float64(d / h)) * t_0); elseif (t_1 <= Inf) tmp = t_2; else tmp = Float64(Float64(Float64(-1.0 * Float64(d * sqrt(Float64(h / d)))) * t_0) / h); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = sqrt((d / l)); t_1 = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); t_2 = (abs(d) / sqrt((h * l))) * 1.0; tmp = 0.0; if (t_1 <= -5e-118) tmp = (sqrt((d * h)) * (-1.0 * (d * sqrt((1.0 / (d * l)))))) / h; elseif (t_1 <= 0.0) tmp = t_2; elseif (t_1 <= 5e+291) tmp = sqrt((d / h)) * t_0; elseif (t_1 <= Inf) tmp = t_2; else tmp = ((-1.0 * (d * sqrt((h / d)))) * t_0) / h; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision]}, If[LessEqual[t$95$1, -5e-118], N[(N[(N[Sqrt[N[(d * h), $MachinePrecision]], $MachinePrecision] * N[(-1.0 * N[(d * N[Sqrt[N[(1.0 / N[(d * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], If[LessEqual[t$95$1, 0.0], t$95$2, If[LessEqual[t$95$1, 5e+291], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[t$95$1, Infinity], t$95$2, N[(N[(N[(-1.0 * N[(d * N[Sqrt[N[(h / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] / h), $MachinePrecision]]]]]]]]
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
t_1 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
t_2 := \frac{\left|d\right|}{\sqrt{h \cdot \ell}} \cdot 1\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{-118}:\\
\;\;\;\;\frac{\sqrt{d \cdot h} \cdot \left(-1 \cdot \left(d \cdot \sqrt{\frac{1}{d \cdot \ell}}\right)\right)}{h}\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+291}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot t\_0\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(-1 \cdot \left(d \cdot \sqrt{\frac{h}{d}}\right)\right) \cdot t\_0}{h}\\
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -5.0000000000000001e-118Initial program 66.7%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.5%
Applied rewrites23.5%
Taylor expanded in d around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6414.5%
Applied rewrites14.5%
if -5.0000000000000001e-118 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 0.0 or 5.0000000000000001e291 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < +inf.0Initial program 66.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.7%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.7%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.7%
Applied rewrites66.7%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-*.f6465.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6466.2%
lift-*.f64N/A
count-2-revN/A
lower-+.f6466.2%
Applied rewrites66.2%
lift-*.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f64N/A
lower-sqrt.f64N/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lower-unsound-/.f64N/A
lower-fabs.f64N/A
lower-unsound-sqrt.f6469.9%
Applied rewrites69.9%
Taylor expanded in d around inf
Applied rewrites44.3%
if 0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 5.0000000000000001e291Initial program 66.7%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.5%
Applied rewrites23.5%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6423.5%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6421.2%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6421.2%
Applied rewrites21.2%
Taylor expanded in l around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6440.2%
Applied rewrites40.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 66.7%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.5%
Applied rewrites23.5%
Taylor expanded in d around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6411.8%
Applied rewrites11.8%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* (/ (fabs d) (sqrt (* h l))) 1.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)))))
(t_2 (sqrt (/ d l))))
(if (<= t_1 -5e-118)
(* (/ (sqrt (/ h l)) h) (- d))
(if (<= t_1 0.0)
t_0
(if (<= t_1 5e+291)
(* (sqrt (/ d h)) t_2)
(if (<= t_1 INFINITY)
t_0
(/ (* (* -1.0 (* d (sqrt (/ h d)))) t_2) h)))))))double code(double d, double h, double l, double M, double D) {
double t_0 = (fabs(d) / sqrt((h * l))) * 1.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 t_2 = sqrt((d / l));
double tmp;
if (t_1 <= -5e-118) {
tmp = (sqrt((h / l)) / h) * -d;
} else if (t_1 <= 0.0) {
tmp = t_0;
} else if (t_1 <= 5e+291) {
tmp = sqrt((d / h)) * t_2;
} else if (t_1 <= ((double) INFINITY)) {
tmp = t_0;
} else {
tmp = ((-1.0 * (d * sqrt((h / d)))) * t_2) / h;
}
return tmp;
}
public static double code(double d, double h, double l, double M, double D) {
double t_0 = (Math.abs(d) / Math.sqrt((h * l))) * 1.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 t_2 = Math.sqrt((d / l));
double tmp;
if (t_1 <= -5e-118) {
tmp = (Math.sqrt((h / l)) / h) * -d;
} else if (t_1 <= 0.0) {
tmp = t_0;
} else if (t_1 <= 5e+291) {
tmp = Math.sqrt((d / h)) * t_2;
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_0;
} else {
tmp = ((-1.0 * (d * Math.sqrt((h / d)))) * t_2) / h;
}
return tmp;
}
def code(d, h, l, M, D): t_0 = (math.fabs(d) / math.sqrt((h * l))) * 1.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))) t_2 = math.sqrt((d / l)) tmp = 0 if t_1 <= -5e-118: tmp = (math.sqrt((h / l)) / h) * -d elif t_1 <= 0.0: tmp = t_0 elif t_1 <= 5e+291: tmp = math.sqrt((d / h)) * t_2 elif t_1 <= math.inf: tmp = t_0 else: tmp = ((-1.0 * (d * math.sqrt((h / d)))) * t_2) / h return tmp
function code(d, h, l, M, D) t_0 = Float64(Float64(abs(d) / sqrt(Float64(h * l))) * 1.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)))) t_2 = sqrt(Float64(d / l)) tmp = 0.0 if (t_1 <= -5e-118) tmp = Float64(Float64(sqrt(Float64(h / l)) / h) * Float64(-d)); elseif (t_1 <= 0.0) tmp = t_0; elseif (t_1 <= 5e+291) tmp = Float64(sqrt(Float64(d / h)) * t_2); elseif (t_1 <= Inf) tmp = t_0; else tmp = Float64(Float64(Float64(-1.0 * Float64(d * sqrt(Float64(h / d)))) * t_2) / h); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = (abs(d) / sqrt((h * l))) * 1.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))); t_2 = sqrt((d / l)); tmp = 0.0; if (t_1 <= -5e-118) tmp = (sqrt((h / l)) / h) * -d; elseif (t_1 <= 0.0) tmp = t_0; elseif (t_1 <= 5e+291) tmp = sqrt((d / h)) * t_2; elseif (t_1 <= Inf) tmp = t_0; else tmp = ((-1.0 * (d * sqrt((h / d)))) * t_2) / h; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.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]}, Block[{t$95$2 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$1, -5e-118], N[(N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] / h), $MachinePrecision] * (-d)), $MachinePrecision], If[LessEqual[t$95$1, 0.0], t$95$0, If[LessEqual[t$95$1, 5e+291], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * t$95$2), $MachinePrecision], If[LessEqual[t$95$1, Infinity], t$95$0, N[(N[(N[(-1.0 * N[(d * N[Sqrt[N[(h / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision] / h), $MachinePrecision]]]]]]]]
\begin{array}{l}
t_0 := \frac{\left|d\right|}{\sqrt{h \cdot \ell}} \cdot 1\\
t_1 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
t_2 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{-118}:\\
\;\;\;\;\frac{\sqrt{\frac{h}{\ell}}}{h} \cdot \left(-d\right)\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+291}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot t\_2\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(-1 \cdot \left(d \cdot \sqrt{\frac{h}{d}}\right)\right) \cdot t\_2}{h}\\
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -5.0000000000000001e-118Initial program 66.7%
lift-*.f64N/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f64N/A
lift-/.f64N/A
mult-flipN/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
frac-2negN/A
frac-2negN/A
frac-timesN/A
remove-double-negN/A
*-lft-identityN/A
remove-double-negN/A
remove-double-negN/A
remove-double-negN/A
lower-/.f64N/A
lower-*.f6451.3%
Applied rewrites51.3%
Taylor expanded in d around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6427.9%
Applied rewrites27.9%
lift-*.f64N/A
mul-1-negN/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lower-neg.f6427.9%
Applied rewrites27.9%
Taylor expanded in h around 0
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6413.3%
Applied rewrites13.3%
if -5.0000000000000001e-118 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 0.0 or 5.0000000000000001e291 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < +inf.0Initial program 66.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.7%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.7%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.7%
Applied rewrites66.7%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-*.f6465.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6466.2%
lift-*.f64N/A
count-2-revN/A
lower-+.f6466.2%
Applied rewrites66.2%
lift-*.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f64N/A
lower-sqrt.f64N/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lower-unsound-/.f64N/A
lower-fabs.f64N/A
lower-unsound-sqrt.f6469.9%
Applied rewrites69.9%
Taylor expanded in d around inf
Applied rewrites44.3%
if 0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 5.0000000000000001e291Initial program 66.7%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.5%
Applied rewrites23.5%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6423.5%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6421.2%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6421.2%
Applied rewrites21.2%
Taylor expanded in l around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6440.2%
Applied rewrites40.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 66.7%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.5%
Applied rewrites23.5%
Taylor expanded in d around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6411.8%
Applied rewrites11.8%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* (/ (fabs d) (sqrt (* h l))) 1.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 -5e-118)
(* (/ (sqrt (/ h l)) h) (- d))
(if (<= t_1 0.0)
t_0
(if (<= t_1 5e+291) (* (sqrt (/ d h)) (sqrt (/ d l))) t_0)))))double code(double d, double h, double l, double M, double D) {
double t_0 = (fabs(d) / sqrt((h * l))) * 1.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 <= -5e-118) {
tmp = (sqrt((h / l)) / h) * -d;
} else if (t_1 <= 0.0) {
tmp = t_0;
} else if (t_1 <= 5e+291) {
tmp = sqrt((d / h)) * sqrt((d / l));
} else {
tmp = t_0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (abs(d) / sqrt((h * l))) * 1.0d0
t_1 = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
if (t_1 <= (-5d-118)) then
tmp = (sqrt((h / l)) / h) * -d
else if (t_1 <= 0.0d0) then
tmp = t_0
else if (t_1 <= 5d+291) then
tmp = sqrt((d / h)) * sqrt((d / l))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = (Math.abs(d) / Math.sqrt((h * l))) * 1.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 <= -5e-118) {
tmp = (Math.sqrt((h / l)) / h) * -d;
} else if (t_1 <= 0.0) {
tmp = t_0;
} else if (t_1 <= 5e+291) {
tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
} else {
tmp = t_0;
}
return tmp;
}
def code(d, h, l, M, D): t_0 = (math.fabs(d) / math.sqrt((h * l))) * 1.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 <= -5e-118: tmp = (math.sqrt((h / l)) / h) * -d elif t_1 <= 0.0: tmp = t_0 elif t_1 <= 5e+291: tmp = math.sqrt((d / h)) * math.sqrt((d / l)) else: tmp = t_0 return tmp
function code(d, h, l, M, D) t_0 = Float64(Float64(abs(d) / sqrt(Float64(h * l))) * 1.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 <= -5e-118) tmp = Float64(Float64(sqrt(Float64(h / l)) / h) * Float64(-d)); elseif (t_1 <= 0.0) tmp = t_0; elseif (t_1 <= 5e+291) tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); else tmp = t_0; end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = (abs(d) / sqrt((h * l))) * 1.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 <= -5e-118) tmp = (sqrt((h / l)) / h) * -d; elseif (t_1 <= 0.0) tmp = t_0; elseif (t_1 <= 5e+291) tmp = sqrt((d / h)) * sqrt((d / l)); else tmp = t_0; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.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, -5e-118], N[(N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] / h), $MachinePrecision] * (-d)), $MachinePrecision], If[LessEqual[t$95$1, 0.0], t$95$0, If[LessEqual[t$95$1, 5e+291], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
t_0 := \frac{\left|d\right|}{\sqrt{h \cdot \ell}} \cdot 1\\
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^{-118}:\\
\;\;\;\;\frac{\sqrt{\frac{h}{\ell}}}{h} \cdot \left(-d\right)\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+291}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -5.0000000000000001e-118Initial program 66.7%
lift-*.f64N/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f64N/A
lift-/.f64N/A
mult-flipN/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
frac-2negN/A
frac-2negN/A
frac-timesN/A
remove-double-negN/A
*-lft-identityN/A
remove-double-negN/A
remove-double-negN/A
remove-double-negN/A
lower-/.f64N/A
lower-*.f6451.3%
Applied rewrites51.3%
Taylor expanded in d around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6427.9%
Applied rewrites27.9%
lift-*.f64N/A
mul-1-negN/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lower-neg.f6427.9%
Applied rewrites27.9%
Taylor expanded in h around 0
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6413.3%
Applied rewrites13.3%
if -5.0000000000000001e-118 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 0.0 or 5.0000000000000001e291 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 66.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.7%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.7%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.7%
Applied rewrites66.7%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-*.f6465.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6466.2%
lift-*.f64N/A
count-2-revN/A
lower-+.f6466.2%
Applied rewrites66.2%
lift-*.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f64N/A
lower-sqrt.f64N/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lower-unsound-/.f64N/A
lower-fabs.f64N/A
lower-unsound-sqrt.f6469.9%
Applied rewrites69.9%
Taylor expanded in d around inf
Applied rewrites44.3%
if 0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 5.0000000000000001e291Initial program 66.7%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.5%
Applied rewrites23.5%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6423.5%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6421.2%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6421.2%
Applied rewrites21.2%
Taylor expanded in l around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6440.2%
Applied rewrites40.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-118)
(* (/ (sqrt (/ h l)) h) (- d))
(* (/ (fabs d) (sqrt (* h l))) 1.0)))double code(double d, double h, double l, double M, double D) {
double tmp;
if (((pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))) <= -5e-118) {
tmp = (sqrt((h / l)) / h) * -d;
} else {
tmp = (fabs(d) / sqrt((h * l))) * 1.0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (((((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))) <= (-5d-118)) then
tmp = (sqrt((h / l)) / h) * -d
else
tmp = (abs(d) / sqrt((h * l))) * 1.0d0
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (((Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))) <= -5e-118) {
tmp = (Math.sqrt((h / l)) / h) * -d;
} else {
tmp = (Math.abs(d) / Math.sqrt((h * l))) * 1.0;
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if ((math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))) <= -5e-118: tmp = (math.sqrt((h / l)) / h) * -d else: tmp = (math.fabs(d) / math.sqrt((h * l))) * 1.0 return tmp
function code(d, h, l, M, D) tmp = 0.0 if (Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) <= -5e-118) tmp = Float64(Float64(sqrt(Float64(h / l)) / h) * Float64(-d)); else tmp = Float64(Float64(abs(d) / sqrt(Float64(h * l))) * 1.0); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (((((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l)))) <= -5e-118) tmp = (sqrt((h / l)) / h) * -d; else tmp = (abs(d) / sqrt((h * l))) * 1.0; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -5e-118], N[(N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] / h), $MachinePrecision] * (-d)), $MachinePrecision], N[(N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq -5 \cdot 10^{-118}:\\
\;\;\;\;\frac{\sqrt{\frac{h}{\ell}}}{h} \cdot \left(-d\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\left|d\right|}{\sqrt{h \cdot \ell}} \cdot 1\\
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -5.0000000000000001e-118Initial program 66.7%
lift-*.f64N/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f64N/A
lift-/.f64N/A
mult-flipN/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
frac-2negN/A
frac-2negN/A
frac-timesN/A
remove-double-negN/A
*-lft-identityN/A
remove-double-negN/A
remove-double-negN/A
remove-double-negN/A
lower-/.f64N/A
lower-*.f6451.3%
Applied rewrites51.3%
Taylor expanded in d around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6427.9%
Applied rewrites27.9%
lift-*.f64N/A
mul-1-negN/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lower-neg.f6427.9%
Applied rewrites27.9%
Taylor expanded in h around 0
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6413.3%
Applied rewrites13.3%
if -5.0000000000000001e-118 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 66.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.7%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.7%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.7%
Applied rewrites66.7%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-*.f6465.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6466.2%
lift-*.f64N/A
count-2-revN/A
lower-+.f6466.2%
Applied rewrites66.2%
lift-*.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f64N/A
lower-sqrt.f64N/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lower-unsound-/.f64N/A
lower-fabs.f64N/A
lower-unsound-sqrt.f6469.9%
Applied rewrites69.9%
Taylor expanded in d around inf
Applied rewrites44.3%
(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-118)
(* (sqrt (/ 1.0 (* h l))) (- d))
(* (/ (fabs d) (sqrt (* h l))) 1.0)))double code(double d, double h, double l, double M, double D) {
double tmp;
if (((pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))) <= -5e-118) {
tmp = sqrt((1.0 / (h * l))) * -d;
} else {
tmp = (fabs(d) / sqrt((h * l))) * 1.0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (((((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))) <= (-5d-118)) then
tmp = sqrt((1.0d0 / (h * l))) * -d
else
tmp = (abs(d) / sqrt((h * l))) * 1.0d0
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (((Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))) <= -5e-118) {
tmp = Math.sqrt((1.0 / (h * l))) * -d;
} else {
tmp = (Math.abs(d) / Math.sqrt((h * l))) * 1.0;
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if ((math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))) <= -5e-118: tmp = math.sqrt((1.0 / (h * l))) * -d else: tmp = (math.fabs(d) / math.sqrt((h * l))) * 1.0 return tmp
function code(d, h, l, M, D) tmp = 0.0 if (Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) <= -5e-118) tmp = Float64(sqrt(Float64(1.0 / Float64(h * l))) * Float64(-d)); else tmp = Float64(Float64(abs(d) / sqrt(Float64(h * l))) * 1.0); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (((((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l)))) <= -5e-118) tmp = sqrt((1.0 / (h * l))) * -d; else tmp = (abs(d) / sqrt((h * l))) * 1.0; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -5e-118], N[(N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-d)), $MachinePrecision], N[(N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq -5 \cdot 10^{-118}:\\
\;\;\;\;\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(-d\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\left|d\right|}{\sqrt{h \cdot \ell}} \cdot 1\\
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -5.0000000000000001e-118Initial program 66.7%
lift-*.f64N/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f64N/A
lift-/.f64N/A
mult-flipN/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
frac-2negN/A
frac-2negN/A
frac-timesN/A
remove-double-negN/A
*-lft-identityN/A
remove-double-negN/A
remove-double-negN/A
remove-double-negN/A
lower-/.f64N/A
lower-*.f6451.3%
Applied rewrites51.3%
Taylor expanded in d around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6427.9%
Applied rewrites27.9%
lift-*.f64N/A
mul-1-negN/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lower-neg.f6427.9%
Applied rewrites27.9%
if -5.0000000000000001e-118 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 66.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.7%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.7%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.7%
Applied rewrites66.7%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-*.f6465.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6466.2%
lift-*.f64N/A
count-2-revN/A
lower-+.f6466.2%
Applied rewrites66.2%
lift-*.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f64N/A
lower-sqrt.f64N/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lower-unsound-/.f64N/A
lower-fabs.f64N/A
lower-unsound-sqrt.f6469.9%
Applied rewrites69.9%
Taylor expanded in d around inf
Applied rewrites44.3%
(FPCore (d h l M D) :precision binary64 (let* ((t_0 (sqrt (/ 1.0 (* h l))))) (if (<= l -1.35e-157) (* t_0 (- d)) (* d t_0))))
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((1.0 / (h * l)));
double tmp;
if (l <= -1.35e-157) {
tmp = t_0 * -d;
} else {
tmp = d * t_0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((1.0d0 / (h * l)))
if (l <= (-1.35d-157)) then
tmp = t_0 * -d
else
tmp = d * t_0
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((1.0 / (h * l)));
double tmp;
if (l <= -1.35e-157) {
tmp = t_0 * -d;
} else {
tmp = d * t_0;
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.sqrt((1.0 / (h * l))) tmp = 0 if l <= -1.35e-157: tmp = t_0 * -d else: tmp = d * t_0 return tmp
function code(d, h, l, M, D) t_0 = sqrt(Float64(1.0 / Float64(h * l))) tmp = 0.0 if (l <= -1.35e-157) tmp = Float64(t_0 * Float64(-d)); else tmp = Float64(d * t_0); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = sqrt((1.0 / (h * l))); tmp = 0.0; if (l <= -1.35e-157) tmp = t_0 * -d; else tmp = d * t_0; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -1.35e-157], N[(t$95$0 * (-d)), $MachinePrecision], N[(d * t$95$0), $MachinePrecision]]]
\begin{array}{l}
t_0 := \sqrt{\frac{1}{h \cdot \ell}}\\
\mathbf{if}\;\ell \leq -1.35 \cdot 10^{-157}:\\
\;\;\;\;t\_0 \cdot \left(-d\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot t\_0\\
\end{array}
if l < -1.35e-157Initial program 66.7%
lift-*.f64N/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f64N/A
lift-/.f64N/A
mult-flipN/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
frac-2negN/A
frac-2negN/A
frac-timesN/A
remove-double-negN/A
*-lft-identityN/A
remove-double-negN/A
remove-double-negN/A
remove-double-negN/A
lower-/.f64N/A
lower-*.f6451.3%
Applied rewrites51.3%
Taylor expanded in d around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6427.9%
Applied rewrites27.9%
lift-*.f64N/A
mul-1-negN/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lower-neg.f6427.9%
Applied rewrites27.9%
if -1.35e-157 < l Initial program 66.7%
lift-*.f64N/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f64N/A
lift-/.f64N/A
mult-flipN/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
frac-2negN/A
frac-2negN/A
frac-timesN/A
remove-double-negN/A
*-lft-identityN/A
remove-double-negN/A
remove-double-negN/A
remove-double-negN/A
lower-/.f64N/A
lower-*.f6451.3%
Applied rewrites51.3%
Taylor expanded in d around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6427.9%
Applied rewrites27.9%
lift-*.f64N/A
mul-1-negN/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lower-neg.f6427.9%
Applied rewrites27.9%
Taylor expanded in d around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6426.3%
Applied rewrites26.3%
(FPCore (d h l M D) :precision binary64 (if (<= l -1.35e-157) (/ (* d (sqrt (/ h l))) h) (* d (sqrt (/ 1.0 (* h l))))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -1.35e-157) {
tmp = (d * sqrt((h / l))) / h;
} else {
tmp = d * sqrt((1.0 / (h * l)));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (l <= (-1.35d-157)) then
tmp = (d * sqrt((h / l))) / h
else
tmp = d * sqrt((1.0d0 / (h * l)))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -1.35e-157) {
tmp = (d * Math.sqrt((h / l))) / h;
} else {
tmp = d * Math.sqrt((1.0 / (h * l)));
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if l <= -1.35e-157: tmp = (d * math.sqrt((h / l))) / h else: tmp = d * math.sqrt((1.0 / (h * l))) return tmp
function code(d, h, l, M, D) tmp = 0.0 if (l <= -1.35e-157) tmp = Float64(Float64(d * sqrt(Float64(h / l))) / h); else tmp = Float64(d * sqrt(Float64(1.0 / Float64(h * l)))); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (l <= -1.35e-157) tmp = (d * sqrt((h / l))) / h; else tmp = d * sqrt((1.0 / (h * l))); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[l, -1.35e-157], N[(N[(d * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.35 \cdot 10^{-157}:\\
\;\;\;\;\frac{d \cdot \sqrt{\frac{h}{\ell}}}{h}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
\end{array}
if l < -1.35e-157Initial program 66.7%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.5%
Applied rewrites23.5%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6423.5%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6421.2%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6421.2%
Applied rewrites21.2%
Taylor expanded in d around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6438.1%
Applied rewrites38.1%
if -1.35e-157 < l Initial program 66.7%
lift-*.f64N/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f64N/A
lift-/.f64N/A
mult-flipN/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
frac-2negN/A
frac-2negN/A
frac-timesN/A
remove-double-negN/A
*-lft-identityN/A
remove-double-negN/A
remove-double-negN/A
remove-double-negN/A
lower-/.f64N/A
lower-*.f6451.3%
Applied rewrites51.3%
Taylor expanded in d around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6427.9%
Applied rewrites27.9%
lift-*.f64N/A
mul-1-negN/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lower-neg.f6427.9%
Applied rewrites27.9%
Taylor expanded in d around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6426.3%
Applied rewrites26.3%
(FPCore (d h l M D) :precision binary64 (* d (sqrt (/ 1.0 (* h l)))))
double code(double d, double h, double l, double M, double D) {
return d * sqrt((1.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 * sqrt((1.0d0 / (h * l)))
end function
public static double code(double d, double h, double l, double M, double D) {
return d * Math.sqrt((1.0 / (h * l)));
}
def code(d, h, l, M, D): return d * math.sqrt((1.0 / (h * l)))
function code(d, h, l, M, D) return Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) end
function tmp = code(d, h, l, M, D) tmp = d * sqrt((1.0 / (h * l))); end
code[d_, h_, l_, M_, D_] := N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
d \cdot \sqrt{\frac{1}{h \cdot \ell}}
Initial program 66.7%
lift-*.f64N/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f64N/A
lift-/.f64N/A
mult-flipN/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
frac-2negN/A
frac-2negN/A
frac-timesN/A
remove-double-negN/A
*-lft-identityN/A
remove-double-negN/A
remove-double-negN/A
remove-double-negN/A
lower-/.f64N/A
lower-*.f6451.3%
Applied rewrites51.3%
Taylor expanded in d around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6427.9%
Applied rewrites27.9%
lift-*.f64N/A
mul-1-negN/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lower-neg.f6427.9%
Applied rewrites27.9%
Taylor expanded in d around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6426.3%
Applied rewrites26.3%
herbie shell --seed 2025196
(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)))))