
(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 16 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 (* t_0 t_1))
(t_3 (* (/ t_0 (+ d d)) t_1))
(t_4 (* (/ -0.5 d) t_2)))
(if (<= l -1.3e-307)
(*
(* (- d) (/ (sqrt (- (/ 1.0 l))) (sqrt (- h))))
(- 1.0 (/ (* (* (* (/ (* t_1 t_0) d) 0.25) t_3) h) l)))
(if (<= l 3e-96)
(*
(fabs (/ (- d) (sqrt (* l h))))
(- 1.0 (* (* 0.25 (/ t_2 d)) (/ (* t_3 h) l))))
(*
(/ (fabs (/ (- d) (sqrt l))) (sqrt h))
(- 1.0 (* t_4 (* t_4 (* 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 = t_0 * t_1;
double t_3 = (t_0 / (d + d)) * t_1;
double t_4 = (-0.5 / d) * t_2;
double tmp;
if (l <= -1.3e-307) {
tmp = (-d * (sqrt(-(1.0 / l)) / sqrt(-h))) * (1.0 - ((((((t_1 * t_0) / d) * 0.25) * t_3) * h) / l));
} else if (l <= 3e-96) {
tmp = fabs((-d / sqrt((l * h)))) * (1.0 - ((0.25 * (t_2 / d)) * ((t_3 * h) / l)));
} else {
tmp = (fabs((-d / sqrt(l))) / sqrt(h)) * (1.0 - (t_4 * (t_4 * (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) :: t_3
real(8) :: t_4
real(8) :: tmp
t_0 = fmax(abs(m), abs(d_1))
t_1 = fmin(abs(m), abs(d_1))
t_2 = t_0 * t_1
t_3 = (t_0 / (d + d)) * t_1
t_4 = ((-0.5d0) / d) * t_2
if (l <= (-1.3d-307)) then
tmp = (-d * (sqrt(-(1.0d0 / l)) / sqrt(-h))) * (1.0d0 - ((((((t_1 * t_0) / d) * 0.25d0) * t_3) * h) / l))
else if (l <= 3d-96) then
tmp = abs((-d / sqrt((l * h)))) * (1.0d0 - ((0.25d0 * (t_2 / d)) * ((t_3 * h) / l)))
else
tmp = (abs((-d / sqrt(l))) / sqrt(h)) * (1.0d0 - (t_4 * (t_4 * (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 = t_0 * t_1;
double t_3 = (t_0 / (d + d)) * t_1;
double t_4 = (-0.5 / d) * t_2;
double tmp;
if (l <= -1.3e-307) {
tmp = (-d * (Math.sqrt(-(1.0 / l)) / Math.sqrt(-h))) * (1.0 - ((((((t_1 * t_0) / d) * 0.25) * t_3) * h) / l));
} else if (l <= 3e-96) {
tmp = Math.abs((-d / Math.sqrt((l * h)))) * (1.0 - ((0.25 * (t_2 / d)) * ((t_3 * h) / l)));
} else {
tmp = (Math.abs((-d / Math.sqrt(l))) / Math.sqrt(h)) * (1.0 - (t_4 * (t_4 * (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 = t_0 * t_1 t_3 = (t_0 / (d + d)) * t_1 t_4 = (-0.5 / d) * t_2 tmp = 0 if l <= -1.3e-307: tmp = (-d * (math.sqrt(-(1.0 / l)) / math.sqrt(-h))) * (1.0 - ((((((t_1 * t_0) / d) * 0.25) * t_3) * h) / l)) elif l <= 3e-96: tmp = math.fabs((-d / math.sqrt((l * h)))) * (1.0 - ((0.25 * (t_2 / d)) * ((t_3 * h) / l))) else: tmp = (math.fabs((-d / math.sqrt(l))) / math.sqrt(h)) * (1.0 - (t_4 * (t_4 * (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(t_0 * t_1) t_3 = Float64(Float64(t_0 / Float64(d + d)) * t_1) t_4 = Float64(Float64(-0.5 / d) * t_2) tmp = 0.0 if (l <= -1.3e-307) tmp = Float64(Float64(Float64(-d) * Float64(sqrt(Float64(-Float64(1.0 / l))) / sqrt(Float64(-h)))) * Float64(1.0 - Float64(Float64(Float64(Float64(Float64(Float64(t_1 * t_0) / d) * 0.25) * t_3) * h) / l))); elseif (l <= 3e-96) tmp = Float64(abs(Float64(Float64(-d) / sqrt(Float64(l * h)))) * Float64(1.0 - Float64(Float64(0.25 * Float64(t_2 / d)) * Float64(Float64(t_3 * h) / l)))); else tmp = Float64(Float64(abs(Float64(Float64(-d) / sqrt(l))) / sqrt(h)) * Float64(1.0 - Float64(t_4 * Float64(t_4 * Float64(0.5 * Float64(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 = t_0 * t_1; t_3 = (t_0 / (d + d)) * t_1; t_4 = (-0.5 / d) * t_2; tmp = 0.0; if (l <= -1.3e-307) tmp = (-d * (sqrt(-(1.0 / l)) / sqrt(-h))) * (1.0 - ((((((t_1 * t_0) / d) * 0.25) * t_3) * h) / l)); elseif (l <= 3e-96) tmp = abs((-d / sqrt((l * h)))) * (1.0 - ((0.25 * (t_2 / d)) * ((t_3 * h) / l))); else tmp = (abs((-d / sqrt(l))) / sqrt(h)) * (1.0 - (t_4 * (t_4 * (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[(t$95$0 * t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(N[(t$95$0 / N[(d + d), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]}, Block[{t$95$4 = N[(N[(-0.5 / d), $MachinePrecision] * t$95$2), $MachinePrecision]}, If[LessEqual[l, -1.3e-307], N[(N[((-d) * N[(N[Sqrt[(-N[(1.0 / l), $MachinePrecision])], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(N[(N[(t$95$1 * t$95$0), $MachinePrecision] / d), $MachinePrecision] * 0.25), $MachinePrecision] * t$95$3), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 3e-96], N[(N[Abs[N[((-d) / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(N[(0.25 * N[(t$95$2 / d), $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$3 * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Abs[N[((-d) / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(t$95$4 * N[(t$95$4 * N[(0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision]), $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 := t\_0 \cdot t\_1\\
t_3 := \frac{t\_0}{d + d} \cdot t\_1\\
t_4 := \frac{-0.5}{d} \cdot t\_2\\
\mathbf{if}\;\ell \leq -1.3 \cdot 10^{-307}:\\
\;\;\;\;\left(\left(-d\right) \cdot \frac{\sqrt{-\frac{1}{\ell}}}{\sqrt{-h}}\right) \cdot \left(1 - \frac{\left(\left(\frac{t\_1 \cdot t\_0}{d} \cdot 0.25\right) \cdot t\_3\right) \cdot h}{\ell}\right)\\
\mathbf{elif}\;\ell \leq 3 \cdot 10^{-96}:\\
\;\;\;\;\left|\frac{-d}{\sqrt{\ell \cdot h}}\right| \cdot \left(1 - \left(0.25 \cdot \frac{t\_2}{d}\right) \cdot \frac{t\_3 \cdot h}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\left|\frac{-d}{\sqrt{\ell}}\right|}{\sqrt{h}} \cdot \left(1 - t\_4 \cdot \left(t\_4 \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right)\right)\\
\end{array}
if l < -1.3e-307Initial program 65.7%
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 rewrites67.4%
Applied rewrites66.9%
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
lift-*.f64N/A
mult-flipN/A
sqrt-prodN/A
lower-unsound-sqrt.f64N/A
lower-sqrt.f64N/A
lift-*.f64N/A
sqr-neg-revN/A
lift-neg.f64N/A
lift-neg.f64N/A
sqrt-unprodN/A
rem-square-sqrtN/A
lower-unsound-*.f64N/A
lower-unsound-sqrt.f64N/A
Applied rewrites37.6%
lift-sqrt.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
frac-2negN/A
lift-neg.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f64N/A
lower-unsound-/.f64N/A
lower-unsound-sqrt.f64N/A
lower-neg.f64N/A
lower-/.f6441.6%
Applied rewrites41.6%
if -1.3e-307 < l < 3.0000000000000001e-96Initial program 65.7%
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 rewrites67.4%
Applied rewrites66.9%
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.0%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
sqrt-divN/A
Applied rewrites73.3%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-/.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
Applied rewrites76.1%
if 3.0000000000000001e-96 < l Initial program 65.7%
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 rewrites67.4%
lift-*.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-/.f64N/A
sqrt-undivN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
associate-*l/N/A
lower-/.f64N/A
*-commutativeN/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6430.9%
Applied rewrites30.9%
lift-sqrt.f64N/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
lower-fabs.f6430.9%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f64N/A
lower-sqrt.f64N/A
lift-*.f64N/A
sqr-neg-revN/A
lift-neg.f64N/A
lift-neg.f64N/A
sqrt-unprodN/A
rem-square-sqrtN/A
lower-unsound-/.f64N/A
lower-unsound-sqrt.f6440.9%
Applied rewrites40.9%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (/ (* D 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 (/ (* M D) (* 2.0 d)) 2.0))
(/ h l)))))
(t_2 (* (/ D (+ d d)) M))
(t_3
(*
(* (sqrt (/ d l)) (sqrt (/ d h)))
(- 1.0 (* (* (* (/ (* M D) d) 0.25) t_2) (/ h l)))))
(t_4 (fabs (/ (- d) (sqrt (* l h))))))
(if (<= t_1 -200000.0)
t_3
(if (<= t_1 1e-307)
(* t_4 (- 1.0 (* t_0 (/ (* (* (* 0.25 M) D) h) (* (+ d d) l)))))
(if (<= t_1 2e+219)
t_3
(* t_4 (- 1.0 (* (* 0.25 t_0) (/ (* t_2 h) l)))))))))double code(double d, double h, double l, double M, double D) {
double t_0 = (D * 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(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double t_2 = (D / (d + d)) * M;
double t_3 = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - (((((M * D) / d) * 0.25) * t_2) * (h / l)));
double t_4 = fabs((-d / sqrt((l * h))));
double tmp;
if (t_1 <= -200000.0) {
tmp = t_3;
} else if (t_1 <= 1e-307) {
tmp = t_4 * (1.0 - (t_0 * ((((0.25 * M) * D) * h) / ((d + d) * l))));
} else if (t_1 <= 2e+219) {
tmp = t_3;
} else {
tmp = t_4 * (1.0 - ((0.25 * t_0) * ((t_2 * h) / l)));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: tmp
t_0 = (d_1 * m) / d
t_1 = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
t_2 = (d_1 / (d + d)) * m
t_3 = (sqrt((d / l)) * sqrt((d / h))) * (1.0d0 - (((((m * d_1) / d) * 0.25d0) * t_2) * (h / l)))
t_4 = abs((-d / sqrt((l * h))))
if (t_1 <= (-200000.0d0)) then
tmp = t_3
else if (t_1 <= 1d-307) then
tmp = t_4 * (1.0d0 - (t_0 * ((((0.25d0 * m) * d_1) * h) / ((d + d) * l))))
else if (t_1 <= 2d+219) then
tmp = t_3
else
tmp = t_4 * (1.0d0 - ((0.25d0 * t_0) * ((t_2 * h) / l)))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = (D * 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(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double t_2 = (D / (d + d)) * M;
double t_3 = (Math.sqrt((d / l)) * Math.sqrt((d / h))) * (1.0 - (((((M * D) / d) * 0.25) * t_2) * (h / l)));
double t_4 = Math.abs((-d / Math.sqrt((l * h))));
double tmp;
if (t_1 <= -200000.0) {
tmp = t_3;
} else if (t_1 <= 1e-307) {
tmp = t_4 * (1.0 - (t_0 * ((((0.25 * M) * D) * h) / ((d + d) * l))));
} else if (t_1 <= 2e+219) {
tmp = t_3;
} else {
tmp = t_4 * (1.0 - ((0.25 * t_0) * ((t_2 * h) / l)));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = (D * 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(((M * D) / (2.0 * d)), 2.0)) * (h / l))) t_2 = (D / (d + d)) * M t_3 = (math.sqrt((d / l)) * math.sqrt((d / h))) * (1.0 - (((((M * D) / d) * 0.25) * t_2) * (h / l))) t_4 = math.fabs((-d / math.sqrt((l * h)))) tmp = 0 if t_1 <= -200000.0: tmp = t_3 elif t_1 <= 1e-307: tmp = t_4 * (1.0 - (t_0 * ((((0.25 * M) * D) * h) / ((d + d) * l)))) elif t_1 <= 2e+219: tmp = t_3 else: tmp = t_4 * (1.0 - ((0.25 * t_0) * ((t_2 * h) / l))) return tmp
function code(d, h, l, M, D) t_0 = Float64(Float64(D * 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(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) t_2 = Float64(Float64(D / Float64(d + d)) * M) t_3 = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * Float64(1.0 - Float64(Float64(Float64(Float64(Float64(M * D) / d) * 0.25) * t_2) * Float64(h / l)))) t_4 = abs(Float64(Float64(-d) / sqrt(Float64(l * h)))) tmp = 0.0 if (t_1 <= -200000.0) tmp = t_3; elseif (t_1 <= 1e-307) tmp = Float64(t_4 * Float64(1.0 - Float64(t_0 * Float64(Float64(Float64(Float64(0.25 * M) * D) * h) / Float64(Float64(d + d) * l))))); elseif (t_1 <= 2e+219) tmp = t_3; else tmp = Float64(t_4 * Float64(1.0 - Float64(Float64(0.25 * t_0) * Float64(Float64(t_2 * h) / l)))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = (D * M) / d; t_1 = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); t_2 = (D / (d + d)) * M; t_3 = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - (((((M * D) / d) * 0.25) * t_2) * (h / l))); t_4 = abs((-d / sqrt((l * h)))); tmp = 0.0; if (t_1 <= -200000.0) tmp = t_3; elseif (t_1 <= 1e-307) tmp = t_4 * (1.0 - (t_0 * ((((0.25 * M) * D) * h) / ((d + d) * l)))); elseif (t_1 <= 2e+219) tmp = t_3; else tmp = t_4 * (1.0 - ((0.25 * t_0) * ((t_2 * h) / l))); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(D * M), $MachinePrecision] / d), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(D / N[(d + d), $MachinePrecision]), $MachinePrecision] * M), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(N[(M * D), $MachinePrecision] / d), $MachinePrecision] * 0.25), $MachinePrecision] * t$95$2), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Abs[N[((-d) / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$1, -200000.0], t$95$3, If[LessEqual[t$95$1, 1e-307], N[(t$95$4 * N[(1.0 - N[(t$95$0 * N[(N[(N[(N[(0.25 * M), $MachinePrecision] * D), $MachinePrecision] * h), $MachinePrecision] / N[(N[(d + d), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+219], t$95$3, N[(t$95$4 * N[(1.0 - N[(N[(0.25 * t$95$0), $MachinePrecision] * N[(N[(t$95$2 * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
t_0 := \frac{D \cdot M}{d}\\
t_1 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
t_2 := \frac{D}{d + d} \cdot M\\
t_3 := \left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - \left(\left(\frac{M \cdot D}{d} \cdot 0.25\right) \cdot t\_2\right) \cdot \frac{h}{\ell}\right)\\
t_4 := \left|\frac{-d}{\sqrt{\ell \cdot h}}\right|\\
\mathbf{if}\;t\_1 \leq -200000:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_1 \leq 10^{-307}:\\
\;\;\;\;t\_4 \cdot \left(1 - t\_0 \cdot \frac{\left(\left(0.25 \cdot M\right) \cdot D\right) \cdot h}{\left(d + d\right) \cdot \ell}\right)\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+219}:\\
\;\;\;\;t\_3\\
\mathbf{else}:\\
\;\;\;\;t\_4 \cdot \left(1 - \left(0.25 \cdot t\_0\right) \cdot \frac{t\_2 \cdot h}{\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)))) < -2e5 or 9.9999999999999991e-308 < (*.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.9999999999999999e219Initial program 65.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6465.7%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6465.7%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6465.7%
Applied rewrites65.7%
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
count-2-revN/A
lift-+.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-/l*N/A
lift-/.f64N/A
metadata-evalN/A
lift-*.f64N/A
lift-/.f64N/A
lower-*.f6465.7%
Applied rewrites65.1%
if -2e5 < (*.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)))) < 9.9999999999999991e-308Initial program 65.7%
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 rewrites67.4%
Applied rewrites66.9%
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.0%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
sqrt-divN/A
Applied rewrites73.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
associate-*l*N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
Applied rewrites75.1%
if 1.9999999999999999e219 < (*.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 65.7%
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 rewrites67.4%
Applied rewrites66.9%
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.0%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
sqrt-divN/A
Applied rewrites73.3%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-/.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
Applied rewrites76.1%
(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)))))
(if (<=
(*
t_1
(-
1.0
(* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l))))
2e+219)
(* t_1 (- 1.0 (* t_0 (* t_0 (* 0.5 (/ h l))))))
(*
(fabs (/ (- d) (sqrt (* l h))))
(-
1.0
(* (* 0.25 (/ (* D M) d)) (/ (* (* (/ D (+ d d)) M) 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));
double tmp;
if ((t_1 * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))) <= 2e+219) {
tmp = t_1 * (1.0 - (t_0 * (t_0 * (0.5 * (h / l)))));
} else {
tmp = fabs((-d / sqrt((l * h)))) * (1.0 - ((0.25 * ((D * M) / d)) * ((((D / (d + d)) * M) * 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))
if ((t_1 * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))) <= 2d+219) then
tmp = t_1 * (1.0d0 - (t_0 * (t_0 * (0.5d0 * (h / l)))))
else
tmp = abs((-d / sqrt((l * h)))) * (1.0d0 - ((0.25d0 * ((d_1 * m) / d)) * ((((d_1 / (d + d)) * m) * 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));
double tmp;
if ((t_1 * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))) <= 2e+219) {
tmp = t_1 * (1.0 - (t_0 * (t_0 * (0.5 * (h / l)))));
} else {
tmp = Math.abs((-d / Math.sqrt((l * h)))) * (1.0 - ((0.25 * ((D * M) / d)) * ((((D / (d + d)) * M) * 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)) tmp = 0 if (t_1 * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))) <= 2e+219: tmp = t_1 * (1.0 - (t_0 * (t_0 * (0.5 * (h / l))))) else: tmp = math.fabs((-d / math.sqrt((l * h)))) * (1.0 - ((0.25 * ((D * M) / d)) * ((((D / (d + d)) * M) * 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(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) tmp = 0.0 if (Float64(t_1 * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) <= 2e+219) tmp = Float64(t_1 * Float64(1.0 - Float64(t_0 * Float64(t_0 * Float64(0.5 * Float64(h / l)))))); else tmp = Float64(abs(Float64(Float64(-d) / sqrt(Float64(l * h)))) * Float64(1.0 - Float64(Float64(0.25 * Float64(Float64(D * M) / d)) * Float64(Float64(Float64(Float64(D / Float64(d + d)) * M) * 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)); tmp = 0.0; if ((t_1 * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l)))) <= 2e+219) tmp = t_1 * (1.0 - (t_0 * (t_0 * (0.5 * (h / l))))); else tmp = abs((-d / sqrt((l * h)))) * (1.0 - ((0.25 * ((D * M) / d)) * ((((D / (d + d)) * M) * 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[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]}, If[LessEqual[N[(t$95$1 * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2e+219], N[(t$95$1 * N[(1.0 - N[(t$95$0 * N[(t$95$0 * N[(0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Abs[N[((-d) / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(N[(0.25 * N[(N[(D * M), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(D / N[(d + d), $MachinePrecision]), $MachinePrecision] * M), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \frac{-0.5}{d} \cdot \left(D \cdot M\right)\\
t_1 := {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\\
\mathbf{if}\;t\_1 \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq 2 \cdot 10^{+219}:\\
\;\;\;\;t\_1 \cdot \left(1 - t\_0 \cdot \left(t\_0 \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{-d}{\sqrt{\ell \cdot h}}\right| \cdot \left(1 - \left(0.25 \cdot \frac{D \cdot M}{d}\right) \cdot \frac{\left(\frac{D}{d + d} \cdot M\right) \cdot h}{\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)))) < 1.9999999999999999e219Initial program 65.7%
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 rewrites67.4%
if 1.9999999999999999e219 < (*.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 65.7%
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 rewrites67.4%
Applied rewrites66.9%
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.0%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
sqrt-divN/A
Applied rewrites73.3%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-/.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
Applied rewrites76.1%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (fmin (fabs M) D))
(t_1 (/ (- d) (sqrt (* l h))))
(t_2 (fmax (fabs M) D))
(t_3
(-
1.0
(/
(* (* (* (/ (* t_0 t_2) d) 0.25) (* (/ t_2 (+ d d)) t_0)) h)
l))))
(if (<= h -1e+70)
(* t_1 t_3)
(if (<= h 4.6e-242)
(*
(fabs t_1)
(-
1.0
(*
(/ (* t_2 t_0) d)
(/ (* (* (* 0.25 t_0) t_2) h) (* (+ d d) l)))))
(* (fabs (/ (/ (- d) (sqrt l)) (- (sqrt h)))) t_3)))))double code(double d, double h, double l, double M, double D) {
double t_0 = fmin(fabs(M), D);
double t_1 = -d / sqrt((l * h));
double t_2 = fmax(fabs(M), D);
double t_3 = 1.0 - ((((((t_0 * t_2) / d) * 0.25) * ((t_2 / (d + d)) * t_0)) * h) / l);
double tmp;
if (h <= -1e+70) {
tmp = t_1 * t_3;
} else if (h <= 4.6e-242) {
tmp = fabs(t_1) * (1.0 - (((t_2 * t_0) / d) * ((((0.25 * t_0) * t_2) * h) / ((d + d) * l))));
} else {
tmp = fabs(((-d / sqrt(l)) / -sqrt(h))) * 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) :: tmp
t_0 = fmin(abs(m), d_1)
t_1 = -d / sqrt((l * h))
t_2 = fmax(abs(m), d_1)
t_3 = 1.0d0 - ((((((t_0 * t_2) / d) * 0.25d0) * ((t_2 / (d + d)) * t_0)) * h) / l)
if (h <= (-1d+70)) then
tmp = t_1 * t_3
else if (h <= 4.6d-242) then
tmp = abs(t_1) * (1.0d0 - (((t_2 * t_0) / d) * ((((0.25d0 * t_0) * t_2) * h) / ((d + d) * l))))
else
tmp = abs(((-d / sqrt(l)) / -sqrt(h))) * 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 = fmin(Math.abs(M), D);
double t_1 = -d / Math.sqrt((l * h));
double t_2 = fmax(Math.abs(M), D);
double t_3 = 1.0 - ((((((t_0 * t_2) / d) * 0.25) * ((t_2 / (d + d)) * t_0)) * h) / l);
double tmp;
if (h <= -1e+70) {
tmp = t_1 * t_3;
} else if (h <= 4.6e-242) {
tmp = Math.abs(t_1) * (1.0 - (((t_2 * t_0) / d) * ((((0.25 * t_0) * t_2) * h) / ((d + d) * l))));
} else {
tmp = Math.abs(((-d / Math.sqrt(l)) / -Math.sqrt(h))) * t_3;
}
return tmp;
}
def code(d, h, l, M, D): t_0 = fmin(math.fabs(M), D) t_1 = -d / math.sqrt((l * h)) t_2 = fmax(math.fabs(M), D) t_3 = 1.0 - ((((((t_0 * t_2) / d) * 0.25) * ((t_2 / (d + d)) * t_0)) * h) / l) tmp = 0 if h <= -1e+70: tmp = t_1 * t_3 elif h <= 4.6e-242: tmp = math.fabs(t_1) * (1.0 - (((t_2 * t_0) / d) * ((((0.25 * t_0) * t_2) * h) / ((d + d) * l)))) else: tmp = math.fabs(((-d / math.sqrt(l)) / -math.sqrt(h))) * t_3 return tmp
function code(d, h, l, M, D) t_0 = fmin(abs(M), D) t_1 = Float64(Float64(-d) / sqrt(Float64(l * h))) t_2 = fmax(abs(M), D) t_3 = Float64(1.0 - Float64(Float64(Float64(Float64(Float64(Float64(t_0 * t_2) / d) * 0.25) * Float64(Float64(t_2 / Float64(d + d)) * t_0)) * h) / l)) tmp = 0.0 if (h <= -1e+70) tmp = Float64(t_1 * t_3); elseif (h <= 4.6e-242) tmp = Float64(abs(t_1) * Float64(1.0 - Float64(Float64(Float64(t_2 * t_0) / d) * Float64(Float64(Float64(Float64(0.25 * t_0) * t_2) * h) / Float64(Float64(d + d) * l))))); else tmp = Float64(abs(Float64(Float64(Float64(-d) / sqrt(l)) / Float64(-sqrt(h)))) * t_3); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = min(abs(M), D); t_1 = -d / sqrt((l * h)); t_2 = max(abs(M), D); t_3 = 1.0 - ((((((t_0 * t_2) / d) * 0.25) * ((t_2 / (d + d)) * t_0)) * h) / l); tmp = 0.0; if (h <= -1e+70) tmp = t_1 * t_3; elseif (h <= 4.6e-242) tmp = abs(t_1) * (1.0 - (((t_2 * t_0) / d) * ((((0.25 * t_0) * t_2) * h) / ((d + d) * l)))); else tmp = abs(((-d / sqrt(l)) / -sqrt(h))) * t_3; 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[((-d) / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Max[N[Abs[M], $MachinePrecision], D], $MachinePrecision]}, Block[{t$95$3 = N[(1.0 - N[(N[(N[(N[(N[(N[(t$95$0 * t$95$2), $MachinePrecision] / d), $MachinePrecision] * 0.25), $MachinePrecision] * N[(N[(t$95$2 / N[(d + d), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -1e+70], N[(t$95$1 * t$95$3), $MachinePrecision], If[LessEqual[h, 4.6e-242], N[(N[Abs[t$95$1], $MachinePrecision] * N[(1.0 - N[(N[(N[(t$95$2 * t$95$0), $MachinePrecision] / d), $MachinePrecision] * N[(N[(N[(N[(0.25 * t$95$0), $MachinePrecision] * t$95$2), $MachinePrecision] * h), $MachinePrecision] / N[(N[(d + d), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Abs[N[(N[((-d) / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] / (-N[Sqrt[h], $MachinePrecision])), $MachinePrecision]], $MachinePrecision] * t$95$3), $MachinePrecision]]]]]]]
\begin{array}{l}
t_0 := \mathsf{min}\left(\left|M\right|, D\right)\\
t_1 := \frac{-d}{\sqrt{\ell \cdot h}}\\
t_2 := \mathsf{max}\left(\left|M\right|, D\right)\\
t_3 := 1 - \frac{\left(\left(\frac{t\_0 \cdot t\_2}{d} \cdot 0.25\right) \cdot \left(\frac{t\_2}{d + d} \cdot t\_0\right)\right) \cdot h}{\ell}\\
\mathbf{if}\;h \leq -1 \cdot 10^{+70}:\\
\;\;\;\;t\_1 \cdot t\_3\\
\mathbf{elif}\;h \leq 4.6 \cdot 10^{-242}:\\
\;\;\;\;\left|t\_1\right| \cdot \left(1 - \frac{t\_2 \cdot t\_0}{d} \cdot \frac{\left(\left(0.25 \cdot t\_0\right) \cdot t\_2\right) \cdot h}{\left(d + d\right) \cdot \ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{\frac{-d}{\sqrt{\ell}}}{-\sqrt{h}}\right| \cdot t\_3\\
\end{array}
if h < -1.0000000000000001e70Initial program 65.7%
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 rewrites67.4%
Applied rewrites66.9%
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
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f64N/A
lower-sqrt.f64N/A
lift-*.f64N/A
sqr-neg-revN/A
lift-neg.f64N/A
lift-neg.f64N/A
sqrt-unprodN/A
rem-square-sqrtN/A
lower-unsound-/.f64N/A
lower-unsound-sqrt.f6437.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6437.7%
Applied rewrites37.7%
if -1.0000000000000001e70 < h < 4.5999999999999997e-242Initial program 65.7%
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 rewrites67.4%
Applied rewrites66.9%
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.0%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
sqrt-divN/A
Applied rewrites73.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
associate-*l*N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
Applied rewrites75.1%
if 4.5999999999999997e-242 < h Initial program 65.7%
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 rewrites67.4%
Applied rewrites66.9%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
associate-/l*N/A
lift-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-undivN/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
neg-fabsN/A
div-fabsN/A
lower-fabs.f64N/A
lower-/.f64N/A
Applied rewrites41.1%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (fmin (fabs M) D))
(t_1 (/ (- d) (sqrt (* l h))))
(t_2 (fmax (fabs M) D)))
(if (<= h -1e+70)
(*
t_1
(-
1.0
(/
(* (* (* (/ (* t_0 t_2) d) 0.25) (* (/ t_2 (+ d d)) t_0)) h)
l)))
(*
(fabs t_1)
(-
1.0
(*
(/ (* t_2 t_0) d)
(/ (* (* (* 0.25 t_0) t_2) h) (* (+ d d) l))))))))double code(double d, double h, double l, double M, double D) {
double t_0 = fmin(fabs(M), D);
double t_1 = -d / sqrt((l * h));
double t_2 = fmax(fabs(M), D);
double tmp;
if (h <= -1e+70) {
tmp = t_1 * (1.0 - ((((((t_0 * t_2) / d) * 0.25) * ((t_2 / (d + d)) * t_0)) * h) / l));
} else {
tmp = fabs(t_1) * (1.0 - (((t_2 * t_0) / d) * ((((0.25 * t_0) * 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) :: tmp
t_0 = fmin(abs(m), d_1)
t_1 = -d / sqrt((l * h))
t_2 = fmax(abs(m), d_1)
if (h <= (-1d+70)) then
tmp = t_1 * (1.0d0 - ((((((t_0 * t_2) / d) * 0.25d0) * ((t_2 / (d + d)) * t_0)) * h) / l))
else
tmp = abs(t_1) * (1.0d0 - (((t_2 * t_0) / d) * ((((0.25d0 * t_0) * 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 = fmin(Math.abs(M), D);
double t_1 = -d / Math.sqrt((l * h));
double t_2 = fmax(Math.abs(M), D);
double tmp;
if (h <= -1e+70) {
tmp = t_1 * (1.0 - ((((((t_0 * t_2) / d) * 0.25) * ((t_2 / (d + d)) * t_0)) * h) / l));
} else {
tmp = Math.abs(t_1) * (1.0 - (((t_2 * t_0) / d) * ((((0.25 * t_0) * t_2) * h) / ((d + d) * l))));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = fmin(math.fabs(M), D) t_1 = -d / math.sqrt((l * h)) t_2 = fmax(math.fabs(M), D) tmp = 0 if h <= -1e+70: tmp = t_1 * (1.0 - ((((((t_0 * t_2) / d) * 0.25) * ((t_2 / (d + d)) * t_0)) * h) / l)) else: tmp = math.fabs(t_1) * (1.0 - (((t_2 * t_0) / d) * ((((0.25 * t_0) * t_2) * h) / ((d + d) * l)))) return tmp
function code(d, h, l, M, D) t_0 = fmin(abs(M), D) t_1 = Float64(Float64(-d) / sqrt(Float64(l * h))) t_2 = fmax(abs(M), D) tmp = 0.0 if (h <= -1e+70) tmp = Float64(t_1 * Float64(1.0 - Float64(Float64(Float64(Float64(Float64(Float64(t_0 * t_2) / d) * 0.25) * Float64(Float64(t_2 / Float64(d + d)) * t_0)) * h) / l))); else tmp = Float64(abs(t_1) * Float64(1.0 - Float64(Float64(Float64(t_2 * t_0) / d) * Float64(Float64(Float64(Float64(0.25 * t_0) * t_2) * h) / Float64(Float64(d + d) * l))))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = min(abs(M), D); t_1 = -d / sqrt((l * h)); t_2 = max(abs(M), D); tmp = 0.0; if (h <= -1e+70) tmp = t_1 * (1.0 - ((((((t_0 * t_2) / d) * 0.25) * ((t_2 / (d + d)) * t_0)) * h) / l)); else tmp = abs(t_1) * (1.0 - (((t_2 * t_0) / d) * ((((0.25 * t_0) * t_2) * h) / ((d + 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[((-d) / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Max[N[Abs[M], $MachinePrecision], D], $MachinePrecision]}, If[LessEqual[h, -1e+70], N[(t$95$1 * N[(1.0 - N[(N[(N[(N[(N[(N[(t$95$0 * t$95$2), $MachinePrecision] / d), $MachinePrecision] * 0.25), $MachinePrecision] * N[(N[(t$95$2 / N[(d + d), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Abs[t$95$1], $MachinePrecision] * N[(1.0 - N[(N[(N[(t$95$2 * t$95$0), $MachinePrecision] / d), $MachinePrecision] * N[(N[(N[(N[(0.25 * t$95$0), $MachinePrecision] * t$95$2), $MachinePrecision] * h), $MachinePrecision] / N[(N[(d + d), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := \mathsf{min}\left(\left|M\right|, D\right)\\
t_1 := \frac{-d}{\sqrt{\ell \cdot h}}\\
t_2 := \mathsf{max}\left(\left|M\right|, D\right)\\
\mathbf{if}\;h \leq -1 \cdot 10^{+70}:\\
\;\;\;\;t\_1 \cdot \left(1 - \frac{\left(\left(\frac{t\_0 \cdot t\_2}{d} \cdot 0.25\right) \cdot \left(\frac{t\_2}{d + d} \cdot t\_0\right)\right) \cdot h}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\left|t\_1\right| \cdot \left(1 - \frac{t\_2 \cdot t\_0}{d} \cdot \frac{\left(\left(0.25 \cdot t\_0\right) \cdot t\_2\right) \cdot h}{\left(d + d\right) \cdot \ell}\right)\\
\end{array}
if h < -1.0000000000000001e70Initial program 65.7%
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 rewrites67.4%
Applied rewrites66.9%
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
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f64N/A
lower-sqrt.f64N/A
lift-*.f64N/A
sqr-neg-revN/A
lift-neg.f64N/A
lift-neg.f64N/A
sqrt-unprodN/A
rem-square-sqrtN/A
lower-unsound-/.f64N/A
lower-unsound-sqrt.f6437.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6437.7%
Applied rewrites37.7%
if -1.0000000000000001e70 < h Initial program 65.7%
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 rewrites67.4%
Applied rewrites66.9%
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.0%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
sqrt-divN/A
Applied rewrites73.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
associate-*l*N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
Applied rewrites75.1%
(FPCore (d h l M D) :precision binary64 (* (fabs (/ (- d) (sqrt (* l h)))) (- 1.0 (* (* 0.25 (/ (* D M) d)) (/ (* (* (/ D (+ d d)) M) h) l)))))
double code(double d, double h, double l, double M, double D) {
return fabs((-d / sqrt((l * h)))) * (1.0 - ((0.25 * ((D * M) / d)) * ((((D / (d + d)) * M) * 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 / sqrt((l * h)))) * (1.0d0 - ((0.25d0 * ((d_1 * m) / d)) * ((((d_1 / (d + d)) * m) * h) / l)))
end function
public static double code(double d, double h, double l, double M, double D) {
return Math.abs((-d / Math.sqrt((l * h)))) * (1.0 - ((0.25 * ((D * M) / d)) * ((((D / (d + d)) * M) * h) / l)));
}
def code(d, h, l, M, D): return math.fabs((-d / math.sqrt((l * h)))) * (1.0 - ((0.25 * ((D * M) / d)) * ((((D / (d + d)) * M) * h) / l)))
function code(d, h, l, M, D) return Float64(abs(Float64(Float64(-d) / sqrt(Float64(l * h)))) * Float64(1.0 - Float64(Float64(0.25 * Float64(Float64(D * M) / d)) * Float64(Float64(Float64(Float64(D / Float64(d + d)) * M) * h) / l)))) end
function tmp = code(d, h, l, M, D) tmp = abs((-d / sqrt((l * h)))) * (1.0 - ((0.25 * ((D * M) / d)) * ((((D / (d + d)) * M) * h) / l))); end
code[d_, h_, l_, M_, D_] := N[(N[Abs[N[((-d) / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(N[(0.25 * N[(N[(D * M), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(D / N[(d + d), $MachinePrecision]), $MachinePrecision] * M), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left|\frac{-d}{\sqrt{\ell \cdot h}}\right| \cdot \left(1 - \left(0.25 \cdot \frac{D \cdot M}{d}\right) \cdot \frac{\left(\frac{D}{d + d} \cdot M\right) \cdot h}{\ell}\right)
Initial program 65.7%
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 rewrites67.4%
Applied rewrites66.9%
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.0%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
sqrt-divN/A
Applied rewrites73.3%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-/.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
Applied rewrites76.1%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (/ (- d) (sqrt (* l h)))) (t_1 (* (/ D (+ d d)) M)))
(if (<= h -1e-90)
(* t_0 (- 1.0 (/ (* (* (* (/ (* M D) d) 0.25) t_1) h) l)))
(*
(fabs t_0)
(- 1.0 (/ (* (* (* 0.25 M) D) (* t_1 h)) (* l d)))))))double code(double d, double h, double l, double M, double D) {
double t_0 = -d / sqrt((l * h));
double t_1 = (D / (d + d)) * M;
double tmp;
if (h <= -1e-90) {
tmp = t_0 * (1.0 - ((((((M * D) / d) * 0.25) * t_1) * h) / l));
} else {
tmp = fabs(t_0) * (1.0 - ((((0.25 * M) * D) * (t_1 * h)) / (l * d)));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = -d / sqrt((l * h))
t_1 = (d_1 / (d + d)) * m
if (h <= (-1d-90)) then
tmp = t_0 * (1.0d0 - ((((((m * d_1) / d) * 0.25d0) * t_1) * h) / l))
else
tmp = abs(t_0) * (1.0d0 - ((((0.25d0 * m) * d_1) * (t_1 * h)) / (l * d)))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = -d / Math.sqrt((l * h));
double t_1 = (D / (d + d)) * M;
double tmp;
if (h <= -1e-90) {
tmp = t_0 * (1.0 - ((((((M * D) / d) * 0.25) * t_1) * h) / l));
} else {
tmp = Math.abs(t_0) * (1.0 - ((((0.25 * M) * D) * (t_1 * h)) / (l * d)));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = -d / math.sqrt((l * h)) t_1 = (D / (d + d)) * M tmp = 0 if h <= -1e-90: tmp = t_0 * (1.0 - ((((((M * D) / d) * 0.25) * t_1) * h) / l)) else: tmp = math.fabs(t_0) * (1.0 - ((((0.25 * M) * D) * (t_1 * h)) / (l * d))) return tmp
function code(d, h, l, M, D) t_0 = Float64(Float64(-d) / sqrt(Float64(l * h))) t_1 = Float64(Float64(D / Float64(d + d)) * M) tmp = 0.0 if (h <= -1e-90) tmp = Float64(t_0 * Float64(1.0 - Float64(Float64(Float64(Float64(Float64(Float64(M * D) / d) * 0.25) * t_1) * h) / l))); else tmp = Float64(abs(t_0) * Float64(1.0 - Float64(Float64(Float64(Float64(0.25 * M) * D) * Float64(t_1 * h)) / Float64(l * d)))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = -d / sqrt((l * h)); t_1 = (D / (d + d)) * M; tmp = 0.0; if (h <= -1e-90) tmp = t_0 * (1.0 - ((((((M * D) / d) * 0.25) * t_1) * h) / l)); else tmp = abs(t_0) * (1.0 - ((((0.25 * M) * D) * (t_1 * h)) / (l * d))); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[((-d) / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(D / N[(d + d), $MachinePrecision]), $MachinePrecision] * M), $MachinePrecision]}, If[LessEqual[h, -1e-90], N[(t$95$0 * N[(1.0 - N[(N[(N[(N[(N[(N[(M * D), $MachinePrecision] / d), $MachinePrecision] * 0.25), $MachinePrecision] * t$95$1), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Abs[t$95$0], $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(0.25 * M), $MachinePrecision] * D), $MachinePrecision] * N[(t$95$1 * h), $MachinePrecision]), $MachinePrecision] / N[(l * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \frac{-d}{\sqrt{\ell \cdot h}}\\
t_1 := \frac{D}{d + d} \cdot M\\
\mathbf{if}\;h \leq -1 \cdot 10^{-90}:\\
\;\;\;\;t\_0 \cdot \left(1 - \frac{\left(\left(\frac{M \cdot D}{d} \cdot 0.25\right) \cdot t\_1\right) \cdot h}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\left|t\_0\right| \cdot \left(1 - \frac{\left(\left(0.25 \cdot M\right) \cdot D\right) \cdot \left(t\_1 \cdot h\right)}{\ell \cdot d}\right)\\
\end{array}
if h < -9.9999999999999999e-91Initial program 65.7%
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 rewrites67.4%
Applied rewrites66.9%
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
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f64N/A
lower-sqrt.f64N/A
lift-*.f64N/A
sqr-neg-revN/A
lift-neg.f64N/A
lift-neg.f64N/A
sqrt-unprodN/A
rem-square-sqrtN/A
lower-unsound-/.f64N/A
lower-unsound-sqrt.f6437.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6437.7%
Applied rewrites37.7%
if -9.9999999999999999e-91 < h Initial program 65.7%
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 rewrites67.4%
Applied rewrites66.9%
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.0%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
sqrt-divN/A
Applied rewrites73.3%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-/.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
Applied rewrites73.7%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (fmin (fabs M) D))
(t_1 (/ (- d) (sqrt (* l h))))
(t_2 (fmax (fabs M) D)))
(if (<= h -1e-90)
(*
t_1
(-
1.0
(/
(* (* (* (/ (* t_0 t_2) d) 0.25) (* (/ t_2 (+ d d)) t_0)) h)
l)))
(*
(fabs t_1)
(-
1.0
(*
(/ (* h (* (* 0.25 t_0) t_2)) (* (* (+ d d) l) d))
(* t_2 t_0)))))))double code(double d, double h, double l, double M, double D) {
double t_0 = fmin(fabs(M), D);
double t_1 = -d / sqrt((l * h));
double t_2 = fmax(fabs(M), D);
double tmp;
if (h <= -1e-90) {
tmp = t_1 * (1.0 - ((((((t_0 * t_2) / d) * 0.25) * ((t_2 / (d + d)) * t_0)) * h) / l));
} else {
tmp = fabs(t_1) * (1.0 - (((h * ((0.25 * t_0) * t_2)) / (((d + d) * l) * d)) * (t_2 * 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) :: tmp
t_0 = fmin(abs(m), d_1)
t_1 = -d / sqrt((l * h))
t_2 = fmax(abs(m), d_1)
if (h <= (-1d-90)) then
tmp = t_1 * (1.0d0 - ((((((t_0 * t_2) / d) * 0.25d0) * ((t_2 / (d + d)) * t_0)) * h) / l))
else
tmp = abs(t_1) * (1.0d0 - (((h * ((0.25d0 * t_0) * t_2)) / (((d + d) * l) * d)) * (t_2 * 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 = fmin(Math.abs(M), D);
double t_1 = -d / Math.sqrt((l * h));
double t_2 = fmax(Math.abs(M), D);
double tmp;
if (h <= -1e-90) {
tmp = t_1 * (1.0 - ((((((t_0 * t_2) / d) * 0.25) * ((t_2 / (d + d)) * t_0)) * h) / l));
} else {
tmp = Math.abs(t_1) * (1.0 - (((h * ((0.25 * t_0) * t_2)) / (((d + d) * l) * d)) * (t_2 * t_0)));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = fmin(math.fabs(M), D) t_1 = -d / math.sqrt((l * h)) t_2 = fmax(math.fabs(M), D) tmp = 0 if h <= -1e-90: tmp = t_1 * (1.0 - ((((((t_0 * t_2) / d) * 0.25) * ((t_2 / (d + d)) * t_0)) * h) / l)) else: tmp = math.fabs(t_1) * (1.0 - (((h * ((0.25 * t_0) * t_2)) / (((d + d) * l) * d)) * (t_2 * t_0))) return tmp
function code(d, h, l, M, D) t_0 = fmin(abs(M), D) t_1 = Float64(Float64(-d) / sqrt(Float64(l * h))) t_2 = fmax(abs(M), D) tmp = 0.0 if (h <= -1e-90) tmp = Float64(t_1 * Float64(1.0 - Float64(Float64(Float64(Float64(Float64(Float64(t_0 * t_2) / d) * 0.25) * Float64(Float64(t_2 / Float64(d + d)) * t_0)) * h) / l))); else tmp = Float64(abs(t_1) * Float64(1.0 - Float64(Float64(Float64(h * Float64(Float64(0.25 * t_0) * t_2)) / Float64(Float64(Float64(d + d) * l) * d)) * Float64(t_2 * t_0)))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = min(abs(M), D); t_1 = -d / sqrt((l * h)); t_2 = max(abs(M), D); tmp = 0.0; if (h <= -1e-90) tmp = t_1 * (1.0 - ((((((t_0 * t_2) / d) * 0.25) * ((t_2 / (d + d)) * t_0)) * h) / l)); else tmp = abs(t_1) * (1.0 - (((h * ((0.25 * t_0) * t_2)) / (((d + d) * l) * d)) * (t_2 * t_0))); 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[((-d) / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Max[N[Abs[M], $MachinePrecision], D], $MachinePrecision]}, If[LessEqual[h, -1e-90], N[(t$95$1 * N[(1.0 - N[(N[(N[(N[(N[(N[(t$95$0 * t$95$2), $MachinePrecision] / d), $MachinePrecision] * 0.25), $MachinePrecision] * N[(N[(t$95$2 / N[(d + d), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Abs[t$95$1], $MachinePrecision] * N[(1.0 - N[(N[(N[(h * N[(N[(0.25 * t$95$0), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(d + d), $MachinePrecision] * l), $MachinePrecision] * d), $MachinePrecision]), $MachinePrecision] * N[(t$95$2 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := \mathsf{min}\left(\left|M\right|, D\right)\\
t_1 := \frac{-d}{\sqrt{\ell \cdot h}}\\
t_2 := \mathsf{max}\left(\left|M\right|, D\right)\\
\mathbf{if}\;h \leq -1 \cdot 10^{-90}:\\
\;\;\;\;t\_1 \cdot \left(1 - \frac{\left(\left(\frac{t\_0 \cdot t\_2}{d} \cdot 0.25\right) \cdot \left(\frac{t\_2}{d + d} \cdot t\_0\right)\right) \cdot h}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\left|t\_1\right| \cdot \left(1 - \frac{h \cdot \left(\left(0.25 \cdot t\_0\right) \cdot t\_2\right)}{\left(\left(d + d\right) \cdot \ell\right) \cdot d} \cdot \left(t\_2 \cdot t\_0\right)\right)\\
\end{array}
if h < -9.9999999999999999e-91Initial program 65.7%
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 rewrites67.4%
Applied rewrites66.9%
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
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f64N/A
lower-sqrt.f64N/A
lift-*.f64N/A
sqr-neg-revN/A
lift-neg.f64N/A
lift-neg.f64N/A
sqrt-unprodN/A
rem-square-sqrtN/A
lower-unsound-/.f64N/A
lower-unsound-sqrt.f6437.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6437.7%
Applied rewrites37.7%
if -9.9999999999999999e-91 < h Initial program 65.7%
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 rewrites67.4%
Applied rewrites66.9%
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.0%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
sqrt-divN/A
Applied rewrites73.3%
Applied rewrites69.4%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (fabs (/ (- d) (sqrt (* l h))))))
(if (<= (* (fabs M) (fabs D)) 1e-129)
(* t_0 1.0)
(*
t_0
(-
1.0
(*
(/ (* h (* (* 0.25 (fabs M)) (fabs D))) (* (* (+ d d) l) d))
(* (fabs D) (fabs M))))))))double code(double d, double h, double l, double M, double D) {
double t_0 = fabs((-d / sqrt((l * h))));
double tmp;
if ((fabs(M) * fabs(D)) <= 1e-129) {
tmp = t_0 * 1.0;
} else {
tmp = t_0 * (1.0 - (((h * ((0.25 * fabs(M)) * fabs(D))) / (((d + d) * l) * d)) * (fabs(D) * fabs(M))));
}
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 = abs((-d / sqrt((l * h))))
if ((abs(m) * abs(d_1)) <= 1d-129) then
tmp = t_0 * 1.0d0
else
tmp = t_0 * (1.0d0 - (((h * ((0.25d0 * abs(m)) * abs(d_1))) / (((d + d) * l) * d)) * (abs(d_1) * abs(m))))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.abs((-d / Math.sqrt((l * h))));
double tmp;
if ((Math.abs(M) * Math.abs(D)) <= 1e-129) {
tmp = t_0 * 1.0;
} else {
tmp = t_0 * (1.0 - (((h * ((0.25 * Math.abs(M)) * Math.abs(D))) / (((d + d) * l) * d)) * (Math.abs(D) * Math.abs(M))));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.fabs((-d / math.sqrt((l * h)))) tmp = 0 if (math.fabs(M) * math.fabs(D)) <= 1e-129: tmp = t_0 * 1.0 else: tmp = t_0 * (1.0 - (((h * ((0.25 * math.fabs(M)) * math.fabs(D))) / (((d + d) * l) * d)) * (math.fabs(D) * math.fabs(M)))) return tmp
function code(d, h, l, M, D) t_0 = abs(Float64(Float64(-d) / sqrt(Float64(l * h)))) tmp = 0.0 if (Float64(abs(M) * abs(D)) <= 1e-129) tmp = Float64(t_0 * 1.0); else tmp = Float64(t_0 * Float64(1.0 - Float64(Float64(Float64(h * Float64(Float64(0.25 * abs(M)) * abs(D))) / Float64(Float64(Float64(d + d) * l) * d)) * Float64(abs(D) * abs(M))))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = abs((-d / sqrt((l * h)))); tmp = 0.0; if ((abs(M) * abs(D)) <= 1e-129) tmp = t_0 * 1.0; else tmp = t_0 * (1.0 - (((h * ((0.25 * abs(M)) * abs(D))) / (((d + d) * l) * d)) * (abs(D) * abs(M)))); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Abs[N[((-d) / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[Abs[M], $MachinePrecision] * N[Abs[D], $MachinePrecision]), $MachinePrecision], 1e-129], N[(t$95$0 * 1.0), $MachinePrecision], N[(t$95$0 * N[(1.0 - N[(N[(N[(h * N[(N[(0.25 * N[Abs[M], $MachinePrecision]), $MachinePrecision] * N[Abs[D], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(d + d), $MachinePrecision] * l), $MachinePrecision] * d), $MachinePrecision]), $MachinePrecision] * N[(N[Abs[D], $MachinePrecision] * N[Abs[M], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_0 := \left|\frac{-d}{\sqrt{\ell \cdot h}}\right|\\
\mathbf{if}\;\left|M\right| \cdot \left|D\right| \leq 10^{-129}:\\
\;\;\;\;t\_0 \cdot 1\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \left(1 - \frac{h \cdot \left(\left(0.25 \cdot \left|M\right|\right) \cdot \left|D\right|\right)}{\left(\left(d + d\right) \cdot \ell\right) \cdot d} \cdot \left(\left|D\right| \cdot \left|M\right|\right)\right)\\
\end{array}
if (*.f64 M D) < 9.9999999999999993e-130Initial program 65.7%
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 rewrites67.4%
Applied rewrites66.9%
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.0%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
sqrt-divN/A
Applied rewrites73.3%
Taylor expanded in d around inf
Applied rewrites42.5%
if 9.9999999999999993e-130 < (*.f64 M D) Initial program 65.7%
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 rewrites67.4%
Applied rewrites66.9%
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.0%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
sqrt-divN/A
Applied rewrites73.3%
Applied rewrites69.4%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* (+ d d) l))
(t_1 (fmin (fabs M) (fabs D)))
(t_2 (* 0.25 t_1))
(t_3 (/ (- d) (sqrt (* l h))))
(t_4 (fabs t_3))
(t_5 (fmax (fabs M) (fabs D)))
(t_6 (* t_5 t_1)))
(if (<= d -1.1e+71)
(* t_3 (- 1.0 (* (* (* t_2 (/ t_5 d)) t_6) (/ h t_0))))
(if (<= d 3.2e+197)
(* t_4 (- 1.0 (* t_2 (/ (* t_5 (* t_6 h)) (* d t_0)))))
(* t_4 1.0)))))double code(double d, double h, double l, double M, double D) {
double t_0 = (d + d) * l;
double t_1 = fmin(fabs(M), fabs(D));
double t_2 = 0.25 * t_1;
double t_3 = -d / sqrt((l * h));
double t_4 = fabs(t_3);
double t_5 = fmax(fabs(M), fabs(D));
double t_6 = t_5 * t_1;
double tmp;
if (d <= -1.1e+71) {
tmp = t_3 * (1.0 - (((t_2 * (t_5 / d)) * t_6) * (h / t_0)));
} else if (d <= 3.2e+197) {
tmp = t_4 * (1.0 - (t_2 * ((t_5 * (t_6 * h)) / (d * t_0))));
} else {
tmp = t_4 * 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) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: t_6
real(8) :: tmp
t_0 = (d + d) * l
t_1 = fmin(abs(m), abs(d_1))
t_2 = 0.25d0 * t_1
t_3 = -d / sqrt((l * h))
t_4 = abs(t_3)
t_5 = fmax(abs(m), abs(d_1))
t_6 = t_5 * t_1
if (d <= (-1.1d+71)) then
tmp = t_3 * (1.0d0 - (((t_2 * (t_5 / d)) * t_6) * (h / t_0)))
else if (d <= 3.2d+197) then
tmp = t_4 * (1.0d0 - (t_2 * ((t_5 * (t_6 * h)) / (d * t_0))))
else
tmp = t_4 * 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 = (d + d) * l;
double t_1 = fmin(Math.abs(M), Math.abs(D));
double t_2 = 0.25 * t_1;
double t_3 = -d / Math.sqrt((l * h));
double t_4 = Math.abs(t_3);
double t_5 = fmax(Math.abs(M), Math.abs(D));
double t_6 = t_5 * t_1;
double tmp;
if (d <= -1.1e+71) {
tmp = t_3 * (1.0 - (((t_2 * (t_5 / d)) * t_6) * (h / t_0)));
} else if (d <= 3.2e+197) {
tmp = t_4 * (1.0 - (t_2 * ((t_5 * (t_6 * h)) / (d * t_0))));
} else {
tmp = t_4 * 1.0;
}
return tmp;
}
def code(d, h, l, M, D): t_0 = (d + d) * l t_1 = fmin(math.fabs(M), math.fabs(D)) t_2 = 0.25 * t_1 t_3 = -d / math.sqrt((l * h)) t_4 = math.fabs(t_3) t_5 = fmax(math.fabs(M), math.fabs(D)) t_6 = t_5 * t_1 tmp = 0 if d <= -1.1e+71: tmp = t_3 * (1.0 - (((t_2 * (t_5 / d)) * t_6) * (h / t_0))) elif d <= 3.2e+197: tmp = t_4 * (1.0 - (t_2 * ((t_5 * (t_6 * h)) / (d * t_0)))) else: tmp = t_4 * 1.0 return tmp
function code(d, h, l, M, D) t_0 = Float64(Float64(d + d) * l) t_1 = fmin(abs(M), abs(D)) t_2 = Float64(0.25 * t_1) t_3 = Float64(Float64(-d) / sqrt(Float64(l * h))) t_4 = abs(t_3) t_5 = fmax(abs(M), abs(D)) t_6 = Float64(t_5 * t_1) tmp = 0.0 if (d <= -1.1e+71) tmp = Float64(t_3 * Float64(1.0 - Float64(Float64(Float64(t_2 * Float64(t_5 / d)) * t_6) * Float64(h / t_0)))); elseif (d <= 3.2e+197) tmp = Float64(t_4 * Float64(1.0 - Float64(t_2 * Float64(Float64(t_5 * Float64(t_6 * h)) / Float64(d * t_0))))); else tmp = Float64(t_4 * 1.0); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = (d + d) * l; t_1 = min(abs(M), abs(D)); t_2 = 0.25 * t_1; t_3 = -d / sqrt((l * h)); t_4 = abs(t_3); t_5 = max(abs(M), abs(D)); t_6 = t_5 * t_1; tmp = 0.0; if (d <= -1.1e+71) tmp = t_3 * (1.0 - (((t_2 * (t_5 / d)) * t_6) * (h / t_0))); elseif (d <= 3.2e+197) tmp = t_4 * (1.0 - (t_2 * ((t_5 * (t_6 * h)) / (d * t_0)))); else tmp = t_4 * 1.0; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(d + d), $MachinePrecision] * l), $MachinePrecision]}, Block[{t$95$1 = N[Min[N[Abs[M], $MachinePrecision], N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(0.25 * t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[((-d) / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Abs[t$95$3], $MachinePrecision]}, Block[{t$95$5 = N[Max[N[Abs[M], $MachinePrecision], N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$6 = N[(t$95$5 * t$95$1), $MachinePrecision]}, If[LessEqual[d, -1.1e+71], N[(t$95$3 * N[(1.0 - N[(N[(N[(t$95$2 * N[(t$95$5 / d), $MachinePrecision]), $MachinePrecision] * t$95$6), $MachinePrecision] * N[(h / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 3.2e+197], N[(t$95$4 * N[(1.0 - N[(t$95$2 * N[(N[(t$95$5 * N[(t$95$6 * h), $MachinePrecision]), $MachinePrecision] / N[(d * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$4 * 1.0), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
t_0 := \left(d + d\right) \cdot \ell\\
t_1 := \mathsf{min}\left(\left|M\right|, \left|D\right|\right)\\
t_2 := 0.25 \cdot t\_1\\
t_3 := \frac{-d}{\sqrt{\ell \cdot h}}\\
t_4 := \left|t\_3\right|\\
t_5 := \mathsf{max}\left(\left|M\right|, \left|D\right|\right)\\
t_6 := t\_5 \cdot t\_1\\
\mathbf{if}\;d \leq -1.1 \cdot 10^{+71}:\\
\;\;\;\;t\_3 \cdot \left(1 - \left(\left(t\_2 \cdot \frac{t\_5}{d}\right) \cdot t\_6\right) \cdot \frac{h}{t\_0}\right)\\
\mathbf{elif}\;d \leq 3.2 \cdot 10^{+197}:\\
\;\;\;\;t\_4 \cdot \left(1 - t\_2 \cdot \frac{t\_5 \cdot \left(t\_6 \cdot h\right)}{d \cdot t\_0}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_4 \cdot 1\\
\end{array}
if d < -1.1e71Initial program 65.7%
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 rewrites67.4%
Applied rewrites66.9%
Applied rewrites35.5%
if -1.1e71 < d < 3.1999999999999998e197Initial program 65.7%
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 rewrites67.4%
Applied rewrites66.9%
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.0%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
sqrt-divN/A
Applied rewrites73.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-/.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
Applied rewrites66.6%
if 3.1999999999999998e197 < d Initial program 65.7%
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 rewrites67.4%
Applied rewrites66.9%
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.0%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
sqrt-divN/A
Applied rewrites73.3%
Taylor expanded in d around inf
Applied rewrites42.5%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* (+ d d) l))
(t_1 (fmin (fabs M) (fabs D)))
(t_2 (* 0.25 t_1))
(t_3 (sqrt (* l h)))
(t_4 (/ (- d) t_3))
(t_5 (fmax (fabs M) (fabs D))))
(if (<= d -1.95e+71)
(* t_4 (- 1.0 (* (* (* t_2 (/ t_5 d)) (* t_5 t_1)) (/ h t_0))))
(if (<= d -8.8e-302)
(/
(*
(- 1.0 (* (/ (* h (* (* t_2 t_5) t_5)) (* t_0 d)) t_1))
(- d))
(sqrt (* h l)))
(if (<= d 2.15e+120)
(*
(fma
(* (* (* t_5 t_5) h) -0.5)
(* t_2 (/ t_1 (* (* d d) l)))
1.0)
(/ (fabs d) t_3))
(* (fabs t_4) 1.0))))))double code(double d, double h, double l, double M, double D) {
double t_0 = (d + d) * l;
double t_1 = fmin(fabs(M), fabs(D));
double t_2 = 0.25 * t_1;
double t_3 = sqrt((l * h));
double t_4 = -d / t_3;
double t_5 = fmax(fabs(M), fabs(D));
double tmp;
if (d <= -1.95e+71) {
tmp = t_4 * (1.0 - (((t_2 * (t_5 / d)) * (t_5 * t_1)) * (h / t_0)));
} else if (d <= -8.8e-302) {
tmp = ((1.0 - (((h * ((t_2 * t_5) * t_5)) / (t_0 * d)) * t_1)) * -d) / sqrt((h * l));
} else if (d <= 2.15e+120) {
tmp = fma((((t_5 * t_5) * h) * -0.5), (t_2 * (t_1 / ((d * d) * l))), 1.0) * (fabs(d) / t_3);
} else {
tmp = fabs(t_4) * 1.0;
}
return tmp;
}
function code(d, h, l, M, D) t_0 = Float64(Float64(d + d) * l) t_1 = fmin(abs(M), abs(D)) t_2 = Float64(0.25 * t_1) t_3 = sqrt(Float64(l * h)) t_4 = Float64(Float64(-d) / t_3) t_5 = fmax(abs(M), abs(D)) tmp = 0.0 if (d <= -1.95e+71) tmp = Float64(t_4 * Float64(1.0 - Float64(Float64(Float64(t_2 * Float64(t_5 / d)) * Float64(t_5 * t_1)) * Float64(h / t_0)))); elseif (d <= -8.8e-302) tmp = Float64(Float64(Float64(1.0 - Float64(Float64(Float64(h * Float64(Float64(t_2 * t_5) * t_5)) / Float64(t_0 * d)) * t_1)) * Float64(-d)) / sqrt(Float64(h * l))); elseif (d <= 2.15e+120) tmp = Float64(fma(Float64(Float64(Float64(t_5 * t_5) * h) * -0.5), Float64(t_2 * Float64(t_1 / Float64(Float64(d * d) * l))), 1.0) * Float64(abs(d) / t_3)); else tmp = Float64(abs(t_4) * 1.0); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(d + d), $MachinePrecision] * l), $MachinePrecision]}, Block[{t$95$1 = N[Min[N[Abs[M], $MachinePrecision], N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(0.25 * t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[((-d) / t$95$3), $MachinePrecision]}, Block[{t$95$5 = N[Max[N[Abs[M], $MachinePrecision], N[Abs[D], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -1.95e+71], N[(t$95$4 * N[(1.0 - N[(N[(N[(t$95$2 * N[(t$95$5 / d), $MachinePrecision]), $MachinePrecision] * N[(t$95$5 * t$95$1), $MachinePrecision]), $MachinePrecision] * N[(h / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -8.8e-302], N[(N[(N[(1.0 - N[(N[(N[(h * N[(N[(t$95$2 * t$95$5), $MachinePrecision] * t$95$5), $MachinePrecision]), $MachinePrecision] / N[(t$95$0 * d), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision] * (-d)), $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.15e+120], N[(N[(N[(N[(N[(t$95$5 * t$95$5), $MachinePrecision] * h), $MachinePrecision] * -0.5), $MachinePrecision] * N[(t$95$2 * N[(t$95$1 / N[(N[(d * d), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[Abs[d], $MachinePrecision] / t$95$3), $MachinePrecision]), $MachinePrecision], N[(N[Abs[t$95$4], $MachinePrecision] * 1.0), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
t_0 := \left(d + d\right) \cdot \ell\\
t_1 := \mathsf{min}\left(\left|M\right|, \left|D\right|\right)\\
t_2 := 0.25 \cdot t\_1\\
t_3 := \sqrt{\ell \cdot h}\\
t_4 := \frac{-d}{t\_3}\\
t_5 := \mathsf{max}\left(\left|M\right|, \left|D\right|\right)\\
\mathbf{if}\;d \leq -1.95 \cdot 10^{+71}:\\
\;\;\;\;t\_4 \cdot \left(1 - \left(\left(t\_2 \cdot \frac{t\_5}{d}\right) \cdot \left(t\_5 \cdot t\_1\right)\right) \cdot \frac{h}{t\_0}\right)\\
\mathbf{elif}\;d \leq -8.8 \cdot 10^{-302}:\\
\;\;\;\;\frac{\left(1 - \frac{h \cdot \left(\left(t\_2 \cdot t\_5\right) \cdot t\_5\right)}{t\_0 \cdot d} \cdot t\_1\right) \cdot \left(-d\right)}{\sqrt{h \cdot \ell}}\\
\mathbf{elif}\;d \leq 2.15 \cdot 10^{+120}:\\
\;\;\;\;\mathsf{fma}\left(\left(\left(t\_5 \cdot t\_5\right) \cdot h\right) \cdot -0.5, t\_2 \cdot \frac{t\_1}{\left(d \cdot d\right) \cdot \ell}, 1\right) \cdot \frac{\left|d\right|}{t\_3}\\
\mathbf{else}:\\
\;\;\;\;\left|t\_4\right| \cdot 1\\
\end{array}
if d < -1.9500000000000001e71Initial program 65.7%
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 rewrites67.4%
Applied rewrites66.9%
Applied rewrites35.5%
if -1.9500000000000001e71 < d < -8.8000000000000003e-302Initial program 65.7%
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 rewrites67.4%
Applied rewrites66.9%
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.0%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
sqrt-divN/A
Applied rewrites73.3%
Applied rewrites33.6%
if -8.8000000000000003e-302 < d < 2.1500000000000001e120Initial program 65.7%
Applied rewrites35.2%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
associate-/l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6434.0%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6434.0%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6434.0%
Applied rewrites34.0%
lift-fma.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6434.0%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
associate-/l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6437.8%
lift-sqrt.f64N/A
Applied rewrites27.5%
rem-square-sqrtN/A
sqrt-unprodN/A
rem-sqrt-square-revN/A
lift-neg.f64N/A
neg-fabsN/A
lower-fabs.f6453.7%
Applied rewrites53.7%
if 2.1500000000000001e120 < d Initial program 65.7%
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 rewrites67.4%
Applied rewrites66.9%
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.0%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
sqrt-divN/A
Applied rewrites73.3%
Taylor expanded in d around inf
Applied rewrites42.5%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (* l h)))
(t_1 (fmin (fabs M) (fabs D)))
(t_2 (fmax (fabs M) (fabs D)))
(t_3
(*
(fma
(* (* (* t_2 t_2) h) -0.5)
(* (* 0.25 t_1) (/ t_1 (* (* d d) l)))
1.0)
(/ (fabs d) t_0)))
(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 -1e-27)
t_3
(if (<= t_4 INFINITY) (* (fabs (/ (- d) t_0)) 1.0) t_3))))double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((l * h));
double t_1 = fmin(fabs(M), fabs(D));
double t_2 = fmax(fabs(M), fabs(D));
double t_3 = fma((((t_2 * t_2) * h) * -0.5), ((0.25 * t_1) * (t_1 / ((d * d) * l))), 1.0) * (fabs(d) / t_0);
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 <= -1e-27) {
tmp = t_3;
} else if (t_4 <= ((double) INFINITY)) {
tmp = fabs((-d / t_0)) * 1.0;
} else {
tmp = t_3;
}
return tmp;
}
function code(d, h, l, M, D) t_0 = sqrt(Float64(l * h)) t_1 = fmin(abs(M), abs(D)) t_2 = fmax(abs(M), abs(D)) t_3 = Float64(fma(Float64(Float64(Float64(t_2 * t_2) * h) * -0.5), Float64(Float64(0.25 * t_1) * Float64(t_1 / Float64(Float64(d * d) * l))), 1.0) * Float64(abs(d) / t_0)) 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 <= -1e-27) tmp = t_3; elseif (t_4 <= Inf) tmp = Float64(abs(Float64(Float64(-d) / t_0)) * 1.0); else tmp = t_3; end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(l * h), $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[(N[(N[(t$95$2 * t$95$2), $MachinePrecision] * h), $MachinePrecision] * -0.5), $MachinePrecision] * N[(N[(0.25 * t$95$1), $MachinePrecision] * N[(t$95$1 / N[(N[(d * d), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[Abs[d], $MachinePrecision] / t$95$0), $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, -1e-27], t$95$3, If[LessEqual[t$95$4, Infinity], N[(N[Abs[N[((-d) / t$95$0), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision], t$95$3]]]]]]]
\begin{array}{l}
t_0 := \sqrt{\ell \cdot h}\\
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 := \mathsf{fma}\left(\left(\left(t\_2 \cdot t\_2\right) \cdot h\right) \cdot -0.5, \left(0.25 \cdot t\_1\right) \cdot \frac{t\_1}{\left(d \cdot d\right) \cdot \ell}, 1\right) \cdot \frac{\left|d\right|}{t\_0}\\
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 -1 \cdot 10^{-27}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_4 \leq \infty:\\
\;\;\;\;\left|\frac{-d}{t\_0}\right| \cdot 1\\
\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)))) < -1e-27 or +inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 65.7%
Applied rewrites35.2%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
associate-/l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6434.0%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6434.0%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6434.0%
Applied rewrites34.0%
lift-fma.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6434.0%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
associate-/l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6437.8%
lift-sqrt.f64N/A
Applied rewrites27.5%
rem-square-sqrtN/A
sqrt-unprodN/A
rem-sqrt-square-revN/A
lift-neg.f64N/A
neg-fabsN/A
lower-fabs.f6453.7%
Applied rewrites53.7%
if -1e-27 < (*.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 65.7%
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 rewrites67.4%
Applied rewrites66.9%
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.0%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
sqrt-divN/A
Applied rewrites73.3%
Taylor expanded in d around inf
Applied rewrites42.5%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (fmin (fabs M) (fabs D)))
(t_1 (/ (- d) (sqrt (* l h))))
(t_2 (fmax (fabs M) (fabs D))))
(if (<=
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(-
1.0
(*
(* (/ 1.0 2.0) (pow (/ (* t_0 t_2) (* 2.0 d)) 2.0))
(/ h l))))
-1e-27)
(*
(fma
t_2
(* (* t_2 h) (* -0.125 (/ (* t_0 t_0) (* (* d d) l))))
1.0)
t_1)
(* (fabs t_1) 1.0))))double code(double d, double h, double l, double M, double D) {
double t_0 = fmin(fabs(M), fabs(D));
double t_1 = -d / sqrt((l * h));
double t_2 = fmax(fabs(M), fabs(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(((t_0 * t_2) / (2.0 * d)), 2.0)) * (h / l)))) <= -1e-27) {
tmp = fma(t_2, ((t_2 * h) * (-0.125 * ((t_0 * t_0) / ((d * d) * l)))), 1.0) * t_1;
} else {
tmp = fabs(t_1) * 1.0;
}
return tmp;
}
function code(d, h, l, M, D) t_0 = fmin(abs(M), abs(D)) t_1 = Float64(Float64(-d) / sqrt(Float64(l * h))) t_2 = fmax(abs(M), abs(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(t_0 * t_2) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) <= -1e-27) tmp = Float64(fma(t_2, Float64(Float64(t_2 * h) * Float64(-0.125 * Float64(Float64(t_0 * t_0) / Float64(Float64(d * d) * l)))), 1.0) * t_1); else tmp = Float64(abs(t_1) * 1.0); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Min[N[Abs[M], $MachinePrecision], N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[((-d) / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Max[N[Abs[M], $MachinePrecision], N[Abs[D], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(t$95$0 * t$95$2), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -1e-27], N[(N[(t$95$2 * N[(N[(t$95$2 * h), $MachinePrecision] * N[(-0.125 * N[(N[(t$95$0 * t$95$0), $MachinePrecision] / N[(N[(d * d), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * t$95$1), $MachinePrecision], N[(N[Abs[t$95$1], $MachinePrecision] * 1.0), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := \mathsf{min}\left(\left|M\right|, \left|D\right|\right)\\
t_1 := \frac{-d}{\sqrt{\ell \cdot h}}\\
t_2 := \mathsf{max}\left(\left|M\right|, \left|D\right|\right)\\
\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{t\_0 \cdot t\_2}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq -1 \cdot 10^{-27}:\\
\;\;\;\;\mathsf{fma}\left(t\_2, \left(t\_2 \cdot h\right) \cdot \left(-0.125 \cdot \frac{t\_0 \cdot t\_0}{\left(d \cdot d\right) \cdot \ell}\right), 1\right) \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;\left|t\_1\right| \cdot 1\\
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -1e-27Initial program 65.7%
Applied rewrites35.2%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
associate-/l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6434.0%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6434.0%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6434.0%
Applied rewrites34.0%
lift-fma.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6434.0%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
associate-/l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6437.8%
lift-sqrt.f64N/A
Applied rewrites27.5%
lift-fma.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites27.8%
if -1e-27 < (*.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 65.7%
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 rewrites67.4%
Applied rewrites66.9%
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.0%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
sqrt-divN/A
Applied rewrites73.3%
Taylor expanded in d around inf
Applied rewrites42.5%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (fmin (fabs M) (fabs D))) (t_1 (fmax (fabs M) (fabs D))))
(if (<=
(*
(* (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))))
-1e-27)
(/
(*
(fma
(* -0.125 (/ (* t_0 t_0) (* (* d d) l)))
(* (* t_1 t_1) h)
1.0)
(- d))
(sqrt (* h l)))
(* (fabs (/ (- d) (sqrt (* l h)))) 1.0))))double code(double d, double h, double l, double M, double D) {
double t_0 = fmin(fabs(M), fabs(D));
double t_1 = fmax(fabs(M), fabs(D));
double tmp;
if (((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)))) <= -1e-27) {
tmp = (fma((-0.125 * ((t_0 * t_0) / ((d * d) * l))), ((t_1 * t_1) * h), 1.0) * -d) / sqrt((h * l));
} else {
tmp = fabs((-d / sqrt((l * h)))) * 1.0;
}
return tmp;
}
function code(d, h, l, M, D) t_0 = fmin(abs(M), abs(D)) t_1 = fmax(abs(M), abs(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(t_0 * t_1) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) <= -1e-27) tmp = Float64(Float64(fma(Float64(-0.125 * Float64(Float64(t_0 * t_0) / Float64(Float64(d * d) * l))), Float64(Float64(t_1 * t_1) * h), 1.0) * Float64(-d)) / sqrt(Float64(h * l))); else tmp = Float64(abs(Float64(Float64(-d) / sqrt(Float64(l * h)))) * 1.0); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Min[N[Abs[M], $MachinePrecision], N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Max[N[Abs[M], $MachinePrecision], N[Abs[D], $MachinePrecision]], $MachinePrecision]}, 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[(t$95$0 * t$95$1), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -1e-27], N[(N[(N[(N[(-0.125 * N[(N[(t$95$0 * t$95$0), $MachinePrecision] / N[(N[(d * d), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$1 * t$95$1), $MachinePrecision] * h), $MachinePrecision] + 1.0), $MachinePrecision] * (-d)), $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Abs[N[((-d) / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \mathsf{min}\left(\left|M\right|, \left|D\right|\right)\\
t_1 := \mathsf{max}\left(\left|M\right|, \left|D\right|\right)\\
\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{t\_0 \cdot t\_1}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq -1 \cdot 10^{-27}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-0.125 \cdot \frac{t\_0 \cdot t\_0}{\left(d \cdot d\right) \cdot \ell}, \left(t\_1 \cdot t\_1\right) \cdot h, 1\right) \cdot \left(-d\right)}{\sqrt{h \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{-d}{\sqrt{\ell \cdot h}}\right| \cdot 1\\
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -1e-27Initial program 65.7%
Applied rewrites35.2%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
associate-/l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6434.0%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6434.0%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6434.0%
Applied rewrites34.0%
lift-fma.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6434.0%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
associate-/l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6437.8%
lift-sqrt.f64N/A
Applied rewrites27.5%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites24.8%
if -1e-27 < (*.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 65.7%
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 rewrites67.4%
Applied rewrites66.9%
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.0%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
sqrt-divN/A
Applied rewrites73.3%
Taylor expanded in d around inf
Applied rewrites42.5%
(FPCore (d h l M D)
:precision binary64
(if (<=
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(-
1.0
(* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l))))
-1e-47)
(* (* (- d) (sqrt (/ 1.0 (* l h)))) 1.0)
(* (fabs (/ (- d) (sqrt (* l h)))) 1.0)))double code(double d, double h, double l, double M, double D) {
double tmp;
if (((pow((d / h), (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)))) <= -1e-47) {
tmp = (-d * sqrt((1.0 / (l * h)))) * 1.0;
} else {
tmp = fabs((-d / sqrt((l * h)))) * 1.0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (((((d / h) ** (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)))) <= (-1d-47)) then
tmp = (-d * sqrt((1.0d0 / (l * h)))) * 1.0d0
else
tmp = abs((-d / sqrt((l * h)))) * 1.0d0
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (((Math.pow((d / h), (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)))) <= -1e-47) {
tmp = (-d * Math.sqrt((1.0 / (l * h)))) * 1.0;
} else {
tmp = Math.abs((-d / Math.sqrt((l * h)))) * 1.0;
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if ((math.pow((d / h), (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)))) <= -1e-47: tmp = (-d * math.sqrt((1.0 / (l * h)))) * 1.0 else: tmp = math.fabs((-d / math.sqrt((l * h)))) * 1.0 return tmp
function code(d, h, l, M, D) tmp = 0.0 if (Float64(Float64((Float64(d / h) ^ 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)))) <= -1e-47) tmp = Float64(Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(l * h)))) * 1.0); else tmp = Float64(abs(Float64(Float64(-d) / sqrt(Float64(l * h)))) * 1.0); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (((((d / h) ^ (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)))) <= -1e-47) tmp = (-d * sqrt((1.0 / (l * h)))) * 1.0; else tmp = abs((-d / sqrt((l * h)))) * 1.0; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(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], -1e-47], N[(N[((-d) * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], N[(N[Abs[N[((-d) / N[Sqrt[N[(l * h), $MachinePrecision]], $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 -1 \cdot 10^{-47}:\\
\;\;\;\;\left(\left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot 1\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{-d}{\sqrt{\ell \cdot h}}\right| \cdot 1\\
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -9.9999999999999997e-48Initial program 65.7%
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 rewrites67.4%
Applied rewrites66.9%
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
lift-*.f64N/A
mult-flipN/A
sqrt-prodN/A
lower-unsound-sqrt.f64N/A
lower-sqrt.f64N/A
lift-*.f64N/A
sqr-neg-revN/A
lift-neg.f64N/A
lift-neg.f64N/A
sqrt-unprodN/A
rem-square-sqrtN/A
lower-unsound-*.f64N/A
lower-unsound-sqrt.f64N/A
Applied rewrites37.6%
Taylor expanded in d around inf
Applied rewrites26.2%
if -9.9999999999999997e-48 < (*.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 65.7%
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 rewrites67.4%
Applied rewrites66.9%
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.0%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
sqrt-divN/A
Applied rewrites73.3%
Taylor expanded in d around inf
Applied rewrites42.5%
(FPCore (d h l M D) :precision binary64 (* (fabs (/ (- d) (sqrt (* l h)))) 1.0))
double code(double d, double h, double l, double M, double D) {
return fabs((-d / sqrt((l * h)))) * 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((l * h)))) * 1.0d0
end function
public static double code(double d, double h, double l, double M, double D) {
return Math.abs((-d / Math.sqrt((l * h)))) * 1.0;
}
def code(d, h, l, M, D): return math.fabs((-d / math.sqrt((l * h)))) * 1.0
function code(d, h, l, M, D) return Float64(abs(Float64(Float64(-d) / sqrt(Float64(l * h)))) * 1.0) end
function tmp = code(d, h, l, M, D) tmp = abs((-d / sqrt((l * h)))) * 1.0; end
code[d_, h_, l_, M_, D_] := N[(N[Abs[N[((-d) / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision]
\left|\frac{-d}{\sqrt{\ell \cdot h}}\right| \cdot 1
Initial program 65.7%
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 rewrites67.4%
Applied rewrites66.9%
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.0%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
sqrt-divN/A
Applied rewrites73.3%
Taylor expanded in d around inf
Applied rewrites42.5%
herbie shell --seed 2025210
(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)))))