?

Average Error: 0.1 → 0.1
Time: 22.3s
Precision: binary64
Cost: 7104

?

\[x \cdot 0.5 + y \cdot \left(\left(1 - z\right) + \log z\right) \]
\[y \cdot \left(1 - \left(z - \log z\right)\right) + 0.5 \cdot x \]
(FPCore (x y z) :precision binary64 (+ (* x 0.5) (* y (+ (- 1.0 z) (log z)))))
(FPCore (x y z) :precision binary64 (+ (* y (- 1.0 (- z (log z)))) (* 0.5 x)))
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 - (z - log(z)))) + (0.5 * x);
}
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 - (z - log(z)))) + (0.5d0 * x)
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 - (z - Math.log(z)))) + (0.5 * x);
}
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 - (z - math.log(z)))) + (0.5 * x)
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 - Float64(z - log(z)))) + Float64(0.5 * x))
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 - (z - log(z)))) + (0.5 * x);
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[(z - N[Log[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * x), $MachinePrecision]), $MachinePrecision]
x \cdot 0.5 + y \cdot \left(\left(1 - z\right) + \log z\right)
y \cdot \left(1 - \left(z - \log z\right)\right) + 0.5 \cdot x

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 x around 0 0.1

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

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

    [Start]0.1

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

    rational.json-simplify-1 [=>]0.1

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

    rational.json-simplify-17 [=>]0.1

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

    rational.json-simplify-42 [<=]0.1

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

    rational.json-simplify-45 [=>]0.1

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

    rational.json-simplify-15 [=>]0.1

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

    rational.json-simplify-44 [<=]0.1

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

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

Alternatives

Alternative 1
Error10.7
Cost7368
\[\begin{array}{l} t_0 := 0.5 \cdot x - y \cdot z\\ \mathbf{if}\;x \cdot 0.5 \leq -2 \cdot 10^{-88}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \cdot 0.5 \leq 10^{-133}:\\ \;\;\;\;y \cdot \left(1 + \left(\log z - z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 2
Error18.1
Cost7248
\[\begin{array}{l} t_0 := \left(1 + \log z\right) \cdot y\\ t_1 := 0.5 \cdot x - y \cdot z\\ \mathbf{if}\;z \leq 2.1 \cdot 10^{-266}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 4.4 \cdot 10^{-236}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 6.6 \cdot 10^{-178}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 3.8 \cdot 10^{-119}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 3
Error0.9
Cost7108
\[\begin{array}{l} \mathbf{if}\;z \leq 0.58:\\ \;\;\;\;y \cdot \left(1 + \log z\right) + 0.5 \cdot x\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(1 - z\right) + 0.5 \cdot x\\ \end{array} \]
Alternative 4
Error0.1
Cost7104
\[x \cdot 0.5 + y \cdot \left(\left(1 - z\right) + \log z\right) \]
Alternative 5
Error29.0
Cost1048
\[\begin{array}{l} t_0 := y \cdot \left(-z\right)\\ \mathbf{if}\;x \leq -2.3 \cdot 10^{-68}:\\ \;\;\;\;0.5 \cdot x\\ \mathbf{elif}\;x \leq 2.3 \cdot 10^{-124}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 2.4 \cdot 10^{-84}:\\ \;\;\;\;0.5 \cdot x\\ \mathbf{elif}\;x \leq 2.4 \cdot 10^{-19}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 7 \cdot 10^{+53}:\\ \;\;\;\;0.5 \cdot x\\ \mathbf{elif}\;x \leq 6.5 \cdot 10^{+85}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot x\\ \end{array} \]
Alternative 6
Error18.2
Cost448
\[0.5 \cdot x - y \cdot z \]
Alternative 7
Error34.5
Cost192
\[0.5 \cdot x \]

Error

Reproduce?

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