
(FPCore (p r q) :precision binary64 (* (/ 1.0 2.0) (+ (+ (fabs p) (fabs r)) (sqrt (+ (pow (- p r) 2.0) (* 4.0 (pow q 2.0)))))))
double code(double p, double r, double q) {
return (1.0 / 2.0) * ((fabs(p) + fabs(r)) + sqrt((pow((p - r), 2.0) + (4.0 * pow(q, 2.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(p, r, q)
use fmin_fmax_functions
real(8), intent (in) :: p
real(8), intent (in) :: r
real(8), intent (in) :: q
code = (1.0d0 / 2.0d0) * ((abs(p) + abs(r)) + sqrt((((p - r) ** 2.0d0) + (4.0d0 * (q ** 2.0d0)))))
end function
public static double code(double p, double r, double q) {
return (1.0 / 2.0) * ((Math.abs(p) + Math.abs(r)) + Math.sqrt((Math.pow((p - r), 2.0) + (4.0 * Math.pow(q, 2.0)))));
}
def code(p, r, q): return (1.0 / 2.0) * ((math.fabs(p) + math.fabs(r)) + math.sqrt((math.pow((p - r), 2.0) + (4.0 * math.pow(q, 2.0)))))
function code(p, r, q) return Float64(Float64(1.0 / 2.0) * Float64(Float64(abs(p) + abs(r)) + sqrt(Float64((Float64(p - r) ^ 2.0) + Float64(4.0 * (q ^ 2.0)))))) end
function tmp = code(p, r, q) tmp = (1.0 / 2.0) * ((abs(p) + abs(r)) + sqrt((((p - r) ^ 2.0) + (4.0 * (q ^ 2.0))))); end
code[p_, r_, q_] := N[(N[(1.0 / 2.0), $MachinePrecision] * N[(N[(N[Abs[p], $MachinePrecision] + N[Abs[r], $MachinePrecision]), $MachinePrecision] + N[Sqrt[N[(N[Power[N[(p - r), $MachinePrecision], 2.0], $MachinePrecision] + N[(4.0 * N[Power[q, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{2} \cdot \left(\left(\left|p\right| + \left|r\right|\right) + \sqrt{{\left(p - r\right)}^{2} + 4 \cdot {q}^{2}}\right)
\end{array}
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (p r q) :precision binary64 (* (/ 1.0 2.0) (+ (+ (fabs p) (fabs r)) (sqrt (+ (pow (- p r) 2.0) (* 4.0 (pow q 2.0)))))))
double code(double p, double r, double q) {
return (1.0 / 2.0) * ((fabs(p) + fabs(r)) + sqrt((pow((p - r), 2.0) + (4.0 * pow(q, 2.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(p, r, q)
use fmin_fmax_functions
real(8), intent (in) :: p
real(8), intent (in) :: r
real(8), intent (in) :: q
code = (1.0d0 / 2.0d0) * ((abs(p) + abs(r)) + sqrt((((p - r) ** 2.0d0) + (4.0d0 * (q ** 2.0d0)))))
end function
public static double code(double p, double r, double q) {
return (1.0 / 2.0) * ((Math.abs(p) + Math.abs(r)) + Math.sqrt((Math.pow((p - r), 2.0) + (4.0 * Math.pow(q, 2.0)))));
}
def code(p, r, q): return (1.0 / 2.0) * ((math.fabs(p) + math.fabs(r)) + math.sqrt((math.pow((p - r), 2.0) + (4.0 * math.pow(q, 2.0)))))
function code(p, r, q) return Float64(Float64(1.0 / 2.0) * Float64(Float64(abs(p) + abs(r)) + sqrt(Float64((Float64(p - r) ^ 2.0) + Float64(4.0 * (q ^ 2.0)))))) end
function tmp = code(p, r, q) tmp = (1.0 / 2.0) * ((abs(p) + abs(r)) + sqrt((((p - r) ^ 2.0) + (4.0 * (q ^ 2.0))))); end
code[p_, r_, q_] := N[(N[(1.0 / 2.0), $MachinePrecision] * N[(N[(N[Abs[p], $MachinePrecision] + N[Abs[r], $MachinePrecision]), $MachinePrecision] + N[Sqrt[N[(N[Power[N[(p - r), $MachinePrecision], 2.0], $MachinePrecision] + N[(4.0 * N[Power[q, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{2} \cdot \left(\left(\left|p\right| + \left|r\right|\right) + \sqrt{{\left(p - r\right)}^{2} + 4 \cdot {q}^{2}}\right)
\end{array}
NOTE: p, r, and q should be sorted in increasing order before calling this function.
(FPCore (p r q)
:precision binary64
(if (<= p -1.25e+124)
(* (+ (- p) (+ (fabs r) (fabs p))) 0.5)
(if (<= p -1.05e-264)
(*
(/ 1.0 2.0)
(+
(+ (fabs p) (fabs r))
(sqrt (+ (pow (- p r) 2.0) (* 4.0 (pow q 2.0))))))
r)))assert(p < r && r < q);
double code(double p, double r, double q) {
double tmp;
if (p <= -1.25e+124) {
tmp = (-p + (fabs(r) + fabs(p))) * 0.5;
} else if (p <= -1.05e-264) {
tmp = (1.0 / 2.0) * ((fabs(p) + fabs(r)) + sqrt((pow((p - r), 2.0) + (4.0 * pow(q, 2.0)))));
} else {
tmp = r;
}
return tmp;
}
NOTE: p, r, and q should be sorted in increasing order before calling this function.
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(p, r, q)
use fmin_fmax_functions
real(8), intent (in) :: p
real(8), intent (in) :: r
real(8), intent (in) :: q
real(8) :: tmp
if (p <= (-1.25d+124)) then
tmp = (-p + (abs(r) + abs(p))) * 0.5d0
else if (p <= (-1.05d-264)) then
tmp = (1.0d0 / 2.0d0) * ((abs(p) + abs(r)) + sqrt((((p - r) ** 2.0d0) + (4.0d0 * (q ** 2.0d0)))))
else
tmp = r
end if
code = tmp
end function
assert p < r && r < q;
public static double code(double p, double r, double q) {
double tmp;
if (p <= -1.25e+124) {
tmp = (-p + (Math.abs(r) + Math.abs(p))) * 0.5;
} else if (p <= -1.05e-264) {
tmp = (1.0 / 2.0) * ((Math.abs(p) + Math.abs(r)) + Math.sqrt((Math.pow((p - r), 2.0) + (4.0 * Math.pow(q, 2.0)))));
} else {
tmp = r;
}
return tmp;
}
[p, r, q] = sort([p, r, q]) def code(p, r, q): tmp = 0 if p <= -1.25e+124: tmp = (-p + (math.fabs(r) + math.fabs(p))) * 0.5 elif p <= -1.05e-264: tmp = (1.0 / 2.0) * ((math.fabs(p) + math.fabs(r)) + math.sqrt((math.pow((p - r), 2.0) + (4.0 * math.pow(q, 2.0))))) else: tmp = r return tmp
p, r, q = sort([p, r, q]) function code(p, r, q) tmp = 0.0 if (p <= -1.25e+124) tmp = Float64(Float64(Float64(-p) + Float64(abs(r) + abs(p))) * 0.5); elseif (p <= -1.05e-264) tmp = Float64(Float64(1.0 / 2.0) * Float64(Float64(abs(p) + abs(r)) + sqrt(Float64((Float64(p - r) ^ 2.0) + Float64(4.0 * (q ^ 2.0)))))); else tmp = r; end return tmp end
p, r, q = num2cell(sort([p, r, q])){:}
function tmp_2 = code(p, r, q)
tmp = 0.0;
if (p <= -1.25e+124)
tmp = (-p + (abs(r) + abs(p))) * 0.5;
elseif (p <= -1.05e-264)
tmp = (1.0 / 2.0) * ((abs(p) + abs(r)) + sqrt((((p - r) ^ 2.0) + (4.0 * (q ^ 2.0)))));
else
tmp = r;
end
tmp_2 = tmp;
end
NOTE: p, r, and q should be sorted in increasing order before calling this function. code[p_, r_, q_] := If[LessEqual[p, -1.25e+124], N[(N[((-p) + N[(N[Abs[r], $MachinePrecision] + N[Abs[p], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision], If[LessEqual[p, -1.05e-264], N[(N[(1.0 / 2.0), $MachinePrecision] * N[(N[(N[Abs[p], $MachinePrecision] + N[Abs[r], $MachinePrecision]), $MachinePrecision] + N[Sqrt[N[(N[Power[N[(p - r), $MachinePrecision], 2.0], $MachinePrecision] + N[(4.0 * N[Power[q, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], r]]
\begin{array}{l}
[p, r, q] = \mathsf{sort}([p, r, q])\\
\\
\begin{array}{l}
\mathbf{if}\;p \leq -1.25 \cdot 10^{+124}:\\
\;\;\;\;\left(\left(-p\right) + \left(\left|r\right| + \left|p\right|\right)\right) \cdot 0.5\\
\mathbf{elif}\;p \leq -1.05 \cdot 10^{-264}:\\
\;\;\;\;\frac{1}{2} \cdot \left(\left(\left|p\right| + \left|r\right|\right) + \sqrt{{\left(p - r\right)}^{2} + 4 \cdot {q}^{2}}\right)\\
\mathbf{else}:\\
\;\;\;\;r\\
\end{array}
\end{array}
if p < -1.2499999999999999e124Initial program 17.0%
Taylor expanded in p around -inf
mul-1-negN/A
lower-neg.f6479.3
Applied rewrites79.3%
lift-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
*-commutativeN/A
lower-*.f6479.3
Applied rewrites79.3%
if -1.2499999999999999e124 < p < -1.0500000000000001e-264Initial program 62.0%
if -1.0500000000000001e-264 < p Initial program 46.5%
Taylor expanded in p around inf
Applied rewrites14.1%
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites14.1%
Taylor expanded in p around -inf
Applied rewrites65.7%
NOTE: p, r, and q should be sorted in increasing order before calling this function.
(FPCore (p r q)
:precision binary64
(let* ((t_0 (+ (fabs r) (fabs p))))
(if (<= p -3.8e+153)
(* (+ (- p) t_0) 0.5)
(if (<= p -1.2e-92)
(* (+ t_0 (sqrt (fma (* q q) 4.0 (* p p)))) 0.5)
(if (<= p -6e-278) (* (+ (+ r p) (+ q q)) 0.5) r)))))assert(p < r && r < q);
double code(double p, double r, double q) {
double t_0 = fabs(r) + fabs(p);
double tmp;
if (p <= -3.8e+153) {
tmp = (-p + t_0) * 0.5;
} else if (p <= -1.2e-92) {
tmp = (t_0 + sqrt(fma((q * q), 4.0, (p * p)))) * 0.5;
} else if (p <= -6e-278) {
tmp = ((r + p) + (q + q)) * 0.5;
} else {
tmp = r;
}
return tmp;
}
p, r, q = sort([p, r, q]) function code(p, r, q) t_0 = Float64(abs(r) + abs(p)) tmp = 0.0 if (p <= -3.8e+153) tmp = Float64(Float64(Float64(-p) + t_0) * 0.5); elseif (p <= -1.2e-92) tmp = Float64(Float64(t_0 + sqrt(fma(Float64(q * q), 4.0, Float64(p * p)))) * 0.5); elseif (p <= -6e-278) tmp = Float64(Float64(Float64(r + p) + Float64(q + q)) * 0.5); else tmp = r; end return tmp end
NOTE: p, r, and q should be sorted in increasing order before calling this function.
code[p_, r_, q_] := Block[{t$95$0 = N[(N[Abs[r], $MachinePrecision] + N[Abs[p], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[p, -3.8e+153], N[(N[((-p) + t$95$0), $MachinePrecision] * 0.5), $MachinePrecision], If[LessEqual[p, -1.2e-92], N[(N[(t$95$0 + N[Sqrt[N[(N[(q * q), $MachinePrecision] * 4.0 + N[(p * p), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision], If[LessEqual[p, -6e-278], N[(N[(N[(r + p), $MachinePrecision] + N[(q + q), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision], r]]]]
\begin{array}{l}
[p, r, q] = \mathsf{sort}([p, r, q])\\
\\
\begin{array}{l}
t_0 := \left|r\right| + \left|p\right|\\
\mathbf{if}\;p \leq -3.8 \cdot 10^{+153}:\\
\;\;\;\;\left(\left(-p\right) + t\_0\right) \cdot 0.5\\
\mathbf{elif}\;p \leq -1.2 \cdot 10^{-92}:\\
\;\;\;\;\left(t\_0 + \sqrt{\mathsf{fma}\left(q \cdot q, 4, p \cdot p\right)}\right) \cdot 0.5\\
\mathbf{elif}\;p \leq -6 \cdot 10^{-278}:\\
\;\;\;\;\left(\left(r + p\right) + \left(q + q\right)\right) \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;r\\
\end{array}
\end{array}
if p < -3.79999999999999966e153Initial program 7.8%
Taylor expanded in p around -inf
mul-1-negN/A
lower-neg.f6482.1
Applied rewrites82.1%
lift-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
*-commutativeN/A
lower-*.f6482.1
Applied rewrites82.1%
if -3.79999999999999966e153 < p < -1.2000000000000001e-92Initial program 64.4%
Taylor expanded in q around inf
count-2-revN/A
lower-+.f6430.0
Applied rewrites30.0%
lift-/.f64N/A
metadata-eval30.0
Applied rewrites30.0%
Taylor expanded in r around 0
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites58.3%
if -1.2000000000000001e-92 < p < -6e-278Initial program 58.4%
Taylor expanded in q around inf
count-2-revN/A
lower-+.f6434.6
Applied rewrites34.6%
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites33.2%
if -6e-278 < p Initial program 46.3%
Taylor expanded in p around inf
Applied rewrites14.1%
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites14.1%
Taylor expanded in p around -inf
Applied rewrites66.2%
NOTE: p, r, and q should be sorted in increasing order before calling this function. (FPCore (p r q) :precision binary64 (if (<= p -8.8e-14) (* (+ (- p) (+ (fabs r) (fabs p))) 0.5) (if (<= p -6e-278) (* 0.5 (+ (+ (fabs p) (fabs r)) (+ q q))) r)))
assert(p < r && r < q);
double code(double p, double r, double q) {
double tmp;
if (p <= -8.8e-14) {
tmp = (-p + (fabs(r) + fabs(p))) * 0.5;
} else if (p <= -6e-278) {
tmp = 0.5 * ((fabs(p) + fabs(r)) + (q + q));
} else {
tmp = r;
}
return tmp;
}
NOTE: p, r, and q should be sorted in increasing order before calling this function.
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(p, r, q)
use fmin_fmax_functions
real(8), intent (in) :: p
real(8), intent (in) :: r
real(8), intent (in) :: q
real(8) :: tmp
if (p <= (-8.8d-14)) then
tmp = (-p + (abs(r) + abs(p))) * 0.5d0
else if (p <= (-6d-278)) then
tmp = 0.5d0 * ((abs(p) + abs(r)) + (q + q))
else
tmp = r
end if
code = tmp
end function
assert p < r && r < q;
public static double code(double p, double r, double q) {
double tmp;
if (p <= -8.8e-14) {
tmp = (-p + (Math.abs(r) + Math.abs(p))) * 0.5;
} else if (p <= -6e-278) {
tmp = 0.5 * ((Math.abs(p) + Math.abs(r)) + (q + q));
} else {
tmp = r;
}
return tmp;
}
[p, r, q] = sort([p, r, q]) def code(p, r, q): tmp = 0 if p <= -8.8e-14: tmp = (-p + (math.fabs(r) + math.fabs(p))) * 0.5 elif p <= -6e-278: tmp = 0.5 * ((math.fabs(p) + math.fabs(r)) + (q + q)) else: tmp = r return tmp
p, r, q = sort([p, r, q]) function code(p, r, q) tmp = 0.0 if (p <= -8.8e-14) tmp = Float64(Float64(Float64(-p) + Float64(abs(r) + abs(p))) * 0.5); elseif (p <= -6e-278) tmp = Float64(0.5 * Float64(Float64(abs(p) + abs(r)) + Float64(q + q))); else tmp = r; end return tmp end
p, r, q = num2cell(sort([p, r, q])){:}
function tmp_2 = code(p, r, q)
tmp = 0.0;
if (p <= -8.8e-14)
tmp = (-p + (abs(r) + abs(p))) * 0.5;
elseif (p <= -6e-278)
tmp = 0.5 * ((abs(p) + abs(r)) + (q + q));
else
tmp = r;
end
tmp_2 = tmp;
end
NOTE: p, r, and q should be sorted in increasing order before calling this function. code[p_, r_, q_] := If[LessEqual[p, -8.8e-14], N[(N[((-p) + N[(N[Abs[r], $MachinePrecision] + N[Abs[p], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision], If[LessEqual[p, -6e-278], N[(0.5 * N[(N[(N[Abs[p], $MachinePrecision] + N[Abs[r], $MachinePrecision]), $MachinePrecision] + N[(q + q), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], r]]
\begin{array}{l}
[p, r, q] = \mathsf{sort}([p, r, q])\\
\\
\begin{array}{l}
\mathbf{if}\;p \leq -8.8 \cdot 10^{-14}:\\
\;\;\;\;\left(\left(-p\right) + \left(\left|r\right| + \left|p\right|\right)\right) \cdot 0.5\\
\mathbf{elif}\;p \leq -6 \cdot 10^{-278}:\\
\;\;\;\;0.5 \cdot \left(\left(\left|p\right| + \left|r\right|\right) + \left(q + q\right)\right)\\
\mathbf{else}:\\
\;\;\;\;r\\
\end{array}
\end{array}
if p < -8.8000000000000004e-14Initial program 35.8%
Taylor expanded in p around -inf
mul-1-negN/A
lower-neg.f6467.3
Applied rewrites67.3%
lift-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
*-commutativeN/A
lower-*.f6467.3
Applied rewrites67.3%
if -8.8000000000000004e-14 < p < -6e-278Initial program 59.9%
Taylor expanded in q around inf
count-2-revN/A
lower-+.f6434.3
Applied rewrites34.3%
lift-/.f64N/A
metadata-eval34.3
Applied rewrites34.3%
if -6e-278 < p Initial program 46.3%
Taylor expanded in p around inf
Applied rewrites14.1%
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites14.1%
Taylor expanded in p around -inf
Applied rewrites66.2%
NOTE: p, r, and q should be sorted in increasing order before calling this function. (FPCore (p r q) :precision binary64 (if (<= p -9.5e-30) (* (+ (- p) (+ (fabs r) (fabs p))) 0.5) (if (<= p -6e-278) (* (+ (+ r p) (+ q q)) 0.5) r)))
assert(p < r && r < q);
double code(double p, double r, double q) {
double tmp;
if (p <= -9.5e-30) {
tmp = (-p + (fabs(r) + fabs(p))) * 0.5;
} else if (p <= -6e-278) {
tmp = ((r + p) + (q + q)) * 0.5;
} else {
tmp = r;
}
return tmp;
}
NOTE: p, r, and q should be sorted in increasing order before calling this function.
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(p, r, q)
use fmin_fmax_functions
real(8), intent (in) :: p
real(8), intent (in) :: r
real(8), intent (in) :: q
real(8) :: tmp
if (p <= (-9.5d-30)) then
tmp = (-p + (abs(r) + abs(p))) * 0.5d0
else if (p <= (-6d-278)) then
tmp = ((r + p) + (q + q)) * 0.5d0
else
tmp = r
end if
code = tmp
end function
assert p < r && r < q;
public static double code(double p, double r, double q) {
double tmp;
if (p <= -9.5e-30) {
tmp = (-p + (Math.abs(r) + Math.abs(p))) * 0.5;
} else if (p <= -6e-278) {
tmp = ((r + p) + (q + q)) * 0.5;
} else {
tmp = r;
}
return tmp;
}
[p, r, q] = sort([p, r, q]) def code(p, r, q): tmp = 0 if p <= -9.5e-30: tmp = (-p + (math.fabs(r) + math.fabs(p))) * 0.5 elif p <= -6e-278: tmp = ((r + p) + (q + q)) * 0.5 else: tmp = r return tmp
p, r, q = sort([p, r, q]) function code(p, r, q) tmp = 0.0 if (p <= -9.5e-30) tmp = Float64(Float64(Float64(-p) + Float64(abs(r) + abs(p))) * 0.5); elseif (p <= -6e-278) tmp = Float64(Float64(Float64(r + p) + Float64(q + q)) * 0.5); else tmp = r; end return tmp end
p, r, q = num2cell(sort([p, r, q])){:}
function tmp_2 = code(p, r, q)
tmp = 0.0;
if (p <= -9.5e-30)
tmp = (-p + (abs(r) + abs(p))) * 0.5;
elseif (p <= -6e-278)
tmp = ((r + p) + (q + q)) * 0.5;
else
tmp = r;
end
tmp_2 = tmp;
end
NOTE: p, r, and q should be sorted in increasing order before calling this function. code[p_, r_, q_] := If[LessEqual[p, -9.5e-30], N[(N[((-p) + N[(N[Abs[r], $MachinePrecision] + N[Abs[p], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision], If[LessEqual[p, -6e-278], N[(N[(N[(r + p), $MachinePrecision] + N[(q + q), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision], r]]
\begin{array}{l}
[p, r, q] = \mathsf{sort}([p, r, q])\\
\\
\begin{array}{l}
\mathbf{if}\;p \leq -9.5 \cdot 10^{-30}:\\
\;\;\;\;\left(\left(-p\right) + \left(\left|r\right| + \left|p\right|\right)\right) \cdot 0.5\\
\mathbf{elif}\;p \leq -6 \cdot 10^{-278}:\\
\;\;\;\;\left(\left(r + p\right) + \left(q + q\right)\right) \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;r\\
\end{array}
\end{array}
if p < -9.49999999999999939e-30Initial program 36.9%
Taylor expanded in p around -inf
mul-1-negN/A
lower-neg.f6465.8
Applied rewrites65.8%
lift-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
*-commutativeN/A
lower-*.f6465.8
Applied rewrites65.8%
if -9.49999999999999939e-30 < p < -6e-278Initial program 59.6%
Taylor expanded in q around inf
count-2-revN/A
lower-+.f6434.6
Applied rewrites34.6%
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites32.5%
if -6e-278 < p Initial program 46.3%
Taylor expanded in p around inf
Applied rewrites14.1%
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites14.1%
Taylor expanded in p around -inf
Applied rewrites66.2%
NOTE: p, r, and q should be sorted in increasing order before calling this function. (FPCore (p r q) :precision binary64 (if (<= q 4.5e-41) r (* (+ (+ r p) (+ q q)) 0.5)))
assert(p < r && r < q);
double code(double p, double r, double q) {
double tmp;
if (q <= 4.5e-41) {
tmp = r;
} else {
tmp = ((r + p) + (q + q)) * 0.5;
}
return tmp;
}
NOTE: p, r, and q should be sorted in increasing order before calling this function.
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(p, r, q)
use fmin_fmax_functions
real(8), intent (in) :: p
real(8), intent (in) :: r
real(8), intent (in) :: q
real(8) :: tmp
if (q <= 4.5d-41) then
tmp = r
else
tmp = ((r + p) + (q + q)) * 0.5d0
end if
code = tmp
end function
assert p < r && r < q;
public static double code(double p, double r, double q) {
double tmp;
if (q <= 4.5e-41) {
tmp = r;
} else {
tmp = ((r + p) + (q + q)) * 0.5;
}
return tmp;
}
[p, r, q] = sort([p, r, q]) def code(p, r, q): tmp = 0 if q <= 4.5e-41: tmp = r else: tmp = ((r + p) + (q + q)) * 0.5 return tmp
p, r, q = sort([p, r, q]) function code(p, r, q) tmp = 0.0 if (q <= 4.5e-41) tmp = r; else tmp = Float64(Float64(Float64(r + p) + Float64(q + q)) * 0.5); end return tmp end
p, r, q = num2cell(sort([p, r, q])){:}
function tmp_2 = code(p, r, q)
tmp = 0.0;
if (q <= 4.5e-41)
tmp = r;
else
tmp = ((r + p) + (q + q)) * 0.5;
end
tmp_2 = tmp;
end
NOTE: p, r, and q should be sorted in increasing order before calling this function. code[p_, r_, q_] := If[LessEqual[q, 4.5e-41], r, N[(N[(N[(r + p), $MachinePrecision] + N[(q + q), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]]
\begin{array}{l}
[p, r, q] = \mathsf{sort}([p, r, q])\\
\\
\begin{array}{l}
\mathbf{if}\;q \leq 4.5 \cdot 10^{-41}:\\
\;\;\;\;r\\
\mathbf{else}:\\
\;\;\;\;\left(\left(r + p\right) + \left(q + q\right)\right) \cdot 0.5\\
\end{array}
\end{array}
if q < 4.5e-41Initial program 48.7%
Taylor expanded in p around inf
Applied rewrites9.2%
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites8.3%
Taylor expanded in p around -inf
Applied rewrites39.3%
if 4.5e-41 < q Initial program 36.6%
Taylor expanded in q around inf
count-2-revN/A
lower-+.f6461.9
Applied rewrites61.9%
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites57.3%
NOTE: p, r, and q should be sorted in increasing order before calling this function. (FPCore (p r q) :precision binary64 (if (<= q 4.5e-41) r q))
assert(p < r && r < q);
double code(double p, double r, double q) {
double tmp;
if (q <= 4.5e-41) {
tmp = r;
} else {
tmp = q;
}
return tmp;
}
NOTE: p, r, and q should be sorted in increasing order before calling this function.
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(p, r, q)
use fmin_fmax_functions
real(8), intent (in) :: p
real(8), intent (in) :: r
real(8), intent (in) :: q
real(8) :: tmp
if (q <= 4.5d-41) then
tmp = r
else
tmp = q
end if
code = tmp
end function
assert p < r && r < q;
public static double code(double p, double r, double q) {
double tmp;
if (q <= 4.5e-41) {
tmp = r;
} else {
tmp = q;
}
return tmp;
}
[p, r, q] = sort([p, r, q]) def code(p, r, q): tmp = 0 if q <= 4.5e-41: tmp = r else: tmp = q return tmp
p, r, q = sort([p, r, q]) function code(p, r, q) tmp = 0.0 if (q <= 4.5e-41) tmp = r; else tmp = q; end return tmp end
p, r, q = num2cell(sort([p, r, q])){:}
function tmp_2 = code(p, r, q)
tmp = 0.0;
if (q <= 4.5e-41)
tmp = r;
else
tmp = q;
end
tmp_2 = tmp;
end
NOTE: p, r, and q should be sorted in increasing order before calling this function. code[p_, r_, q_] := If[LessEqual[q, 4.5e-41], r, q]
\begin{array}{l}
[p, r, q] = \mathsf{sort}([p, r, q])\\
\\
\begin{array}{l}
\mathbf{if}\;q \leq 4.5 \cdot 10^{-41}:\\
\;\;\;\;r\\
\mathbf{else}:\\
\;\;\;\;q\\
\end{array}
\end{array}
if q < 4.5e-41Initial program 48.7%
Taylor expanded in p around inf
Applied rewrites9.2%
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites8.3%
Taylor expanded in p around -inf
Applied rewrites39.3%
if 4.5e-41 < q Initial program 36.6%
Taylor expanded in q around inf
Applied rewrites55.2%
NOTE: p, r, and q should be sorted in increasing order before calling this function. (FPCore (p r q) :precision binary64 r)
assert(p < r && r < q);
double code(double p, double r, double q) {
return r;
}
NOTE: p, r, and q should be sorted in increasing order before calling this function.
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(p, r, q)
use fmin_fmax_functions
real(8), intent (in) :: p
real(8), intent (in) :: r
real(8), intent (in) :: q
code = r
end function
assert p < r && r < q;
public static double code(double p, double r, double q) {
return r;
}
[p, r, q] = sort([p, r, q]) def code(p, r, q): return r
p, r, q = sort([p, r, q]) function code(p, r, q) return r end
p, r, q = num2cell(sort([p, r, q])){:}
function tmp = code(p, r, q)
tmp = r;
end
NOTE: p, r, and q should be sorted in increasing order before calling this function. code[p_, r_, q_] := r
\begin{array}{l}
[p, r, q] = \mathsf{sort}([p, r, q])\\
\\
r
\end{array}
Initial program 45.2%
Taylor expanded in p around inf
Applied rewrites8.5%
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites7.7%
Taylor expanded in p around -inf
Applied rewrites35.4%
NOTE: p, r, and q should be sorted in increasing order before calling this function. (FPCore (p r q) :precision binary64 p)
assert(p < r && r < q);
double code(double p, double r, double q) {
return p;
}
NOTE: p, r, and q should be sorted in increasing order before calling this function.
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(p, r, q)
use fmin_fmax_functions
real(8), intent (in) :: p
real(8), intent (in) :: r
real(8), intent (in) :: q
code = p
end function
assert p < r && r < q;
public static double code(double p, double r, double q) {
return p;
}
[p, r, q] = sort([p, r, q]) def code(p, r, q): return p
p, r, q = sort([p, r, q]) function code(p, r, q) return p end
p, r, q = num2cell(sort([p, r, q])){:}
function tmp = code(p, r, q)
tmp = p;
end
NOTE: p, r, and q should be sorted in increasing order before calling this function. code[p_, r_, q_] := p
\begin{array}{l}
[p, r, q] = \mathsf{sort}([p, r, q])\\
\\
p
\end{array}
Initial program 45.2%
Taylor expanded in p around inf
Applied rewrites8.5%
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites7.7%
Taylor expanded in p around inf
Applied rewrites1.9%
herbie shell --seed 2025117
(FPCore (p r q)
:name "1/2(abs(p)+abs(r) + sqrt((p-r)^2 + 4q^2))"
:precision binary64
(* (/ 1.0 2.0) (+ (+ (fabs p) (fabs r)) (sqrt (+ (pow (- p r) 2.0) (* 4.0 (pow q 2.0)))))))