Average Error: 5.3 → 1.2
Time: 29.9s
Precision: binary64
Cost: 53440
\[ \begin{array}{c}[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \end{array} \]
\[\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) \]
\[\left(\left(\frac{1 + \left(x - x\right)}{\sqrt{1 + x} + \sqrt{x}} + \frac{1 + \left(y - y\right)}{\sqrt{1 + y} + \sqrt{y}}\right) + \left(\sqrt{1 + z} - \sqrt{z}\right)\right) + \left(\sqrt{1 + t} - \sqrt{t}\right) \]
(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))))
(FPCore (x y z t)
 :precision binary64
 (+
  (+
   (+
    (/ (+ 1.0 (- x x)) (+ (sqrt (+ 1.0 x)) (sqrt x)))
    (/ (+ 1.0 (- y y)) (+ (sqrt (+ 1.0 y)) (sqrt y))))
   (- (sqrt (+ 1.0 z)) (sqrt z)))
  (- (sqrt (+ 1.0 t)) (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));
}
double code(double x, double y, double z, double t) {
	return ((((1.0 + (x - x)) / (sqrt((1.0 + x)) + sqrt(x))) + ((1.0 + (y - y)) / (sqrt((1.0 + y)) + sqrt(y)))) + (sqrt((1.0 + z)) - sqrt(z))) + (sqrt((1.0 + t)) - sqrt(t));
}
real(8) function code(x, y, z, t)
    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
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = ((((1.0d0 + (x - x)) / (sqrt((1.0d0 + x)) + sqrt(x))) + ((1.0d0 + (y - y)) / (sqrt((1.0d0 + y)) + sqrt(y)))) + (sqrt((1.0d0 + z)) - sqrt(z))) + (sqrt((1.0d0 + t)) - 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));
}
public static double code(double x, double y, double z, double t) {
	return ((((1.0 + (x - x)) / (Math.sqrt((1.0 + x)) + Math.sqrt(x))) + ((1.0 + (y - y)) / (Math.sqrt((1.0 + y)) + Math.sqrt(y)))) + (Math.sqrt((1.0 + z)) - Math.sqrt(z))) + (Math.sqrt((1.0 + t)) - 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))
