Beckmann Distribution sample, tan2theta, alphax == alphay

?

Percentage Accurate: 55.4% → 99.0%
Time: 10.2s
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) \]
\[\alpha \cdot \left(\alpha \cdot \left(-\mathsf{log1p}\left(-u0\right)\right)\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(alpha * Float32(alpha * Float32(-log1p(Float32(-u0)))))
end
\left(\left(-\alpha\right) \cdot \alpha\right) \cdot \log \left(1 - u0\right)
\alpha \cdot \left(\alpha \cdot \left(-\mathsf{log1p}\left(-u0\right)\right)\right)

Local Percentage Accuracy?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Herbie found 6 alternatives:

AlternativeAccuracySpeedup

Accuracy vs Speed

The accuracy (vertical axis) and speed (horizontal axis) of each of Herbie's proposed alternatives. Up and to the right is better. Each dot represents an alternative program; the red square represents the initial program.

Bogosity?

Bogosity

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 56.8%

    \[\left(\left(-\alpha\right) \cdot \alpha\right) \cdot \log \left(1 - u0\right) \]
  2. Simplified99.0%

    \[\leadsto \color{blue}{\left(-\alpha\right) \cdot \left(\alpha \cdot \mathsf{log1p}\left(-u0\right)\right)} \]
    Step-by-step derivation

    [Start]56.8

    \[ \left(\left(-\alpha\right) \cdot \alpha\right) \cdot \log \left(1 - u0\right) \]

    associate-*l* [=>]56.8

    \[ \color{blue}{\left(-\alpha\right) \cdot \left(\alpha \cdot \log \left(1 - u0\right)\right)} \]

    sub-neg [=>]56.8

    \[ \left(-\alpha\right) \cdot \left(\alpha \cdot \log \color{blue}{\left(1 + \left(-u0\right)\right)}\right) \]

    log1p-def [=>]99.0

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

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

Alternatives

Alternative 1
Accuracy91.4%
Cost608
\[\left(\alpha \cdot \alpha\right) \cdot \left(\left(u0 \cdot u0\right) \cdot \left(u0 \cdot 0.3333333333333333 + 0.5\right)\right) + u0 \cdot \left(\alpha \cdot \alpha\right) \]
Alternative 2
Accuracy91.4%
Cost480
\[\left(\alpha \cdot \alpha\right) \cdot \left(u0 + \left(u0 \cdot u0\right) \cdot \left(u0 \cdot 0.3333333333333333 + 0.5\right)\right) \]
Alternative 3
Accuracy91.4%
Cost480
\[\alpha \cdot \left(\alpha \cdot \left(u0 - \left(u0 \cdot u0\right) \cdot \left(-0.5 + u0 \cdot -0.3333333333333333\right)\right)\right) \]
Alternative 4
Accuracy87.4%
Cost352
\[\left(\alpha \cdot \alpha\right) \cdot \left(u0 + \left(u0 \cdot u0\right) \cdot 0.5\right) \]
Alternative 5
Accuracy74.8%
Cost160
\[\alpha \cdot \left(\alpha \cdot u0\right) \]

Reproduce?

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