?

Average Error: 6.8 → 0.1
Time: 1.6min
Precision: binary64
Cost: 20160

?

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

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 6.8

    \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
  2. Applied egg-rr0.1

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

Alternatives

Alternative 1
Error0.1
Cost19968
\[\mathsf{fma}\left(\log y, -1 + x, \mathsf{log1p}\left(-y\right) \cdot \left(-1 + z\right) - t\right) \]
Alternative 2
Error0.3
Cost13892
\[\begin{array}{l} t_1 := \left(x - 1\right) \cdot \log y\\ \mathbf{if}\;y \leq 4.2 \cdot 10^{-9}:\\ \;\;\;\;\left(t_1 + \left(1 - z\right) \cdot y\right) - t\\ \mathbf{else}:\\ \;\;\;\;\left(t_1 + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t\\ \end{array} \]
Alternative 3
Error4.2
Cost7368
\[\begin{array}{l} t_1 := \left(\log y \cdot x + \left(1 - z\right) \cdot y\right) - t\\ \mathbf{if}\;z \leq -3.4 \cdot 10^{+148}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 2.7 \cdot 10^{+268}:\\ \;\;\;\;\left(x - 1\right) \cdot \log y - t\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 4
Error8.2
Cost7240
\[\begin{array}{l} t_1 := \log y \cdot x - t\\ \mathbf{if}\;x - 1 \leq -500000000:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x - 1 \leq -0.999999999:\\ \;\;\;\;\left(-t\right) + \left(-\log y\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 5
Error0.6
Cost7232
\[\left(\left(x - 1\right) \cdot \log y + \left(1 - z\right) \cdot y\right) - t \]
Alternative 6
Error21.7
Cost7120
\[\begin{array}{l} t_1 := \log y \cdot x\\ \mathbf{if}\;x \leq -4.9 \cdot 10^{+45}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 4.8 \cdot 10^{+32}:\\ \;\;\;\;\left(y - y \cdot z\right) - t\\ \mathbf{elif}\;x \leq 1.2 \cdot 10^{+48}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 4.6 \cdot 10^{+110}:\\ \;\;\;\;\left(-y \cdot z\right) - t\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 7
Error14.4
Cost6984
\[\begin{array}{l} t_1 := \left(-y \cdot z\right) - t\\ \mathbf{if}\;t \leq -8.6 \cdot 10^{+95}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 5.6 \cdot 10^{+18}:\\ \;\;\;\;\left(x - 1\right) \cdot \log y\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 8
Error7.0
Cost6980
\[\begin{array}{l} \mathbf{if}\;z \leq -3.25 \cdot 10^{+246}:\\ \;\;\;\;\left(-y \cdot z\right) - t\\ \mathbf{else}:\\ \;\;\;\;\left(x - 1\right) \cdot \log y - t\\ \end{array} \]
Alternative 9
Error37.2
Cost520
\[\begin{array}{l} \mathbf{if}\;t \leq -265000000000:\\ \;\;\;\;-t\\ \mathbf{elif}\;t \leq 5.2 \cdot 10^{+43}:\\ \;\;\;\;\left(-y\right) \cdot z\\ \mathbf{else}:\\ \;\;\;\;-t\\ \end{array} \]
Alternative 10
Error34.6
Cost448
\[\left(y - y \cdot z\right) - t \]
Alternative 11
Error34.7
Cost384
\[\left(-y \cdot z\right) - t \]
Alternative 12
Error41.3
Cost128
\[-t \]

Error

Reproduce?

herbie shell --seed 2023033 
(FPCore (x y z t)
  :name "Statistics.Distribution.Beta:$cdensity from math-functions-0.1.5.2"
  :precision binary64
  (- (+ (* (- x 1.0) (log y)) (* (- z 1.0) (log (- 1.0 y)))) t))