?

Average Error: 14.0 → 0.3
Time: 9.5s
Precision: binary32
Cost: 3424

?

\[\left(0.0001 \leq \alpha \land \alpha \leq 1\right) \land \left(2.328306437 \cdot 10^{-10} \leq u0 \land u0 \leq 1\right)\]
\[\left(\left(-\alpha\right) \cdot \alpha\right) \cdot \log \left(1 - u0\right) \]
\[\left(\alpha \cdot \left(-\alpha\right)\right) \cdot \mathsf{log1p}\left(-u0\right) \]
(FPCore (alpha u0)
 :precision binary32
 (* (* (- alpha) alpha) (log (- 1.0 u0))))
(FPCore (alpha u0) :precision binary32 (* (* alpha (- alpha)) (log1p (- u0))))
float code(float alpha, float u0) {
	return (-alpha * alpha) * logf((1.0f - u0));
}
float code(float alpha, float u0) {
	return (alpha * -alpha) * log1pf(-u0);
}
function code(alpha, u0)
	return Float32(Float32(Float32(-alpha) * alpha) * log(Float32(Float32(1.0) - u0)))
end
function code(alpha, u0)
	return Float32(Float32(alpha * Float32(-alpha)) * log1p(Float32(-u0)))
end
\left(\left(-\alpha\right) \cdot \alpha\right) \cdot \log \left(1 - u0\right)
\left(\alpha \cdot \left(-\alpha\right)\right) \cdot \mathsf{log1p}\left(-u0\right)

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 14.0

    \[\left(\left(-\alpha\right) \cdot \alpha\right) \cdot \log \left(1 - u0\right) \]
  2. Applied egg-rr0.3

    \[\leadsto \left(\left(-\alpha\right) \cdot \alpha\right) \cdot \color{blue}{\left(0 + \mathsf{log1p}\left(-u0\right)\right)} \]
  3. Simplified0.3

    \[\leadsto \left(\left(-\alpha\right) \cdot \alpha\right) \cdot \color{blue}{\mathsf{log1p}\left(-u0\right)} \]
    Proof

    [Start]0.3

    \[ \left(\left(-\alpha\right) \cdot \alpha\right) \cdot \left(0 + \mathsf{log1p}\left(-u0\right)\right) \]

    +-lft-identity [=>]0.3

    \[ \left(\left(-\alpha\right) \cdot \alpha\right) \cdot \color{blue}{\mathsf{log1p}\left(-u0\right)} \]
  4. Final simplification0.3

    \[\leadsto \left(\alpha \cdot \left(-\alpha\right)\right) \cdot \mathsf{log1p}\left(-u0\right) \]

Alternatives

Alternative 1
Error0.3
Cost3424
\[\alpha \cdot \left(\left(-\alpha\right) \cdot \mathsf{log1p}\left(-u0\right)\right) \]
Alternative 2
Error2.8
Cost480
\[\left(\alpha \cdot \alpha\right) \cdot \left(u0 + \left(u0 \cdot u0\right) \cdot \left(0.5 + u0 \cdot 0.3333333333333333\right)\right) \]
Alternative 3
Error4.1
Cost352
\[\alpha \cdot \left(u0 \cdot \left(\alpha + \alpha \cdot \left(u0 \cdot 0.5\right)\right)\right) \]
Alternative 4
Error4.1
Cost352
\[\left(\alpha \cdot \alpha\right) \cdot \left(u0 + \left(u0 \cdot u0\right) \cdot 0.5\right) \]
Alternative 5
Error8.2
Cost160
\[\alpha \cdot \left(\alpha \cdot u0\right) \]
Alternative 6
Error8.2
Cost160
\[u0 \cdot \left(\alpha \cdot \alpha\right) \]
Alternative 7
Error29.6
Cost32
\[0 \]

Error

Reproduce?

herbie shell --seed 2023046 
(FPCore (alpha u0)
  :name "Beckmann Distribution sample, tan2theta, alphax == alphay"
  :precision binary32
  :pre (and (and (<= 0.0001 alpha) (<= alpha 1.0)) (and (<= 2.328306437e-10 u0) (<= u0 1.0)))
  (* (* (- alpha) alpha) (log (- 1.0 u0))))