?

Average Error: 5.2 → 5.1
Time: 28.8s
Precision: binary64
Cost: 118592

?

\[ \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) \]
\[\begin{array}{l} t_1 := \left(\left(\sqrt{1 + z} - \sqrt{z}\right) - \sqrt{x}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\\ \left(\sqrt{x + 1} + \left(\sqrt{1 + y} - \sqrt{y}\right)\right) + t_1 \cdot \left(t_1 \cdot \frac{1}{t_1}\right) \end{array} \]
(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
 (let* ((t_1
         (+
          (- (- (sqrt (+ 1.0 z)) (sqrt z)) (sqrt x))
          (- (sqrt (+ 1.0 t)) (sqrt t)))))
   (+
    (+ (sqrt (+ x 1.0)) (- (sqrt (+ 1.0 y)) (sqrt y)))
    (* t_1 (* t_1 (/ 1.0 t_1))))))
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) {
	double t_1 = ((sqrt((1.0 + z)) - sqrt(z)) - sqrt(x)) + (sqrt((1.0 + t)) - sqrt(t));
	return (sqrt((x + 1.0)) + (sqrt((1.0 + y)) - sqrt(y))) + (t_1 * (t_1 * (1.0 / t_1)));
}
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
    real(8) :: t_1
    t_1 = ((sqrt((1.0d0 + z)) - sqrt(z)) - sqrt(x)) + (sqrt((1.0d0 + t)) - sqrt(t))
    code = (sqrt((x + 1.0d0)) + (sqrt((1.0d0 + y)) - sqrt(y))) + (t_1 * (t_1 * (1.0d0 / t_1)))
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) {
	double t_1 = ((Math.sqrt((1.0 + z)) - Math.sqrt(z)) - Math.sqrt(x)) + (Math.sqrt((1.0 + t)) - Math.sqrt(t));
	return (Math.sqrt((x + 1.0)) + (Math.sqrt((1.0 + y)) - Math.sqrt(y))) + (t_1 * (t_1 * (1.0 / t_1)));
}
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):
	t_1 = ((math.sqrt((1.0 + z)) - math.sqrt(z)) - math.sqrt(x)) + (math.sqrt((1.0 + t)) - math.sqrt(t))
	return (math.sqrt((x + 1.0)) + (math.sqrt((1.0 + y)) - math.sqrt(y))) + (t_1 * (t_1 * (1.0 / t_1)))
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)
	t_1 = Float64(Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) - sqrt(x)) + Float64(sqrt(Float64(1.0 + t)) - sqrt(t)))
	return Float64(Float64(sqrt(Float64(x + 1.0)) + Float64(sqrt(Float64(1.0 + y)) - sqrt(y))) + Float64(t_1 * Float64(t_1 * Float64(1.0 / t_1))))
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)
	t_1 = ((sqrt((1.0 + z)) - sqrt(z)) - sqrt(x)) + (sqrt((1.0 + t)) - sqrt(t));
	tmp = (sqrt((x + 1.0)) + (sqrt((1.0 + y)) - sqrt(y))) + (t_1 * (t_1 * (1.0 / t_1)));
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_] := Block[{t$95$1 = N[(N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 * N[(t$95$1 * N[(1.0 / t$95$1), $MachinePrecision]), $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)
\begin{array}{l}
t_1 := \left(\left(\sqrt{1 + z} - \sqrt{z}\right) - \sqrt{x}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\\
\left(\sqrt{x + 1} + \left(\sqrt{1 + y} - \sqrt{y}\right)\right) + t_1 \cdot \left(t_1 \cdot \frac{1}{t_1}\right)
\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original5.2
Target0.4
Herbie5.1
\[\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.2

    \[\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. Simplified18.9

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

    [Start]5.2

    \[ \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) \]

    rational_best_oopsla_all_46_json_45_simplify-35 [=>]5.2

    \[ \color{blue}{\left(\sqrt{t + 1} - \sqrt{t}\right) + \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)} \]

    rational_best_oopsla_all_46_json_45_simplify-82 [=>]5.2

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

    rational_best_oopsla_all_46_json_45_simplify-35 [=>]5.2

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

    rational_best_oopsla_all_46_json_45_simplify-35 [=>]5.2

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

    rational_best_oopsla_all_46_json_45_simplify-108 [=>]5.2

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

    rational_best_oopsla_all_46_json_45_simplify-108 [=>]5.2

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

    rational_best_oopsla_all_46_json_45_simplify-35 [=>]5.2

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

    rational_best_oopsla_all_46_json_45_simplify-107 [=>]5.2

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

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

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

Alternatives

Alternative 1
Error5.2
Cost52672
\[\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) \]
Alternative 2
Error5.6
Cost39748
\[\begin{array}{l} t_1 := \sqrt{x + 1}\\ \mathbf{if}\;y \leq 4.5 \cdot 10^{-25}:\\ \;\;\;\;\left(t_1 - \sqrt{x}\right) + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(1 + \left(\sqrt{1 + t} - \sqrt{t}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(t_1 + \left(\sqrt{1 + y} - \sqrt{y}\right)\right) + \left(-\sqrt{x}\right)\\ \end{array} \]
Alternative 3
Error5.2
Cost39748
\[\begin{array}{l} t_1 := \sqrt{1 + y}\\ \mathbf{if}\;z \leq 3.8 \cdot 10^{+29}:\\ \;\;\;\;\left(\left(1 + t_1\right) - \sqrt{y}\right) + \left(\left(\sqrt{1 + t} - \sqrt{t}\right) + \left(\sqrt{1 + z} - \sqrt{z}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\sqrt{x + 1} + \left(t_1 - \sqrt{y}\right)\right) + \left(-\sqrt{x}\right)\\ \end{array} \]
Alternative 4
Error5.6
Cost26696
\[\begin{array}{l} t_1 := \sqrt{1 + z}\\ t_2 := \sqrt{1 + y}\\ \mathbf{if}\;z \leq 10^{-20}:\\ \;\;\;\;\left(\sqrt{1 + t} - \left(\sqrt{z} + \sqrt{t}\right)\right) + \left(2 + t_1\right)\\ \mathbf{elif}\;z \leq 2.3 \cdot 10^{+14}:\\ \;\;\;\;1 + \left(t_1 + \left(t_2 - \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\sqrt{x + 1} + \left(t_2 - \sqrt{y}\right)\right) + \left(-\sqrt{x}\right)\\ \end{array} \]
Alternative 5
Error9.4
Cost26568
\[\begin{array}{l} t_1 := \sqrt{1 + x}\\ \mathbf{if}\;y \leq 3 \cdot 10^{-25}:\\ \;\;\;\;2 + \left(\sqrt{1 + z} - \sqrt{z}\right)\\ \mathbf{elif}\;y \leq 5 \cdot 10^{+22}:\\ \;\;\;\;t_1 + \left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_1 - \sqrt{x}\\ \end{array} \]
Alternative 6
Error8.9
Cost26564
\[\begin{array}{l} t_1 := \sqrt{1 + y}\\ \mathbf{if}\;z \leq 2.6 \cdot 10^{+14}:\\ \;\;\;\;1 + \left(\sqrt{1 + z} + \left(t_1 - \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\sqrt{x + 1} + \left(t_1 - \sqrt{y}\right)\right) + \left(-\sqrt{x}\right)\\ \end{array} \]
Alternative 7
Error9.4
Cost26500
\[\begin{array}{l} \mathbf{if}\;y \leq 1.55 \cdot 10^{-25}:\\ \;\;\;\;2 + \left(\sqrt{1 + z} - \sqrt{z}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\sqrt{x + 1} + \left(\sqrt{1 + y} - \sqrt{y}\right)\right) + \left(-\sqrt{x}\right)\\ \end{array} \]
Alternative 8
Error9.5
Cost20040
\[\begin{array}{l} \mathbf{if}\;y \leq 2.4 \cdot 10^{-25}:\\ \;\;\;\;2 + \left(\sqrt{1 + z} - \sqrt{z}\right)\\ \mathbf{elif}\;y \leq 3 \cdot 10^{+22}:\\ \;\;\;\;\left(\sqrt{1 + y} + 1\right) - \left(\sqrt{x} + \sqrt{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{1 + x} - \sqrt{x}\\ \end{array} \]
Alternative 9
Error9.6
Cost13512
\[\begin{array}{l} \mathbf{if}\;y \leq 5 \cdot 10^{-25}:\\ \;\;\;\;2 + \left(\sqrt{1 + z} - \sqrt{z}\right)\\ \mathbf{elif}\;y \leq 3 \cdot 10^{+22}:\\ \;\;\;\;1 + \left(\sqrt{y - -1} - \sqrt{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{1 + x} - \sqrt{x}\\ \end{array} \]
Alternative 10
Error22.7
Cost13380
\[\begin{array}{l} \mathbf{if}\;y \leq 4 \cdot 10^{+24}:\\ \;\;\;\;1 + \left(\sqrt{y - -1} - \sqrt{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{1 + x} - \sqrt{x}\\ \end{array} \]
Alternative 11
Error23.8
Cost13252
\[\begin{array}{l} \mathbf{if}\;y \leq 2.9:\\ \;\;\;\;\left(2 + 0.5 \cdot y\right) - \sqrt{y}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{1 + x} - \sqrt{x}\\ \end{array} \]
Alternative 12
Error24.6
Cost6980
\[\begin{array}{l} \mathbf{if}\;y \leq 7.2:\\ \;\;\;\;\left(2 + 0.5 \cdot y\right) - \sqrt{y}\\ \mathbf{else}:\\ \;\;\;\;1 - \sqrt{x}\\ \end{array} \]
Alternative 13
Error24.2
Cost6980
\[\begin{array}{l} \mathbf{if}\;y \leq 5.8:\\ \;\;\;\;\left(2 + 0.5 \cdot y\right) - \sqrt{y}\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 \cdot x + 1\right) - \sqrt{x}\\ \end{array} \]
Alternative 14
Error25.8
Cost6724
\[\begin{array}{l} \mathbf{if}\;y \leq 9.6:\\ \;\;\;\;2\\ \mathbf{else}:\\ \;\;\;\;1 - \sqrt{x}\\ \end{array} \]
Alternative 15
Error25.8
Cost6724
\[\begin{array}{l} \mathbf{if}\;y \leq 15:\\ \;\;\;\;2 - \sqrt{x}\\ \mathbf{else}:\\ \;\;\;\;1 - \sqrt{x}\\ \end{array} \]
Alternative 16
Error25.8
Cost196
\[\begin{array}{l} \mathbf{if}\;y \leq 4.5:\\ \;\;\;\;2\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
Alternative 17
Error41.9
Cost64
\[1 \]

Error

Reproduce?

herbie shell --seed 2023090 
(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))))