Skip to content
This repository has been archived by the owner on Nov 29, 2022. It is now read-only.

Fix check of rho argument to sim_pte #38

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Dec 31, 2019

  1. Fix check of rho argument to sim_pte

    The expression to check if the rho argument to sim_pte is between 0 and 1 used the bitwise OR operator instead of the logical OR operator. Due to operator precedence of the bitwise OR operator, the bitwise operator is evaluated first before the comparisons.  '0 | rho' will evaluate to the value of rho, given rho is an integer, making the conditional equivalently rho < rho > 1 which will always evaluate to False no matter the value of rho. If rho is a float, which would be common, a TypeError exception would be thrown as you can't perform bitwise OR on a float. To correctly check that rho is between 0 and 1, the bitwise OR operator is replaced with the logical OR operator 'or'.
    cody-somerville committed Dec 31, 2019
    Configuration menu
    Copy the full SHA
    5bfad1b View commit details
    Browse the repository at this point in the history