?

Average Error: 0.1 → 0.1
Time: 15.2s
Precision: binary64
Cost: 7296

?

\[x \cdot 0.5 + y \cdot \left(\left(1 - z\right) + \log z\right) \]
\[y \cdot \left(1 + \log z\right) + \left(0.5 \cdot x + z \cdot \left(-y\right)\right) \]
(FPCore (x y z) :precision binary64 (+ (* x 0.5) (* y (+ (- 1.0 z) (log z)))))
(FPCore (x y z)
 :precision binary64
 (+ (* y (+ 1.0 (log z))) (+ (* 0.5 x) (* z (- y)))))
double code(double x, double y, double z) {
	return (x * 0.5) + (y * ((1.0 - z) + log(z)));
}
double code(double x, double y, double z) {
	return (y * (1.0 + log(z))) + ((0.5 * x) + (z * -y));
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = (x * 0.5d0) + (y * ((1.0d0 - z) + log(z)))
end function
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = (y * (1.0d0 + log(z))) + ((0.5d0 * x) + (z * -y))
end function
public static double code(double x, double y, double z) {
	return (x * 0.5) + (y * ((1.0 - z) + Math.log(z)));
}
public static double code(double x, double y, double z) {
	return (y * (1.0 + Math.log(z))) + ((0.5 * x) + (z * -y));
}
def code(x, y, z):
	return (x * 0.5) + (y * ((1.0 - z) + math.log(z)))
def code(x, y, z):
	return (y * (1.0 + math.log(z))) + ((0.5 * x) + (z * -y))
function code(x, y, z)
	return Float64(Float64(x * 0.5) + Float64(y * Float64(Float64(1.0 - z) + log(z))))
end
function code(x, y, z)
	return Float64(Float64(y * Float64(1.0 + log(z))) + Float64(Float64(0.5 * x) + Float64(z * Float64(-y))))
end
function tmp = code(x, y, z)
	tmp = (x * 0.5) + (y * ((1.0 - z) + log(z)));
end
function tmp = code(x, y, z)
	tmp = (y * (1.0 + log(z))) + ((0.5 * x) + (z * -y));
end
code[x_, y_, z_] := N[(N[(x * 0.5), $MachinePrecision] + N[(y * N[(N[(1.0 - z), $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_] := N[(N[(y * N[(1.0 + N[Log[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * x), $MachinePrecision] + N[(z * (-y)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x \cdot 0.5 + y \cdot \left(\left(1 - z\right) + \log z\right)
y \cdot \left(1 + \log z\right) + \left(0.5 \cdot x + z \cdot \left(-y\right)\right)

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original0.1
Target0.1
Herbie0.1
\[\left(y + 0.5 \cdot x\right) - y \cdot \left(z - \log z\right) \]

Derivation?

  1. Initial program 0.1

    \[x \cdot 0.5 + y \cdot \left(\left(1 - z\right) + \log z\right) \]
  2. Taylor expanded in z around 0 0.1

    \[\leadsto \color{blue}{0.5 \cdot x + \left(-1 \cdot \left(y \cdot z\right) + \left(1 + \log z\right) \cdot y\right)} \]
  3. Simplified0.1

    \[\leadsto \color{blue}{y \cdot \left(1 + \log z\right) + \left(y \cdot \left(z \cdot -1\right) + 0.5 \cdot x\right)} \]
    Proof

    [Start]0.1

    \[ 0.5 \cdot x + \left(-1 \cdot \left(y \cdot z\right) + \left(1 + \log z\right) \cdot y\right) \]

    rational_best-simplify-43 [=>]0.1

    \[ \color{blue}{\left(1 + \log z\right) \cdot y + \left(-1 \cdot \left(y \cdot z\right) + 0.5 \cdot x\right)} \]

    rational_best-simplify-2 [=>]0.1

    \[ \color{blue}{y \cdot \left(1 + \log z\right)} + \left(-1 \cdot \left(y \cdot z\right) + 0.5 \cdot x\right) \]

    rational_best-simplify-44 [=>]0.1

    \[ y \cdot \left(1 + \log z\right) + \left(\color{blue}{y \cdot \left(-1 \cdot z\right)} + 0.5 \cdot x\right) \]

    rational_best-simplify-2 [=>]0.1

    \[ y \cdot \left(1 + \log z\right) + \left(y \cdot \color{blue}{\left(z \cdot -1\right)} + 0.5 \cdot x\right) \]
  4. Taylor expanded in y around 0 0.1

    \[\leadsto y \cdot \left(1 + \log z\right) + \color{blue}{\left(0.5 \cdot x + -1 \cdot \left(y \cdot z\right)\right)} \]
  5. Simplified0.1

    \[\leadsto y \cdot \left(1 + \log z\right) + \color{blue}{\left(0.5 \cdot x + z \cdot \left(-y\right)\right)} \]
    Proof

    [Start]0.1

    \[ y \cdot \left(1 + \log z\right) + \left(0.5 \cdot x + -1 \cdot \left(y \cdot z\right)\right) \]

    rational_best-simplify-44 [=>]0.1

    \[ y \cdot \left(1 + \log z\right) + \left(0.5 \cdot x + \color{blue}{y \cdot \left(-1 \cdot z\right)}\right) \]

    rational_best-simplify-2 [=>]0.1

    \[ y \cdot \left(1 + \log z\right) + \left(0.5 \cdot x + y \cdot \color{blue}{\left(z \cdot -1\right)}\right) \]

    rational_best-simplify-44 [=>]0.1

    \[ y \cdot \left(1 + \log z\right) + \left(0.5 \cdot x + \color{blue}{z \cdot \left(y \cdot -1\right)}\right) \]

    rational_best-simplify-12 [=>]0.1

    \[ y \cdot \left(1 + \log z\right) + \left(0.5 \cdot x + z \cdot \color{blue}{\left(-y\right)}\right) \]
  6. Final simplification0.1

    \[\leadsto y \cdot \left(1 + \log z\right) + \left(0.5 \cdot x + z \cdot \left(-y\right)\right) \]

Alternatives

Alternative 1
Error18.8
Cost7248
\[\begin{array}{l} t_0 := \left(1 + \log z\right) \cdot y\\ t_1 := x \cdot 0.5 + z \cdot \left(-y\right)\\ t_2 := x \cdot 0.5 + y \cdot \left(-z\right)\\ \mathbf{if}\;z \leq 5.4 \cdot 10^{-238}:\\ \;\;\;\;t_1 \cdot \left(t_1 \cdot \frac{2}{x}\right)\\ \mathbf{elif}\;z \leq 1.6 \cdot 10^{-176}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 2.2 \cdot 10^{-155}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq 5 \cdot 10^{-113}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 2
Error10.5
Cost7112
\[\begin{array}{l} t_0 := y \cdot \left(\left(\log z - z\right) + 1\right)\\ \mathbf{if}\;y \leq -21000000000000:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 1.8 \cdot 10^{+55}:\\ \;\;\;\;x \cdot 0.5 + y \cdot \left(-z\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 3
Error0.9
Cost7108
\[\begin{array}{l} \mathbf{if}\;z \leq 0.28:\\ \;\;\;\;y \cdot \left(1 + \log z\right) + 0.5 \cdot x\\ \mathbf{else}:\\ \;\;\;\;x \cdot 0.5 + y \cdot \left(-z\right)\\ \end{array} \]
Alternative 4
Error0.1
Cost7104
\[x \cdot 0.5 + y \cdot \left(\left(1 - z\right) + \log z\right) \]
Alternative 5
Error29.3
Cost784
\[\begin{array}{l} t_0 := z \cdot \left(-y\right)\\ \mathbf{if}\;x \leq -180000000000:\\ \;\;\;\;0.5 \cdot x\\ \mathbf{elif}\;x \leq 6.2 \cdot 10^{-149}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 5.5 \cdot 10^{-126}:\\ \;\;\;\;0.5 \cdot x\\ \mathbf{elif}\;x \leq 0.41:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot x\\ \end{array} \]
Alternative 6
Error18.8
Cost512
\[x \cdot 0.5 + y \cdot \left(-z\right) \]
Alternative 7
Error35.2
Cost192
\[0.5 \cdot x \]

Error

Reproduce?

herbie shell --seed 2023092 
(FPCore (x y z)
  :name "System.Random.MWC.Distributions:gamma from mwc-random-0.13.3.2"
  :precision binary64

  :herbie-target
  (- (+ y (* 0.5 x)) (* y (- z (log z))))

  (+ (* x 0.5) (* y (+ (- 1.0 z) (log z)))))