
(FPCore (x y z) :precision binary64 (* 2.0 (sqrt (+ (+ (* x y) (* x z)) (* y z)))))
double code(double x, double y, double z) {
return 2.0 * sqrt((((x * y) + (x * z)) + (y * z)));
}
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(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 2.0d0 * sqrt((((x * y) + (x * z)) + (y * z)))
end function
public static double code(double x, double y, double z) {
return 2.0 * Math.sqrt((((x * y) + (x * z)) + (y * z)));
}
def code(x, y, z): return 2.0 * math.sqrt((((x * y) + (x * z)) + (y * z)))
function code(x, y, z) return Float64(2.0 * sqrt(Float64(Float64(Float64(x * y) + Float64(x * z)) + Float64(y * z)))) end
function tmp = code(x, y, z) tmp = 2.0 * sqrt((((x * y) + (x * z)) + (y * z))); end
code[x_, y_, z_] := N[(2.0 * N[Sqrt[N[(N[(N[(x * y), $MachinePrecision] + N[(x * z), $MachinePrecision]), $MachinePrecision] + N[(y * z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (* 2.0 (sqrt (+ (+ (* x y) (* x z)) (* y z)))))
double code(double x, double y, double z) {
return 2.0 * sqrt((((x * y) + (x * z)) + (y * z)));
}
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(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 2.0d0 * sqrt((((x * y) + (x * z)) + (y * z)))
end function
public static double code(double x, double y, double z) {
return 2.0 * Math.sqrt((((x * y) + (x * z)) + (y * z)));
}
def code(x, y, z): return 2.0 * math.sqrt((((x * y) + (x * z)) + (y * z)))
function code(x, y, z) return Float64(2.0 * sqrt(Float64(Float64(Float64(x * y) + Float64(x * z)) + Float64(y * z)))) end
function tmp = code(x, y, z) tmp = 2.0 * sqrt((((x * y) + (x * z)) + (y * z))); end
code[x_, y_, z_] := N[(2.0 * N[Sqrt[N[(N[(N[(x * y), $MachinePrecision] + N[(x * z), $MachinePrecision]), $MachinePrecision] + N[(y * z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z}
\end{array}
NOTE: x, y, and z should be sorted in increasing order before calling this function.
(FPCore (x y z)
:precision binary64
(if (<= y -1.2e+37)
(* 2.0 (* (* (sqrt (/ (+ x z) y)) -1.0) y))
(if (<= y 3.1e+27)
(* 2.0 (sqrt (fma x (+ (* 2.0 z) (- y z)) (* y z))))
(* 2.0 (* z (sqrt (/ (+ x y) z)))))))assert(x < y && y < z);
double code(double x, double y, double z) {
double tmp;
if (y <= -1.2e+37) {
tmp = 2.0 * ((sqrt(((x + z) / y)) * -1.0) * y);
} else if (y <= 3.1e+27) {
tmp = 2.0 * sqrt(fma(x, ((2.0 * z) + (y - z)), (y * z)));
} else {
tmp = 2.0 * (z * sqrt(((x + y) / z)));
}
return tmp;
}
x, y, z = sort([x, y, z]) function code(x, y, z) tmp = 0.0 if (y <= -1.2e+37) tmp = Float64(2.0 * Float64(Float64(sqrt(Float64(Float64(x + z) / y)) * -1.0) * y)); elseif (y <= 3.1e+27) tmp = Float64(2.0 * sqrt(fma(x, Float64(Float64(2.0 * z) + Float64(y - z)), Float64(y * z)))); else tmp = Float64(2.0 * Float64(z * sqrt(Float64(Float64(x + y) / z)))); end return tmp end
NOTE: x, y, and z should be sorted in increasing order before calling this function. code[x_, y_, z_] := If[LessEqual[y, -1.2e+37], N[(2.0 * N[(N[(N[Sqrt[N[(N[(x + z), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision] * -1.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.1e+27], N[(2.0 * N[Sqrt[N[(x * N[(N[(2.0 * z), $MachinePrecision] + N[(y - z), $MachinePrecision]), $MachinePrecision] + N[(y * z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(z * N[Sqrt[N[(N[(x + y), $MachinePrecision] / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.2 \cdot 10^{+37}:\\
\;\;\;\;2 \cdot \left(\left(\sqrt{\frac{x + z}{y}} \cdot -1\right) \cdot y\right)\\
\mathbf{elif}\;y \leq 3.1 \cdot 10^{+27}:\\
\;\;\;\;2 \cdot \sqrt{\mathsf{fma}\left(x, 2 \cdot z + \left(y - z\right), y \cdot z\right)}\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(z \cdot \sqrt{\frac{x + y}{z}}\right)\\
\end{array}
\end{array}
if y < -1.2e37Initial program 50.4%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites0.8%
Taylor expanded in y around -inf
sqrt-pow2N/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-+.f6483.9
Applied rewrites83.9%
if -1.2e37 < y < 3.09999999999999996e27Initial program 81.7%
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-+l+N/A
distribute-rgt-inN/A
flip-+N/A
lower-/.f64N/A
Applied rewrites51.5%
Taylor expanded in x around 0
lower-fma.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f6481.7
Applied rewrites81.7%
if 3.09999999999999996e27 < y Initial program 52.2%
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-+l+N/A
distribute-rgt-inN/A
flip-+N/A
lower-/.f64N/A
Applied rewrites26.6%
Taylor expanded in z around inf
lower-*.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
Applied rewrites30.2%
Taylor expanded in z around inf
lift-/.f64N/A
lift-+.f64N/A
lift-sqrt.f6443.2
Applied rewrites43.2%
Final simplification73.5%
NOTE: x, y, and z should be sorted in increasing order before calling this function.
(FPCore (x y z)
:precision binary64
(if (<= y -1.2e+37)
(* 2.0 (* (* (sqrt (/ (+ x z) y)) -1.0) y))
(if (<= y 3.2e-287)
(* 2.0 (sqrt (* (+ (fma y (/ z x) z) y) x)))
(if (<= y 9.5e-123)
(* 2.0 (sqrt (* z y)))
(* 2.0 (* z (sqrt (/ (+ x y) z))))))))assert(x < y && y < z);
double code(double x, double y, double z) {
double tmp;
if (y <= -1.2e+37) {
tmp = 2.0 * ((sqrt(((x + z) / y)) * -1.0) * y);
} else if (y <= 3.2e-287) {
tmp = 2.0 * sqrt(((fma(y, (z / x), z) + y) * x));
} else if (y <= 9.5e-123) {
tmp = 2.0 * sqrt((z * y));
} else {
tmp = 2.0 * (z * sqrt(((x + y) / z)));
}
return tmp;
}
x, y, z = sort([x, y, z]) function code(x, y, z) tmp = 0.0 if (y <= -1.2e+37) tmp = Float64(2.0 * Float64(Float64(sqrt(Float64(Float64(x + z) / y)) * -1.0) * y)); elseif (y <= 3.2e-287) tmp = Float64(2.0 * sqrt(Float64(Float64(fma(y, Float64(z / x), z) + y) * x))); elseif (y <= 9.5e-123) tmp = Float64(2.0 * sqrt(Float64(z * y))); else tmp = Float64(2.0 * Float64(z * sqrt(Float64(Float64(x + y) / z)))); end return tmp end
NOTE: x, y, and z should be sorted in increasing order before calling this function. code[x_, y_, z_] := If[LessEqual[y, -1.2e+37], N[(2.0 * N[(N[(N[Sqrt[N[(N[(x + z), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision] * -1.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.2e-287], N[(2.0 * N[Sqrt[N[(N[(N[(y * N[(z / x), $MachinePrecision] + z), $MachinePrecision] + y), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 9.5e-123], N[(2.0 * N[Sqrt[N[(z * y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(z * N[Sqrt[N[(N[(x + y), $MachinePrecision] / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.2 \cdot 10^{+37}:\\
\;\;\;\;2 \cdot \left(\left(\sqrt{\frac{x + z}{y}} \cdot -1\right) \cdot y\right)\\
\mathbf{elif}\;y \leq 3.2 \cdot 10^{-287}:\\
\;\;\;\;2 \cdot \sqrt{\left(\mathsf{fma}\left(y, \frac{z}{x}, z\right) + y\right) \cdot x}\\
\mathbf{elif}\;y \leq 9.5 \cdot 10^{-123}:\\
\;\;\;\;2 \cdot \sqrt{z \cdot y}\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(z \cdot \sqrt{\frac{x + y}{z}}\right)\\
\end{array}
\end{array}
if y < -1.2e37Initial program 50.4%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites0.8%
Taylor expanded in y around -inf
sqrt-pow2N/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-+.f6483.9
Applied rewrites83.9%
if -1.2e37 < y < 3.20000000000000018e-287Initial program 82.6%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6474.0
Applied rewrites74.0%
if 3.20000000000000018e-287 < y < 9.5000000000000002e-123Initial program 75.0%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f6410.2
Applied rewrites10.2%
if 9.5000000000000002e-123 < y Initial program 64.1%
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-+l+N/A
distribute-rgt-inN/A
flip-+N/A
lower-/.f64N/A
Applied rewrites37.2%
Taylor expanded in z around inf
lower-*.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
Applied rewrites34.2%
Taylor expanded in z around inf
lift-/.f64N/A
lift-+.f64N/A
lift-sqrt.f6447.4
Applied rewrites47.4%
NOTE: x, y, and z should be sorted in increasing order before calling this function.
(FPCore (x y z)
:precision binary64
(if (<= y -7.1e-308)
(* 2.0 (* (* (sqrt (/ (+ x z) y)) -1.0) y))
(if (<= y 9.5e-123)
(* 2.0 (sqrt (* z y)))
(* 2.0 (* z (sqrt (/ (+ x y) z)))))))assert(x < y && y < z);
double code(double x, double y, double z) {
double tmp;
if (y <= -7.1e-308) {
tmp = 2.0 * ((sqrt(((x + z) / y)) * -1.0) * y);
} else if (y <= 9.5e-123) {
tmp = 2.0 * sqrt((z * y));
} else {
tmp = 2.0 * (z * sqrt(((x + y) / z)));
}
return tmp;
}
NOTE: x, y, and z 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(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= (-7.1d-308)) then
tmp = 2.0d0 * ((sqrt(((x + z) / y)) * (-1.0d0)) * y)
else if (y <= 9.5d-123) then
tmp = 2.0d0 * sqrt((z * y))
else
tmp = 2.0d0 * (z * sqrt(((x + y) / z)))
end if
code = tmp
end function
assert x < y && y < z;
public static double code(double x, double y, double z) {
double tmp;
if (y <= -7.1e-308) {
tmp = 2.0 * ((Math.sqrt(((x + z) / y)) * -1.0) * y);
} else if (y <= 9.5e-123) {
tmp = 2.0 * Math.sqrt((z * y));
} else {
tmp = 2.0 * (z * Math.sqrt(((x + y) / z)));
}
return tmp;
}
[x, y, z] = sort([x, y, z]) def code(x, y, z): tmp = 0 if y <= -7.1e-308: tmp = 2.0 * ((math.sqrt(((x + z) / y)) * -1.0) * y) elif y <= 9.5e-123: tmp = 2.0 * math.sqrt((z * y)) else: tmp = 2.0 * (z * math.sqrt(((x + y) / z))) return tmp
x, y, z = sort([x, y, z]) function code(x, y, z) tmp = 0.0 if (y <= -7.1e-308) tmp = Float64(2.0 * Float64(Float64(sqrt(Float64(Float64(x + z) / y)) * -1.0) * y)); elseif (y <= 9.5e-123) tmp = Float64(2.0 * sqrt(Float64(z * y))); else tmp = Float64(2.0 * Float64(z * sqrt(Float64(Float64(x + y) / z)))); end return tmp end
x, y, z = num2cell(sort([x, y, z])){:}
function tmp_2 = code(x, y, z)
tmp = 0.0;
if (y <= -7.1e-308)
tmp = 2.0 * ((sqrt(((x + z) / y)) * -1.0) * y);
elseif (y <= 9.5e-123)
tmp = 2.0 * sqrt((z * y));
else
tmp = 2.0 * (z * sqrt(((x + y) / z)));
end
tmp_2 = tmp;
end
NOTE: x, y, and z should be sorted in increasing order before calling this function. code[x_, y_, z_] := If[LessEqual[y, -7.1e-308], N[(2.0 * N[(N[(N[Sqrt[N[(N[(x + z), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision] * -1.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 9.5e-123], N[(2.0 * N[Sqrt[N[(z * y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(z * N[Sqrt[N[(N[(x + y), $MachinePrecision] / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.1 \cdot 10^{-308}:\\
\;\;\;\;2 \cdot \left(\left(\sqrt{\frac{x + z}{y}} \cdot -1\right) \cdot y\right)\\
\mathbf{elif}\;y \leq 9.5 \cdot 10^{-123}:\\
\;\;\;\;2 \cdot \sqrt{z \cdot y}\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(z \cdot \sqrt{\frac{x + y}{z}}\right)\\
\end{array}
\end{array}
if y < -7.10000000000000005e-308Initial program 66.9%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites0.7%
Taylor expanded in y around -inf
sqrt-pow2N/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-+.f6462.2
Applied rewrites62.2%
if -7.10000000000000005e-308 < y < 9.5000000000000002e-123Initial program 74.0%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f649.1
Applied rewrites9.1%
if 9.5000000000000002e-123 < y Initial program 64.1%
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-+l+N/A
distribute-rgt-inN/A
flip-+N/A
lower-/.f64N/A
Applied rewrites37.2%
Taylor expanded in z around inf
lower-*.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
Applied rewrites34.2%
Taylor expanded in z around inf
lift-/.f64N/A
lift-+.f64N/A
lift-sqrt.f6447.4
Applied rewrites47.4%
NOTE: x, y, and z should be sorted in increasing order before calling this function.
(FPCore (x y z)
:precision binary64
(let* ((t_0 (sqrt (/ y z))))
(if (<= y 7.2e-287)
(* 2.0 (* (* (sqrt (/ (+ x z) y)) -1.0) y))
(if (<= y 4.5e-90)
(*
2.0
(/
(fma
x
(fma -0.25 (* x t_0) (* 0.5 (sqrt (* y z))))
(*
y
(fma
(sqrt y)
(sqrt z)
(* x (fma -0.125 (* x (sqrt (/ y (pow z 3.0)))) (* 0.5 t_0))))))
y))
(* 2.0 (* z (sqrt (/ (+ x y) z))))))))assert(x < y && y < z);
double code(double x, double y, double z) {
double t_0 = sqrt((y / z));
double tmp;
if (y <= 7.2e-287) {
tmp = 2.0 * ((sqrt(((x + z) / y)) * -1.0) * y);
} else if (y <= 4.5e-90) {
tmp = 2.0 * (fma(x, fma(-0.25, (x * t_0), (0.5 * sqrt((y * z)))), (y * fma(sqrt(y), sqrt(z), (x * fma(-0.125, (x * sqrt((y / pow(z, 3.0)))), (0.5 * t_0)))))) / y);
} else {
tmp = 2.0 * (z * sqrt(((x + y) / z)));
}
return tmp;
}
x, y, z = sort([x, y, z]) function code(x, y, z) t_0 = sqrt(Float64(y / z)) tmp = 0.0 if (y <= 7.2e-287) tmp = Float64(2.0 * Float64(Float64(sqrt(Float64(Float64(x + z) / y)) * -1.0) * y)); elseif (y <= 4.5e-90) tmp = Float64(2.0 * Float64(fma(x, fma(-0.25, Float64(x * t_0), Float64(0.5 * sqrt(Float64(y * z)))), Float64(y * fma(sqrt(y), sqrt(z), Float64(x * fma(-0.125, Float64(x * sqrt(Float64(y / (z ^ 3.0)))), Float64(0.5 * t_0)))))) / y)); else tmp = Float64(2.0 * Float64(z * sqrt(Float64(Float64(x + y) / z)))); end return tmp end
NOTE: x, y, and z should be sorted in increasing order before calling this function.
code[x_, y_, z_] := Block[{t$95$0 = N[Sqrt[N[(y / z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 7.2e-287], N[(2.0 * N[(N[(N[Sqrt[N[(N[(x + z), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision] * -1.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.5e-90], N[(2.0 * N[(N[(x * N[(-0.25 * N[(x * t$95$0), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(y * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y * N[(N[Sqrt[y], $MachinePrecision] * N[Sqrt[z], $MachinePrecision] + N[(x * N[(-0.125 * N[(x * N[Sqrt[N[(y / N[Power[z, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(0.5 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(z * N[Sqrt[N[(N[(x + y), $MachinePrecision] / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{y}{z}}\\
\mathbf{if}\;y \leq 7.2 \cdot 10^{-287}:\\
\;\;\;\;2 \cdot \left(\left(\sqrt{\frac{x + z}{y}} \cdot -1\right) \cdot y\right)\\
\mathbf{elif}\;y \leq 4.5 \cdot 10^{-90}:\\
\;\;\;\;2 \cdot \frac{\mathsf{fma}\left(x, \mathsf{fma}\left(-0.25, x \cdot t\_0, 0.5 \cdot \sqrt{y \cdot z}\right), y \cdot \mathsf{fma}\left(\sqrt{y}, \sqrt{z}, x \cdot \mathsf{fma}\left(-0.125, x \cdot \sqrt{\frac{y}{{z}^{3}}}, 0.5 \cdot t\_0\right)\right)\right)}{y}\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(z \cdot \sqrt{\frac{x + y}{z}}\right)\\
\end{array}
\end{array}
if y < 7.2000000000000003e-287Initial program 66.5%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites0.7%
Taylor expanded in y around -inf
sqrt-pow2N/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-+.f6459.0
Applied rewrites59.0%
if 7.2000000000000003e-287 < y < 4.50000000000000009e-90Initial program 81.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites4.6%
Taylor expanded in x around 0
Applied rewrites2.6%
Taylor expanded in y around 0
lower-/.f64N/A
Applied rewrites18.4%
if 4.50000000000000009e-90 < y Initial program 61.0%
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-+l+N/A
distribute-rgt-inN/A
flip-+N/A
lower-/.f64N/A
Applied rewrites33.0%
Taylor expanded in z around inf
lower-*.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
Applied rewrites31.7%
Taylor expanded in z around inf
lift-/.f64N/A
lift-+.f64N/A
lift-sqrt.f6444.8
Applied rewrites44.8%
NOTE: x, y, and z should be sorted in increasing order before calling this function.
(FPCore (x y z)
:precision binary64
(let* ((t_0 (sqrt (/ y z))) (t_1 (sqrt (* y z))))
(if (<= y 7.2e-287)
(* 2.0 (* (* (sqrt (/ (+ x z) y)) -1.0) y))
(if (<= y 2.45e-18)
(*
2.0
(/
(fma
x
(fma -0.25 (* x t_0) (* 0.5 t_1))
(*
y
(fma
(sqrt y)
(sqrt z)
(* x (fma -0.125 (* x (sqrt (/ y (pow z 3.0)))) (* 0.5 t_0))))))
y))
(*
2.0
(fma
(sqrt y)
(sqrt z)
(*
x
(fma
x
(*
y
(fma
-0.25
(sqrt (pow (* (pow y 3.0) z) -1.0))
(* -0.125 (sqrt (pow (* y (pow z 3.0)) -1.0)))))
(* y (fma 0.5 (/ 1.0 t_1) (* 0.5 (sqrt (/ z (pow y 3.0))))))))))))))assert(x < y && y < z);
double code(double x, double y, double z) {
double t_0 = sqrt((y / z));
double t_1 = sqrt((y * z));
double tmp;
if (y <= 7.2e-287) {
tmp = 2.0 * ((sqrt(((x + z) / y)) * -1.0) * y);
} else if (y <= 2.45e-18) {
tmp = 2.0 * (fma(x, fma(-0.25, (x * t_0), (0.5 * t_1)), (y * fma(sqrt(y), sqrt(z), (x * fma(-0.125, (x * sqrt((y / pow(z, 3.0)))), (0.5 * t_0)))))) / y);
} else {
tmp = 2.0 * fma(sqrt(y), sqrt(z), (x * fma(x, (y * fma(-0.25, sqrt(pow((pow(y, 3.0) * z), -1.0)), (-0.125 * sqrt(pow((y * pow(z, 3.0)), -1.0))))), (y * fma(0.5, (1.0 / t_1), (0.5 * sqrt((z / pow(y, 3.0)))))))));
}
return tmp;
}
x, y, z = sort([x, y, z]) function code(x, y, z) t_0 = sqrt(Float64(y / z)) t_1 = sqrt(Float64(y * z)) tmp = 0.0 if (y <= 7.2e-287) tmp = Float64(2.0 * Float64(Float64(sqrt(Float64(Float64(x + z) / y)) * -1.0) * y)); elseif (y <= 2.45e-18) tmp = Float64(2.0 * Float64(fma(x, fma(-0.25, Float64(x * t_0), Float64(0.5 * t_1)), Float64(y * fma(sqrt(y), sqrt(z), Float64(x * fma(-0.125, Float64(x * sqrt(Float64(y / (z ^ 3.0)))), Float64(0.5 * t_0)))))) / y)); else tmp = Float64(2.0 * fma(sqrt(y), sqrt(z), Float64(x * fma(x, Float64(y * fma(-0.25, sqrt((Float64((y ^ 3.0) * z) ^ -1.0)), Float64(-0.125 * sqrt((Float64(y * (z ^ 3.0)) ^ -1.0))))), Float64(y * fma(0.5, Float64(1.0 / t_1), Float64(0.5 * sqrt(Float64(z / (y ^ 3.0)))))))))); end return tmp end
NOTE: x, y, and z should be sorted in increasing order before calling this function.
code[x_, y_, z_] := Block[{t$95$0 = N[Sqrt[N[(y / z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(y * z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 7.2e-287], N[(2.0 * N[(N[(N[Sqrt[N[(N[(x + z), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision] * -1.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.45e-18], N[(2.0 * N[(N[(x * N[(-0.25 * N[(x * t$95$0), $MachinePrecision] + N[(0.5 * t$95$1), $MachinePrecision]), $MachinePrecision] + N[(y * N[(N[Sqrt[y], $MachinePrecision] * N[Sqrt[z], $MachinePrecision] + N[(x * N[(-0.125 * N[(x * N[Sqrt[N[(y / N[Power[z, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(0.5 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[Sqrt[y], $MachinePrecision] * N[Sqrt[z], $MachinePrecision] + N[(x * N[(x * N[(y * N[(-0.25 * N[Sqrt[N[Power[N[(N[Power[y, 3.0], $MachinePrecision] * z), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision] + N[(-0.125 * N[Sqrt[N[Power[N[(y * N[Power[z, 3.0], $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y * N[(0.5 * N[(1.0 / t$95$1), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(z / N[Power[y, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{y}{z}}\\
t_1 := \sqrt{y \cdot z}\\
\mathbf{if}\;y \leq 7.2 \cdot 10^{-287}:\\
\;\;\;\;2 \cdot \left(\left(\sqrt{\frac{x + z}{y}} \cdot -1\right) \cdot y\right)\\
\mathbf{elif}\;y \leq 2.45 \cdot 10^{-18}:\\
\;\;\;\;2 \cdot \frac{\mathsf{fma}\left(x, \mathsf{fma}\left(-0.25, x \cdot t\_0, 0.5 \cdot t\_1\right), y \cdot \mathsf{fma}\left(\sqrt{y}, \sqrt{z}, x \cdot \mathsf{fma}\left(-0.125, x \cdot \sqrt{\frac{y}{{z}^{3}}}, 0.5 \cdot t\_0\right)\right)\right)}{y}\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(\sqrt{y}, \sqrt{z}, x \cdot \mathsf{fma}\left(x, y \cdot \mathsf{fma}\left(-0.25, \sqrt{{\left({y}^{3} \cdot z\right)}^{-1}}, -0.125 \cdot \sqrt{{\left(y \cdot {z}^{3}\right)}^{-1}}\right), y \cdot \mathsf{fma}\left(0.5, \frac{1}{t\_1}, 0.5 \cdot \sqrt{\frac{z}{{y}^{3}}}\right)\right)\right)\\
\end{array}
\end{array}
if y < 7.2000000000000003e-287Initial program 66.5%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites0.7%
Taylor expanded in y around -inf
sqrt-pow2N/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-+.f6459.0
Applied rewrites59.0%
if 7.2000000000000003e-287 < y < 2.4500000000000001e-18Initial program 82.7%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites14.7%
Taylor expanded in x around 0
Applied rewrites4.4%
Taylor expanded in y around 0
lower-/.f64N/A
Applied rewrites17.7%
if 2.4500000000000001e-18 < y Initial program 55.1%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites71.6%
Taylor expanded in x around 0
Applied rewrites28.5%
NOTE: x, y, and z should be sorted in increasing order before calling this function.
(FPCore (x y z)
:precision binary64
(let* ((t_0 (sqrt (/ y z))) (t_1 (sqrt (* y z))))
(if (<= y -9.8e-172)
(* 2.0 (* (* (sqrt (* x (+ (pow y -1.0) (/ z (* x y))))) -1.0) y))
(if (<= y 7.2e-287)
(* 2.0 (* (* (sqrt (/ (* z (+ 1.0 (/ x z))) y)) -1.0) y))
(if (<= y 2.45e-18)
(*
2.0
(/
(fma
x
(fma -0.25 (* x t_0) (* 0.5 t_1))
(*
y
(fma
(sqrt y)
(sqrt z)
(* x (fma -0.125 (* x (sqrt (/ y (pow z 3.0)))) (* 0.5 t_0))))))
y))
(*
2.0
(fma
(sqrt y)
(sqrt z)
(*
x
(fma
x
(*
y
(fma
-0.25
(sqrt (pow (* (pow y 3.0) z) -1.0))
(* -0.125 (sqrt (pow (* y (pow z 3.0)) -1.0)))))
(*
y
(fma 0.5 (/ 1.0 t_1) (* 0.5 (sqrt (/ z (pow y 3.0)))))))))))))))assert(x < y && y < z);
double code(double x, double y, double z) {
double t_0 = sqrt((y / z));
double t_1 = sqrt((y * z));
double tmp;
if (y <= -9.8e-172) {
tmp = 2.0 * ((sqrt((x * (pow(y, -1.0) + (z / (x * y))))) * -1.0) * y);
} else if (y <= 7.2e-287) {
tmp = 2.0 * ((sqrt(((z * (1.0 + (x / z))) / y)) * -1.0) * y);
} else if (y <= 2.45e-18) {
tmp = 2.0 * (fma(x, fma(-0.25, (x * t_0), (0.5 * t_1)), (y * fma(sqrt(y), sqrt(z), (x * fma(-0.125, (x * sqrt((y / pow(z, 3.0)))), (0.5 * t_0)))))) / y);
} else {
tmp = 2.0 * fma(sqrt(y), sqrt(z), (x * fma(x, (y * fma(-0.25, sqrt(pow((pow(y, 3.0) * z), -1.0)), (-0.125 * sqrt(pow((y * pow(z, 3.0)), -1.0))))), (y * fma(0.5, (1.0 / t_1), (0.5 * sqrt((z / pow(y, 3.0)))))))));
}
return tmp;
}
x, y, z = sort([x, y, z]) function code(x, y, z) t_0 = sqrt(Float64(y / z)) t_1 = sqrt(Float64(y * z)) tmp = 0.0 if (y <= -9.8e-172) tmp = Float64(2.0 * Float64(Float64(sqrt(Float64(x * Float64((y ^ -1.0) + Float64(z / Float64(x * y))))) * -1.0) * y)); elseif (y <= 7.2e-287) tmp = Float64(2.0 * Float64(Float64(sqrt(Float64(Float64(z * Float64(1.0 + Float64(x / z))) / y)) * -1.0) * y)); elseif (y <= 2.45e-18) tmp = Float64(2.0 * Float64(fma(x, fma(-0.25, Float64(x * t_0), Float64(0.5 * t_1)), Float64(y * fma(sqrt(y), sqrt(z), Float64(x * fma(-0.125, Float64(x * sqrt(Float64(y / (z ^ 3.0)))), Float64(0.5 * t_0)))))) / y)); else tmp = Float64(2.0 * fma(sqrt(y), sqrt(z), Float64(x * fma(x, Float64(y * fma(-0.25, sqrt((Float64((y ^ 3.0) * z) ^ -1.0)), Float64(-0.125 * sqrt((Float64(y * (z ^ 3.0)) ^ -1.0))))), Float64(y * fma(0.5, Float64(1.0 / t_1), Float64(0.5 * sqrt(Float64(z / (y ^ 3.0)))))))))); end return tmp end
NOTE: x, y, and z should be sorted in increasing order before calling this function.
code[x_, y_, z_] := Block[{t$95$0 = N[Sqrt[N[(y / z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(y * z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, -9.8e-172], N[(2.0 * N[(N[(N[Sqrt[N[(x * N[(N[Power[y, -1.0], $MachinePrecision] + N[(z / N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * -1.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7.2e-287], N[(2.0 * N[(N[(N[Sqrt[N[(N[(z * N[(1.0 + N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision] * -1.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.45e-18], N[(2.0 * N[(N[(x * N[(-0.25 * N[(x * t$95$0), $MachinePrecision] + N[(0.5 * t$95$1), $MachinePrecision]), $MachinePrecision] + N[(y * N[(N[Sqrt[y], $MachinePrecision] * N[Sqrt[z], $MachinePrecision] + N[(x * N[(-0.125 * N[(x * N[Sqrt[N[(y / N[Power[z, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(0.5 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[Sqrt[y], $MachinePrecision] * N[Sqrt[z], $MachinePrecision] + N[(x * N[(x * N[(y * N[(-0.25 * N[Sqrt[N[Power[N[(N[Power[y, 3.0], $MachinePrecision] * z), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision] + N[(-0.125 * N[Sqrt[N[Power[N[(y * N[Power[z, 3.0], $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y * N[(0.5 * N[(1.0 / t$95$1), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(z / N[Power[y, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{y}{z}}\\
t_1 := \sqrt{y \cdot z}\\
\mathbf{if}\;y \leq -9.8 \cdot 10^{-172}:\\
\;\;\;\;2 \cdot \left(\left(\sqrt{x \cdot \left({y}^{-1} + \frac{z}{x \cdot y}\right)} \cdot -1\right) \cdot y\right)\\
\mathbf{elif}\;y \leq 7.2 \cdot 10^{-287}:\\
\;\;\;\;2 \cdot \left(\left(\sqrt{\frac{z \cdot \left(1 + \frac{x}{z}\right)}{y}} \cdot -1\right) \cdot y\right)\\
\mathbf{elif}\;y \leq 2.45 \cdot 10^{-18}:\\
\;\;\;\;2 \cdot \frac{\mathsf{fma}\left(x, \mathsf{fma}\left(-0.25, x \cdot t\_0, 0.5 \cdot t\_1\right), y \cdot \mathsf{fma}\left(\sqrt{y}, \sqrt{z}, x \cdot \mathsf{fma}\left(-0.125, x \cdot \sqrt{\frac{y}{{z}^{3}}}, 0.5 \cdot t\_0\right)\right)\right)}{y}\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(\sqrt{y}, \sqrt{z}, x \cdot \mathsf{fma}\left(x, y \cdot \mathsf{fma}\left(-0.25, \sqrt{{\left({y}^{3} \cdot z\right)}^{-1}}, -0.125 \cdot \sqrt{{\left(y \cdot {z}^{3}\right)}^{-1}}\right), y \cdot \mathsf{fma}\left(0.5, \frac{1}{t\_1}, 0.5 \cdot \sqrt{\frac{z}{{y}^{3}}}\right)\right)\right)\\
\end{array}
\end{array}
if y < -9.8000000000000001e-172Initial program 65.9%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites0.8%
Taylor expanded in y around -inf
sqrt-pow2N/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-+.f6474.9
Applied rewrites74.9%
Taylor expanded in x around inf
lower-*.f64N/A
lower-+.f64N/A
inv-powN/A
lower-pow.f64N/A
lower-/.f64N/A
lift-*.f6461.3
Applied rewrites61.3%
if -9.8000000000000001e-172 < y < 7.2000000000000003e-287Initial program 68.5%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites0.4%
Taylor expanded in y around -inf
sqrt-pow2N/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-+.f647.9
Applied rewrites7.9%
Taylor expanded in z around inf
lower-*.f64N/A
lower-+.f64N/A
lower-/.f647.9
Applied rewrites7.9%
if 7.2000000000000003e-287 < y < 2.4500000000000001e-18Initial program 82.7%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites14.7%
Taylor expanded in x around 0
Applied rewrites4.4%
Taylor expanded in y around 0
lower-/.f64N/A
Applied rewrites17.7%
if 2.4500000000000001e-18 < y Initial program 55.1%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites71.6%
Taylor expanded in x around 0
Applied rewrites28.5%
NOTE: x, y, and z should be sorted in increasing order before calling this function.
(FPCore (x y z)
:precision binary64
(let* ((t_0 (sqrt (* y z))) (t_1 (sqrt (/ y z))))
(if (<= y 3.3e-287)
(* 2.0 (* (* (sqrt (* x (+ (pow y -1.0) (/ z (* x y))))) -1.0) y))
(if (<= y 2.45e-18)
(*
2.0
(/
(fma
x
(fma -0.25 (* x t_1) (* 0.5 t_0))
(*
y
(fma
(sqrt y)
(sqrt z)
(* x (fma -0.125 (* x (sqrt (/ y (pow z 3.0)))) (* 0.5 t_1))))))
y))
(*
2.0
(fma
(sqrt y)
(sqrt z)
(*
x
(fma
x
(*
y
(fma
-0.25
(sqrt (pow (* (pow y 3.0) z) -1.0))
(* -0.125 (sqrt (pow (* y (pow z 3.0)) -1.0)))))
(* y (fma 0.5 (/ 1.0 t_0) (* 0.5 (sqrt (/ z (pow y 3.0))))))))))))))assert(x < y && y < z);
double code(double x, double y, double z) {
double t_0 = sqrt((y * z));
double t_1 = sqrt((y / z));
double tmp;
if (y <= 3.3e-287) {
tmp = 2.0 * ((sqrt((x * (pow(y, -1.0) + (z / (x * y))))) * -1.0) * y);
} else if (y <= 2.45e-18) {
tmp = 2.0 * (fma(x, fma(-0.25, (x * t_1), (0.5 * t_0)), (y * fma(sqrt(y), sqrt(z), (x * fma(-0.125, (x * sqrt((y / pow(z, 3.0)))), (0.5 * t_1)))))) / y);
} else {
tmp = 2.0 * fma(sqrt(y), sqrt(z), (x * fma(x, (y * fma(-0.25, sqrt(pow((pow(y, 3.0) * z), -1.0)), (-0.125 * sqrt(pow((y * pow(z, 3.0)), -1.0))))), (y * fma(0.5, (1.0 / t_0), (0.5 * sqrt((z / pow(y, 3.0)))))))));
}
return tmp;
}
x, y, z = sort([x, y, z]) function code(x, y, z) t_0 = sqrt(Float64(y * z)) t_1 = sqrt(Float64(y / z)) tmp = 0.0 if (y <= 3.3e-287) tmp = Float64(2.0 * Float64(Float64(sqrt(Float64(x * Float64((y ^ -1.0) + Float64(z / Float64(x * y))))) * -1.0) * y)); elseif (y <= 2.45e-18) tmp = Float64(2.0 * Float64(fma(x, fma(-0.25, Float64(x * t_1), Float64(0.5 * t_0)), Float64(y * fma(sqrt(y), sqrt(z), Float64(x * fma(-0.125, Float64(x * sqrt(Float64(y / (z ^ 3.0)))), Float64(0.5 * t_1)))))) / y)); else tmp = Float64(2.0 * fma(sqrt(y), sqrt(z), Float64(x * fma(x, Float64(y * fma(-0.25, sqrt((Float64((y ^ 3.0) * z) ^ -1.0)), Float64(-0.125 * sqrt((Float64(y * (z ^ 3.0)) ^ -1.0))))), Float64(y * fma(0.5, Float64(1.0 / t_0), Float64(0.5 * sqrt(Float64(z / (y ^ 3.0)))))))))); end return tmp end
NOTE: x, y, and z should be sorted in increasing order before calling this function.
code[x_, y_, z_] := Block[{t$95$0 = N[Sqrt[N[(y * z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(y / z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 3.3e-287], N[(2.0 * N[(N[(N[Sqrt[N[(x * N[(N[Power[y, -1.0], $MachinePrecision] + N[(z / N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * -1.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.45e-18], N[(2.0 * N[(N[(x * N[(-0.25 * N[(x * t$95$1), $MachinePrecision] + N[(0.5 * t$95$0), $MachinePrecision]), $MachinePrecision] + N[(y * N[(N[Sqrt[y], $MachinePrecision] * N[Sqrt[z], $MachinePrecision] + N[(x * N[(-0.125 * N[(x * N[Sqrt[N[(y / N[Power[z, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(0.5 * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[Sqrt[y], $MachinePrecision] * N[Sqrt[z], $MachinePrecision] + N[(x * N[(x * N[(y * N[(-0.25 * N[Sqrt[N[Power[N[(N[Power[y, 3.0], $MachinePrecision] * z), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision] + N[(-0.125 * N[Sqrt[N[Power[N[(y * N[Power[z, 3.0], $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y * N[(0.5 * N[(1.0 / t$95$0), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(z / N[Power[y, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
t_0 := \sqrt{y \cdot z}\\
t_1 := \sqrt{\frac{y}{z}}\\
\mathbf{if}\;y \leq 3.3 \cdot 10^{-287}:\\
\;\;\;\;2 \cdot \left(\left(\sqrt{x \cdot \left({y}^{-1} + \frac{z}{x \cdot y}\right)} \cdot -1\right) \cdot y\right)\\
\mathbf{elif}\;y \leq 2.45 \cdot 10^{-18}:\\
\;\;\;\;2 \cdot \frac{\mathsf{fma}\left(x, \mathsf{fma}\left(-0.25, x \cdot t\_1, 0.5 \cdot t\_0\right), y \cdot \mathsf{fma}\left(\sqrt{y}, \sqrt{z}, x \cdot \mathsf{fma}\left(-0.125, x \cdot \sqrt{\frac{y}{{z}^{3}}}, 0.5 \cdot t\_1\right)\right)\right)}{y}\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(\sqrt{y}, \sqrt{z}, x \cdot \mathsf{fma}\left(x, y \cdot \mathsf{fma}\left(-0.25, \sqrt{{\left({y}^{3} \cdot z\right)}^{-1}}, -0.125 \cdot \sqrt{{\left(y \cdot {z}^{3}\right)}^{-1}}\right), y \cdot \mathsf{fma}\left(0.5, \frac{1}{t\_0}, 0.5 \cdot \sqrt{\frac{z}{{y}^{3}}}\right)\right)\right)\\
\end{array}
\end{array}
if y < 3.29999999999999973e-287Initial program 67.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites0.7%
Taylor expanded in y around -inf
sqrt-pow2N/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-+.f6459.5
Applied rewrites59.5%
Taylor expanded in x around inf
lower-*.f64N/A
lower-+.f64N/A
inv-powN/A
lower-pow.f64N/A
lower-/.f64N/A
lift-*.f6447.4
Applied rewrites47.4%
if 3.29999999999999973e-287 < y < 2.4500000000000001e-18Initial program 81.3%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites14.5%
Taylor expanded in x around 0
Applied rewrites4.3%
Taylor expanded in y around 0
lower-/.f64N/A
Applied rewrites17.4%
if 2.4500000000000001e-18 < y Initial program 55.1%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites71.6%
Taylor expanded in x around 0
Applied rewrites28.5%
NOTE: x, y, and z should be sorted in increasing order before calling this function.
(FPCore (x y z)
:precision binary64
(let* ((t_0 (sqrt (* y z)))
(t_1 (* 2.0 (sqrt (+ (+ (* x y) (* x z)) (* y z)))))
(t_2 (sqrt (/ y z))))
(if (<= t_1 1e-81)
(* 2.0 (* (sqrt (/ (+ x z) y)) y))
(if (<= t_1 1e+118)
(*
2.0
(/
(fma
x
(fma -0.25 (* x t_2) (* 0.5 t_0))
(*
y
(fma
(sqrt y)
(sqrt z)
(* x (fma -0.125 (* x (sqrt (/ y (pow z 3.0)))) (* 0.5 t_2))))))
y))
(*
2.0
(fma
(sqrt y)
(sqrt z)
(*
x
(fma
x
(*
y
(fma
-0.25
(sqrt (pow (* (pow y 3.0) z) -1.0))
(* -0.125 (sqrt (pow (* y (pow z 3.0)) -1.0)))))
(* y (fma 0.5 (/ 1.0 t_0) (* 0.5 (sqrt (/ z (pow y 3.0))))))))))))))assert(x < y && y < z);
double code(double x, double y, double z) {
double t_0 = sqrt((y * z));
double t_1 = 2.0 * sqrt((((x * y) + (x * z)) + (y * z)));
double t_2 = sqrt((y / z));
double tmp;
if (t_1 <= 1e-81) {
tmp = 2.0 * (sqrt(((x + z) / y)) * y);
} else if (t_1 <= 1e+118) {
tmp = 2.0 * (fma(x, fma(-0.25, (x * t_2), (0.5 * t_0)), (y * fma(sqrt(y), sqrt(z), (x * fma(-0.125, (x * sqrt((y / pow(z, 3.0)))), (0.5 * t_2)))))) / y);
} else {
tmp = 2.0 * fma(sqrt(y), sqrt(z), (x * fma(x, (y * fma(-0.25, sqrt(pow((pow(y, 3.0) * z), -1.0)), (-0.125 * sqrt(pow((y * pow(z, 3.0)), -1.0))))), (y * fma(0.5, (1.0 / t_0), (0.5 * sqrt((z / pow(y, 3.0)))))))));
}
return tmp;
}
x, y, z = sort([x, y, z]) function code(x, y, z) t_0 = sqrt(Float64(y * z)) t_1 = Float64(2.0 * sqrt(Float64(Float64(Float64(x * y) + Float64(x * z)) + Float64(y * z)))) t_2 = sqrt(Float64(y / z)) tmp = 0.0 if (t_1 <= 1e-81) tmp = Float64(2.0 * Float64(sqrt(Float64(Float64(x + z) / y)) * y)); elseif (t_1 <= 1e+118) tmp = Float64(2.0 * Float64(fma(x, fma(-0.25, Float64(x * t_2), Float64(0.5 * t_0)), Float64(y * fma(sqrt(y), sqrt(z), Float64(x * fma(-0.125, Float64(x * sqrt(Float64(y / (z ^ 3.0)))), Float64(0.5 * t_2)))))) / y)); else tmp = Float64(2.0 * fma(sqrt(y), sqrt(z), Float64(x * fma(x, Float64(y * fma(-0.25, sqrt((Float64((y ^ 3.0) * z) ^ -1.0)), Float64(-0.125 * sqrt((Float64(y * (z ^ 3.0)) ^ -1.0))))), Float64(y * fma(0.5, Float64(1.0 / t_0), Float64(0.5 * sqrt(Float64(z / (y ^ 3.0)))))))))); end return tmp end
NOTE: x, y, and z should be sorted in increasing order before calling this function.
code[x_, y_, z_] := Block[{t$95$0 = N[Sqrt[N[(y * z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(2.0 * N[Sqrt[N[(N[(N[(x * y), $MachinePrecision] + N[(x * z), $MachinePrecision]), $MachinePrecision] + N[(y * z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(y / z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$1, 1e-81], N[(2.0 * N[(N[Sqrt[N[(N[(x + z), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+118], N[(2.0 * N[(N[(x * N[(-0.25 * N[(x * t$95$2), $MachinePrecision] + N[(0.5 * t$95$0), $MachinePrecision]), $MachinePrecision] + N[(y * N[(N[Sqrt[y], $MachinePrecision] * N[Sqrt[z], $MachinePrecision] + N[(x * N[(-0.125 * N[(x * N[Sqrt[N[(y / N[Power[z, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(0.5 * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[Sqrt[y], $MachinePrecision] * N[Sqrt[z], $MachinePrecision] + N[(x * N[(x * N[(y * N[(-0.25 * N[Sqrt[N[Power[N[(N[Power[y, 3.0], $MachinePrecision] * z), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision] + N[(-0.125 * N[Sqrt[N[Power[N[(y * N[Power[z, 3.0], $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y * N[(0.5 * N[(1.0 / t$95$0), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(z / N[Power[y, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
t_0 := \sqrt{y \cdot z}\\
t_1 := 2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z}\\
t_2 := \sqrt{\frac{y}{z}}\\
\mathbf{if}\;t\_1 \leq 10^{-81}:\\
\;\;\;\;2 \cdot \left(\sqrt{\frac{x + z}{y}} \cdot y\right)\\
\mathbf{elif}\;t\_1 \leq 10^{+118}:\\
\;\;\;\;2 \cdot \frac{\mathsf{fma}\left(x, \mathsf{fma}\left(-0.25, x \cdot t\_2, 0.5 \cdot t\_0\right), y \cdot \mathsf{fma}\left(\sqrt{y}, \sqrt{z}, x \cdot \mathsf{fma}\left(-0.125, x \cdot \sqrt{\frac{y}{{z}^{3}}}, 0.5 \cdot t\_2\right)\right)\right)}{y}\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(\sqrt{y}, \sqrt{z}, x \cdot \mathsf{fma}\left(x, y \cdot \mathsf{fma}\left(-0.25, \sqrt{{\left({y}^{3} \cdot z\right)}^{-1}}, -0.125 \cdot \sqrt{{\left(y \cdot {z}^{3}\right)}^{-1}}\right), y \cdot \mathsf{fma}\left(0.5, \frac{1}{t\_0}, 0.5 \cdot \sqrt{\frac{z}{{y}^{3}}}\right)\right)\right)\\
\end{array}
\end{array}
if (*.f64 #s(literal 2 binary64) (sqrt.f64 (+.f64 (+.f64 (*.f64 x y) (*.f64 x z)) (*.f64 y z)))) < 9.9999999999999996e-82Initial program 68.7%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites5.3%
Taylor expanded in y around inf
lower-sqrt.f64N/A
lower-/.f64N/A
lower-+.f6428.5
Applied rewrites28.5%
if 9.9999999999999996e-82 < (*.f64 #s(literal 2 binary64) (sqrt.f64 (+.f64 (+.f64 (*.f64 x y) (*.f64 x z)) (*.f64 y z)))) < 9.99999999999999967e117Initial program 99.9%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites24.1%
Taylor expanded in x around 0
Applied rewrites5.3%
Taylor expanded in y around 0
lower-/.f64N/A
Applied rewrites10.0%
if 9.99999999999999967e117 < (*.f64 #s(literal 2 binary64) (sqrt.f64 (+.f64 (+.f64 (*.f64 x y) (*.f64 x z)) (*.f64 y z)))) Initial program 30.7%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites23.2%
Taylor expanded in x around 0
Applied rewrites13.2%
NOTE: x, y, and z should be sorted in increasing order before calling this function.
(FPCore (x y z)
:precision binary64
(let* ((t_0 (sqrt (/ y z))) (t_1 (sqrt (* y z))))
(if (<= y 7.5e-270)
(fma (* (pow (* z x) -0.5) y) (+ z x) (* (sqrt (* z x)) 2.0))
(if (<= y 2.45e-18)
(*
2.0
(/
(fma
x
(fma -0.25 (* x t_0) (* 0.5 t_1))
(*
y
(fma
(sqrt y)
(sqrt z)
(* x (fma -0.125 (* x (sqrt (/ y (pow z 3.0)))) (* 0.5 t_0))))))
y))
(*
2.0
(fma
(sqrt y)
(sqrt z)
(*
x
(fma
x
(*
y
(fma
-0.25
(sqrt (pow (* (pow y 3.0) z) -1.0))
(* -0.125 (sqrt (pow (* y (pow z 3.0)) -1.0)))))
(* y (fma 0.5 (/ 1.0 t_1) (* 0.5 (sqrt (/ z (pow y 3.0))))))))))))))assert(x < y && y < z);
double code(double x, double y, double z) {
double t_0 = sqrt((y / z));
double t_1 = sqrt((y * z));
double tmp;
if (y <= 7.5e-270) {
tmp = fma((pow((z * x), -0.5) * y), (z + x), (sqrt((z * x)) * 2.0));
} else if (y <= 2.45e-18) {
tmp = 2.0 * (fma(x, fma(-0.25, (x * t_0), (0.5 * t_1)), (y * fma(sqrt(y), sqrt(z), (x * fma(-0.125, (x * sqrt((y / pow(z, 3.0)))), (0.5 * t_0)))))) / y);
} else {
tmp = 2.0 * fma(sqrt(y), sqrt(z), (x * fma(x, (y * fma(-0.25, sqrt(pow((pow(y, 3.0) * z), -1.0)), (-0.125 * sqrt(pow((y * pow(z, 3.0)), -1.0))))), (y * fma(0.5, (1.0 / t_1), (0.5 * sqrt((z / pow(y, 3.0)))))))));
}
return tmp;
}
x, y, z = sort([x, y, z]) function code(x, y, z) t_0 = sqrt(Float64(y / z)) t_1 = sqrt(Float64(y * z)) tmp = 0.0 if (y <= 7.5e-270) tmp = fma(Float64((Float64(z * x) ^ -0.5) * y), Float64(z + x), Float64(sqrt(Float64(z * x)) * 2.0)); elseif (y <= 2.45e-18) tmp = Float64(2.0 * Float64(fma(x, fma(-0.25, Float64(x * t_0), Float64(0.5 * t_1)), Float64(y * fma(sqrt(y), sqrt(z), Float64(x * fma(-0.125, Float64(x * sqrt(Float64(y / (z ^ 3.0)))), Float64(0.5 * t_0)))))) / y)); else tmp = Float64(2.0 * fma(sqrt(y), sqrt(z), Float64(x * fma(x, Float64(y * fma(-0.25, sqrt((Float64((y ^ 3.0) * z) ^ -1.0)), Float64(-0.125 * sqrt((Float64(y * (z ^ 3.0)) ^ -1.0))))), Float64(y * fma(0.5, Float64(1.0 / t_1), Float64(0.5 * sqrt(Float64(z / (y ^ 3.0)))))))))); end return tmp end
NOTE: x, y, and z should be sorted in increasing order before calling this function.
code[x_, y_, z_] := Block[{t$95$0 = N[Sqrt[N[(y / z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(y * z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 7.5e-270], N[(N[(N[Power[N[(z * x), $MachinePrecision], -0.5], $MachinePrecision] * y), $MachinePrecision] * N[(z + x), $MachinePrecision] + N[(N[Sqrt[N[(z * x), $MachinePrecision]], $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.45e-18], N[(2.0 * N[(N[(x * N[(-0.25 * N[(x * t$95$0), $MachinePrecision] + N[(0.5 * t$95$1), $MachinePrecision]), $MachinePrecision] + N[(y * N[(N[Sqrt[y], $MachinePrecision] * N[Sqrt[z], $MachinePrecision] + N[(x * N[(-0.125 * N[(x * N[Sqrt[N[(y / N[Power[z, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(0.5 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[Sqrt[y], $MachinePrecision] * N[Sqrt[z], $MachinePrecision] + N[(x * N[(x * N[(y * N[(-0.25 * N[Sqrt[N[Power[N[(N[Power[y, 3.0], $MachinePrecision] * z), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision] + N[(-0.125 * N[Sqrt[N[Power[N[(y * N[Power[z, 3.0], $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y * N[(0.5 * N[(1.0 / t$95$1), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(z / N[Power[y, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{y}{z}}\\
t_1 := \sqrt{y \cdot z}\\
\mathbf{if}\;y \leq 7.5 \cdot 10^{-270}:\\
\;\;\;\;\mathsf{fma}\left({\left(z \cdot x\right)}^{-0.5} \cdot y, z + x, \sqrt{z \cdot x} \cdot 2\right)\\
\mathbf{elif}\;y \leq 2.45 \cdot 10^{-18}:\\
\;\;\;\;2 \cdot \frac{\mathsf{fma}\left(x, \mathsf{fma}\left(-0.25, x \cdot t\_0, 0.5 \cdot t\_1\right), y \cdot \mathsf{fma}\left(\sqrt{y}, \sqrt{z}, x \cdot \mathsf{fma}\left(-0.125, x \cdot \sqrt{\frac{y}{{z}^{3}}}, 0.5 \cdot t\_0\right)\right)\right)}{y}\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(\sqrt{y}, \sqrt{z}, x \cdot \mathsf{fma}\left(x, y \cdot \mathsf{fma}\left(-0.25, \sqrt{{\left({y}^{3} \cdot z\right)}^{-1}}, -0.125 \cdot \sqrt{{\left(y \cdot {z}^{3}\right)}^{-1}}\right), y \cdot \mathsf{fma}\left(0.5, \frac{1}{t\_1}, 0.5 \cdot \sqrt{\frac{z}{{y}^{3}}}\right)\right)\right)\\
\end{array}
\end{array}
if y < 7.4999999999999997e-270Initial program 66.6%
Taylor expanded in y around 0
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
inv-powN/A
sqrt-pow1N/A
metadata-evalN/A
metadata-evalN/A
lower-pow.f64N/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
+-commutativeN/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
*-commutativeN/A
lower-*.f6426.0
Applied rewrites26.0%
if 7.4999999999999997e-270 < y < 2.4500000000000001e-18Initial program 83.4%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites15.5%
Taylor expanded in x around 0
Applied rewrites4.6%
Taylor expanded in y around 0
lower-/.f64N/A
Applied rewrites18.6%
if 2.4500000000000001e-18 < y Initial program 55.1%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites71.6%
Taylor expanded in x around 0
Applied rewrites28.5%
NOTE: x, y, and z should be sorted in increasing order before calling this function.
(FPCore (x y z)
:precision binary64
(let* ((t_0 (sqrt (/ y z))))
(if (<= z 5.5e-116)
(fma (* (pow (* z x) -0.5) y) (+ z x) (* (sqrt (* z x)) 2.0))
(*
2.0
(/
(fma
x
(fma -0.25 (* x t_0) (* 0.5 (sqrt (* y z))))
(*
y
(fma
(sqrt y)
(sqrt z)
(* x (fma -0.125 (* x (sqrt (/ y (pow z 3.0)))) (* 0.5 t_0))))))
y)))))assert(x < y && y < z);
double code(double x, double y, double z) {
double t_0 = sqrt((y / z));
double tmp;
if (z <= 5.5e-116) {
tmp = fma((pow((z * x), -0.5) * y), (z + x), (sqrt((z * x)) * 2.0));
} else {
tmp = 2.0 * (fma(x, fma(-0.25, (x * t_0), (0.5 * sqrt((y * z)))), (y * fma(sqrt(y), sqrt(z), (x * fma(-0.125, (x * sqrt((y / pow(z, 3.0)))), (0.5 * t_0)))))) / y);
}
return tmp;
}
x, y, z = sort([x, y, z]) function code(x, y, z) t_0 = sqrt(Float64(y / z)) tmp = 0.0 if (z <= 5.5e-116) tmp = fma(Float64((Float64(z * x) ^ -0.5) * y), Float64(z + x), Float64(sqrt(Float64(z * x)) * 2.0)); else tmp = Float64(2.0 * Float64(fma(x, fma(-0.25, Float64(x * t_0), Float64(0.5 * sqrt(Float64(y * z)))), Float64(y * fma(sqrt(y), sqrt(z), Float64(x * fma(-0.125, Float64(x * sqrt(Float64(y / (z ^ 3.0)))), Float64(0.5 * t_0)))))) / y)); end return tmp end
NOTE: x, y, and z should be sorted in increasing order before calling this function.
code[x_, y_, z_] := Block[{t$95$0 = N[Sqrt[N[(y / z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 5.5e-116], N[(N[(N[Power[N[(z * x), $MachinePrecision], -0.5], $MachinePrecision] * y), $MachinePrecision] * N[(z + x), $MachinePrecision] + N[(N[Sqrt[N[(z * x), $MachinePrecision]], $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[(x * N[(-0.25 * N[(x * t$95$0), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(y * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y * N[(N[Sqrt[y], $MachinePrecision] * N[Sqrt[z], $MachinePrecision] + N[(x * N[(-0.125 * N[(x * N[Sqrt[N[(y / N[Power[z, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(0.5 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{y}{z}}\\
\mathbf{if}\;z \leq 5.5 \cdot 10^{-116}:\\
\;\;\;\;\mathsf{fma}\left({\left(z \cdot x\right)}^{-0.5} \cdot y, z + x, \sqrt{z \cdot x} \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \frac{\mathsf{fma}\left(x, \mathsf{fma}\left(-0.25, x \cdot t\_0, 0.5 \cdot \sqrt{y \cdot z}\right), y \cdot \mathsf{fma}\left(\sqrt{y}, \sqrt{z}, x \cdot \mathsf{fma}\left(-0.125, x \cdot \sqrt{\frac{y}{{z}^{3}}}, 0.5 \cdot t\_0\right)\right)\right)}{y}\\
\end{array}
\end{array}
if z < 5.4999999999999998e-116Initial program 72.0%
Taylor expanded in y around 0
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
inv-powN/A
sqrt-pow1N/A
metadata-evalN/A
metadata-evalN/A
lower-pow.f64N/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
+-commutativeN/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
*-commutativeN/A
lower-*.f6421.9
Applied rewrites21.9%
if 5.4999999999999998e-116 < z Initial program 57.6%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites26.6%
Taylor expanded in x around 0
Applied rewrites24.0%
Taylor expanded in y around 0
lower-/.f64N/A
Applied rewrites16.4%
NOTE: x, y, and z should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (fma (* (pow (* z x) -0.5) y) (+ z x) (* (sqrt (* z x)) 2.0)))
assert(x < y && y < z);
double code(double x, double y, double z) {
return fma((pow((z * x), -0.5) * y), (z + x), (sqrt((z * x)) * 2.0));
}
x, y, z = sort([x, y, z]) function code(x, y, z) return fma(Float64((Float64(z * x) ^ -0.5) * y), Float64(z + x), Float64(sqrt(Float64(z * x)) * 2.0)) end
NOTE: x, y, and z should be sorted in increasing order before calling this function. code[x_, y_, z_] := N[(N[(N[Power[N[(z * x), $MachinePrecision], -0.5], $MachinePrecision] * y), $MachinePrecision] * N[(z + x), $MachinePrecision] + N[(N[Sqrt[N[(z * x), $MachinePrecision]], $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\mathsf{fma}\left({\left(z \cdot x\right)}^{-0.5} \cdot y, z + x, \sqrt{z \cdot x} \cdot 2\right)
\end{array}
Initial program 67.1%
Taylor expanded in y around 0
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
inv-powN/A
sqrt-pow1N/A
metadata-evalN/A
metadata-evalN/A
lower-pow.f64N/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
+-commutativeN/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
*-commutativeN/A
lower-*.f6426.3
Applied rewrites26.3%
herbie shell --seed 2025057
(FPCore (x y z)
:name "Diagrams.TwoD.Apollonian:descartes from diagrams-contrib-1.3.0.5"
:precision binary64
:alt
(! :herbie-platform default (if (< z 763695009057367500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (* 2 (sqrt (+ (* (+ x y) z) (* x y)))) (* (* (+ (* 1/4 (* (* (pow y -3/4) (* (pow z -3/4) x)) (+ y z))) (* (pow z 1/4) (pow y 1/4))) (+ (* 1/4 (* (* (pow y -3/4) (* (pow z -3/4) x)) (+ y z))) (* (pow z 1/4) (pow y 1/4)))) 2)))
(* 2.0 (sqrt (+ (+ (* x y) (* x z)) (* y z)))))