def code(x, y, z, t):
	return ((((1.0 + (x - x)) / (math.sqrt((1.0 + x)) + math.sqrt(x))) + ((1.0 + (y - y)) / (math.sqrt((1.0 + y)) + math.sqrt(y)))) + (math.sqrt((1.0 + z)) - math.sqrt(z))) + (math.sqrt((1.0 + t)) - 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 code(x, y, z, t)
	return Float64(Float64(Float64(Float64(Float64(1.0 + Float64(x - x)) / Float64(sqrt(Float64(1.0 + x)) + sqrt(x))) + Float64(Float64(1.0 + Float64(y - y)) / Float64(sqrt(Float64(1.0 + y)) + sqrt(y)))) + Float64(sqrt(Float64(1.0 + z)) - sqrt(z))) + Float64(sqrt(Float64(1.0 + t)) - 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
function tmp = code(x, y, z, t)
	tmp = ((((1.0 + (x - x)) / (sqrt((1.0 + x)) + sqrt(x))) + ((1.0 + (y - y)) / (sqrt((1.0 + y)) + sqrt(y)))) + (sqrt((1.0 + z)) - sqrt(z))) + (sqrt((1.0 + t)) - 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]
code[x_, y_, z_, t_] := N[(N[(N[(N[(N[(1.0 + N[(x - x), $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 + N[(y - y), $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\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)
\left(\left(\frac{1 + \left(x - x\right)}{\sqrt{1 + x} + \sqrt{x}} + \frac{1 + \left(y - y\right)}{\sqrt{1 + y} + \sqrt{y}}\right) + \left(\sqrt{1 + z} - \sqrt{z}\right)\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original5.3
Target0.3
Herbie1.2
\[\left(\left(\frac{1}{\sqrt{x + 1} + \sqrt{x}} + \frac{1}{\sqrt{y + 1} + \sqrt{y}}\right) + \frac{1}{\sqrt{z + 1} + \sqrt{z}}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]

Derivation

  1. Initial program 5.3

    \[\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) \]
  2. Applied egg-rr2.5

    \[\leadsto \left(\left(\color{blue}{\frac{1 + \left(x - x\right)}{\sqrt{1 + x} + \sqrt{x}}} + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
  3. Applied egg-rr1.2

    \[\leadsto \left(\left(\frac{1 + \left(x - x\right)}{\sqrt{1 + x} + \sqrt{x}} + \color{blue}{\frac{1 + \left(y - y\right)}{\sqrt{1 + y} + \sqrt{y}}}\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
  4. Final simplification1.2

    \[\leadsto \left(\left(\frac{1 + \left(x - x\right)}{\sqrt{1 + x} + \sqrt{x}} + \frac{1 + \left(y - y\right)}{\sqrt{1 + y} + \sqrt{y}}\right) + \left(\sqrt{1 + z} - \sqrt{z}\right)\right) + \left(\sqrt{1 + t} - \sqrt{t}\right) \]

Alternatives

Alternative 1
Error2.5
Cost53056
\[\left(\sqrt{1 + t} - \sqrt{t}\right) + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\frac{1 + \left(x - x\right)}{\sqrt{1 + x} + \sqrt{x}} + \left(\sqrt{1 + y} - \sqrt{y}\right)\right)\right) \]
Alternative 2
Error2.6
Cost52804
\[\begin{array}{l} t_1 := \sqrt{1 + y}\\ t_2 := \sqrt{1 + x}\\ \mathbf{if}\;x \leq 558.4004015684403:\\ \;\;\;\;\left(\sqrt{1 + t} - \sqrt{t}\right) + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\left(t_1 - \sqrt{y}\right) + \left(t_2 - \sqrt{x}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1 + \left(x - x\right)}{t_2 + \sqrt{x}} + \left(t_1 + \left(1 - \sqrt{y}\right)\right)\\ \end{array} \]
Alternative 3
Error2.9
Cost39748
\[\begin{array}{l} t_1 := \sqrt{1 + y}\\ \mathbf{if}\;y \leq 5.484053509800018 \cdot 10^{+31}:\\ \;\;\;\;\left(\sqrt{1 + t} - \sqrt{t}\right) + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(1 + \left(t_1 - \sqrt{y}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1 + \left(x - x\right)}{\sqrt{1 + x} + \sqrt{x}} + \left(t_1 + \left(1 - \sqrt{y}\right)\right)\\ \end{array} \]
Alternative 4
Error4.9
Cost27080
\[\begin{array}{l} t_1 := \sqrt{1 + y}\\ t_2 := \sqrt{1 + z}\\ \mathbf{if}\;z \leq 1.5172183661289052 \cdot 10^{-24}:\\ \;\;\;\;\left(2 + t_2\right) + \left(\left(\sqrt{1 + t} - \sqrt{z}\right) - \sqrt{t}\right)\\ \mathbf{elif}\;z \leq 2.2437517479300632 \cdot 10^{+30}:\\ \;\;\;\;\left(1 + t_1\right) + \left(\frac{1 + \left(z - z\right)}{\sqrt{z} + t_2} - \sqrt{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{1 + x} + \left(\left(t_1 - \sqrt{y}\right) - \sqrt{x}\right)\\ \end{array} \]
Alternative 5
Error9.1
Cost26568
\[\begin{array}{l} \mathbf{if}\;y \leq 2.0165899666012955 \cdot 10^{-20}:\\ \;\;\;\;2 + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) - \sqrt{y}\right)\\ \mathbf{elif}\;y \leq 34721730252025.332:\\ \;\;\;\;\sqrt{1 + y} + \left(\left(\sqrt{1 + x} - \sqrt{x}\right) - \sqrt{y}\right)\\ \mathbf{else}:\\ \;\;\;\;{\left({\left(1 + x\right)}^{0.25}\right)}^{2} - \sqrt{x}\\ \end{array} \]
Alternative 6
Error6.0
Cost26568
\[\begin{array}{l} t_1 := \sqrt{1 + z}\\ \mathbf{if}\;z \leq 1.5172183661289052 \cdot 10^{-24}:\\ \;\;\;\;\left(2 + t_1\right) + \left(\left(\sqrt{1 + t} - \sqrt{z}\right) - \sqrt{t}\right)\\ \mathbf{elif}\;z \leq 2.2437517479300632 \cdot 10^{+30}:\\ \;\;\;\;\left(2 + y \cdot 0.5\right) + \left(\left(t_1 - \sqrt{z}\right) - \sqrt{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{1 + x} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) - \sqrt{x}\right)\\ \end{array} \]
Alternative 7
Error9.1
Cost26436
\[\begin{array}{l} \mathbf{if}\;y \leq 2.0165899666012955 \cdot 10^{-20}:\\ \;\;\;\;2 + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) - \sqrt{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{1 + x} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) - \sqrt{x}\right)\\ \end{array} \]
Alternative 8
Error9.5
Cost19912
\[\begin{array}{l} \mathbf{if}\;y \leq 1.2488006607689187 \cdot 10^{-26}:\\ \;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + 2\\ \mathbf{elif}\;y \leq 818027180953.7164:\\ \;\;\;\;\sqrt{1 + y} + \left(1 - \sqrt{y}\right)\\ \mathbf{else}:\\ \;\;\;\;{\left({\left(1 + x\right)}^{0.25}\right)}^{2} - \sqrt{x}\\ \end{array} \]
Alternative 9
Error9.3
Cost19912
\[\begin{array}{l} \mathbf{if}\;y \leq 2.0165899666012955 \cdot 10^{-20}:\\ \;\;\;\;2 + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) - \sqrt{y}\right)\\ \mathbf{elif}\;y \leq 818027180953.7164:\\ \;\;\;\;\sqrt{1 + y} + \left(1 - \sqrt{y}\right)\\ \mathbf{else}:\\ \;\;\;\;{\left({\left(1 + x\right)}^{0.25}\right)}^{2} - \sqrt{x}\\ \end{array} \]
Alternative 10
Error9.5
Cost13512
\[\begin{array}{l} \mathbf{if}\;y \leq 1.2488006607689187 \cdot 10^{-26}:\\ \;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + 2\\ \mathbf{elif}\;y \leq 818027180953.7164:\\ \;\;\;\;\left(1 + \sqrt{1 + y}\right) - \sqrt{y}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{1 + x} - \sqrt{x}\\ \end{array} \]
Alternative 11
Error9.5
Cost13512
\[\begin{array}{l} \mathbf{if}\;y \leq 1.2488006607689187 \cdot 10^{-26}:\\ \;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + 2\\ \mathbf{elif}\;y \leq 818027180953.7164:\\ \;\;\;\;\sqrt{1 + y} + \left(1 - \sqrt{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{1 + x} - \sqrt{x}\\ \end{array} \]
Alternative 12
Error11.9
Cost13380
\[\begin{array}{l} \mathbf{if}\;y \leq 0.04637627181512525:\\ \;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + 2\\ \mathbf{else}:\\ \;\;\;\;\sqrt{1 + x} - \sqrt{x}\\ \end{array} \]
Alternative 13
Error41.1
Cost13120
\[\sqrt{1 + x} - \sqrt{x} \]
Alternative 14
Error41.4
Cost6848
\[\left(1 + x \cdot 0.5\right) - \sqrt{x} \]
Alternative 15
Error41.8
Cost64
\[1 \]

Error

Reproduce

herbie shell --seed 2022294 
(FPCore (x y z t)
  :name "Main:z from "
  :precision binary64

  :herbie-target
  (+ (+ (+ (/ 1.0 (+ (sqrt (+ x 1.0)) (sqrt x))) (/ 1.0 (+ (sqrt (+ y 1.0)) (sqrt y)))) (/ 1.0 (+ (sqrt (+ z 1.0)) (sqrt z)))) (- (sqrt (+ t 1.0)) (sqrt t)))

  (+ (+ (+ (- (sqrt (+ x 1.0)) (sqrt x)) (- (sqrt (+ y 1.0)) (sqrt y))) (- (sqrt (+ z 1.0)) (sqrt z))) (- (sqrt (+ t 1.0)) (sqrt t))))