Skip to content

Conversation

@markstrefford
Copy link

In certain situations, beta_q is creating a complex number (see https://stackoverflow.com/questions/66903214/why-is-python-creating-a-complex-number-here/66903343). This is because the unary - in a negative result for (1.0 / (2.0 - rand * alpha)) takes precedence over ** (1.0 / (eta + 1)).

This fix identifies the sign (-/+) and uses the absolute values in the calculation for beta_q, then retrospectively applies the correct sign again.

@fmder
Copy link
Member

fmder commented Nov 13, 2021

Not sure it is really operator precedence as the expression is wrapped in parenthesis.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants