?

Average Error: 9.7 → 0.5
Time: 6.9s
Precision: binary64
Cost: 6976

?

\[\left(x \cdot \log y + z \cdot \log \left(1 - y\right)\right) - t \]
\[\left(\log y \cdot x - y \cdot z\right) - t \]
(FPCore (x y z t)
 :precision binary64
 (- (+ (* x (log y)) (* z (log (- 1.0 y)))) t))
(FPCore (x y z t) :precision binary64 (- (- (* (log y) x) (* y z)) t))
double code(double x, double y, double z, double t) {
	return ((x * log(y)) + (z * log((1.0 - y)))) - t;
}
double code(double x, double y, double z, double t) {
	return ((log(y) * x) - (y * z)) - 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 = ((x * log(y)) + (z * log((1.0d0 - y)))) - 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 = ((log(y) * x) - (y * z)) - t
end function
public static double code(double x, double y, double z, double t) {
	return ((x * Math.log(y)) + (z * Math.log((1.0 - y)))) - t;
}
public static double code(double x, double y, double z, double t) {
	return ((Math.log(y) * x) - (y * z)) - t;
}
def code(x, y, z, t):
	return ((x * math.log(y)) + (z * math.log((1.0 - y)))) - t
def code(x, y, z, t):
	return ((math.log(y) * x) - (y * z)) - t
function code(x, y, z, t)
	return Float64(Float64(Float64(x * log(y)) + Float64(z * log(Float64(1.0 - y)))) - t)
end
function code(x, y, z, t)
	return Float64(Float64(Float64(log(y) * x) - Float64(y * z)) - t)
end
function tmp = code(x, y, z, t)
	tmp = ((x * log(y)) + (z * log((1.0 - y)))) - t;
end
function tmp = code(x, y, z, t)
	tmp = ((log(y) * x) - (y * z)) - t;
end
code[x_, y_, z_, t_] := N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[Log[N[(1.0 - y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
code[x_, y_, z_, t_] := N[(N[(N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\left(x \cdot \log y + z \cdot \log \left(1 - y\right)\right) - t
\left(\log y \cdot x - y \cdot z\right) - t

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original9.7
Target0.2
Herbie0.5
\[\left(-z\right) \cdot \left(\left(0.5 \cdot \left(y \cdot y\right) + y\right) + \frac{0.3333333333333333}{1 \cdot \left(1 \cdot 1\right)} \cdot \left(y \cdot \left(y \cdot y\right)\right)\right) - \left(t - x \cdot \log y\right) \]

Derivation?

  1. Initial program 9.7

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

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

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

    [Start]0.5

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

    rational_best_oopsla_all_46_json_45_simplify-74 [=>]0.5

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

    rational_best_oopsla_all_46_json_45_simplify-92 [=>]0.5

    \[ \left(x \cdot \log y + z \cdot \color{blue}{\left(-y\right)}\right) - t \]
  4. Applied egg-rr0.5

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

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

    [Start]0.5

    \[ \left(x \cdot \log y - y \cdot z\right) - t \]

    rational_best_oopsla_all_46_json_45_simplify-74 [<=]0.5

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

    \[\leadsto \left(\log y \cdot x - y \cdot z\right) - t \]

Alternatives

Alternative 1
Error6.4
Cost6984
\[\begin{array}{l} t_1 := \log y \cdot x - t\\ \mathbf{if}\;x \leq -5 \cdot 10^{-150}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 1.06 \cdot 10^{-22}:\\ \;\;\;\;y \cdot \left(-z\right) - t\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 2
Error14.7
Cost6856
\[\begin{array}{l} t_1 := \log y \cdot x\\ \mathbf{if}\;x \leq -3500000000000:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 7.6 \cdot 10^{+111}:\\ \;\;\;\;y \cdot \left(-z\right) - t\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 3
Error33.4
Cost520
\[\begin{array}{l} \mathbf{if}\;t \leq -40000000:\\ \;\;\;\;-t\\ \mathbf{elif}\;t \leq 3.35 \cdot 10^{-56}:\\ \;\;\;\;z \cdot \left(-y\right)\\ \mathbf{else}:\\ \;\;\;\;-t\\ \end{array} \]
Alternative 4
Error27.4
Cost384
\[y \cdot \left(-z\right) - t \]
Alternative 5
Error36.9
Cost128
\[-t \]

Error

Reproduce?

herbie shell --seed 2023090 
(FPCore (x y z t)
  :name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, B"
  :precision binary64

  :herbie-target
  (- (* (- z) (+ (+ (* 0.5 (* y y)) y) (* (/ 0.3333333333333333 (* 1.0 (* 1.0 1.0))) (* y (* y y))))) (- t (* x (log y))))

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