
(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 19 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 (fmax (fabs M) (fabs D)))
(t_1 (fmin (fabs M) (fabs D)))
(t_2 (* (/ -0.5 d) (* t_0 t_1))))
(if (<= d -2.35e-268)
(*
(fabs (/ (- d) (sqrt (* l h))))
(- 1.0 (* t_2 (/ (* -0.25 (/ (* t_0 (* t_1 h)) d)) l))))
(if (<= d 6e-216)
(*
-0.125
(/ (* (pow t_0 2.0) (pow t_1 2.0)) (* d (* l (sqrt (/ l h))))))
(*
(fabs (/ (- d) (* (sqrt l) (sqrt h))))
(-
1.0
(* t_2 (/ (* (* (* (/ -0.5 d) t_1) t_0) (* 0.5 h)) l))))))))double code(double d, double h, double l, double M, double D) {
double t_0 = fmax(fabs(M), fabs(D));
double t_1 = fmin(fabs(M), fabs(D));
double t_2 = (-0.5 / d) * (t_0 * t_1);
double tmp;
if (d <= -2.35e-268) {
tmp = fabs((-d / sqrt((l * h)))) * (1.0 - (t_2 * ((-0.25 * ((t_0 * (t_1 * h)) / d)) / l)));
} else if (d <= 6e-216) {
tmp = -0.125 * ((pow(t_0, 2.0) * pow(t_1, 2.0)) / (d * (l * sqrt((l / h)))));
} else {
tmp = fabs((-d / (sqrt(l) * sqrt(h)))) * (1.0 - (t_2 * (((((-0.5 / d) * t_1) * t_0) * (0.5 * h)) / l)));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = fmax(abs(m), abs(d_1))
t_1 = fmin(abs(m), abs(d_1))
t_2 = ((-0.5d0) / d) * (t_0 * t_1)
if (d <= (-2.35d-268)) then
tmp = abs((-d / sqrt((l * h)))) * (1.0d0 - (t_2 * (((-0.25d0) * ((t_0 * (t_1 * h)) / d)) / l)))
else if (d <= 6d-216) then
tmp = (-0.125d0) * (((t_0 ** 2.0d0) * (t_1 ** 2.0d0)) / (d * (l * sqrt((l / h)))))
else
tmp = abs((-d / (sqrt(l) * sqrt(h)))) * (1.0d0 - (t_2 * ((((((-0.5d0) / d) * t_1) * t_0) * (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 = fmax(Math.abs(M), Math.abs(D));
double t_1 = fmin(Math.abs(M), Math.abs(D));
double t_2 = (-0.5 / d) * (t_0 * t_1);
double tmp;
if (d <= -2.35e-268) {
tmp = Math.abs((-d / Math.sqrt((l * h)))) * (1.0 - (t_2 * ((-0.25 * ((t_0 * (t_1 * h)) / d)) / l)));
} else if (d <= 6e-216) {
tmp = -0.125 * ((Math.pow(t_0, 2.0) * Math.pow(t_1, 2.0)) / (d * (l * Math.sqrt((l / h)))));
} else {
tmp = Math.abs((-d / (Math.sqrt(l) * Math.sqrt(h)))) * (1.0 - (t_2 * (((((-0.5 / d) * t_1) * t_0) * (0.5 * h)) / l)));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = fmax(math.fabs(M), math.fabs(D)) t_1 = fmin(math.fabs(M), math.fabs(D)) t_2 = (-0.5 / d) * (t_0 * t_1) tmp = 0 if d <= -2.35e-268: tmp = math.fabs((-d / math.sqrt((l * h)))) * (1.0 - (t_2 * ((-0.25 * ((t_0 * (t_1 * h)) / d)) / l))) elif d <= 6e-216: tmp = -0.125 * ((math.pow(t_0, 2.0) * math.pow(t_1, 2.0)) / (d * (l * math.sqrt((l / h))))) else: tmp = math.fabs((-d / (math.sqrt(l) * math.sqrt(h)))) * (1.0 - (t_2 * (((((-0.5 / d) * t_1) * t_0) * (0.5 * h)) / l))) return tmp
function code(d, h, l, M, D) t_0 = fmax(abs(M), abs(D)) t_1 = fmin(abs(M), abs(D)) t_2 = Float64(Float64(-0.5 / d) * Float64(t_0 * t_1)) tmp = 0.0 if (d <= -2.35e-268) tmp = Float64(abs(Float64(Float64(-d) / sqrt(Float64(l * h)))) * Float64(1.0 - Float64(t_2 * Float64(Float64(-0.25 * Float64(Float64(t_0 * Float64(t_1 * h)) / d)) / l)))); elseif (d <= 6e-216) tmp = Float64(-0.125 * Float64(Float64((t_0 ^ 2.0) * (t_1 ^ 2.0)) / Float64(d * Float64(l * sqrt(Float64(l / h)))))); else tmp = Float64(abs(Float64(Float64(-d) / Float64(sqrt(l) * sqrt(h)))) * Float64(1.0 - Float64(t_2 * Float64(Float64(Float64(Float64(Float64(-0.5 / d) * t_1) * t_0) * Float64(0.5 * h)) / l)))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = max(abs(M), abs(D)); t_1 = min(abs(M), abs(D)); t_2 = (-0.5 / d) * (t_0 * t_1); tmp = 0.0; if (d <= -2.35e-268) tmp = abs((-d / sqrt((l * h)))) * (1.0 - (t_2 * ((-0.25 * ((t_0 * (t_1 * h)) / d)) / l))); elseif (d <= 6e-216) tmp = -0.125 * (((t_0 ^ 2.0) * (t_1 ^ 2.0)) / (d * (l * sqrt((l / h))))); else tmp = abs((-d / (sqrt(l) * sqrt(h)))) * (1.0 - (t_2 * (((((-0.5 / d) * t_1) * t_0) * (0.5 * h)) / l))); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Max[N[Abs[M], $MachinePrecision], N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Min[N[Abs[M], $MachinePrecision], N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(-0.5 / d), $MachinePrecision] * N[(t$95$0 * t$95$1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -2.35e-268], N[(N[Abs[N[((-d) / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(t$95$2 * N[(N[(-0.25 * N[(N[(t$95$0 * N[(t$95$1 * h), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 6e-216], N[(-0.125 * N[(N[(N[Power[t$95$0, 2.0], $MachinePrecision] * N[Power[t$95$1, 2.0], $MachinePrecision]), $MachinePrecision] / N[(d * N[(l * N[Sqrt[N[(l / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Abs[N[((-d) / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(t$95$2 * N[(N[(N[(N[(N[(-0.5 / d), $MachinePrecision] * t$95$1), $MachinePrecision] * t$95$0), $MachinePrecision] * N[(0.5 * h), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
t_0 := \mathsf{max}\left(\left|M\right|, \left|D\right|\right)\\
t_1 := \mathsf{min}\left(\left|M\right|, \left|D\right|\right)\\
t_2 := \frac{-0.5}{d} \cdot \left(t\_0 \cdot t\_1\right)\\
\mathbf{if}\;d \leq -2.35 \cdot 10^{-268}:\\
\;\;\;\;\left|\frac{-d}{\sqrt{\ell \cdot h}}\right| \cdot \left(1 - t\_2 \cdot \frac{-0.25 \cdot \frac{t\_0 \cdot \left(t\_1 \cdot h\right)}{d}}{\ell}\right)\\
\mathbf{elif}\;d \leq 6 \cdot 10^{-216}:\\
\;\;\;\;-0.125 \cdot \frac{{t\_0}^{2} \cdot {t\_1}^{2}}{d \cdot \left(\ell \cdot \sqrt{\frac{\ell}{h}}\right)}\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{-d}{\sqrt{\ell} \cdot \sqrt{h}}\right| \cdot \left(1 - t\_2 \cdot \frac{\left(\left(\frac{-0.5}{d} \cdot t\_1\right) \cdot t\_0\right) \cdot \left(0.5 \cdot h\right)}{\ell}\right)\\
\end{array}
if d < -2.3499999999999999e-268Initial program 67.4%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-pow.f64N/A
unpow2N/A
sqr-neg-revN/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites69.0%
lift-*.f64N/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
associate-*r/N/A
lift-/.f64N/A
lift-*.f64N/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
lower-fabs.f6453.3%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
sqrt-divN/A
Applied rewrites72.2%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6476.8%
Applied rewrites76.8%
Taylor expanded in d around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f6475.3%
Applied rewrites75.3%
if -2.3499999999999999e-268 < d < 6.0000000000000003e-216Initial program 67.4%
Applied rewrites35.9%
Applied rewrites24.3%
Taylor expanded in h around -inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6433.8%
Applied rewrites33.8%
if 6.0000000000000003e-216 < d Initial program 67.4%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-pow.f64N/A
unpow2N/A
sqr-neg-revN/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites69.0%
lift-*.f64N/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
associate-*r/N/A
lift-/.f64N/A
lift-*.f64N/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
lower-fabs.f6453.3%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
sqrt-divN/A
Applied rewrites72.2%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6476.8%
Applied rewrites76.8%
lift-sqrt.f64N/A
lift-*.f64N/A
sqrt-prodN/A
lower-unsound-*.f64N/A
lower-unsound-sqrt.f64N/A
lower-unsound-sqrt.f6443.8%
Applied rewrites43.8%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* (/ -0.5 d) (* D M)))
(t_1
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(-
1.0
(*
(* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0))
(/ h l))))))
(if (<= t_1 1e-111)
(*
(fabs (/ d (* h (sqrt (/ l h)))))
(- 1.0 (* t_0 (* t_0 (* 0.5 (/ h l))))))
(if (<= t_1 5e+243)
(* (* 1.0 (sqrt (/ d l))) (sqrt (/ d h)))
(/
(*
(-
1.0
(*
(/ (* (* (* M D) -0.5) (* 0.5 h)) (* l d))
(* (* D (/ -0.5 d)) M)))
(fabs d))
(sqrt (* h l)))))))double code(double d, double h, double l, double M, double D) {
double t_0 = (-0.5 / d) * (D * M);
double t_1 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double tmp;
if (t_1 <= 1e-111) {
tmp = fabs((d / (h * sqrt((l / h))))) * (1.0 - (t_0 * (t_0 * (0.5 * (h / l)))));
} else if (t_1 <= 5e+243) {
tmp = (1.0 * sqrt((d / l))) * sqrt((d / h));
} else {
tmp = ((1.0 - (((((M * D) * -0.5) * (0.5 * h)) / (l * d)) * ((D * (-0.5 / d)) * M))) * fabs(d)) / sqrt((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 = ((-0.5d0) / d) * (d_1 * m)
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 <= 1d-111) then
tmp = abs((d / (h * sqrt((l / h))))) * (1.0d0 - (t_0 * (t_0 * (0.5d0 * (h / l)))))
else if (t_1 <= 5d+243) then
tmp = (1.0d0 * sqrt((d / l))) * sqrt((d / h))
else
tmp = ((1.0d0 - (((((m * d_1) * (-0.5d0)) * (0.5d0 * h)) / (l * d)) * ((d_1 * ((-0.5d0) / d)) * m))) * abs(d)) / sqrt((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 = (-0.5 / d) * (D * M);
double t_1 = (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double tmp;
if (t_1 <= 1e-111) {
tmp = Math.abs((d / (h * Math.sqrt((l / h))))) * (1.0 - (t_0 * (t_0 * (0.5 * (h / l)))));
} else if (t_1 <= 5e+243) {
tmp = (1.0 * Math.sqrt((d / l))) * Math.sqrt((d / h));
} else {
tmp = ((1.0 - (((((M * D) * -0.5) * (0.5 * h)) / (l * d)) * ((D * (-0.5 / d)) * M))) * Math.abs(d)) / Math.sqrt((h * l));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = (-0.5 / d) * (D * M) t_1 = (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l))) tmp = 0 if t_1 <= 1e-111: tmp = math.fabs((d / (h * math.sqrt((l / h))))) * (1.0 - (t_0 * (t_0 * (0.5 * (h / l))))) elif t_1 <= 5e+243: tmp = (1.0 * math.sqrt((d / l))) * math.sqrt((d / h)) else: tmp = ((1.0 - (((((M * D) * -0.5) * (0.5 * h)) / (l * d)) * ((D * (-0.5 / d)) * M))) * math.fabs(d)) / math.sqrt((h * l)) return tmp
function code(d, h, l, M, D) t_0 = Float64(Float64(-0.5 / d) * Float64(D * M)) t_1 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) tmp = 0.0 if (t_1 <= 1e-111) tmp = Float64(abs(Float64(d / Float64(h * sqrt(Float64(l / h))))) * Float64(1.0 - Float64(t_0 * Float64(t_0 * Float64(0.5 * Float64(h / l)))))); elseif (t_1 <= 5e+243) tmp = Float64(Float64(1.0 * sqrt(Float64(d / l))) * sqrt(Float64(d / h))); else tmp = Float64(Float64(Float64(1.0 - Float64(Float64(Float64(Float64(Float64(M * D) * -0.5) * Float64(0.5 * h)) / Float64(l * d)) * Float64(Float64(D * Float64(-0.5 / d)) * M))) * abs(d)) / sqrt(Float64(h * l))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = (-0.5 / d) * (D * M); t_1 = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); tmp = 0.0; if (t_1 <= 1e-111) tmp = abs((d / (h * sqrt((l / h))))) * (1.0 - (t_0 * (t_0 * (0.5 * (h / l))))); elseif (t_1 <= 5e+243) tmp = (1.0 * sqrt((d / l))) * sqrt((d / h)); else tmp = ((1.0 - (((((M * D) * -0.5) * (0.5 * h)) / (l * d)) * ((D * (-0.5 / d)) * M))) * abs(d)) / sqrt((h * l)); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(-0.5 / d), $MachinePrecision] * N[(D * M), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 1e-111], N[(N[Abs[N[(d / N[(h * N[Sqrt[N[(l / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(t$95$0 * N[(t$95$0 * N[(0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+243], N[(N[(1.0 * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 - N[(N[(N[(N[(N[(M * D), $MachinePrecision] * -0.5), $MachinePrecision] * N[(0.5 * h), $MachinePrecision]), $MachinePrecision] / N[(l * d), $MachinePrecision]), $MachinePrecision] * N[(N[(D * N[(-0.5 / d), $MachinePrecision]), $MachinePrecision] * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Abs[d], $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := \frac{-0.5}{d} \cdot \left(D \cdot M\right)\\
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 10^{-111}:\\
\;\;\;\;\left|\frac{d}{h \cdot \sqrt{\frac{\ell}{h}}}\right| \cdot \left(1 - t\_0 \cdot \left(t\_0 \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right)\right)\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+243}:\\
\;\;\;\;\left(1 \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{\frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 - \frac{\left(\left(M \cdot D\right) \cdot -0.5\right) \cdot \left(0.5 \cdot h\right)}{\ell \cdot d} \cdot \left(\left(D \cdot \frac{-0.5}{d}\right) \cdot M\right)\right) \cdot \left|d\right|}{\sqrt{h \cdot \ell}}\\
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 1.0000000000000001e-111Initial program 67.4%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-pow.f64N/A
unpow2N/A
sqr-neg-revN/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites69.0%
lift-*.f64N/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
associate-*r/N/A
lift-/.f64N/A
lift-*.f64N/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
lower-fabs.f6453.3%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
sqrt-divN/A
Applied rewrites72.2%
Taylor expanded in h around -inf
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6474.7%
Applied rewrites74.7%
if 1.0000000000000001e-111 < (*.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.0000000000000004e243Initial program 67.4%
Taylor expanded in d around inf
Applied rewrites38.6%
metadata-eval38.6%
lift-/.f64N/A
*-commutativeN/A
*-commutativeN/A
lift-/.f6438.6%
lift-*.f64N/A
Applied rewrites38.6%
if 5.0000000000000004e243 < (*.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 67.4%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-pow.f64N/A
unpow2N/A
sqr-neg-revN/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites69.0%
lift-*.f64N/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
associate-*r/N/A
lift-/.f64N/A
lift-*.f64N/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
lower-fabs.f6453.3%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
sqrt-divN/A
Applied rewrites72.2%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6476.8%
Applied rewrites76.8%
Applied rewrites75.8%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(-
1.0
(*
(* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0))
(/ h l))))))
(if (<= t_0 2e-254)
(*
(fabs (/ (- d) (sqrt (* l h))))
(-
1.0
(*
(* (/ -0.5 d) (* D M))
(/ (* (* (* (/ -0.5 d) M) D) (* 0.5 h)) l))))
(if (<= t_0 5e+243)
(* (* 1.0 (sqrt (/ d l))) (sqrt (/ d h)))
(/
(*
(-
1.0
(*
(/ (* (* (* M D) -0.5) (* 0.5 h)) (* l d))
(* (* D (/ -0.5 d)) M)))
(fabs d))
(sqrt (* h l)))))))double code(double d, double h, double l, double M, double D) {
double t_0 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double tmp;
if (t_0 <= 2e-254) {
tmp = fabs((-d / sqrt((l * h)))) * (1.0 - (((-0.5 / d) * (D * M)) * (((((-0.5 / d) * M) * D) * (0.5 * h)) / l)));
} else if (t_0 <= 5e+243) {
tmp = (1.0 * sqrt((d / l))) * sqrt((d / h));
} else {
tmp = ((1.0 - (((((M * D) * -0.5) * (0.5 * h)) / (l * d)) * ((D * (-0.5 / d)) * M))) * fabs(d)) / sqrt((h * l));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
if (t_0 <= 2d-254) then
tmp = abs((-d / sqrt((l * h)))) * (1.0d0 - ((((-0.5d0) / d) * (d_1 * m)) * ((((((-0.5d0) / d) * m) * d_1) * (0.5d0 * h)) / l)))
else if (t_0 <= 5d+243) then
tmp = (1.0d0 * sqrt((d / l))) * sqrt((d / h))
else
tmp = ((1.0d0 - (((((m * d_1) * (-0.5d0)) * (0.5d0 * h)) / (l * d)) * ((d_1 * ((-0.5d0) / d)) * m))) * abs(d)) / sqrt((h * l))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double tmp;
if (t_0 <= 2e-254) {
tmp = Math.abs((-d / Math.sqrt((l * h)))) * (1.0 - (((-0.5 / d) * (D * M)) * (((((-0.5 / d) * M) * D) * (0.5 * h)) / l)));
} else if (t_0 <= 5e+243) {
tmp = (1.0 * Math.sqrt((d / l))) * Math.sqrt((d / h));
} else {
tmp = ((1.0 - (((((M * D) * -0.5) * (0.5 * h)) / (l * d)) * ((D * (-0.5 / d)) * M))) * Math.abs(d)) / Math.sqrt((h * l));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l))) tmp = 0 if t_0 <= 2e-254: tmp = math.fabs((-d / math.sqrt((l * h)))) * (1.0 - (((-0.5 / d) * (D * M)) * (((((-0.5 / d) * M) * D) * (0.5 * h)) / l))) elif t_0 <= 5e+243: tmp = (1.0 * math.sqrt((d / l))) * math.sqrt((d / h)) else: tmp = ((1.0 - (((((M * D) * -0.5) * (0.5 * h)) / (l * d)) * ((D * (-0.5 / d)) * M))) * math.fabs(d)) / math.sqrt((h * l)) return tmp
function code(d, h, l, M, D) t_0 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) tmp = 0.0 if (t_0 <= 2e-254) tmp = Float64(abs(Float64(Float64(-d) / sqrt(Float64(l * h)))) * Float64(1.0 - Float64(Float64(Float64(-0.5 / d) * Float64(D * M)) * Float64(Float64(Float64(Float64(Float64(-0.5 / d) * M) * D) * Float64(0.5 * h)) / l)))); elseif (t_0 <= 5e+243) tmp = Float64(Float64(1.0 * sqrt(Float64(d / l))) * sqrt(Float64(d / h))); else tmp = Float64(Float64(Float64(1.0 - Float64(Float64(Float64(Float64(Float64(M * D) * -0.5) * Float64(0.5 * h)) / Float64(l * d)) * Float64(Float64(D * Float64(-0.5 / d)) * M))) * abs(d)) / sqrt(Float64(h * l))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); tmp = 0.0; if (t_0 <= 2e-254) tmp = abs((-d / sqrt((l * h)))) * (1.0 - (((-0.5 / d) * (D * M)) * (((((-0.5 / d) * M) * D) * (0.5 * h)) / l))); elseif (t_0 <= 5e+243) tmp = (1.0 * sqrt((d / l))) * sqrt((d / h)); else tmp = ((1.0 - (((((M * D) * -0.5) * (0.5 * h)) / (l * d)) * ((D * (-0.5 / d)) * M))) * abs(d)) / sqrt((h * l)); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 2e-254], N[(N[Abs[N[((-d) / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(N[(N[(-0.5 / d), $MachinePrecision] * N[(D * M), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(N[(-0.5 / d), $MachinePrecision] * M), $MachinePrecision] * D), $MachinePrecision] * N[(0.5 * h), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e+243], N[(N[(1.0 * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 - N[(N[(N[(N[(N[(M * D), $MachinePrecision] * -0.5), $MachinePrecision] * N[(0.5 * h), $MachinePrecision]), $MachinePrecision] / N[(l * d), $MachinePrecision]), $MachinePrecision] * N[(N[(D * N[(-0.5 / d), $MachinePrecision]), $MachinePrecision] * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Abs[d], $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{if}\;t\_0 \leq 2 \cdot 10^{-254}:\\
\;\;\;\;\left|\frac{-d}{\sqrt{\ell \cdot h}}\right| \cdot \left(1 - \left(\frac{-0.5}{d} \cdot \left(D \cdot M\right)\right) \cdot \frac{\left(\left(\frac{-0.5}{d} \cdot M\right) \cdot D\right) \cdot \left(0.5 \cdot h\right)}{\ell}\right)\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+243}:\\
\;\;\;\;\left(1 \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{\frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 - \frac{\left(\left(M \cdot D\right) \cdot -0.5\right) \cdot \left(0.5 \cdot h\right)}{\ell \cdot d} \cdot \left(\left(D \cdot \frac{-0.5}{d}\right) \cdot M\right)\right) \cdot \left|d\right|}{\sqrt{h \cdot \ell}}\\
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 1.9999999999999998e-254Initial program 67.4%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-pow.f64N/A
unpow2N/A
sqr-neg-revN/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites69.0%
lift-*.f64N/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
associate-*r/N/A
lift-/.f64N/A
lift-*.f64N/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
lower-fabs.f6453.3%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
sqrt-divN/A
Applied rewrites72.2%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6476.8%
Applied rewrites76.8%
if 1.9999999999999998e-254 < (*.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.0000000000000004e243Initial program 67.4%
Taylor expanded in d around inf
Applied rewrites38.6%
metadata-eval38.6%
lift-/.f64N/A
*-commutativeN/A
*-commutativeN/A
lift-/.f6438.6%
lift-*.f64N/A
Applied rewrites38.6%
if 5.0000000000000004e243 < (*.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 67.4%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-pow.f64N/A
unpow2N/A
sqr-neg-revN/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites69.0%
lift-*.f64N/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
associate-*r/N/A
lift-/.f64N/A
lift-*.f64N/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
lower-fabs.f6453.3%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
sqrt-divN/A
Applied rewrites72.2%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6476.8%
Applied rewrites76.8%
Applied rewrites75.8%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* (* D (/ -0.5 d)) M))
(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 2e-254)
(*
(fabs (/ (- d) (sqrt (* l h))))
(- 1.0 (* t_0 (/ (* (* (* (/ -0.5 d) M) D) (* 0.5 h)) l))))
(if (<= t_1 5e+243)
(* (* 1.0 (sqrt (/ d l))) (sqrt (/ d h)))
(/
(*
(- 1.0 (* (/ (* (* (* M D) -0.5) (* 0.5 h)) (* l d)) t_0))
(fabs d))
(sqrt (* h l)))))))double code(double d, double h, double l, double M, double D) {
double t_0 = (D * (-0.5 / d)) * M;
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 <= 2e-254) {
tmp = fabs((-d / sqrt((l * h)))) * (1.0 - (t_0 * (((((-0.5 / d) * M) * D) * (0.5 * h)) / l)));
} else if (t_1 <= 5e+243) {
tmp = (1.0 * sqrt((d / l))) * sqrt((d / h));
} else {
tmp = ((1.0 - (((((M * D) * -0.5) * (0.5 * h)) / (l * d)) * t_0)) * fabs(d)) / sqrt((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 * ((-0.5d0) / d)) * m
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 <= 2d-254) then
tmp = abs((-d / sqrt((l * h)))) * (1.0d0 - (t_0 * ((((((-0.5d0) / d) * m) * d_1) * (0.5d0 * h)) / l)))
else if (t_1 <= 5d+243) then
tmp = (1.0d0 * sqrt((d / l))) * sqrt((d / h))
else
tmp = ((1.0d0 - (((((m * d_1) * (-0.5d0)) * (0.5d0 * h)) / (l * d)) * t_0)) * abs(d)) / sqrt((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 * (-0.5 / d)) * M;
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 <= 2e-254) {
tmp = Math.abs((-d / Math.sqrt((l * h)))) * (1.0 - (t_0 * (((((-0.5 / d) * M) * D) * (0.5 * h)) / l)));
} else if (t_1 <= 5e+243) {
tmp = (1.0 * Math.sqrt((d / l))) * Math.sqrt((d / h));
} else {
tmp = ((1.0 - (((((M * D) * -0.5) * (0.5 * h)) / (l * d)) * t_0)) * Math.abs(d)) / Math.sqrt((h * l));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = (D * (-0.5 / d)) * M 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 <= 2e-254: tmp = math.fabs((-d / math.sqrt((l * h)))) * (1.0 - (t_0 * (((((-0.5 / d) * M) * D) * (0.5 * h)) / l))) elif t_1 <= 5e+243: tmp = (1.0 * math.sqrt((d / l))) * math.sqrt((d / h)) else: tmp = ((1.0 - (((((M * D) * -0.5) * (0.5 * h)) / (l * d)) * t_0)) * math.fabs(d)) / math.sqrt((h * l)) return tmp
function code(d, h, l, M, D) t_0 = Float64(Float64(D * Float64(-0.5 / d)) * M) 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 <= 2e-254) tmp = Float64(abs(Float64(Float64(-d) / sqrt(Float64(l * h)))) * Float64(1.0 - Float64(t_0 * Float64(Float64(Float64(Float64(Float64(-0.5 / d) * M) * D) * Float64(0.5 * h)) / l)))); elseif (t_1 <= 5e+243) tmp = Float64(Float64(1.0 * sqrt(Float64(d / l))) * sqrt(Float64(d / h))); else tmp = Float64(Float64(Float64(1.0 - Float64(Float64(Float64(Float64(Float64(M * D) * -0.5) * Float64(0.5 * h)) / Float64(l * d)) * t_0)) * abs(d)) / sqrt(Float64(h * l))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = (D * (-0.5 / d)) * M; 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 <= 2e-254) tmp = abs((-d / sqrt((l * h)))) * (1.0 - (t_0 * (((((-0.5 / d) * M) * D) * (0.5 * h)) / l))); elseif (t_1 <= 5e+243) tmp = (1.0 * sqrt((d / l))) * sqrt((d / h)); else tmp = ((1.0 - (((((M * D) * -0.5) * (0.5 * h)) / (l * d)) * t_0)) * abs(d)) / sqrt((h * l)); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(D * N[(-0.5 / d), $MachinePrecision]), $MachinePrecision] * M), $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, 2e-254], N[(N[Abs[N[((-d) / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(t$95$0 * N[(N[(N[(N[(N[(-0.5 / d), $MachinePrecision] * M), $MachinePrecision] * D), $MachinePrecision] * N[(0.5 * h), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+243], N[(N[(1.0 * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 - N[(N[(N[(N[(N[(M * D), $MachinePrecision] * -0.5), $MachinePrecision] * N[(0.5 * h), $MachinePrecision]), $MachinePrecision] / N[(l * d), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] * N[Abs[d], $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := \left(D \cdot \frac{-0.5}{d}\right) \cdot M\\
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 2 \cdot 10^{-254}:\\
\;\;\;\;\left|\frac{-d}{\sqrt{\ell \cdot h}}\right| \cdot \left(1 - t\_0 \cdot \frac{\left(\left(\frac{-0.5}{d} \cdot M\right) \cdot D\right) \cdot \left(0.5 \cdot h\right)}{\ell}\right)\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+243}:\\
\;\;\;\;\left(1 \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{\frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 - \frac{\left(\left(M \cdot D\right) \cdot -0.5\right) \cdot \left(0.5 \cdot h\right)}{\ell \cdot d} \cdot t\_0\right) \cdot \left|d\right|}{\sqrt{h \cdot \ell}}\\
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 1.9999999999999998e-254Initial program 67.4%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-pow.f64N/A
unpow2N/A
sqr-neg-revN/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites69.0%
lift-*.f64N/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
associate-*r/N/A
lift-/.f64N/A
lift-*.f64N/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
lower-fabs.f6453.3%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
sqrt-divN/A
Applied rewrites72.2%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6476.8%
Applied rewrites76.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6476.2%
Applied rewrites76.2%
if 1.9999999999999998e-254 < (*.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.0000000000000004e243Initial program 67.4%
Taylor expanded in d around inf
Applied rewrites38.6%
metadata-eval38.6%
lift-/.f64N/A
*-commutativeN/A
*-commutativeN/A
lift-/.f6438.6%
lift-*.f64N/A
Applied rewrites38.6%
if 5.0000000000000004e243 < (*.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 67.4%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-pow.f64N/A
unpow2N/A
sqr-neg-revN/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites69.0%
lift-*.f64N/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
associate-*r/N/A
lift-/.f64N/A
lift-*.f64N/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
lower-fabs.f6453.3%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
sqrt-divN/A
Applied rewrites72.2%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6476.8%
Applied rewrites76.8%
Applied rewrites75.8%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* (fmin M D) (fmax M D)))
(t_1
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(-
1.0
(* (* (/ 1.0 2.0) (pow (/ t_0 (* 2.0 d)) 2.0)) (/ h l))))))
(if (<= t_1 2e-254)
(*
(fabs (/ (- d) (sqrt (* l h))))
(-
1.0
(*
(* (/ -0.5 d) (* (fmax M D) (fmin M D)))
(/ (* -0.25 (/ (* (fmax M D) (* (fmin M D) h)) d)) l))))
(if (<= t_1 5e+243)
(* (* 1.0 (sqrt (/ d l))) (sqrt (/ d h)))
(/
(*
(-
1.0
(*
(/ (* (* t_0 -0.5) (* 0.5 h)) (* l d))
(* (* (fmax M D) (/ -0.5 d)) (fmin M D))))
(fabs d))
(sqrt (* h l)))))))double code(double d, double h, double l, double M, double D) {
double t_0 = fmin(M, D) * fmax(M, 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((t_0 / (2.0 * d)), 2.0)) * (h / l)));
double tmp;
if (t_1 <= 2e-254) {
tmp = fabs((-d / sqrt((l * h)))) * (1.0 - (((-0.5 / d) * (fmax(M, D) * fmin(M, D))) * ((-0.25 * ((fmax(M, D) * (fmin(M, D) * h)) / d)) / l)));
} else if (t_1 <= 5e+243) {
tmp = (1.0 * sqrt((d / l))) * sqrt((d / h));
} else {
tmp = ((1.0 - ((((t_0 * -0.5) * (0.5 * h)) / (l * d)) * ((fmax(M, D) * (-0.5 / d)) * fmin(M, D)))) * fabs(d)) / sqrt((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 = fmin(m, d_1) * fmax(m, d_1)
t_1 = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * ((t_0 / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
if (t_1 <= 2d-254) then
tmp = abs((-d / sqrt((l * h)))) * (1.0d0 - ((((-0.5d0) / d) * (fmax(m, d_1) * fmin(m, d_1))) * (((-0.25d0) * ((fmax(m, d_1) * (fmin(m, d_1) * h)) / d)) / l)))
else if (t_1 <= 5d+243) then
tmp = (1.0d0 * sqrt((d / l))) * sqrt((d / h))
else
tmp = ((1.0d0 - ((((t_0 * (-0.5d0)) * (0.5d0 * h)) / (l * d)) * ((fmax(m, d_1) * ((-0.5d0) / d)) * fmin(m, d_1)))) * abs(d)) / sqrt((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 = fmin(M, D) * fmax(M, 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((t_0 / (2.0 * d)), 2.0)) * (h / l)));
double tmp;
if (t_1 <= 2e-254) {
tmp = Math.abs((-d / Math.sqrt((l * h)))) * (1.0 - (((-0.5 / d) * (fmax(M, D) * fmin(M, D))) * ((-0.25 * ((fmax(M, D) * (fmin(M, D) * h)) / d)) / l)));
} else if (t_1 <= 5e+243) {
tmp = (1.0 * Math.sqrt((d / l))) * Math.sqrt((d / h));
} else {
tmp = ((1.0 - ((((t_0 * -0.5) * (0.5 * h)) / (l * d)) * ((fmax(M, D) * (-0.5 / d)) * fmin(M, D)))) * Math.abs(d)) / Math.sqrt((h * l));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = fmin(M, D) * fmax(M, 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((t_0 / (2.0 * d)), 2.0)) * (h / l))) tmp = 0 if t_1 <= 2e-254: tmp = math.fabs((-d / math.sqrt((l * h)))) * (1.0 - (((-0.5 / d) * (fmax(M, D) * fmin(M, D))) * ((-0.25 * ((fmax(M, D) * (fmin(M, D) * h)) / d)) / l))) elif t_1 <= 5e+243: tmp = (1.0 * math.sqrt((d / l))) * math.sqrt((d / h)) else: tmp = ((1.0 - ((((t_0 * -0.5) * (0.5 * h)) / (l * d)) * ((fmax(M, D) * (-0.5 / d)) * fmin(M, D)))) * math.fabs(d)) / math.sqrt((h * l)) return tmp
function code(d, h, l, M, D) t_0 = Float64(fmin(M, D) * fmax(M, 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(t_0 / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) tmp = 0.0 if (t_1 <= 2e-254) tmp = Float64(abs(Float64(Float64(-d) / sqrt(Float64(l * h)))) * Float64(1.0 - Float64(Float64(Float64(-0.5 / d) * Float64(fmax(M, D) * fmin(M, D))) * Float64(Float64(-0.25 * Float64(Float64(fmax(M, D) * Float64(fmin(M, D) * h)) / d)) / l)))); elseif (t_1 <= 5e+243) tmp = Float64(Float64(1.0 * sqrt(Float64(d / l))) * sqrt(Float64(d / h))); else tmp = Float64(Float64(Float64(1.0 - Float64(Float64(Float64(Float64(t_0 * -0.5) * Float64(0.5 * h)) / Float64(l * d)) * Float64(Float64(fmax(M, D) * Float64(-0.5 / d)) * fmin(M, D)))) * abs(d)) / sqrt(Float64(h * l))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = min(M, D) * max(M, D); t_1 = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * ((t_0 / (2.0 * d)) ^ 2.0)) * (h / l))); tmp = 0.0; if (t_1 <= 2e-254) tmp = abs((-d / sqrt((l * h)))) * (1.0 - (((-0.5 / d) * (max(M, D) * min(M, D))) * ((-0.25 * ((max(M, D) * (min(M, D) * h)) / d)) / l))); elseif (t_1 <= 5e+243) tmp = (1.0 * sqrt((d / l))) * sqrt((d / h)); else tmp = ((1.0 - ((((t_0 * -0.5) * (0.5 * h)) / (l * d)) * ((max(M, D) * (-0.5 / d)) * min(M, D)))) * abs(d)) / sqrt((h * l)); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[Min[M, D], $MachinePrecision] * N[Max[M, 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[(t$95$0 / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 2e-254], N[(N[Abs[N[((-d) / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(N[(N[(-0.5 / d), $MachinePrecision] * N[(N[Max[M, D], $MachinePrecision] * N[Min[M, D], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(-0.25 * N[(N[(N[Max[M, D], $MachinePrecision] * N[(N[Min[M, D], $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+243], N[(N[(1.0 * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 - N[(N[(N[(N[(t$95$0 * -0.5), $MachinePrecision] * N[(0.5 * h), $MachinePrecision]), $MachinePrecision] / N[(l * d), $MachinePrecision]), $MachinePrecision] * N[(N[(N[Max[M, D], $MachinePrecision] * N[(-0.5 / d), $MachinePrecision]), $MachinePrecision] * N[Min[M, D], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Abs[d], $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := \mathsf{min}\left(M, D\right) \cdot \mathsf{max}\left(M, D\right)\\
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{t\_0}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{if}\;t\_1 \leq 2 \cdot 10^{-254}:\\
\;\;\;\;\left|\frac{-d}{\sqrt{\ell \cdot h}}\right| \cdot \left(1 - \left(\frac{-0.5}{d} \cdot \left(\mathsf{max}\left(M, D\right) \cdot \mathsf{min}\left(M, D\right)\right)\right) \cdot \frac{-0.25 \cdot \frac{\mathsf{max}\left(M, D\right) \cdot \left(\mathsf{min}\left(M, D\right) \cdot h\right)}{d}}{\ell}\right)\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+243}:\\
\;\;\;\;\left(1 \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{\frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 - \frac{\left(t\_0 \cdot -0.5\right) \cdot \left(0.5 \cdot h\right)}{\ell \cdot d} \cdot \left(\left(\mathsf{max}\left(M, D\right) \cdot \frac{-0.5}{d}\right) \cdot \mathsf{min}\left(M, D\right)\right)\right) \cdot \left|d\right|}{\sqrt{h \cdot \ell}}\\
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 1.9999999999999998e-254Initial program 67.4%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-pow.f64N/A
unpow2N/A
sqr-neg-revN/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites69.0%
lift-*.f64N/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
associate-*r/N/A
lift-/.f64N/A
lift-*.f64N/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
lower-fabs.f6453.3%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
sqrt-divN/A
Applied rewrites72.2%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6476.8%
Applied rewrites76.8%
Taylor expanded in d around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f6475.3%
Applied rewrites75.3%
if 1.9999999999999998e-254 < (*.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.0000000000000004e243Initial program 67.4%
Taylor expanded in d around inf
Applied rewrites38.6%
metadata-eval38.6%
lift-/.f64N/A
*-commutativeN/A
*-commutativeN/A
lift-/.f6438.6%
lift-*.f64N/A
Applied rewrites38.6%
if 5.0000000000000004e243 < (*.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 67.4%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-pow.f64N/A
unpow2N/A
sqr-neg-revN/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites69.0%
lift-*.f64N/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
associate-*r/N/A
lift-/.f64N/A
lift-*.f64N/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
lower-fabs.f6453.3%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
sqrt-divN/A
Applied rewrites72.2%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6476.8%
Applied rewrites76.8%
Applied rewrites75.8%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (fmax (fabs M) (fabs D)))
(t_1 (fmin (fabs M) (fabs D)))
(t_2 (* (/ -0.5 d) (* t_0 t_1))))
(if (<= l 5.45e-303)
(*
(fabs (/ (- d) (sqrt (* l h))))
(- 1.0 (* t_2 (/ (* -0.25 (/ (* t_0 (* t_1 h)) d)) l))))
(*
(fabs (/ (- d) (* (sqrt l) (sqrt h))))
(- 1.0 (* t_2 (/ (* (* (* (/ -0.5 d) t_1) t_0) (* 0.5 h)) l)))))))double code(double d, double h, double l, double M, double D) {
double t_0 = fmax(fabs(M), fabs(D));
double t_1 = fmin(fabs(M), fabs(D));
double t_2 = (-0.5 / d) * (t_0 * t_1);
double tmp;
if (l <= 5.45e-303) {
tmp = fabs((-d / sqrt((l * h)))) * (1.0 - (t_2 * ((-0.25 * ((t_0 * (t_1 * h)) / d)) / l)));
} else {
tmp = fabs((-d / (sqrt(l) * sqrt(h)))) * (1.0 - (t_2 * (((((-0.5 / d) * t_1) * t_0) * (0.5 * h)) / l)));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = fmax(abs(m), abs(d_1))
t_1 = fmin(abs(m), abs(d_1))
t_2 = ((-0.5d0) / d) * (t_0 * t_1)
if (l <= 5.45d-303) then
tmp = abs((-d / sqrt((l * h)))) * (1.0d0 - (t_2 * (((-0.25d0) * ((t_0 * (t_1 * h)) / d)) / l)))
else
tmp = abs((-d / (sqrt(l) * sqrt(h)))) * (1.0d0 - (t_2 * ((((((-0.5d0) / d) * t_1) * t_0) * (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 = fmax(Math.abs(M), Math.abs(D));
double t_1 = fmin(Math.abs(M), Math.abs(D));
double t_2 = (-0.5 / d) * (t_0 * t_1);
double tmp;
if (l <= 5.45e-303) {
tmp = Math.abs((-d / Math.sqrt((l * h)))) * (1.0 - (t_2 * ((-0.25 * ((t_0 * (t_1 * h)) / d)) / l)));
} else {
tmp = Math.abs((-d / (Math.sqrt(l) * Math.sqrt(h)))) * (1.0 - (t_2 * (((((-0.5 / d) * t_1) * t_0) * (0.5 * h)) / l)));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = fmax(math.fabs(M), math.fabs(D)) t_1 = fmin(math.fabs(M), math.fabs(D)) t_2 = (-0.5 / d) * (t_0 * t_1) tmp = 0 if l <= 5.45e-303: tmp = math.fabs((-d / math.sqrt((l * h)))) * (1.0 - (t_2 * ((-0.25 * ((t_0 * (t_1 * h)) / d)) / l))) else: tmp = math.fabs((-d / (math.sqrt(l) * math.sqrt(h)))) * (1.0 - (t_2 * (((((-0.5 / d) * t_1) * t_0) * (0.5 * h)) / l))) return tmp
function code(d, h, l, M, D) t_0 = fmax(abs(M), abs(D)) t_1 = fmin(abs(M), abs(D)) t_2 = Float64(Float64(-0.5 / d) * Float64(t_0 * t_1)) tmp = 0.0 if (l <= 5.45e-303) tmp = Float64(abs(Float64(Float64(-d) / sqrt(Float64(l * h)))) * Float64(1.0 - Float64(t_2 * Float64(Float64(-0.25 * Float64(Float64(t_0 * Float64(t_1 * h)) / d)) / l)))); else tmp = Float64(abs(Float64(Float64(-d) / Float64(sqrt(l) * sqrt(h)))) * Float64(1.0 - Float64(t_2 * Float64(Float64(Float64(Float64(Float64(-0.5 / d) * t_1) * t_0) * Float64(0.5 * h)) / l)))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = max(abs(M), abs(D)); t_1 = min(abs(M), abs(D)); t_2 = (-0.5 / d) * (t_0 * t_1); tmp = 0.0; if (l <= 5.45e-303) tmp = abs((-d / sqrt((l * h)))) * (1.0 - (t_2 * ((-0.25 * ((t_0 * (t_1 * h)) / d)) / l))); else tmp = abs((-d / (sqrt(l) * sqrt(h)))) * (1.0 - (t_2 * (((((-0.5 / d) * t_1) * t_0) * (0.5 * h)) / l))); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Max[N[Abs[M], $MachinePrecision], N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Min[N[Abs[M], $MachinePrecision], N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(-0.5 / d), $MachinePrecision] * N[(t$95$0 * t$95$1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, 5.45e-303], N[(N[Abs[N[((-d) / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(t$95$2 * N[(N[(-0.25 * N[(N[(t$95$0 * N[(t$95$1 * h), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Abs[N[((-d) / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(t$95$2 * N[(N[(N[(N[(N[(-0.5 / d), $MachinePrecision] * t$95$1), $MachinePrecision] * t$95$0), $MachinePrecision] * N[(0.5 * h), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := \mathsf{max}\left(\left|M\right|, \left|D\right|\right)\\
t_1 := \mathsf{min}\left(\left|M\right|, \left|D\right|\right)\\
t_2 := \frac{-0.5}{d} \cdot \left(t\_0 \cdot t\_1\right)\\
\mathbf{if}\;\ell \leq 5.45 \cdot 10^{-303}:\\
\;\;\;\;\left|\frac{-d}{\sqrt{\ell \cdot h}}\right| \cdot \left(1 - t\_2 \cdot \frac{-0.25 \cdot \frac{t\_0 \cdot \left(t\_1 \cdot h\right)}{d}}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{-d}{\sqrt{\ell} \cdot \sqrt{h}}\right| \cdot \left(1 - t\_2 \cdot \frac{\left(\left(\frac{-0.5}{d} \cdot t\_1\right) \cdot t\_0\right) \cdot \left(0.5 \cdot h\right)}{\ell}\right)\\
\end{array}
if l < 5.45e-303Initial program 67.4%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-pow.f64N/A
unpow2N/A
sqr-neg-revN/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites69.0%
lift-*.f64N/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
associate-*r/N/A
lift-/.f64N/A
lift-*.f64N/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
lower-fabs.f6453.3%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
sqrt-divN/A
Applied rewrites72.2%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6476.8%
Applied rewrites76.8%
Taylor expanded in d around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f6475.3%
Applied rewrites75.3%
if 5.45e-303 < l Initial program 67.4%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-pow.f64N/A
unpow2N/A
sqr-neg-revN/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites69.0%
lift-*.f64N/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
associate-*r/N/A
lift-/.f64N/A
lift-*.f64N/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
lower-fabs.f6453.3%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
sqrt-divN/A
Applied rewrites72.2%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6476.8%
Applied rewrites76.8%
lift-sqrt.f64N/A
lift-*.f64N/A
sqrt-prodN/A
lower-unsound-*.f64N/A
lower-unsound-sqrt.f64N/A
lower-unsound-sqrt.f6443.8%
Applied rewrites43.8%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (* h l)))
(t_1 (* (fmin M D) (fmax M D)))
(t_2
(-
1.0
(*
(/ (* (* t_1 -0.5) (* 0.5 h)) (* l d))
(* (* (fmax M D) (/ -0.5 d)) (fmin M D)))))
(t_3
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(-
1.0
(* (* (/ 1.0 2.0) (pow (/ t_1 (* 2.0 d)) 2.0)) (/ h l))))))
(if (<= t_3 2e-254)
(* (/ (fabs d) t_0) t_2)
(if (<= t_3 5e+243)
(* (* 1.0 (sqrt (/ d l))) (sqrt (/ d h)))
(/ (* t_2 (fabs d)) t_0)))))double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((h * l));
double t_1 = fmin(M, D) * fmax(M, D);
double t_2 = 1.0 - ((((t_1 * -0.5) * (0.5 * h)) / (l * d)) * ((fmax(M, D) * (-0.5 / d)) * fmin(M, D)));
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_1 / (2.0 * d)), 2.0)) * (h / l)));
double tmp;
if (t_3 <= 2e-254) {
tmp = (fabs(d) / t_0) * t_2;
} else if (t_3 <= 5e+243) {
tmp = (1.0 * sqrt((d / l))) * sqrt((d / h));
} else {
tmp = (t_2 * fabs(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) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = sqrt((h * l))
t_1 = fmin(m, d_1) * fmax(m, d_1)
t_2 = 1.0d0 - ((((t_1 * (-0.5d0)) * (0.5d0 * h)) / (l * d)) * ((fmax(m, d_1) * ((-0.5d0) / d)) * fmin(m, d_1)))
t_3 = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * ((t_1 / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
if (t_3 <= 2d-254) then
tmp = (abs(d) / t_0) * t_2
else if (t_3 <= 5d+243) then
tmp = (1.0d0 * sqrt((d / l))) * sqrt((d / h))
else
tmp = (t_2 * abs(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((h * l));
double t_1 = fmin(M, D) * fmax(M, D);
double t_2 = 1.0 - ((((t_1 * -0.5) * (0.5 * h)) / (l * d)) * ((fmax(M, D) * (-0.5 / d)) * fmin(M, D)));
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_1 / (2.0 * d)), 2.0)) * (h / l)));
double tmp;
if (t_3 <= 2e-254) {
tmp = (Math.abs(d) / t_0) * t_2;
} else if (t_3 <= 5e+243) {
tmp = (1.0 * Math.sqrt((d / l))) * Math.sqrt((d / h));
} else {
tmp = (t_2 * Math.abs(d)) / t_0;
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.sqrt((h * l)) t_1 = fmin(M, D) * fmax(M, D) t_2 = 1.0 - ((((t_1 * -0.5) * (0.5 * h)) / (l * d)) * ((fmax(M, D) * (-0.5 / d)) * fmin(M, D))) 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_1 / (2.0 * d)), 2.0)) * (h / l))) tmp = 0 if t_3 <= 2e-254: tmp = (math.fabs(d) / t_0) * t_2 elif t_3 <= 5e+243: tmp = (1.0 * math.sqrt((d / l))) * math.sqrt((d / h)) else: tmp = (t_2 * math.fabs(d)) / t_0 return tmp
function code(d, h, l, M, D) t_0 = sqrt(Float64(h * l)) t_1 = Float64(fmin(M, D) * fmax(M, D)) t_2 = Float64(1.0 - Float64(Float64(Float64(Float64(t_1 * -0.5) * Float64(0.5 * h)) / Float64(l * d)) * Float64(Float64(fmax(M, D) * Float64(-0.5 / d)) * fmin(M, D)))) 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_1 / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) tmp = 0.0 if (t_3 <= 2e-254) tmp = Float64(Float64(abs(d) / t_0) * t_2); elseif (t_3 <= 5e+243) tmp = Float64(Float64(1.0 * sqrt(Float64(d / l))) * sqrt(Float64(d / h))); else tmp = Float64(Float64(t_2 * abs(d)) / t_0); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = sqrt((h * l)); t_1 = min(M, D) * max(M, D); t_2 = 1.0 - ((((t_1 * -0.5) * (0.5 * h)) / (l * d)) * ((max(M, D) * (-0.5 / d)) * min(M, D))); t_3 = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * ((t_1 / (2.0 * d)) ^ 2.0)) * (h / l))); tmp = 0.0; if (t_3 <= 2e-254) tmp = (abs(d) / t_0) * t_2; elseif (t_3 <= 5e+243) tmp = (1.0 * sqrt((d / l))) * sqrt((d / h)); else tmp = (t_2 * abs(d)) / t_0; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Min[M, D], $MachinePrecision] * N[Max[M, D], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(1.0 - N[(N[(N[(N[(t$95$1 * -0.5), $MachinePrecision] * N[(0.5 * h), $MachinePrecision]), $MachinePrecision] / N[(l * d), $MachinePrecision]), $MachinePrecision] * N[(N[(N[Max[M, D], $MachinePrecision] * N[(-0.5 / d), $MachinePrecision]), $MachinePrecision] * N[Min[M, D], $MachinePrecision]), $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[(t$95$1 / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, 2e-254], N[(N[(N[Abs[d], $MachinePrecision] / t$95$0), $MachinePrecision] * t$95$2), $MachinePrecision], If[LessEqual[t$95$3, 5e+243], N[(N[(1.0 * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(t$95$2 * N[Abs[d], $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]]]]]]]
\begin{array}{l}
t_0 := \sqrt{h \cdot \ell}\\
t_1 := \mathsf{min}\left(M, D\right) \cdot \mathsf{max}\left(M, D\right)\\
t_2 := 1 - \frac{\left(t\_1 \cdot -0.5\right) \cdot \left(0.5 \cdot h\right)}{\ell \cdot d} \cdot \left(\left(\mathsf{max}\left(M, D\right) \cdot \frac{-0.5}{d}\right) \cdot \mathsf{min}\left(M, D\right)\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\_1}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{if}\;t\_3 \leq 2 \cdot 10^{-254}:\\
\;\;\;\;\frac{\left|d\right|}{t\_0} \cdot t\_2\\
\mathbf{elif}\;t\_3 \leq 5 \cdot 10^{+243}:\\
\;\;\;\;\left(1 \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{\frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_2 \cdot \left|d\right|}{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)))) < 1.9999999999999998e-254Initial program 67.4%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-pow.f64N/A
unpow2N/A
sqr-neg-revN/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites69.0%
lift-*.f64N/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
associate-*r/N/A
lift-/.f64N/A
lift-*.f64N/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
lower-fabs.f6453.3%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
sqrt-divN/A
Applied rewrites72.2%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6476.8%
Applied rewrites76.8%
Applied rewrites74.0%
if 1.9999999999999998e-254 < (*.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.0000000000000004e243Initial program 67.4%
Taylor expanded in d around inf
Applied rewrites38.6%
metadata-eval38.6%
lift-/.f64N/A
*-commutativeN/A
*-commutativeN/A
lift-/.f6438.6%
lift-*.f64N/A
Applied rewrites38.6%
if 5.0000000000000004e243 < (*.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 67.4%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-pow.f64N/A
unpow2N/A
sqr-neg-revN/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites69.0%
lift-*.f64N/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
associate-*r/N/A
lift-/.f64N/A
lift-*.f64N/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
lower-fabs.f6453.3%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
sqrt-divN/A
Applied rewrites72.2%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6476.8%
Applied rewrites76.8%
Applied rewrites75.8%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (fmin (fabs M) D))
(t_1 (fmax (fabs M) D))
(t_2 (* t_0 t_1))
(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))))))
(if (<= t_3 2e-254)
(*
(/ (fabs d) (sqrt (* h l)))
(-
1.0
(*
(/ (* (* t_2 -0.5) (* 0.5 h)) (* l d))
(* (* t_1 (/ -0.5 d)) t_0))))
(if (<= t_3 5e+243)
(* (* 1.0 (sqrt (/ d l))) (sqrt (/ d h)))
(*
(fabs (/ (- d) (sqrt (* l h))))
(-
1.0
(*
(* (/ -0.5 d) (* t_1 t_0))
(* -0.25 (/ (* t_1 (* t_0 h)) (* d l))))))))))double code(double d, double h, double l, double M, double D) {
double t_0 = fmin(fabs(M), D);
double t_1 = fmax(fabs(M), D);
double t_2 = t_0 * t_1;
double t_3 = (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 tmp;
if (t_3 <= 2e-254) {
tmp = (fabs(d) / sqrt((h * l))) * (1.0 - ((((t_2 * -0.5) * (0.5 * h)) / (l * d)) * ((t_1 * (-0.5 / d)) * t_0)));
} else if (t_3 <= 5e+243) {
tmp = (1.0 * sqrt((d / l))) * sqrt((d / h));
} else {
tmp = fabs((-d / sqrt((l * h)))) * (1.0 - (((-0.5 / d) * (t_1 * t_0)) * (-0.25 * ((t_1 * (t_0 * h)) / (d * 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 = fmin(abs(m), d_1)
t_1 = fmax(abs(m), d_1)
t_2 = t_0 * t_1
t_3 = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * ((t_2 / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
if (t_3 <= 2d-254) then
tmp = (abs(d) / sqrt((h * l))) * (1.0d0 - ((((t_2 * (-0.5d0)) * (0.5d0 * h)) / (l * d)) * ((t_1 * ((-0.5d0) / d)) * t_0)))
else if (t_3 <= 5d+243) then
tmp = (1.0d0 * sqrt((d / l))) * sqrt((d / h))
else
tmp = abs((-d / sqrt((l * h)))) * (1.0d0 - ((((-0.5d0) / d) * (t_1 * t_0)) * ((-0.25d0) * ((t_1 * (t_0 * h)) / (d * l)))))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = fmin(Math.abs(M), D);
double t_1 = fmax(Math.abs(M), D);
double t_2 = t_0 * t_1;
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_2 / (2.0 * d)), 2.0)) * (h / l)));
double tmp;
if (t_3 <= 2e-254) {
tmp = (Math.abs(d) / Math.sqrt((h * l))) * (1.0 - ((((t_2 * -0.5) * (0.5 * h)) / (l * d)) * ((t_1 * (-0.5 / d)) * t_0)));
} else if (t_3 <= 5e+243) {
tmp = (1.0 * Math.sqrt((d / l))) * Math.sqrt((d / h));
} else {
tmp = Math.abs((-d / Math.sqrt((l * h)))) * (1.0 - (((-0.5 / d) * (t_1 * t_0)) * (-0.25 * ((t_1 * (t_0 * h)) / (d * l)))));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = fmin(math.fabs(M), D) t_1 = fmax(math.fabs(M), D) t_2 = t_0 * t_1 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_2 / (2.0 * d)), 2.0)) * (h / l))) tmp = 0 if t_3 <= 2e-254: tmp = (math.fabs(d) / math.sqrt((h * l))) * (1.0 - ((((t_2 * -0.5) * (0.5 * h)) / (l * d)) * ((t_1 * (-0.5 / d)) * t_0))) elif t_3 <= 5e+243: tmp = (1.0 * math.sqrt((d / l))) * math.sqrt((d / h)) else: tmp = math.fabs((-d / math.sqrt((l * h)))) * (1.0 - (((-0.5 / d) * (t_1 * t_0)) * (-0.25 * ((t_1 * (t_0 * h)) / (d * l))))) return tmp
function code(d, h, l, M, D) t_0 = fmin(abs(M), D) t_1 = fmax(abs(M), D) t_2 = Float64(t_0 * t_1) 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)))) tmp = 0.0 if (t_3 <= 2e-254) tmp = Float64(Float64(abs(d) / sqrt(Float64(h * l))) * Float64(1.0 - Float64(Float64(Float64(Float64(t_2 * -0.5) * Float64(0.5 * h)) / Float64(l * d)) * Float64(Float64(t_1 * Float64(-0.5 / d)) * t_0)))); elseif (t_3 <= 5e+243) tmp = Float64(Float64(1.0 * sqrt(Float64(d / l))) * sqrt(Float64(d / h))); else tmp = Float64(abs(Float64(Float64(-d) / sqrt(Float64(l * h)))) * Float64(1.0 - Float64(Float64(Float64(-0.5 / d) * Float64(t_1 * t_0)) * Float64(-0.25 * Float64(Float64(t_1 * Float64(t_0 * h)) / Float64(d * l)))))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = min(abs(M), D); t_1 = max(abs(M), D); t_2 = t_0 * t_1; t_3 = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * ((t_2 / (2.0 * d)) ^ 2.0)) * (h / l))); tmp = 0.0; if (t_3 <= 2e-254) tmp = (abs(d) / sqrt((h * l))) * (1.0 - ((((t_2 * -0.5) * (0.5 * h)) / (l * d)) * ((t_1 * (-0.5 / d)) * t_0))); elseif (t_3 <= 5e+243) tmp = (1.0 * sqrt((d / l))) * sqrt((d / h)); else tmp = abs((-d / sqrt((l * h)))) * (1.0 - (((-0.5 / d) * (t_1 * t_0)) * (-0.25 * ((t_1 * (t_0 * h)) / (d * l))))); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Min[N[Abs[M], $MachinePrecision], D], $MachinePrecision]}, Block[{t$95$1 = N[Max[N[Abs[M], $MachinePrecision], D], $MachinePrecision]}, Block[{t$95$2 = N[(t$95$0 * t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(N[(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]}, If[LessEqual[t$95$3, 2e-254], N[(N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(t$95$2 * -0.5), $MachinePrecision] * N[(0.5 * h), $MachinePrecision]), $MachinePrecision] / N[(l * d), $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$1 * N[(-0.5 / d), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 5e+243], N[(N[(1.0 * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Abs[N[((-d) / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(N[(N[(-0.5 / d), $MachinePrecision] * N[(t$95$1 * t$95$0), $MachinePrecision]), $MachinePrecision] * N[(-0.25 * N[(N[(t$95$1 * N[(t$95$0 * h), $MachinePrecision]), $MachinePrecision] / N[(d * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
t_0 := \mathsf{min}\left(\left|M\right|, D\right)\\
t_1 := \mathsf{max}\left(\left|M\right|, D\right)\\
t_2 := t\_0 \cdot t\_1\\
t_3 := \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)\\
\mathbf{if}\;t\_3 \leq 2 \cdot 10^{-254}:\\
\;\;\;\;\frac{\left|d\right|}{\sqrt{h \cdot \ell}} \cdot \left(1 - \frac{\left(t\_2 \cdot -0.5\right) \cdot \left(0.5 \cdot h\right)}{\ell \cdot d} \cdot \left(\left(t\_1 \cdot \frac{-0.5}{d}\right) \cdot t\_0\right)\right)\\
\mathbf{elif}\;t\_3 \leq 5 \cdot 10^{+243}:\\
\;\;\;\;\left(1 \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{\frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{-d}{\sqrt{\ell \cdot h}}\right| \cdot \left(1 - \left(\frac{-0.5}{d} \cdot \left(t\_1 \cdot t\_0\right)\right) \cdot \left(-0.25 \cdot \frac{t\_1 \cdot \left(t\_0 \cdot h\right)}{d \cdot \ell}\right)\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)))) < 1.9999999999999998e-254Initial program 67.4%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-pow.f64N/A
unpow2N/A
sqr-neg-revN/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites69.0%
lift-*.f64N/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
associate-*r/N/A
lift-/.f64N/A
lift-*.f64N/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
lower-fabs.f6453.3%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
sqrt-divN/A
Applied rewrites72.2%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6476.8%
Applied rewrites76.8%
Applied rewrites74.0%
if 1.9999999999999998e-254 < (*.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.0000000000000004e243Initial program 67.4%
Taylor expanded in d around inf
Applied rewrites38.6%
metadata-eval38.6%
lift-/.f64N/A
*-commutativeN/A
*-commutativeN/A
lift-/.f6438.6%
lift-*.f64N/A
Applied rewrites38.6%
if 5.0000000000000004e243 < (*.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 67.4%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-pow.f64N/A
unpow2N/A
sqr-neg-revN/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites69.0%
lift-*.f64N/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
associate-*r/N/A
lift-/.f64N/A
lift-*.f64N/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
lower-fabs.f6453.3%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
sqrt-divN/A
Applied rewrites72.2%
Taylor expanded in d around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6473.6%
Applied rewrites73.6%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (fmin (fabs M) D))
(t_1 (fmax (fabs M) D))
(t_2
(*
(fabs (/ (- d) (sqrt (* l h))))
(-
1.0
(*
(* (/ -0.5 d) (* t_1 t_0))
(* -0.25 (/ (* t_1 (* t_0 h)) (* d l)))))))
(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 2e-254)
t_2
(if (<= t_3 5e+243)
(* (* 1.0 (sqrt (/ d l))) (sqrt (/ d h)))
t_2))))double code(double d, double h, double l, double M, double D) {
double t_0 = fmin(fabs(M), D);
double t_1 = fmax(fabs(M), D);
double t_2 = fabs((-d / sqrt((l * h)))) * (1.0 - (((-0.5 / d) * (t_1 * t_0)) * (-0.25 * ((t_1 * (t_0 * h)) / (d * l)))));
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 <= 2e-254) {
tmp = t_2;
} else if (t_3 <= 5e+243) {
tmp = (1.0 * sqrt((d / l))) * sqrt((d / h));
} else {
tmp = t_2;
}
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 = fmin(abs(m), d_1)
t_1 = fmax(abs(m), d_1)
t_2 = abs((-d / sqrt((l * h)))) * (1.0d0 - ((((-0.5d0) / d) * (t_1 * t_0)) * ((-0.25d0) * ((t_1 * (t_0 * h)) / (d * l)))))
t_3 = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((t_0 * t_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
if (t_3 <= 2d-254) then
tmp = t_2
else if (t_3 <= 5d+243) then
tmp = (1.0d0 * sqrt((d / l))) * sqrt((d / h))
else
tmp = t_2
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = fmin(Math.abs(M), D);
double t_1 = fmax(Math.abs(M), D);
double t_2 = Math.abs((-d / Math.sqrt((l * h)))) * (1.0 - (((-0.5 / d) * (t_1 * t_0)) * (-0.25 * ((t_1 * (t_0 * h)) / (d * l)))));
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 <= 2e-254) {
tmp = t_2;
} else if (t_3 <= 5e+243) {
tmp = (1.0 * Math.sqrt((d / l))) * Math.sqrt((d / h));
} else {
tmp = t_2;
}
return tmp;
}
def code(d, h, l, M, D): t_0 = fmin(math.fabs(M), D) t_1 = fmax(math.fabs(M), D) t_2 = math.fabs((-d / math.sqrt((l * h)))) * (1.0 - (((-0.5 / d) * (t_1 * t_0)) * (-0.25 * ((t_1 * (t_0 * h)) / (d * l))))) 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 <= 2e-254: tmp = t_2 elif t_3 <= 5e+243: tmp = (1.0 * math.sqrt((d / l))) * math.sqrt((d / h)) else: tmp = t_2 return tmp
function code(d, h, l, M, D) t_0 = fmin(abs(M), D) t_1 = fmax(abs(M), D) t_2 = Float64(abs(Float64(Float64(-d) / sqrt(Float64(l * h)))) * Float64(1.0 - Float64(Float64(Float64(-0.5 / d) * Float64(t_1 * t_0)) * Float64(-0.25 * Float64(Float64(t_1 * Float64(t_0 * h)) / Float64(d * l)))))) 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 <= 2e-254) tmp = t_2; elseif (t_3 <= 5e+243) tmp = Float64(Float64(1.0 * sqrt(Float64(d / l))) * sqrt(Float64(d / h))); else tmp = t_2; end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = min(abs(M), D); t_1 = max(abs(M), D); t_2 = abs((-d / sqrt((l * h)))) * (1.0 - (((-0.5 / d) * (t_1 * t_0)) * (-0.25 * ((t_1 * (t_0 * h)) / (d * l))))); 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 <= 2e-254) tmp = t_2; elseif (t_3 <= 5e+243) tmp = (1.0 * sqrt((d / l))) * sqrt((d / h)); 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], D], $MachinePrecision]}, Block[{t$95$1 = N[Max[N[Abs[M], $MachinePrecision], D], $MachinePrecision]}, Block[{t$95$2 = N[(N[Abs[N[((-d) / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(N[(N[(-0.5 / d), $MachinePrecision] * N[(t$95$1 * t$95$0), $MachinePrecision]), $MachinePrecision] * N[(-0.25 * N[(N[(t$95$1 * N[(t$95$0 * h), $MachinePrecision]), $MachinePrecision] / N[(d * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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, 2e-254], t$95$2, If[LessEqual[t$95$3, 5e+243], N[(N[(1.0 * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$2]]]]]]
\begin{array}{l}
t_0 := \mathsf{min}\left(\left|M\right|, D\right)\\
t_1 := \mathsf{max}\left(\left|M\right|, D\right)\\
t_2 := \left|\frac{-d}{\sqrt{\ell \cdot h}}\right| \cdot \left(1 - \left(\frac{-0.5}{d} \cdot \left(t\_1 \cdot t\_0\right)\right) \cdot \left(-0.25 \cdot \frac{t\_1 \cdot \left(t\_0 \cdot h\right)}{d \cdot \ell}\right)\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 2 \cdot 10^{-254}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_3 \leq 5 \cdot 10^{+243}:\\
\;\;\;\;\left(1 \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{\frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 1.9999999999999998e-254 or 5.0000000000000004e243 < (*.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 67.4%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-pow.f64N/A
unpow2N/A
sqr-neg-revN/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites69.0%
lift-*.f64N/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
associate-*r/N/A
lift-/.f64N/A
lift-*.f64N/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
lower-fabs.f6453.3%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
sqrt-divN/A
Applied rewrites72.2%
Taylor expanded in d around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6473.6%
Applied rewrites73.6%
if 1.9999999999999998e-254 < (*.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.0000000000000004e243Initial program 67.4%
Taylor expanded in d around inf
Applied rewrites38.6%
metadata-eval38.6%
lift-/.f64N/A
*-commutativeN/A
*-commutativeN/A
lift-/.f6438.6%
lift-*.f64N/A
Applied rewrites38.6%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (* h l)))
(t_1 (fmin M (fabs D)))
(t_2 (fmax M (fabs D)))
(t_3
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(-
1.0
(*
(* (/ 1.0 2.0) (pow (/ (* t_1 t_2) (* 2.0 d)) 2.0))
(/ h l)))))
(t_4 (/ (fabs d) t_0))
(t_5 (* t_4 1.0)))
(if (<= t_3 -5e-102)
(/
(*
t_4
(- d (/ (* (* (* 0.125 (* t_1 t_1)) t_2) (* t_2 h)) (* l d))))
d)
(if (<= t_3 2e-254)
t_5
(if (<= t_3 5e+243)
(* (* 1.0 (sqrt (/ d l))) (sqrt (/ d h)))
(if (<= t_3 INFINITY)
t_5
(/
(*
(-
1.0
(*
(/
(* (* (* (* t_2 t_2) t_1) t_1) h)
(* (* 4.0 (* d d)) l))
0.5))
(fabs d))
t_0)))))))double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((h * l));
double t_1 = fmin(M, fabs(D));
double t_2 = fmax(M, fabs(D));
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_1 * t_2) / (2.0 * d)), 2.0)) * (h / l)));
double t_4 = fabs(d) / t_0;
double t_5 = t_4 * 1.0;
double tmp;
if (t_3 <= -5e-102) {
tmp = (t_4 * (d - ((((0.125 * (t_1 * t_1)) * t_2) * (t_2 * h)) / (l * d)))) / d;
} else if (t_3 <= 2e-254) {
tmp = t_5;
} else if (t_3 <= 5e+243) {
tmp = (1.0 * sqrt((d / l))) * sqrt((d / h));
} else if (t_3 <= ((double) INFINITY)) {
tmp = t_5;
} else {
tmp = ((1.0 - ((((((t_2 * t_2) * t_1) * t_1) * h) / ((4.0 * (d * d)) * l)) * 0.5)) * fabs(d)) / t_0;
}
return tmp;
}
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((h * l));
double t_1 = fmin(M, Math.abs(D));
double t_2 = fmax(M, Math.abs(D));
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_1 * t_2) / (2.0 * d)), 2.0)) * (h / l)));
double t_4 = Math.abs(d) / t_0;
double t_5 = t_4 * 1.0;
double tmp;
if (t_3 <= -5e-102) {
tmp = (t_4 * (d - ((((0.125 * (t_1 * t_1)) * t_2) * (t_2 * h)) / (l * d)))) / d;
} else if (t_3 <= 2e-254) {
tmp = t_5;
} else if (t_3 <= 5e+243) {
tmp = (1.0 * Math.sqrt((d / l))) * Math.sqrt((d / h));
} else if (t_3 <= Double.POSITIVE_INFINITY) {
tmp = t_5;
} else {
tmp = ((1.0 - ((((((t_2 * t_2) * t_1) * t_1) * h) / ((4.0 * (d * d)) * l)) * 0.5)) * Math.abs(d)) / t_0;
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.sqrt((h * l)) t_1 = fmin(M, math.fabs(D)) t_2 = fmax(M, math.fabs(D)) 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_1 * t_2) / (2.0 * d)), 2.0)) * (h / l))) t_4 = math.fabs(d) / t_0 t_5 = t_4 * 1.0 tmp = 0 if t_3 <= -5e-102: tmp = (t_4 * (d - ((((0.125 * (t_1 * t_1)) * t_2) * (t_2 * h)) / (l * d)))) / d elif t_3 <= 2e-254: tmp = t_5 elif t_3 <= 5e+243: tmp = (1.0 * math.sqrt((d / l))) * math.sqrt((d / h)) elif t_3 <= math.inf: tmp = t_5 else: tmp = ((1.0 - ((((((t_2 * t_2) * t_1) * t_1) * h) / ((4.0 * (d * d)) * l)) * 0.5)) * math.fabs(d)) / t_0 return tmp
function code(d, h, l, M, D) t_0 = sqrt(Float64(h * l)) t_1 = fmin(M, abs(D)) t_2 = fmax(M, abs(D)) 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_1 * t_2) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) t_4 = Float64(abs(d) / t_0) t_5 = Float64(t_4 * 1.0) tmp = 0.0 if (t_3 <= -5e-102) tmp = Float64(Float64(t_4 * Float64(d - Float64(Float64(Float64(Float64(0.125 * Float64(t_1 * t_1)) * t_2) * Float64(t_2 * h)) / Float64(l * d)))) / d); elseif (t_3 <= 2e-254) tmp = t_5; elseif (t_3 <= 5e+243) tmp = Float64(Float64(1.0 * sqrt(Float64(d / l))) * sqrt(Float64(d / h))); elseif (t_3 <= Inf) tmp = t_5; else tmp = Float64(Float64(Float64(1.0 - Float64(Float64(Float64(Float64(Float64(Float64(t_2 * t_2) * t_1) * t_1) * h) / Float64(Float64(4.0 * Float64(d * d)) * l)) * 0.5)) * abs(d)) / t_0); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = sqrt((h * l)); t_1 = min(M, abs(D)); t_2 = max(M, abs(D)); t_3 = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((t_1 * t_2) / (2.0 * d)) ^ 2.0)) * (h / l))); t_4 = abs(d) / t_0; t_5 = t_4 * 1.0; tmp = 0.0; if (t_3 <= -5e-102) tmp = (t_4 * (d - ((((0.125 * (t_1 * t_1)) * t_2) * (t_2 * h)) / (l * d)))) / d; elseif (t_3 <= 2e-254) tmp = t_5; elseif (t_3 <= 5e+243) tmp = (1.0 * sqrt((d / l))) * sqrt((d / h)); elseif (t_3 <= Inf) tmp = t_5; else tmp = ((1.0 - ((((((t_2 * t_2) * t_1) * t_1) * h) / ((4.0 * (d * d)) * l)) * 0.5)) * abs(d)) / t_0; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Min[M, N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Max[M, N[Abs[D], $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$1 * t$95$2), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[Abs[d], $MachinePrecision] / t$95$0), $MachinePrecision]}, Block[{t$95$5 = N[(t$95$4 * 1.0), $MachinePrecision]}, If[LessEqual[t$95$3, -5e-102], N[(N[(t$95$4 * N[(d - N[(N[(N[(N[(0.125 * N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision] * N[(t$95$2 * h), $MachinePrecision]), $MachinePrecision] / N[(l * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision], If[LessEqual[t$95$3, 2e-254], t$95$5, If[LessEqual[t$95$3, 5e+243], N[(N[(1.0 * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, Infinity], t$95$5, N[(N[(N[(1.0 - N[(N[(N[(N[(N[(N[(t$95$2 * t$95$2), $MachinePrecision] * t$95$1), $MachinePrecision] * t$95$1), $MachinePrecision] * h), $MachinePrecision] / N[(N[(4.0 * N[(d * d), $MachinePrecision]), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] * N[Abs[d], $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]]]]]]]]]]]
\begin{array}{l}
t_0 := \sqrt{h \cdot \ell}\\
t_1 := \mathsf{min}\left(M, \left|D\right|\right)\\
t_2 := \mathsf{max}\left(M, \left|D\right|\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\_1 \cdot t\_2}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
t_4 := \frac{\left|d\right|}{t\_0}\\
t_5 := t\_4 \cdot 1\\
\mathbf{if}\;t\_3 \leq -5 \cdot 10^{-102}:\\
\;\;\;\;\frac{t\_4 \cdot \left(d - \frac{\left(\left(0.125 \cdot \left(t\_1 \cdot t\_1\right)\right) \cdot t\_2\right) \cdot \left(t\_2 \cdot h\right)}{\ell \cdot d}\right)}{d}\\
\mathbf{elif}\;t\_3 \leq 2 \cdot 10^{-254}:\\
\;\;\;\;t\_5\\
\mathbf{elif}\;t\_3 \leq 5 \cdot 10^{+243}:\\
\;\;\;\;\left(1 \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;t\_3 \leq \infty:\\
\;\;\;\;t\_5\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 - \frac{\left(\left(\left(t\_2 \cdot t\_2\right) \cdot t\_1\right) \cdot t\_1\right) \cdot h}{\left(4 \cdot \left(d \cdot d\right)\right) \cdot \ell} \cdot 0.5\right) \cdot \left|d\right|}{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.0000000000000003e-102Initial program 67.4%
Applied rewrites35.9%
lift-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites42.0%
Applied rewrites54.7%
if -5.0000000000000003e-102 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 1.9999999999999998e-254 or 5.0000000000000004e243 < (*.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 67.4%
Taylor expanded in d around inf
Applied rewrites38.6%
Applied rewrites41.7%
if 1.9999999999999998e-254 < (*.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.0000000000000004e243Initial program 67.4%
Taylor expanded in d around inf
Applied rewrites38.6%
metadata-eval38.6%
lift-/.f64N/A
*-commutativeN/A
*-commutativeN/A
lift-/.f6438.6%
lift-*.f64N/A
Applied rewrites38.6%
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 67.4%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-pow.f64N/A
unpow2N/A
sqr-neg-revN/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites69.0%
lift-*.f64N/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
associate-*r/N/A
lift-/.f64N/A
lift-*.f64N/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
lower-fabs.f6453.3%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
sqrt-divN/A
Applied rewrites72.2%
Applied rewrites55.9%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (* h l)))
(t_1 (/ (fabs d) t_0))
(t_2 (* t_1 1.0))
(t_3 (fmin M (fabs D)))
(t_4 (fmax M (fabs D)))
(t_5
(-
1.0
(*
(/ (* (* (* (* t_4 t_4) t_3) t_3) h) (* (* 4.0 (* d d)) l))
0.5)))
(t_6
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(-
1.0
(*
(* (/ 1.0 2.0) (pow (/ (* t_3 t_4) (* 2.0 d)) 2.0))
(/ h l))))))
(if (<= t_6 -5e-113)
(* t_1 t_5)
(if (<= t_6 2e-254)
t_2
(if (<= t_6 5e+243)
(* (* 1.0 (sqrt (/ d l))) (sqrt (/ d h)))
(if (<= t_6 INFINITY) t_2 (/ (* t_5 (fabs d)) t_0)))))))double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((h * l));
double t_1 = fabs(d) / t_0;
double t_2 = t_1 * 1.0;
double t_3 = fmin(M, fabs(D));
double t_4 = fmax(M, fabs(D));
double t_5 = 1.0 - ((((((t_4 * t_4) * t_3) * t_3) * h) / ((4.0 * (d * d)) * l)) * 0.5);
double t_6 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((t_3 * t_4) / (2.0 * d)), 2.0)) * (h / l)));
double tmp;
if (t_6 <= -5e-113) {
tmp = t_1 * t_5;
} else if (t_6 <= 2e-254) {
tmp = t_2;
} else if (t_6 <= 5e+243) {
tmp = (1.0 * sqrt((d / l))) * sqrt((d / h));
} else if (t_6 <= ((double) INFINITY)) {
tmp = t_2;
} else {
tmp = (t_5 * fabs(d)) / t_0;
}
return tmp;
}
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((h * l));
double t_1 = Math.abs(d) / t_0;
double t_2 = t_1 * 1.0;
double t_3 = fmin(M, Math.abs(D));
double t_4 = fmax(M, Math.abs(D));
double t_5 = 1.0 - ((((((t_4 * t_4) * t_3) * t_3) * h) / ((4.0 * (d * d)) * l)) * 0.5);
double t_6 = (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_3 * t_4) / (2.0 * d)), 2.0)) * (h / l)));
double tmp;
if (t_6 <= -5e-113) {
tmp = t_1 * t_5;
} else if (t_6 <= 2e-254) {
tmp = t_2;
} else if (t_6 <= 5e+243) {
tmp = (1.0 * Math.sqrt((d / l))) * Math.sqrt((d / h));
} else if (t_6 <= Double.POSITIVE_INFINITY) {
tmp = t_2;
} else {
tmp = (t_5 * Math.abs(d)) / t_0;
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.sqrt((h * l)) t_1 = math.fabs(d) / t_0 t_2 = t_1 * 1.0 t_3 = fmin(M, math.fabs(D)) t_4 = fmax(M, math.fabs(D)) t_5 = 1.0 - ((((((t_4 * t_4) * t_3) * t_3) * h) / ((4.0 * (d * d)) * l)) * 0.5) t_6 = (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_3 * t_4) / (2.0 * d)), 2.0)) * (h / l))) tmp = 0 if t_6 <= -5e-113: tmp = t_1 * t_5 elif t_6 <= 2e-254: tmp = t_2 elif t_6 <= 5e+243: tmp = (1.0 * math.sqrt((d / l))) * math.sqrt((d / h)) elif t_6 <= math.inf: tmp = t_2 else: tmp = (t_5 * math.fabs(d)) / t_0 return tmp
function code(d, h, l, M, D) t_0 = sqrt(Float64(h * l)) t_1 = Float64(abs(d) / t_0) t_2 = Float64(t_1 * 1.0) t_3 = fmin(M, abs(D)) t_4 = fmax(M, abs(D)) t_5 = Float64(1.0 - Float64(Float64(Float64(Float64(Float64(Float64(t_4 * t_4) * t_3) * t_3) * h) / Float64(Float64(4.0 * Float64(d * d)) * l)) * 0.5)) t_6 = 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_3 * t_4) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) tmp = 0.0 if (t_6 <= -5e-113) tmp = Float64(t_1 * t_5); elseif (t_6 <= 2e-254) tmp = t_2; elseif (t_6 <= 5e+243) tmp = Float64(Float64(1.0 * sqrt(Float64(d / l))) * sqrt(Float64(d / h))); elseif (t_6 <= Inf) tmp = t_2; else tmp = Float64(Float64(t_5 * abs(d)) / t_0); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = sqrt((h * l)); t_1 = abs(d) / t_0; t_2 = t_1 * 1.0; t_3 = min(M, abs(D)); t_4 = max(M, abs(D)); t_5 = 1.0 - ((((((t_4 * t_4) * t_3) * t_3) * h) / ((4.0 * (d * d)) * l)) * 0.5); t_6 = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((t_3 * t_4) / (2.0 * d)) ^ 2.0)) * (h / l))); tmp = 0.0; if (t_6 <= -5e-113) tmp = t_1 * t_5; elseif (t_6 <= 2e-254) tmp = t_2; elseif (t_6 <= 5e+243) tmp = (1.0 * sqrt((d / l))) * sqrt((d / h)); elseif (t_6 <= Inf) tmp = t_2; else tmp = (t_5 * abs(d)) / t_0; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Abs[d], $MachinePrecision] / t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * 1.0), $MachinePrecision]}, Block[{t$95$3 = N[Min[M, N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[Max[M, N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$5 = N[(1.0 - N[(N[(N[(N[(N[(N[(t$95$4 * t$95$4), $MachinePrecision] * t$95$3), $MachinePrecision] * t$95$3), $MachinePrecision] * h), $MachinePrecision] / N[(N[(4.0 * N[(d * d), $MachinePrecision]), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$6 = 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$3 * t$95$4), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$6, -5e-113], N[(t$95$1 * t$95$5), $MachinePrecision], If[LessEqual[t$95$6, 2e-254], t$95$2, If[LessEqual[t$95$6, 5e+243], N[(N[(1.0 * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$6, Infinity], t$95$2, N[(N[(t$95$5 * N[Abs[d], $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]]]]]]]]]]]]
\begin{array}{l}
t_0 := \sqrt{h \cdot \ell}\\
t_1 := \frac{\left|d\right|}{t\_0}\\
t_2 := t\_1 \cdot 1\\
t_3 := \mathsf{min}\left(M, \left|D\right|\right)\\
t_4 := \mathsf{max}\left(M, \left|D\right|\right)\\
t_5 := 1 - \frac{\left(\left(\left(t\_4 \cdot t\_4\right) \cdot t\_3\right) \cdot t\_3\right) \cdot h}{\left(4 \cdot \left(d \cdot d\right)\right) \cdot \ell} \cdot 0.5\\
t_6 := \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\_3 \cdot t\_4}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{if}\;t\_6 \leq -5 \cdot 10^{-113}:\\
\;\;\;\;t\_1 \cdot t\_5\\
\mathbf{elif}\;t\_6 \leq 2 \cdot 10^{-254}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_6 \leq 5 \cdot 10^{+243}:\\
\;\;\;\;\left(1 \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;t\_6 \leq \infty:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_5 \cdot \left|d\right|}{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)))) < -4.9999999999999997e-113Initial program 67.4%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-pow.f64N/A
unpow2N/A
sqr-neg-revN/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites69.0%
lift-*.f64N/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
associate-*r/N/A
lift-/.f64N/A
lift-*.f64N/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
lower-fabs.f6453.3%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
sqrt-divN/A
Applied rewrites72.2%
Applied rewrites54.6%
if -4.9999999999999997e-113 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 1.9999999999999998e-254 or 5.0000000000000004e243 < (*.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 67.4%
Taylor expanded in d around inf
Applied rewrites38.6%
Applied rewrites41.7%
if 1.9999999999999998e-254 < (*.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.0000000000000004e243Initial program 67.4%
Taylor expanded in d around inf
Applied rewrites38.6%
metadata-eval38.6%
lift-/.f64N/A
*-commutativeN/A
*-commutativeN/A
lift-/.f6438.6%
lift-*.f64N/A
Applied rewrites38.6%
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 67.4%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-pow.f64N/A
unpow2N/A
sqr-neg-revN/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites69.0%
lift-*.f64N/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
associate-*r/N/A
lift-/.f64N/A
lift-*.f64N/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
lower-fabs.f6453.3%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
sqrt-divN/A
Applied rewrites72.2%
Applied rewrites55.9%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (/ (fabs d) (sqrt (* h l))))
(t_1 (fmin (fabs M) (fabs D)))
(t_2 (fmax (fabs M) (fabs D)))
(t_3
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(-
1.0
(*
(* (/ 1.0 2.0) (pow (/ (* t_1 t_2) (* 2.0 d)) 2.0))
(/ h l))))))
(if (<= t_3 -5e-113)
(*
t_0
(-
1.0
(*
(/ (* (* (* (* t_2 t_2) t_1) t_1) h) (* (* 4.0 (* d d)) l))
0.5)))
(if (<= t_3 2e-254)
(* t_0 1.0)
(if (<= t_3 5e+243)
(* (* 1.0 (sqrt (/ d l))) (sqrt (/ d h)))
(*
t_0
(-
1.0
(/
(* (* (* 0.125 (* t_1 t_1)) t_2) (* t_2 h))
(* (* d d) l)))))))))double code(double d, double h, double l, double M, double D) {
double t_0 = fabs(d) / sqrt((h * l));
double t_1 = fmin(fabs(M), fabs(D));
double t_2 = fmax(fabs(M), fabs(D));
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_1 * t_2) / (2.0 * d)), 2.0)) * (h / l)));
double tmp;
if (t_3 <= -5e-113) {
tmp = t_0 * (1.0 - ((((((t_2 * t_2) * t_1) * t_1) * h) / ((4.0 * (d * d)) * l)) * 0.5));
} else if (t_3 <= 2e-254) {
tmp = t_0 * 1.0;
} else if (t_3 <= 5e+243) {
tmp = (1.0 * sqrt((d / l))) * sqrt((d / h));
} else {
tmp = t_0 * (1.0 - ((((0.125 * (t_1 * t_1)) * t_2) * (t_2 * h)) / ((d * d) * 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 = fmin(abs(m), abs(d_1))
t_2 = fmax(abs(m), abs(d_1))
t_3 = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((t_1 * t_2) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
if (t_3 <= (-5d-113)) then
tmp = t_0 * (1.0d0 - ((((((t_2 * t_2) * t_1) * t_1) * h) / ((4.0d0 * (d * d)) * l)) * 0.5d0))
else if (t_3 <= 2d-254) then
tmp = t_0 * 1.0d0
else if (t_3 <= 5d+243) then
tmp = (1.0d0 * sqrt((d / l))) * sqrt((d / h))
else
tmp = t_0 * (1.0d0 - ((((0.125d0 * (t_1 * t_1)) * t_2) * (t_2 * h)) / ((d * d) * 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 = fmin(Math.abs(M), Math.abs(D));
double t_2 = fmax(Math.abs(M), Math.abs(D));
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_1 * t_2) / (2.0 * d)), 2.0)) * (h / l)));
double tmp;
if (t_3 <= -5e-113) {
tmp = t_0 * (1.0 - ((((((t_2 * t_2) * t_1) * t_1) * h) / ((4.0 * (d * d)) * l)) * 0.5));
} else if (t_3 <= 2e-254) {
tmp = t_0 * 1.0;
} else if (t_3 <= 5e+243) {
tmp = (1.0 * Math.sqrt((d / l))) * Math.sqrt((d / h));
} else {
tmp = t_0 * (1.0 - ((((0.125 * (t_1 * t_1)) * t_2) * (t_2 * h)) / ((d * d) * l)));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.fabs(d) / math.sqrt((h * l)) t_1 = fmin(math.fabs(M), math.fabs(D)) t_2 = fmax(math.fabs(M), math.fabs(D)) 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_1 * t_2) / (2.0 * d)), 2.0)) * (h / l))) tmp = 0 if t_3 <= -5e-113: tmp = t_0 * (1.0 - ((((((t_2 * t_2) * t_1) * t_1) * h) / ((4.0 * (d * d)) * l)) * 0.5)) elif t_3 <= 2e-254: tmp = t_0 * 1.0 elif t_3 <= 5e+243: tmp = (1.0 * math.sqrt((d / l))) * math.sqrt((d / h)) else: tmp = t_0 * (1.0 - ((((0.125 * (t_1 * t_1)) * t_2) * (t_2 * h)) / ((d * d) * l))) return tmp
function code(d, h, l, M, D) t_0 = Float64(abs(d) / sqrt(Float64(h * l))) t_1 = fmin(abs(M), abs(D)) t_2 = fmax(abs(M), abs(D)) 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_1 * t_2) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) tmp = 0.0 if (t_3 <= -5e-113) tmp = Float64(t_0 * Float64(1.0 - Float64(Float64(Float64(Float64(Float64(Float64(t_2 * t_2) * t_1) * t_1) * h) / Float64(Float64(4.0 * Float64(d * d)) * l)) * 0.5))); elseif (t_3 <= 2e-254) tmp = Float64(t_0 * 1.0); elseif (t_3 <= 5e+243) tmp = Float64(Float64(1.0 * sqrt(Float64(d / l))) * sqrt(Float64(d / h))); else tmp = Float64(t_0 * Float64(1.0 - Float64(Float64(Float64(Float64(0.125 * Float64(t_1 * t_1)) * t_2) * Float64(t_2 * h)) / Float64(Float64(d * d) * l)))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = abs(d) / sqrt((h * l)); t_1 = min(abs(M), abs(D)); t_2 = max(abs(M), abs(D)); t_3 = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((t_1 * t_2) / (2.0 * d)) ^ 2.0)) * (h / l))); tmp = 0.0; if (t_3 <= -5e-113) tmp = t_0 * (1.0 - ((((((t_2 * t_2) * t_1) * t_1) * h) / ((4.0 * (d * d)) * l)) * 0.5)); elseif (t_3 <= 2e-254) tmp = t_0 * 1.0; elseif (t_3 <= 5e+243) tmp = (1.0 * sqrt((d / l))) * sqrt((d / h)); else tmp = t_0 * (1.0 - ((((0.125 * (t_1 * t_1)) * t_2) * (t_2 * h)) / ((d * d) * 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[Min[N[Abs[M], $MachinePrecision], N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Max[N[Abs[M], $MachinePrecision], N[Abs[D], $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$1 * t$95$2), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, -5e-113], N[(t$95$0 * N[(1.0 - N[(N[(N[(N[(N[(N[(t$95$2 * t$95$2), $MachinePrecision] * t$95$1), $MachinePrecision] * t$95$1), $MachinePrecision] * h), $MachinePrecision] / N[(N[(4.0 * N[(d * d), $MachinePrecision]), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 2e-254], N[(t$95$0 * 1.0), $MachinePrecision], If[LessEqual[t$95$3, 5e+243], N[(N[(1.0 * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(1.0 - N[(N[(N[(N[(0.125 * N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision] * N[(t$95$2 * h), $MachinePrecision]), $MachinePrecision] / N[(N[(d * d), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
t_0 := \frac{\left|d\right|}{\sqrt{h \cdot \ell}}\\
t_1 := \mathsf{min}\left(\left|M\right|, \left|D\right|\right)\\
t_2 := \mathsf{max}\left(\left|M\right|, \left|D\right|\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\_1 \cdot t\_2}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{if}\;t\_3 \leq -5 \cdot 10^{-113}:\\
\;\;\;\;t\_0 \cdot \left(1 - \frac{\left(\left(\left(t\_2 \cdot t\_2\right) \cdot t\_1\right) \cdot t\_1\right) \cdot h}{\left(4 \cdot \left(d \cdot d\right)\right) \cdot \ell} \cdot 0.5\right)\\
\mathbf{elif}\;t\_3 \leq 2 \cdot 10^{-254}:\\
\;\;\;\;t\_0 \cdot 1\\
\mathbf{elif}\;t\_3 \leq 5 \cdot 10^{+243}:\\
\;\;\;\;\left(1 \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{\frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \left(1 - \frac{\left(\left(0.125 \cdot \left(t\_1 \cdot t\_1\right)\right) \cdot t\_2\right) \cdot \left(t\_2 \cdot h\right)}{\left(d \cdot d\right) \cdot \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)))) < -4.9999999999999997e-113Initial program 67.4%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-pow.f64N/A
unpow2N/A
sqr-neg-revN/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites69.0%
lift-*.f64N/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
associate-*r/N/A
lift-/.f64N/A
lift-*.f64N/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
lower-fabs.f6453.3%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
sqrt-divN/A
Applied rewrites72.2%
Applied rewrites54.6%
if -4.9999999999999997e-113 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 1.9999999999999998e-254Initial program 67.4%
Taylor expanded in d around inf
Applied rewrites38.6%
Applied rewrites41.7%
if 1.9999999999999998e-254 < (*.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.0000000000000004e243Initial program 67.4%
Taylor expanded in d around inf
Applied rewrites38.6%
metadata-eval38.6%
lift-/.f64N/A
*-commutativeN/A
*-commutativeN/A
lift-/.f6438.6%
lift-*.f64N/A
Applied rewrites38.6%
if 5.0000000000000004e243 < (*.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 67.4%
Applied rewrites35.9%
lift-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites42.0%
Applied rewrites54.7%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (/ (fabs d) (sqrt (* h l))))
(t_1 (fmin (fabs M) (fabs D)))
(t_2 (fmax (fabs M) (fabs D)))
(t_3
(*
t_0
(-
1.0
(/
(* (* (* 0.125 (* t_1 t_1)) t_2) (* t_2 h))
(* (* d d) l)))))
(t_4
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(-
1.0
(*
(* (/ 1.0 2.0) (pow (/ (* t_1 t_2) (* 2.0 d)) 2.0))
(/ h l))))))
(if (<= t_4 -5e-102)
t_3
(if (<= t_4 2e-254)
(* t_0 1.0)
(if (<= t_4 5e+243)
(* (* 1.0 (sqrt (/ d l))) (sqrt (/ d h)))
t_3)))))double code(double d, double h, double l, double M, double D) {
double t_0 = fabs(d) / sqrt((h * l));
double t_1 = fmin(fabs(M), fabs(D));
double t_2 = fmax(fabs(M), fabs(D));
double t_3 = t_0 * (1.0 - ((((0.125 * (t_1 * t_1)) * t_2) * (t_2 * h)) / ((d * d) * l)));
double t_4 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((t_1 * t_2) / (2.0 * d)), 2.0)) * (h / l)));
double tmp;
if (t_4 <= -5e-102) {
tmp = t_3;
} else if (t_4 <= 2e-254) {
tmp = t_0 * 1.0;
} else if (t_4 <= 5e+243) {
tmp = (1.0 * sqrt((d / l))) * sqrt((d / h));
} else {
tmp = t_3;
}
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) :: t_4
real(8) :: tmp
t_0 = abs(d) / sqrt((h * l))
t_1 = fmin(abs(m), abs(d_1))
t_2 = fmax(abs(m), abs(d_1))
t_3 = t_0 * (1.0d0 - ((((0.125d0 * (t_1 * t_1)) * t_2) * (t_2 * h)) / ((d * d) * l)))
t_4 = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((t_1 * t_2) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
if (t_4 <= (-5d-102)) then
tmp = t_3
else if (t_4 <= 2d-254) then
tmp = t_0 * 1.0d0
else if (t_4 <= 5d+243) then
tmp = (1.0d0 * sqrt((d / l))) * sqrt((d / h))
else
tmp = t_3
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 = fmin(Math.abs(M), Math.abs(D));
double t_2 = fmax(Math.abs(M), Math.abs(D));
double t_3 = t_0 * (1.0 - ((((0.125 * (t_1 * t_1)) * t_2) * (t_2 * h)) / ((d * d) * l)));
double t_4 = (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_1 * t_2) / (2.0 * d)), 2.0)) * (h / l)));
double tmp;
if (t_4 <= -5e-102) {
tmp = t_3;
} else if (t_4 <= 2e-254) {
tmp = t_0 * 1.0;
} else if (t_4 <= 5e+243) {
tmp = (1.0 * Math.sqrt((d / l))) * Math.sqrt((d / h));
} else {
tmp = t_3;
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.fabs(d) / math.sqrt((h * l)) t_1 = fmin(math.fabs(M), math.fabs(D)) t_2 = fmax(math.fabs(M), math.fabs(D)) t_3 = t_0 * (1.0 - ((((0.125 * (t_1 * t_1)) * t_2) * (t_2 * h)) / ((d * d) * l))) t_4 = (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_1 * t_2) / (2.0 * d)), 2.0)) * (h / l))) tmp = 0 if t_4 <= -5e-102: tmp = t_3 elif t_4 <= 2e-254: tmp = t_0 * 1.0 elif t_4 <= 5e+243: tmp = (1.0 * math.sqrt((d / l))) * math.sqrt((d / h)) else: tmp = t_3 return tmp
function code(d, h, l, M, D) t_0 = Float64(abs(d) / sqrt(Float64(h * l))) t_1 = fmin(abs(M), abs(D)) t_2 = fmax(abs(M), abs(D)) t_3 = Float64(t_0 * Float64(1.0 - Float64(Float64(Float64(Float64(0.125 * Float64(t_1 * t_1)) * t_2) * Float64(t_2 * h)) / Float64(Float64(d * d) * l)))) t_4 = 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_1 * t_2) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) tmp = 0.0 if (t_4 <= -5e-102) tmp = t_3; elseif (t_4 <= 2e-254) tmp = Float64(t_0 * 1.0); elseif (t_4 <= 5e+243) tmp = Float64(Float64(1.0 * sqrt(Float64(d / l))) * sqrt(Float64(d / h))); else tmp = t_3; end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = abs(d) / sqrt((h * l)); t_1 = min(abs(M), abs(D)); t_2 = max(abs(M), abs(D)); t_3 = t_0 * (1.0 - ((((0.125 * (t_1 * t_1)) * t_2) * (t_2 * h)) / ((d * d) * l))); t_4 = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((t_1 * t_2) / (2.0 * d)) ^ 2.0)) * (h / l))); tmp = 0.0; if (t_4 <= -5e-102) tmp = t_3; elseif (t_4 <= 2e-254) tmp = t_0 * 1.0; elseif (t_4 <= 5e+243) tmp = (1.0 * sqrt((d / l))) * sqrt((d / h)); else tmp = t_3; 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[Min[N[Abs[M], $MachinePrecision], N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Max[N[Abs[M], $MachinePrecision], N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(t$95$0 * N[(1.0 - N[(N[(N[(N[(0.125 * N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision] * N[(t$95$2 * h), $MachinePrecision]), $MachinePrecision] / N[(N[(d * d), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = 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$1 * t$95$2), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$4, -5e-102], t$95$3, If[LessEqual[t$95$4, 2e-254], N[(t$95$0 * 1.0), $MachinePrecision], If[LessEqual[t$95$4, 5e+243], N[(N[(1.0 * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$3]]]]]]]]
\begin{array}{l}
t_0 := \frac{\left|d\right|}{\sqrt{h \cdot \ell}}\\
t_1 := \mathsf{min}\left(\left|M\right|, \left|D\right|\right)\\
t_2 := \mathsf{max}\left(\left|M\right|, \left|D\right|\right)\\
t_3 := t\_0 \cdot \left(1 - \frac{\left(\left(0.125 \cdot \left(t\_1 \cdot t\_1\right)\right) \cdot t\_2\right) \cdot \left(t\_2 \cdot h\right)}{\left(d \cdot d\right) \cdot \ell}\right)\\
t_4 := \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\_1 \cdot t\_2}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{if}\;t\_4 \leq -5 \cdot 10^{-102}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_4 \leq 2 \cdot 10^{-254}:\\
\;\;\;\;t\_0 \cdot 1\\
\mathbf{elif}\;t\_4 \leq 5 \cdot 10^{+243}:\\
\;\;\;\;\left(1 \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{\frac{d}{h}}\\
\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)))) < -5.0000000000000003e-102 or 5.0000000000000004e243 < (*.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 67.4%
Applied rewrites35.9%
lift-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites42.0%
Applied rewrites54.7%
if -5.0000000000000003e-102 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 1.9999999999999998e-254Initial program 67.4%
Taylor expanded in d around inf
Applied rewrites38.6%
Applied rewrites41.7%
if 1.9999999999999998e-254 < (*.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.0000000000000004e243Initial program 67.4%
Taylor expanded in d around inf
Applied rewrites38.6%
metadata-eval38.6%
lift-/.f64N/A
*-commutativeN/A
*-commutativeN/A
lift-/.f6438.6%
lift-*.f64N/A
Applied rewrites38.6%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(-
1.0
(*
(* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0))
(/ h l)))))
(t_1 (sqrt (* h l))))
(if (<= t_0 0.0)
(/ (- d (/ (* (* (* 0.125 (* M M)) D) (* D h)) (* l d))) (- t_1))
(if (<= t_0 5e+243)
(* (* 1.0 (sqrt (/ d l))) (sqrt (/ d h)))
(* (/ (fabs d) t_1) 1.0)))))double code(double d, double h, double l, double M, double D) {
double t_0 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double t_1 = sqrt((h * l));
double tmp;
if (t_0 <= 0.0) {
tmp = (d - ((((0.125 * (M * M)) * D) * (D * h)) / (l * d))) / -t_1;
} else if (t_0 <= 5e+243) {
tmp = (1.0 * sqrt((d / l))) * sqrt((d / h));
} else {
tmp = (fabs(d) / t_1) * 1.0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
t_1 = sqrt((h * l))
if (t_0 <= 0.0d0) then
tmp = (d - ((((0.125d0 * (m * m)) * d_1) * (d_1 * h)) / (l * d))) / -t_1
else if (t_0 <= 5d+243) then
tmp = (1.0d0 * sqrt((d / l))) * sqrt((d / h))
else
tmp = (abs(d) / t_1) * 1.0d0
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double t_1 = Math.sqrt((h * l));
double tmp;
if (t_0 <= 0.0) {
tmp = (d - ((((0.125 * (M * M)) * D) * (D * h)) / (l * d))) / -t_1;
} else if (t_0 <= 5e+243) {
tmp = (1.0 * Math.sqrt((d / l))) * Math.sqrt((d / h));
} else {
tmp = (Math.abs(d) / t_1) * 1.0;
}
return tmp;
}
def code(d, h, l, M, D): t_0 = (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l))) t_1 = math.sqrt((h * l)) tmp = 0 if t_0 <= 0.0: tmp = (d - ((((0.125 * (M * M)) * D) * (D * h)) / (l * d))) / -t_1 elif t_0 <= 5e+243: tmp = (1.0 * math.sqrt((d / l))) * math.sqrt((d / h)) else: tmp = (math.fabs(d) / t_1) * 1.0 return tmp
function code(d, h, l, M, D) t_0 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) t_1 = sqrt(Float64(h * l)) tmp = 0.0 if (t_0 <= 0.0) tmp = Float64(Float64(d - Float64(Float64(Float64(Float64(0.125 * Float64(M * M)) * D) * Float64(D * h)) / Float64(l * d))) / Float64(-t_1)); elseif (t_0 <= 5e+243) tmp = Float64(Float64(1.0 * sqrt(Float64(d / l))) * sqrt(Float64(d / h))); else tmp = Float64(Float64(abs(d) / t_1) * 1.0); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); t_1 = sqrt((h * l)); tmp = 0.0; if (t_0 <= 0.0) tmp = (d - ((((0.125 * (M * M)) * D) * (D * h)) / (l * d))) / -t_1; elseif (t_0 <= 5e+243) tmp = (1.0 * sqrt((d / l))) * sqrt((d / h)); else tmp = (abs(d) / t_1) * 1.0; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, 0.0], N[(N[(d - N[(N[(N[(N[(0.125 * N[(M * M), $MachinePrecision]), $MachinePrecision] * D), $MachinePrecision] * N[(D * h), $MachinePrecision]), $MachinePrecision] / N[(l * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / (-t$95$1)), $MachinePrecision], If[LessEqual[t$95$0, 5e+243], N[(N[(1.0 * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[Abs[d], $MachinePrecision] / t$95$1), $MachinePrecision] * 1.0), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
t_1 := \sqrt{h \cdot \ell}\\
\mathbf{if}\;t\_0 \leq 0:\\
\;\;\;\;\frac{d - \frac{\left(\left(0.125 \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot \left(D \cdot h\right)}{\ell \cdot d}}{-t\_1}\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+243}:\\
\;\;\;\;\left(1 \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{\frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left|d\right|}{t\_1} \cdot 1\\
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 0.0Initial program 67.4%
Applied rewrites35.9%
Applied rewrites24.3%
Applied rewrites34.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.0000000000000004e243Initial program 67.4%
Taylor expanded in d around inf
Applied rewrites38.6%
metadata-eval38.6%
lift-/.f64N/A
*-commutativeN/A
*-commutativeN/A
lift-/.f6438.6%
lift-*.f64N/A
Applied rewrites38.6%
if 5.0000000000000004e243 < (*.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 67.4%
Taylor expanded in d around inf
Applied rewrites38.6%
Applied rewrites41.7%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(-
1.0
(*
(* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0))
(/ h l))))))
(if (<= t_0 0.0)
(* (* -1.0 (/ (fabs d) (* h (sqrt (/ l h))))) 1.0)
(if (<= t_0 5e+243)
(* (* 1.0 (sqrt (/ d l))) (sqrt (/ d h)))
(* (/ (fabs d) (sqrt (* h l))) 1.0)))))double code(double d, double h, double l, double M, double D) {
double t_0 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double tmp;
if (t_0 <= 0.0) {
tmp = (-1.0 * (fabs(d) / (h * sqrt((l / h))))) * 1.0;
} else if (t_0 <= 5e+243) {
tmp = (1.0 * sqrt((d / l))) * sqrt((d / h));
} 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) :: t_0
real(8) :: tmp
t_0 = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
if (t_0 <= 0.0d0) then
tmp = ((-1.0d0) * (abs(d) / (h * sqrt((l / h))))) * 1.0d0
else if (t_0 <= 5d+243) then
tmp = (1.0d0 * sqrt((d / l))) * sqrt((d / h))
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 t_0 = (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double tmp;
if (t_0 <= 0.0) {
tmp = (-1.0 * (Math.abs(d) / (h * Math.sqrt((l / h))))) * 1.0;
} else if (t_0 <= 5e+243) {
tmp = (1.0 * Math.sqrt((d / l))) * Math.sqrt((d / h));
} else {
tmp = (Math.abs(d) / Math.sqrt((h * l))) * 1.0;
}
return tmp;
}
def code(d, h, l, M, D): t_0 = (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l))) tmp = 0 if t_0 <= 0.0: tmp = (-1.0 * (math.fabs(d) / (h * math.sqrt((l / h))))) * 1.0 elif t_0 <= 5e+243: tmp = (1.0 * math.sqrt((d / l))) * math.sqrt((d / h)) else: tmp = (math.fabs(d) / math.sqrt((h * l))) * 1.0 return tmp
function code(d, h, l, M, D) t_0 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) tmp = 0.0 if (t_0 <= 0.0) tmp = Float64(Float64(-1.0 * Float64(abs(d) / Float64(h * sqrt(Float64(l / h))))) * 1.0); elseif (t_0 <= 5e+243) tmp = Float64(Float64(1.0 * sqrt(Float64(d / l))) * sqrt(Float64(d / h))); 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) t_0 = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); tmp = 0.0; if (t_0 <= 0.0) tmp = (-1.0 * (abs(d) / (h * sqrt((l / h))))) * 1.0; elseif (t_0 <= 5e+243) tmp = (1.0 * sqrt((d / l))) * sqrt((d / h)); else tmp = (abs(d) / sqrt((h * l))) * 1.0; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 0.0], N[(N[(-1.0 * N[(N[Abs[d], $MachinePrecision] / N[(h * N[Sqrt[N[(l / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], If[LessEqual[t$95$0, 5e+243], N[(N[(1.0 * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{if}\;t\_0 \leq 0:\\
\;\;\;\;\left(-1 \cdot \frac{\left|d\right|}{h \cdot \sqrt{\frac{\ell}{h}}}\right) \cdot 1\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+243}:\\
\;\;\;\;\left(1 \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{\frac{d}{h}}\\
\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)))) < 0.0Initial program 67.4%
Taylor expanded in d around inf
Applied rewrites38.6%
Applied rewrites41.7%
Taylor expanded in h around -inf
lower-*.f64N/A
lower-/.f64N/A
lower-fabs.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6425.4%
Applied rewrites25.4%
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.0000000000000004e243Initial program 67.4%
Taylor expanded in d around inf
Applied rewrites38.6%
metadata-eval38.6%
lift-/.f64N/A
*-commutativeN/A
*-commutativeN/A
lift-/.f6438.6%
lift-*.f64N/A
Applied rewrites38.6%
if 5.0000000000000004e243 < (*.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 67.4%
Taylor expanded in d around inf
Applied rewrites38.6%
Applied rewrites41.7%
(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-113)
(* (* -1.0 (/ (fabs d) (* h (sqrt (/ l h))))) 1.0)
(* (/ (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-113) {
tmp = (-1.0 * (fabs(d) / (h * sqrt((l / h))))) * 1.0;
} 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-113)) then
tmp = ((-1.0d0) * (abs(d) / (h * sqrt((l / h))))) * 1.0d0
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-113) {
tmp = (-1.0 * (Math.abs(d) / (h * Math.sqrt((l / h))))) * 1.0;
} 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-113: tmp = (-1.0 * (math.fabs(d) / (h * math.sqrt((l / h))))) * 1.0 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-113) tmp = Float64(Float64(-1.0 * Float64(abs(d) / Float64(h * sqrt(Float64(l / h))))) * 1.0); 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-113) tmp = (-1.0 * (abs(d) / (h * sqrt((l / h))))) * 1.0; 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-113], N[(N[(-1.0 * N[(N[Abs[d], $MachinePrecision] / N[(h * N[Sqrt[N[(l / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 1.0), $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^{-113}:\\
\;\;\;\;\left(-1 \cdot \frac{\left|d\right|}{h \cdot \sqrt{\frac{\ell}{h}}}\right) \cdot 1\\
\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)))) < -4.9999999999999997e-113Initial program 67.4%
Taylor expanded in d around inf
Applied rewrites38.6%
Applied rewrites41.7%
Taylor expanded in h around -inf
lower-*.f64N/A
lower-/.f64N/A
lower-fabs.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6425.4%
Applied rewrites25.4%
if -4.9999999999999997e-113 < (*.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 67.4%
Taylor expanded in d around inf
Applied rewrites38.6%
Applied rewrites41.7%
(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-102)
(* (/ (fabs d) (* h (sqrt (/ l h)))) 1.0)
(* (/ (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-102) {
tmp = (fabs(d) / (h * sqrt((l / h)))) * 1.0;
} 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-102)) then
tmp = (abs(d) / (h * sqrt((l / h)))) * 1.0d0
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-102) {
tmp = (Math.abs(d) / (h * Math.sqrt((l / h)))) * 1.0;
} 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-102: tmp = (math.fabs(d) / (h * math.sqrt((l / h)))) * 1.0 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-102) tmp = Float64(Float64(abs(d) / Float64(h * sqrt(Float64(l / h)))) * 1.0); 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-102) tmp = (abs(d) / (h * sqrt((l / h)))) * 1.0; 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-102], N[(N[(N[Abs[d], $MachinePrecision] / N[(h * N[Sqrt[N[(l / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 1.0), $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^{-102}:\\
\;\;\;\;\frac{\left|d\right|}{h \cdot \sqrt{\frac{\ell}{h}}} \cdot 1\\
\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.0000000000000003e-102Initial program 67.4%
Taylor expanded in d around inf
Applied rewrites38.6%
Applied rewrites41.7%
Taylor expanded in h around inf
lower-/.f64N/A
lower-fabs.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6426.2%
Applied rewrites26.2%
if -5.0000000000000003e-102 < (*.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 67.4%
Taylor expanded in d around inf
Applied rewrites38.6%
Applied rewrites41.7%
(FPCore (d h l M D) :precision binary64 (* (/ (fabs d) (sqrt (* h l))) 1.0))
double code(double d, double h, double l, double M, double D) {
return (fabs(d) / sqrt((h * l))) * 1.0;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(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 = (abs(d) / sqrt((h * l))) * 1.0d0
end function
public static double code(double d, double h, double l, double M, double D) {
return (Math.abs(d) / Math.sqrt((h * l))) * 1.0;
}
def code(d, h, l, M, D): return (math.fabs(d) / math.sqrt((h * l))) * 1.0
function code(d, h, l, M, D) return Float64(Float64(abs(d) / sqrt(Float64(h * l))) * 1.0) end
function tmp = code(d, h, l, M, D) tmp = (abs(d) / sqrt((h * l))) * 1.0; end
code[d_, h_, l_, M_, D_] := N[(N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision]
\frac{\left|d\right|}{\sqrt{h \cdot \ell}} \cdot 1
Initial program 67.4%
Taylor expanded in d around inf
Applied rewrites38.6%
Applied rewrites41.7%
(FPCore (d h l M D) :precision binary64 (* (fabs d) (/ 1.0 (sqrt (* h l)))))
double code(double d, double h, double l, double M, double D) {
return fabs(d) * (1.0 / sqrt((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 = abs(d) * (1.0d0 / sqrt((h * l)))
end function
public static double code(double d, double h, double l, double M, double D) {
return Math.abs(d) * (1.0 / Math.sqrt((h * l)));
}
def code(d, h, l, M, D): return math.fabs(d) * (1.0 / math.sqrt((h * l)))
function code(d, h, l, M, D) return Float64(abs(d) * Float64(1.0 / sqrt(Float64(h * l)))) end
function tmp = code(d, h, l, M, D) tmp = abs(d) * (1.0 / sqrt((h * l))); end
code[d_, h_, l_, M_, D_] := N[(N[Abs[d], $MachinePrecision] * N[(1.0 / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left|d\right| \cdot \frac{1}{\sqrt{h \cdot \ell}}
Initial program 67.4%
Taylor expanded in d around inf
Applied rewrites38.6%
Applied rewrites41.7%
Applied rewrites41.7%
herbie shell --seed 2025258
(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)))))