Average Error: 9.3 → 0.2
Time: 10.4s
Precision: binary64
Cost: 20672
\[\left(x \cdot \log y + z \cdot \log \left(1 - y\right)\right) - t \]
\[\left(\left(-0.5 \cdot \left({y}^{2} \cdot z\right) + \left(-0.3333333333333333 \cdot \left(z \cdot {y}^{3}\right) - y \cdot z\right)\right) + x \cdot \log y\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
 (-
  (+
   (+
    (* -0.5 (* (pow y 2.0) z))
    (- (* -0.3333333333333333 (* z (pow y 3.0))) (* y z)))
   (* x (log y)))
  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 (((-0.5 * (pow(y, 2.0) * z)) + ((-0.3333333333333333 * (z * pow(y, 3.0))) - (y * z))) + (x * log(y))) - 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 = ((((-0.5d0) * ((y ** 2.0d0) * z)) + (((-0.3333333333333333d0) * (z * (y ** 3.0d0))) - (y * z))) + (x * log(y))) - 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 (((-0.5 * (Math.pow(y, 2.0) * z)) + ((-0.3333333333333333 * (z * Math.pow(y, 3.0))) - (y * z))) + (x * Math.log(y))) - 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 (((-0.5 * (math.pow(y, 2.0) * z)) + ((-0.3333333333333333 * (z * math.pow(y, 3.0))) - (y * z))) + (x * math.log(y))) - 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(Float64(-0.5 * Float64((y ^ 2.0) * z)) + Float64(Float64(-0.3333333333333333 * Float64(z * (y ^ 3.0))) - Float64(y * z))) + Float64(x * log(y))) - 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 = (((-0.5 * ((y ^ 2.0) * z)) + ((-0.3333333333333333 * (z * (y ^ 3.0))) - (y * z))) + (x * log(y))) - 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[(-0.5 * N[(N[Power[y, 2.0], $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] + N[(N[(-0.3333333333333333 * N[(z * N[Power[y, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\left(x \cdot \log y + z \cdot \log \left(1 - y\right)\right) - t
\left(\left(-0.5 \cdot \left({y}^{2} \cdot z\right) + \left(-0.3333333333333333 \cdot \left(z \cdot {y}^{3}\right) - y \cdot z\right)\right) + x \cdot \log y\right) - t

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

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

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

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

Alternatives

Alternative 1
Error0.1
Cost19712
\[\mathsf{fma}\left(z, \mathsf{log1p}\left(-y\right), x \cdot \log y - t\right) \]
Alternative 2
Error9.0
Cost7380
\[\begin{array}{l} t_1 := x \cdot \log y\\ t_2 := t_1 - y \cdot z\\ t_3 := t_1 - t\\ \mathbf{if}\;z \leq -1.6183436434399383 \cdot 10^{+263}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;z \leq -6.835687924195195 \cdot 10^{+167}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq 2.9342281253659834 \cdot 10^{+154}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;z \leq 3.7569719895179107 \cdot 10^{+202}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq 3.258415033976312 \cdot 10^{+236}:\\ \;\;\;\;t_3\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(-y\right) - t\\ \end{array} \]
Alternative 3
Error0.3
Cost7360
\[\left(y \cdot \left(-0.5 \cdot \left(y \cdot z\right) - z\right) + x \cdot \log y\right) - t \]
Alternative 4
Error6.2
Cost6984
\[\begin{array}{l} t_1 := x \cdot \log y - t\\ \mathbf{if}\;x \leq -2.428285371177199 \cdot 10^{-40}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 1.1792494140917817 \cdot 10^{-126}:\\ \;\;\;\;z \cdot \left(\left(y \cdot y\right) \cdot \left(-0.5 + y \cdot -0.3333333333333333\right) - y\right) - t\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 5
Error0.5
Cost6976
\[x \cdot \log y - \left(y \cdot z + t\right) \]
Alternative 6
Error14.3
Cost6856
\[\begin{array}{l} t_1 := x \cdot \log y\\ \mathbf{if}\;x \leq -1.7440234057405707 \cdot 10^{+109}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 4.081841202474604 \cdot 10^{+77}:\\ \;\;\;\;z \cdot \left(\left(y \cdot y\right) \cdot \left(-0.5 + y \cdot -0.3333333333333333\right) - y\right) - t\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 7
Error27.1
Cost960
\[z \cdot \left(\left(y \cdot y\right) \cdot \left(-0.5 + y \cdot -0.3333333333333333\right) - y\right) - t \]
Alternative 8
Error27.2
Cost704
\[z \cdot \left(y \cdot \left(y \cdot -0.5\right) - y\right) - t \]
Alternative 9
Error32.9
Cost520
\[\begin{array}{l} \mathbf{if}\;t \leq -2.533013990074557 \cdot 10^{-97}:\\ \;\;\;\;-t\\ \mathbf{elif}\;t \leq 6.026838816709749 \cdot 10^{-141}:\\ \;\;\;\;z \cdot \left(-y\right)\\ \mathbf{else}:\\ \;\;\;\;-t\\ \end{array} \]
Alternative 10
Error33.0
Cost520
\[\begin{array}{l} \mathbf{if}\;t \leq -2.533013990074557 \cdot 10^{-97}:\\ \;\;\;\;y \cdot z - t\\ \mathbf{elif}\;t \leq 6.026838816709749 \cdot 10^{-141}:\\ \;\;\;\;z \cdot \left(-y\right)\\ \mathbf{else}:\\ \;\;\;\;-t\\ \end{array} \]
Alternative 11
Error27.4
Cost384
\[z \cdot \left(-y\right) - t \]
Alternative 12
Error36.5
Cost128
\[-t \]

Error

Reproduce

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