| Alternative 1 | |
|---|---|
| Error | 0.1 |
| Cost | 19968 |
\[\mathsf{fma}\left(x + -1, \log y, \left(z + -1\right) \cdot \mathsf{log1p}\left(-y\right)\right) - t
\]
(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 (- (fma (+ z -1.0) (log1p (- y)) (* (log y) (+ x -1.0))) t))
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 fma((z + -1.0), log1p(-y), (log(y) * (x + -1.0))) - t;
}
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(fma(Float64(z + -1.0), log1p(Float64(-y)), Float64(log(y) * Float64(x + -1.0))) - t) 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[(z + -1.0), $MachinePrecision] * N[Log[1 + (-y)], $MachinePrecision] + N[(N[Log[y], $MachinePrecision] * N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t
\mathsf{fma}\left(z + -1, \mathsf{log1p}\left(-y\right), \log y \cdot \left(x + -1\right)\right) - t
Initial program 7.1
Simplified0.1
[Start]7.1 | \[ \left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t
\] |
|---|---|
+-commutative [=>]7.1 | \[ \color{blue}{\left(\left(z - 1\right) \cdot \log \left(1 - y\right) + \left(x - 1\right) \cdot \log y\right)} - t
\] |
fma-def [=>]7.1 | \[ \color{blue}{\mathsf{fma}\left(z - 1, \log \left(1 - y\right), \left(x - 1\right) \cdot \log y\right)} - t
\] |
sub-neg [=>]7.1 | \[ \mathsf{fma}\left(z - 1, \log \color{blue}{\left(1 + \left(-y\right)\right)}, \left(x - 1\right) \cdot \log y\right) - t
\] |
log1p-def [=>]0.1 | \[ \mathsf{fma}\left(z - 1, \color{blue}{\mathsf{log1p}\left(-y\right)}, \left(x - 1\right) \cdot \log y\right) - t
\] |
remove-double-neg [<=]0.1 | \[ \mathsf{fma}\left(z - 1, \mathsf{log1p}\left(-y\right), \color{blue}{\left(-\left(-\left(x - 1\right)\right)\right)} \cdot \log y\right) - t
\] |
remove-double-neg [=>]0.1 | \[ \mathsf{fma}\left(z - 1, \mathsf{log1p}\left(-y\right), \color{blue}{\left(x - 1\right)} \cdot \log y\right) - t
\] |
sub-neg [=>]0.1 | \[ \mathsf{fma}\left(z - 1, \mathsf{log1p}\left(-y\right), \color{blue}{\left(x + \left(-1\right)\right)} \cdot \log y\right) - t
\] |
metadata-eval [=>]0.1 | \[ \mathsf{fma}\left(z - 1, \mathsf{log1p}\left(-y\right), \left(x + \color{blue}{-1}\right) \cdot \log y\right) - t
\] |
Final simplification0.1
| Alternative 1 | |
|---|---|
| Error | 0.1 |
| Cost | 19968 |
| Alternative 2 | |
|---|---|
| Error | 0.1 |
| Cost | 13696 |
| Alternative 3 | |
|---|---|
| Error | 0.3 |
| Cost | 7616 |
| Alternative 4 | |
|---|---|
| Error | 1.5 |
| Cost | 7497 |
| Alternative 5 | |
|---|---|
| Error | 0.4 |
| Cost | 7488 |
| Alternative 6 | |
|---|---|
| Error | 3.6 |
| Cost | 7432 |
| Alternative 7 | |
|---|---|
| Error | 16.9 |
| Cost | 7185 |
| Alternative 8 | |
|---|---|
| Error | 27.1 |
| Cost | 7120 |
| Alternative 9 | |
|---|---|
| Error | 0.6 |
| Cost | 7104 |
| Alternative 10 | |
|---|---|
| Error | 8.5 |
| Cost | 6985 |
| Alternative 11 | |
|---|---|
| Error | 7.4 |
| Cost | 6980 |
| Alternative 12 | |
|---|---|
| Error | 36.4 |
| Cost | 520 |
| Alternative 13 | |
|---|---|
| Error | 34.2 |
| Cost | 448 |
| Alternative 14 | |
|---|---|
| Error | 34.3 |
| Cost | 384 |
| Alternative 15 | |
|---|---|
| Error | 41.1 |
| Cost | 128 |
herbie shell --seed 2023039
(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))