?

Average Error: 9.5 → 0.3
Time: 12.1s
Precision: binary64
Cost: 13760

?

\[\left(x \cdot \log y + z \cdot \log \left(1 - y\right)\right) - t \]
\[\left(x \cdot \log y + z \cdot \left(\left(-y\right) + -0.5 \cdot {y}^{2}\right)\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
 (- (+ (* x (log y)) (* z (+ (- y) (* -0.5 (pow y 2.0))))) 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 ((x * log(y)) + (z * (-y + (-0.5 * pow(y, 2.0))))) - 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 = ((x * log(y)) + (z * (-y + ((-0.5d0) * (y ** 2.0d0))))) - 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 ((x * Math.log(y)) + (z * (-y + (-0.5 * Math.pow(y, 2.0))))) - 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 ((x * math.log(y)) + (z * (-y + (-0.5 * math.pow(y, 2.0))))) - 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(x * log(y)) + Float64(z * Float64(Float64(-y) + Float64(-0.5 * (y ^ 2.0))))) - 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 = ((x * log(y)) + (z * (-y + (-0.5 * (y ^ 2.0))))) - 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[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[((-y) + N[(-0.5 * N[Power[y, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\left(x \cdot \log y + z \cdot \log \left(1 - y\right)\right) - t
\left(x \cdot \log y + z \cdot \left(\left(-y\right) + -0.5 \cdot {y}^{2}\right)\right) - t

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original9.5
Target0.3
Herbie0.3
\[\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.5

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

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

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

    [Start]0.3

    \[ \left(x \cdot \log y + z \cdot \left(-0.5 \cdot {y}^{2} + -1 \cdot y\right)\right) - t \]

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

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

    rational.json-simplify-2 [=>]0.3

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

    rational.json-simplify-9 [=>]0.3

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

    \[\leadsto \left(x \cdot \log y + z \cdot \left(\left(-y\right) + -0.5 \cdot {y}^{2}\right)\right) - t \]

Alternatives

Alternative 1
Error6.7
Cost7176
\[\begin{array}{l} t_1 := \log y \cdot x\\ t_2 := t_1 - t\\ \mathbf{if}\;t \leq -5.6 \cdot 10^{-160}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq 2.3 \cdot 10^{-137}:\\ \;\;\;\;y \cdot \left(-z\right) + t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 2
Error0.5
Cost7040
\[\left(x \cdot \log y + z \cdot \left(-y\right)\right) - t \]
Alternative 3
Error6.5
Cost6984
\[\begin{array}{l} t_1 := \log y \cdot x - t\\ \mathbf{if}\;x \leq -1.95 \cdot 10^{-125}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 9.5 \cdot 10^{-113}:\\ \;\;\;\;y \cdot \left(-z\right) - t\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 4
Error15.4
Cost6856
\[\begin{array}{l} t_1 := \log y \cdot x\\ \mathbf{if}\;x \leq -3.7 \cdot 10^{+49}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 4.6 \cdot 10^{-63}:\\ \;\;\;\;y \cdot \left(-z\right) - t\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 5
Error33.1
Cost520
\[\begin{array}{l} \mathbf{if}\;t \leq -2 \cdot 10^{-154}:\\ \;\;\;\;-t\\ \mathbf{elif}\;t \leq 1.05 \cdot 10^{-133}:\\ \;\;\;\;z \cdot \left(-y\right)\\ \mathbf{else}:\\ \;\;\;\;-t\\ \end{array} \]
Alternative 6
Error27.3
Cost384
\[y \cdot \left(-z\right) - t \]
Alternative 7
Error36.7
Cost128
\[-t \]

Error

Reproduce?

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