
(FPCore (x y z t) :precision binary64 (+ (+ (+ (- (sqrt (+ x 1.0)) (sqrt x)) (- (sqrt (+ y 1.0)) (sqrt y))) (- (sqrt (+ z 1.0)) (sqrt z))) (- (sqrt (+ t 1.0)) (sqrt t))))
double code(double x, double y, double z, double t) {
return (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t));
}
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, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((sqrt((x + 1.0d0)) - sqrt(x)) + (sqrt((y + 1.0d0)) - sqrt(y))) + (sqrt((z + 1.0d0)) - sqrt(z))) + (sqrt((t + 1.0d0)) - sqrt(t))
end function
public static double code(double x, double y, double z, double t) {
return (((Math.sqrt((x + 1.0)) - Math.sqrt(x)) + (Math.sqrt((y + 1.0)) - Math.sqrt(y))) + (Math.sqrt((z + 1.0)) - Math.sqrt(z))) + (Math.sqrt((t + 1.0)) - Math.sqrt(t));
}
def code(x, y, z, t): return (((math.sqrt((x + 1.0)) - math.sqrt(x)) + (math.sqrt((y + 1.0)) - math.sqrt(y))) + (math.sqrt((z + 1.0)) - math.sqrt(z))) + (math.sqrt((t + 1.0)) - math.sqrt(t))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + Float64(sqrt(Float64(y + 1.0)) - sqrt(y))) + Float64(sqrt(Float64(z + 1.0)) - sqrt(z))) + Float64(sqrt(Float64(t + 1.0)) - sqrt(t))) end
function tmp = code(x, y, z, t) tmp = (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)
\end{array}
Herbie found 6 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (+ (+ (- (sqrt (+ x 1.0)) (sqrt x)) (- (sqrt (+ y 1.0)) (sqrt y))) (- (sqrt (+ z 1.0)) (sqrt z))) (- (sqrt (+ t 1.0)) (sqrt t))))
double code(double x, double y, double z, double t) {
return (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t));
}
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, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((sqrt((x + 1.0d0)) - sqrt(x)) + (sqrt((y + 1.0d0)) - sqrt(y))) + (sqrt((z + 1.0d0)) - sqrt(z))) + (sqrt((t + 1.0d0)) - sqrt(t))
end function
public static double code(double x, double y, double z, double t) {
return (((Math.sqrt((x + 1.0)) - Math.sqrt(x)) + (Math.sqrt((y + 1.0)) - Math.sqrt(y))) + (Math.sqrt((z + 1.0)) - Math.sqrt(z))) + (Math.sqrt((t + 1.0)) - Math.sqrt(t));
}
def code(x, y, z, t): return (((math.sqrt((x + 1.0)) - math.sqrt(x)) + (math.sqrt((y + 1.0)) - math.sqrt(y))) + (math.sqrt((z + 1.0)) - math.sqrt(z))) + (math.sqrt((t + 1.0)) - math.sqrt(t))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + Float64(sqrt(Float64(y + 1.0)) - sqrt(y))) + Float64(sqrt(Float64(z + 1.0)) - sqrt(z))) + Float64(sqrt(Float64(t + 1.0)) - sqrt(t))) end
function tmp = code(x, y, z, t) tmp = (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)
\end{array}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (sqrt (+ y 1.0)) (sqrt y)))
(t_2 (- (sqrt (+ t 1.0)) (sqrt t))))
(if (<= t_1 0.0005)
(+
(+
(+
(/ 1.0 (+ (pow (+ 1.0 x) 0.5) (pow x 0.5)))
(/
(fma
-0.125
(pow (pow y -1.0) 0.5)
(fma 0.0625 (pow (pow (pow y 3.0) -1.0) 0.5) (* 0.5 (pow y 0.5))))
y))
(- (sqrt (+ z 1.0)) (sqrt z)))
t_2)
(+
(+
(+ (- (sqrt (+ x 1.0)) (sqrt x)) t_1)
(/ 1.0 (+ (pow (+ z 1.0) 0.5) (pow z 0.5))))
t_2))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((y + 1.0)) - sqrt(y);
double t_2 = sqrt((t + 1.0)) - sqrt(t);
double tmp;
if (t_1 <= 0.0005) {
tmp = (((1.0 / (pow((1.0 + x), 0.5) + pow(x, 0.5))) + (fma(-0.125, pow(pow(y, -1.0), 0.5), fma(0.0625, pow(pow(pow(y, 3.0), -1.0), 0.5), (0.5 * pow(y, 0.5)))) / y)) + (sqrt((z + 1.0)) - sqrt(z))) + t_2;
} else {
tmp = (((sqrt((x + 1.0)) - sqrt(x)) + t_1) + (1.0 / (pow((z + 1.0), 0.5) + pow(z, 0.5)))) + t_2;
}
return tmp;
}
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(y + 1.0)) - sqrt(y)) t_2 = Float64(sqrt(Float64(t + 1.0)) - sqrt(t)) tmp = 0.0 if (t_1 <= 0.0005) tmp = Float64(Float64(Float64(Float64(1.0 / Float64((Float64(1.0 + x) ^ 0.5) + (x ^ 0.5))) + Float64(fma(-0.125, ((y ^ -1.0) ^ 0.5), fma(0.0625, (((y ^ 3.0) ^ -1.0) ^ 0.5), Float64(0.5 * (y ^ 0.5)))) / y)) + Float64(sqrt(Float64(z + 1.0)) - sqrt(z))) + t_2); else tmp = Float64(Float64(Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + t_1) + Float64(1.0 / Float64((Float64(z + 1.0) ^ 0.5) + (z ^ 0.5)))) + t_2); end return tmp end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 0.0005], N[(N[(N[(N[(1.0 / N[(N[Power[N[(1.0 + x), $MachinePrecision], 0.5], $MachinePrecision] + N[Power[x, 0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(-0.125 * N[Power[N[Power[y, -1.0], $MachinePrecision], 0.5], $MachinePrecision] + N[(0.0625 * N[Power[N[Power[N[Power[y, 3.0], $MachinePrecision], -1.0], $MachinePrecision], 0.5], $MachinePrecision] + N[(0.5 * N[Power[y, 0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision], N[(N[(N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision] + N[(1.0 / N[(N[Power[N[(z + 1.0), $MachinePrecision], 0.5], $MachinePrecision] + N[Power[z, 0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{y + 1} - \sqrt{y}\\
t_2 := \sqrt{t + 1} - \sqrt{t}\\
\mathbf{if}\;t\_1 \leq 0.0005:\\
\;\;\;\;\left(\left(\frac{1}{{\left(1 + x\right)}^{0.5} + {x}^{0.5}} + \frac{\mathsf{fma}\left(-0.125, {\left({y}^{-1}\right)}^{0.5}, \mathsf{fma}\left(0.0625, {\left({\left({y}^{3}\right)}^{-1}\right)}^{0.5}, 0.5 \cdot {y}^{0.5}\right)\right)}{y}\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + t\_2\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + t\_1\right) + \frac{1}{{\left(z + 1\right)}^{0.5} + {z}^{0.5}}\right) + t\_2\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y)) < 5.0000000000000001e-4Initial program 76.7%
lift--.f64N/A
lift-+.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
+-commutativeN/A
flip--N/A
lower-/.f64N/A
Applied rewrites77.2%
Taylor expanded in x around 0
Applied rewrites92.8%
Taylor expanded in y around inf
lower-/.f64N/A
lower-fma.f64N/A
pow1/2N/A
lower-pow.f64N/A
inv-powN/A
lower-pow.f64N/A
lower-fma.f64N/A
pow1/2N/A
lower-pow.f64N/A
inv-powN/A
lower-pow.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
pow1/2N/A
lift-pow.f6499.4
Applied rewrites99.4%
if 5.0000000000000001e-4 < (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y)) Initial program 97.4%
lift--.f64N/A
lift-+.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
flip--N/A
lower-/.f64N/A
Applied rewrites97.6%
Taylor expanded in z around 0
Applied rewrites99.1%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (sqrt (+ y 1.0)) (sqrt y)))
(t_2 (- (sqrt (+ t 1.0)) (sqrt t))))
(if (<= t_1 0.0005)
(+
(+
(fma
-0.125
(pow (pow (pow y 3.0) -1.0) 0.5)
(fma
0.0625
(pow (pow (pow y 5.0) -1.0) 0.5)
(fma
0.5
(pow (pow y -1.0) 0.5)
(pow (+ (pow x 0.5) (pow (+ 1.0 x) 0.5)) -1.0))))
(- (sqrt (+ z 1.0)) (sqrt z)))
t_2)
(+
(+
(+ (- (sqrt (+ x 1.0)) (sqrt x)) t_1)
(/ 1.0 (+ (pow (+ z 1.0) 0.5) (pow z 0.5))))
t_2))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((y + 1.0)) - sqrt(y);
double t_2 = sqrt((t + 1.0)) - sqrt(t);
double tmp;
if (t_1 <= 0.0005) {
tmp = (fma(-0.125, pow(pow(pow(y, 3.0), -1.0), 0.5), fma(0.0625, pow(pow(pow(y, 5.0), -1.0), 0.5), fma(0.5, pow(pow(y, -1.0), 0.5), pow((pow(x, 0.5) + pow((1.0 + x), 0.5)), -1.0)))) + (sqrt((z + 1.0)) - sqrt(z))) + t_2;
} else {
tmp = (((sqrt((x + 1.0)) - sqrt(x)) + t_1) + (1.0 / (pow((z + 1.0), 0.5) + pow(z, 0.5)))) + t_2;
}
return tmp;
}
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(y + 1.0)) - sqrt(y)) t_2 = Float64(sqrt(Float64(t + 1.0)) - sqrt(t)) tmp = 0.0 if (t_1 <= 0.0005) tmp = Float64(Float64(fma(-0.125, (((y ^ 3.0) ^ -1.0) ^ 0.5), fma(0.0625, (((y ^ 5.0) ^ -1.0) ^ 0.5), fma(0.5, ((y ^ -1.0) ^ 0.5), (Float64((x ^ 0.5) + (Float64(1.0 + x) ^ 0.5)) ^ -1.0)))) + Float64(sqrt(Float64(z + 1.0)) - sqrt(z))) + t_2); else tmp = Float64(Float64(Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + t_1) + Float64(1.0 / Float64((Float64(z + 1.0) ^ 0.5) + (z ^ 0.5)))) + t_2); end return tmp end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 0.0005], N[(N[(N[(-0.125 * N[Power[N[Power[N[Power[y, 3.0], $MachinePrecision], -1.0], $MachinePrecision], 0.5], $MachinePrecision] + N[(0.0625 * N[Power[N[Power[N[Power[y, 5.0], $MachinePrecision], -1.0], $MachinePrecision], 0.5], $MachinePrecision] + N[(0.5 * N[Power[N[Power[y, -1.0], $MachinePrecision], 0.5], $MachinePrecision] + N[Power[N[(N[Power[x, 0.5], $MachinePrecision] + N[Power[N[(1.0 + x), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision], N[(N[(N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision] + N[(1.0 / N[(N[Power[N[(z + 1.0), $MachinePrecision], 0.5], $MachinePrecision] + N[Power[z, 0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{y + 1} - \sqrt{y}\\
t_2 := \sqrt{t + 1} - \sqrt{t}\\
\mathbf{if}\;t\_1 \leq 0.0005:\\
\;\;\;\;\left(\mathsf{fma}\left(-0.125, {\left({\left({y}^{3}\right)}^{-1}\right)}^{0.5}, \mathsf{fma}\left(0.0625, {\left({\left({y}^{5}\right)}^{-1}\right)}^{0.5}, \mathsf{fma}\left(0.5, {\left({y}^{-1}\right)}^{0.5}, {\left({x}^{0.5} + {\left(1 + x\right)}^{0.5}\right)}^{-1}\right)\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + t\_2\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + t\_1\right) + \frac{1}{{\left(z + 1\right)}^{0.5} + {z}^{0.5}}\right) + t\_2\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y)) < 5.0000000000000001e-4Initial program 76.7%
lift--.f64N/A
lift-+.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
+-commutativeN/A
flip--N/A
lower-/.f64N/A
Applied rewrites77.2%
Taylor expanded in y around inf
lower-fma.f64N/A
pow1/2N/A
lower-pow.f64N/A
inv-powN/A
lower-pow.f64N/A
lower-pow.f64N/A
lower-fma.f64N/A
Applied rewrites99.3%
if 5.0000000000000001e-4 < (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y)) Initial program 97.4%
lift--.f64N/A
lift-+.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
flip--N/A
lower-/.f64N/A
Applied rewrites97.6%
Taylor expanded in z around 0
Applied rewrites99.1%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (sqrt (+ y 1.0)) (sqrt y)))
(t_2 (- (sqrt (+ z 1.0)) (sqrt z))))
(if (<= t_1 0.0005)
(+
(+
(fma
-0.125
(pow (pow (pow y 3.0) -1.0) 0.5)
(fma
0.0625
(pow (pow (pow y 5.0) -1.0) 0.5)
(fma
0.5
(pow (pow y -1.0) 0.5)
(pow (+ (pow x 0.5) (pow (+ 1.0 x) 0.5)) -1.0))))
t_2)
(- (sqrt (+ t 1.0)) (sqrt t)))
(+
(+ (+ (- (sqrt (+ x 1.0)) (sqrt x)) t_1) t_2)
(/ 1.0 (+ (pow (+ t 1.0) 0.5) (pow t 0.5)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((y + 1.0)) - sqrt(y);
double t_2 = sqrt((z + 1.0)) - sqrt(z);
double tmp;
if (t_1 <= 0.0005) {
tmp = (fma(-0.125, pow(pow(pow(y, 3.0), -1.0), 0.5), fma(0.0625, pow(pow(pow(y, 5.0), -1.0), 0.5), fma(0.5, pow(pow(y, -1.0), 0.5), pow((pow(x, 0.5) + pow((1.0 + x), 0.5)), -1.0)))) + t_2) + (sqrt((t + 1.0)) - sqrt(t));
} else {
tmp = (((sqrt((x + 1.0)) - sqrt(x)) + t_1) + t_2) + (1.0 / (pow((t + 1.0), 0.5) + pow(t, 0.5)));
}
return tmp;
}
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(y + 1.0)) - sqrt(y)) t_2 = Float64(sqrt(Float64(z + 1.0)) - sqrt(z)) tmp = 0.0 if (t_1 <= 0.0005) tmp = Float64(Float64(fma(-0.125, (((y ^ 3.0) ^ -1.0) ^ 0.5), fma(0.0625, (((y ^ 5.0) ^ -1.0) ^ 0.5), fma(0.5, ((y ^ -1.0) ^ 0.5), (Float64((x ^ 0.5) + (Float64(1.0 + x) ^ 0.5)) ^ -1.0)))) + t_2) + Float64(sqrt(Float64(t + 1.0)) - sqrt(t))); else tmp = Float64(Float64(Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + t_1) + t_2) + Float64(1.0 / Float64((Float64(t + 1.0) ^ 0.5) + (t ^ 0.5)))); end return tmp end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 0.0005], N[(N[(N[(-0.125 * N[Power[N[Power[N[Power[y, 3.0], $MachinePrecision], -1.0], $MachinePrecision], 0.5], $MachinePrecision] + N[(0.0625 * N[Power[N[Power[N[Power[y, 5.0], $MachinePrecision], -1.0], $MachinePrecision], 0.5], $MachinePrecision] + N[(0.5 * N[Power[N[Power[y, -1.0], $MachinePrecision], 0.5], $MachinePrecision] + N[Power[N[(N[Power[x, 0.5], $MachinePrecision] + N[Power[N[(1.0 + x), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision] + N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision] + t$95$2), $MachinePrecision] + N[(1.0 / N[(N[Power[N[(t + 1.0), $MachinePrecision], 0.5], $MachinePrecision] + N[Power[t, 0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{y + 1} - \sqrt{y}\\
t_2 := \sqrt{z + 1} - \sqrt{z}\\
\mathbf{if}\;t\_1 \leq 0.0005:\\
\;\;\;\;\left(\mathsf{fma}\left(-0.125, {\left({\left({y}^{3}\right)}^{-1}\right)}^{0.5}, \mathsf{fma}\left(0.0625, {\left({\left({y}^{5}\right)}^{-1}\right)}^{0.5}, \mathsf{fma}\left(0.5, {\left({y}^{-1}\right)}^{0.5}, {\left({x}^{0.5} + {\left(1 + x\right)}^{0.5}\right)}^{-1}\right)\right)\right) + t\_2\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + t\_1\right) + t\_2\right) + \frac{1}{{\left(t + 1\right)}^{0.5} + {t}^{0.5}}\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y)) < 5.0000000000000001e-4Initial program 76.7%
lift--.f64N/A
lift-+.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
+-commutativeN/A
flip--N/A
lower-/.f64N/A
Applied rewrites77.2%
Taylor expanded in y around inf
lower-fma.f64N/A
pow1/2N/A
lower-pow.f64N/A
inv-powN/A
lower-pow.f64N/A
lower-pow.f64N/A
lower-fma.f64N/A
Applied rewrites99.3%
if 5.0000000000000001e-4 < (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y)) Initial program 97.4%
lift--.f64N/A
lift-+.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
flip--N/A
lower-/.f64N/A
Applied rewrites97.5%
Taylor expanded in t around 0
Applied rewrites98.1%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (sqrt (+ z 1.0)) (sqrt z)))
(t_2 (- (sqrt (+ t 1.0)) (sqrt t))))
(if (<= y 5000.0)
(+
(+
(+ (- (exp (* (log1p x) 0.5)) (sqrt x)) (- (sqrt (+ y 1.0)) (sqrt y)))
t_1)
t_2)
(+
(+
(fma
-0.125
(pow (pow (pow y 3.0) -1.0) 0.5)
(fma
0.0625
(pow (pow (pow y 5.0) -1.0) 0.5)
(fma
0.5
(pow (pow y -1.0) 0.5)
(pow (+ (pow x 0.5) (pow (+ 1.0 x) 0.5)) -1.0))))
t_1)
t_2))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((z + 1.0)) - sqrt(z);
double t_2 = sqrt((t + 1.0)) - sqrt(t);
double tmp;
if (y <= 5000.0) {
tmp = (((exp((log1p(x) * 0.5)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + t_1) + t_2;
} else {
tmp = (fma(-0.125, pow(pow(pow(y, 3.0), -1.0), 0.5), fma(0.0625, pow(pow(pow(y, 5.0), -1.0), 0.5), fma(0.5, pow(pow(y, -1.0), 0.5), pow((pow(x, 0.5) + pow((1.0 + x), 0.5)), -1.0)))) + t_1) + t_2;
}
return tmp;
}
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(z + 1.0)) - sqrt(z)) t_2 = Float64(sqrt(Float64(t + 1.0)) - sqrt(t)) tmp = 0.0 if (y <= 5000.0) tmp = Float64(Float64(Float64(Float64(exp(Float64(log1p(x) * 0.5)) - sqrt(x)) + Float64(sqrt(Float64(y + 1.0)) - sqrt(y))) + t_1) + t_2); else tmp = Float64(Float64(fma(-0.125, (((y ^ 3.0) ^ -1.0) ^ 0.5), fma(0.0625, (((y ^ 5.0) ^ -1.0) ^ 0.5), fma(0.5, ((y ^ -1.0) ^ 0.5), (Float64((x ^ 0.5) + (Float64(1.0 + x) ^ 0.5)) ^ -1.0)))) + t_1) + t_2); end return tmp end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 5000.0], N[(N[(N[(N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] * 0.5), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision] + t$95$2), $MachinePrecision], N[(N[(N[(-0.125 * N[Power[N[Power[N[Power[y, 3.0], $MachinePrecision], -1.0], $MachinePrecision], 0.5], $MachinePrecision] + N[(0.0625 * N[Power[N[Power[N[Power[y, 5.0], $MachinePrecision], -1.0], $MachinePrecision], 0.5], $MachinePrecision] + N[(0.5 * N[Power[N[Power[y, -1.0], $MachinePrecision], 0.5], $MachinePrecision] + N[Power[N[(N[Power[x, 0.5], $MachinePrecision] + N[Power[N[(1.0 + x), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision] + t$95$2), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{z + 1} - \sqrt{z}\\
t_2 := \sqrt{t + 1} - \sqrt{t}\\
\mathbf{if}\;y \leq 5000:\\
\;\;\;\;\left(\left(\left(e^{\mathsf{log1p}\left(x\right) \cdot 0.5} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + t\_1\right) + t\_2\\
\mathbf{else}:\\
\;\;\;\;\left(\mathsf{fma}\left(-0.125, {\left({\left({y}^{3}\right)}^{-1}\right)}^{0.5}, \mathsf{fma}\left(0.0625, {\left({\left({y}^{5}\right)}^{-1}\right)}^{0.5}, \mathsf{fma}\left(0.5, {\left({y}^{-1}\right)}^{0.5}, {\left({x}^{0.5} + {\left(1 + x\right)}^{0.5}\right)}^{-1}\right)\right)\right) + t\_1\right) + t\_2\\
\end{array}
\end{array}
if y < 5e3Initial program 97.5%
lift-+.f64N/A
lift-sqrt.f64N/A
pow1/2N/A
pow-to-expN/A
lower-exp.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-log1p.f6497.5
Applied rewrites97.5%
if 5e3 < y Initial program 76.9%
lift--.f64N/A
lift-+.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
+-commutativeN/A
flip--N/A
lower-/.f64N/A
Applied rewrites77.4%
Taylor expanded in y around inf
lower-fma.f64N/A
pow1/2N/A
lower-pow.f64N/A
inv-powN/A
lower-pow.f64N/A
lower-pow.f64N/A
lower-fma.f64N/A
Applied rewrites99.3%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (pow (+ 1.0 x) 0.5)))
(if (<= y 6.2e-10)
(-
(+
t_1
(+
(pow (+ 1.0 z) 0.5)
(fma
-0.125
(pow (pow (pow t 3.0) -1.0) 0.5)
(fma
0.0625
(pow (pow (pow t 5.0) -1.0) 0.5)
(fma
0.5
(pow (pow t -1.0) 0.5)
(pow (+ (pow y 0.5) (pow (+ 1.0 y) 0.5)) -1.0))))))
(+ (pow x 0.5) (pow z 0.5)))
(+
(+
(fma
-0.125
(pow (pow (pow y 3.0) -1.0) 0.5)
(fma
0.0625
(pow (pow (pow y 5.0) -1.0) 0.5)
(fma 0.5 (pow (pow y -1.0) 0.5) (pow (+ (pow x 0.5) t_1) -1.0))))
(- (sqrt (+ z 1.0)) (sqrt z)))
(- (sqrt (+ t 1.0)) (sqrt t))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = pow((1.0 + x), 0.5);
double tmp;
if (y <= 6.2e-10) {
tmp = (t_1 + (pow((1.0 + z), 0.5) + fma(-0.125, pow(pow(pow(t, 3.0), -1.0), 0.5), fma(0.0625, pow(pow(pow(t, 5.0), -1.0), 0.5), fma(0.5, pow(pow(t, -1.0), 0.5), pow((pow(y, 0.5) + pow((1.0 + y), 0.5)), -1.0)))))) - (pow(x, 0.5) + pow(z, 0.5));
} else {
tmp = (fma(-0.125, pow(pow(pow(y, 3.0), -1.0), 0.5), fma(0.0625, pow(pow(pow(y, 5.0), -1.0), 0.5), fma(0.5, pow(pow(y, -1.0), 0.5), pow((pow(x, 0.5) + t_1), -1.0)))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t));
}
return tmp;
}
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(1.0 + x) ^ 0.5 tmp = 0.0 if (y <= 6.2e-10) tmp = Float64(Float64(t_1 + Float64((Float64(1.0 + z) ^ 0.5) + fma(-0.125, (((t ^ 3.0) ^ -1.0) ^ 0.5), fma(0.0625, (((t ^ 5.0) ^ -1.0) ^ 0.5), fma(0.5, ((t ^ -1.0) ^ 0.5), (Float64((y ^ 0.5) + (Float64(1.0 + y) ^ 0.5)) ^ -1.0)))))) - Float64((x ^ 0.5) + (z ^ 0.5))); else tmp = Float64(Float64(fma(-0.125, (((y ^ 3.0) ^ -1.0) ^ 0.5), fma(0.0625, (((y ^ 5.0) ^ -1.0) ^ 0.5), fma(0.5, ((y ^ -1.0) ^ 0.5), (Float64((x ^ 0.5) + t_1) ^ -1.0)))) + Float64(sqrt(Float64(z + 1.0)) - sqrt(z))) + Float64(sqrt(Float64(t + 1.0)) - sqrt(t))); end return tmp end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Power[N[(1.0 + x), $MachinePrecision], 0.5], $MachinePrecision]}, If[LessEqual[y, 6.2e-10], N[(N[(t$95$1 + N[(N[Power[N[(1.0 + z), $MachinePrecision], 0.5], $MachinePrecision] + N[(-0.125 * N[Power[N[Power[N[Power[t, 3.0], $MachinePrecision], -1.0], $MachinePrecision], 0.5], $MachinePrecision] + N[(0.0625 * N[Power[N[Power[N[Power[t, 5.0], $MachinePrecision], -1.0], $MachinePrecision], 0.5], $MachinePrecision] + N[(0.5 * N[Power[N[Power[t, -1.0], $MachinePrecision], 0.5], $MachinePrecision] + N[Power[N[(N[Power[y, 0.5], $MachinePrecision] + N[Power[N[(1.0 + y), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Power[x, 0.5], $MachinePrecision] + N[Power[z, 0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(-0.125 * N[Power[N[Power[N[Power[y, 3.0], $MachinePrecision], -1.0], $MachinePrecision], 0.5], $MachinePrecision] + N[(0.0625 * N[Power[N[Power[N[Power[y, 5.0], $MachinePrecision], -1.0], $MachinePrecision], 0.5], $MachinePrecision] + N[(0.5 * N[Power[N[Power[y, -1.0], $MachinePrecision], 0.5], $MachinePrecision] + N[Power[N[(N[Power[x, 0.5], $MachinePrecision] + t$95$1), $MachinePrecision], -1.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := {\left(1 + x\right)}^{0.5}\\
\mathbf{if}\;y \leq 6.2 \cdot 10^{-10}:\\
\;\;\;\;\left(t\_1 + \left({\left(1 + z\right)}^{0.5} + \mathsf{fma}\left(-0.125, {\left({\left({t}^{3}\right)}^{-1}\right)}^{0.5}, \mathsf{fma}\left(0.0625, {\left({\left({t}^{5}\right)}^{-1}\right)}^{0.5}, \mathsf{fma}\left(0.5, {\left({t}^{-1}\right)}^{0.5}, {\left({y}^{0.5} + {\left(1 + y\right)}^{0.5}\right)}^{-1}\right)\right)\right)\right)\right) - \left({x}^{0.5} + {z}^{0.5}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\mathsf{fma}\left(-0.125, {\left({\left({y}^{3}\right)}^{-1}\right)}^{0.5}, \mathsf{fma}\left(0.0625, {\left({\left({y}^{5}\right)}^{-1}\right)}^{0.5}, \mathsf{fma}\left(0.5, {\left({y}^{-1}\right)}^{0.5}, {\left({x}^{0.5} + t\_1\right)}^{-1}\right)\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\\
\end{array}
\end{array}
if y < 6.2000000000000003e-10Initial program 97.6%
lift--.f64N/A
lift-+.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
+-commutativeN/A
flip--N/A
lower-/.f64N/A
Applied rewrites97.6%
Taylor expanded in t around inf
Applied rewrites46.5%
if 6.2000000000000003e-10 < y Initial program 78.7%
lift--.f64N/A
lift-+.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
+-commutativeN/A
flip--N/A
lower-/.f64N/A
Applied rewrites79.2%
Taylor expanded in y around inf
lower-fma.f64N/A
pow1/2N/A
lower-pow.f64N/A
inv-powN/A
lower-pow.f64N/A
lower-pow.f64N/A
lower-fma.f64N/A
Applied rewrites92.2%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(-
(+
(pow (+ 1.0 x) 0.5)
(+
(pow (+ 1.0 z) 0.5)
(fma
-0.125
(pow (pow (pow t 3.0) -1.0) 0.5)
(fma
0.0625
(pow (pow (pow t 5.0) -1.0) 0.5)
(fma
0.5
(pow (pow t -1.0) 0.5)
(pow (+ (pow y 0.5) (pow (+ 1.0 y) 0.5)) -1.0))))))
(+ (pow x 0.5) (pow z 0.5))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return (pow((1.0 + x), 0.5) + (pow((1.0 + z), 0.5) + fma(-0.125, pow(pow(pow(t, 3.0), -1.0), 0.5), fma(0.0625, pow(pow(pow(t, 5.0), -1.0), 0.5), fma(0.5, pow(pow(t, -1.0), 0.5), pow((pow(y, 0.5) + pow((1.0 + y), 0.5)), -1.0)))))) - (pow(x, 0.5) + pow(z, 0.5));
}
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(Float64((Float64(1.0 + x) ^ 0.5) + Float64((Float64(1.0 + z) ^ 0.5) + fma(-0.125, (((t ^ 3.0) ^ -1.0) ^ 0.5), fma(0.0625, (((t ^ 5.0) ^ -1.0) ^ 0.5), fma(0.5, ((t ^ -1.0) ^ 0.5), (Float64((y ^ 0.5) + (Float64(1.0 + y) ^ 0.5)) ^ -1.0)))))) - Float64((x ^ 0.5) + (z ^ 0.5))) end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(N[(N[Power[N[(1.0 + x), $MachinePrecision], 0.5], $MachinePrecision] + N[(N[Power[N[(1.0 + z), $MachinePrecision], 0.5], $MachinePrecision] + N[(-0.125 * N[Power[N[Power[N[Power[t, 3.0], $MachinePrecision], -1.0], $MachinePrecision], 0.5], $MachinePrecision] + N[(0.0625 * N[Power[N[Power[N[Power[t, 5.0], $MachinePrecision], -1.0], $MachinePrecision], 0.5], $MachinePrecision] + N[(0.5 * N[Power[N[Power[t, -1.0], $MachinePrecision], 0.5], $MachinePrecision] + N[Power[N[(N[Power[y, 0.5], $MachinePrecision] + N[Power[N[(1.0 + y), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Power[x, 0.5], $MachinePrecision] + N[Power[z, 0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\left({\left(1 + x\right)}^{0.5} + \left({\left(1 + z\right)}^{0.5} + \mathsf{fma}\left(-0.125, {\left({\left({t}^{3}\right)}^{-1}\right)}^{0.5}, \mathsf{fma}\left(0.0625, {\left({\left({t}^{5}\right)}^{-1}\right)}^{0.5}, \mathsf{fma}\left(0.5, {\left({t}^{-1}\right)}^{0.5}, {\left({y}^{0.5} + {\left(1 + y\right)}^{0.5}\right)}^{-1}\right)\right)\right)\right)\right) - \left({x}^{0.5} + {z}^{0.5}\right)
\end{array}
Initial program 91.0%
lift--.f64N/A
lift-+.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
+-commutativeN/A
flip--N/A
lower-/.f64N/A
Applied rewrites91.2%
Taylor expanded in t around inf
Applied rewrites32.1%
herbie shell --seed 2025093
(FPCore (x y z t)
:name "Main:z from "
:precision binary64
(+ (+ (+ (- (sqrt (+ x 1.0)) (sqrt x)) (- (sqrt (+ y 1.0)) (sqrt y))) (- (sqrt (+ z 1.0)) (sqrt z))) (- (sqrt (+ t 1.0)) (sqrt t))))