3 added 56 characters in body
source | link

Arithmetic tricks

Here are some arithmetic tricks which are either shorter or are more useful due to precedence rules.

Assumptions                  Version 1        Version 2
-------------------------------------------------------------------
n >= 0 float                 n==0             0**n
n >>= 0 integer               n==0             1>>n
n >  0 integer               n!=1             1%n
n >  0 integer, Python 2      n==1             1/n

Arithmetic tricks

Here are some arithmetic tricks which are either shorter or are more useful due to precedence rules.

Assumptions                  Version 1        Version 2
-------------------------------------------------------------------
n >= 0 float                 n==0             0**n
n > 0 integer                n!=1             1%n
n > 0 integer, Python 2      n==1             1/n

Arithmetic tricks

Here are some arithmetic tricks which are either shorter or are more useful due to precedence rules.

Assumptions                  Version 1        Version 2
-------------------------------------------------------------------
n >= 0 float                 n==0             0**n
n >= 0 integer               n==0             1>>n
n >  0 integer               n!=1             1%n
n >  0 integer, Python 2     n==1             1/n
    Mod Removes Wiki by Doorknob
2 added 5 characters in body
source | link

Arithmetic tricks

Here are some arithmetic tricks which are either shorter or are more useful due to precedence rules.

Assumptions                  Version 1        Version 2
-------------------------------------------------------------------
n float   >= 0 float                 n==0             0**n
n > 0 integer                n!=1             1%n
n > 0 integer, Python 2      n==1             1/n

Arithmetic tricks

Here are some arithmetic tricks which are either shorter or are more useful due to precedence rules.

Assumptions                  Version 1        Version 2
-------------------------------------------------------------------
n float                      n==0             0**n
n > 0 integer                n!=1             1%n
n > 0 integer, Python 2      n==1             1/n

Arithmetic tricks

Here are some arithmetic tricks which are either shorter or are more useful due to precedence rules.

Assumptions                  Version 1        Version 2
-------------------------------------------------------------------
n >= 0 float                 n==0             0**n
n > 0 integer                n!=1             1%n
n > 0 integer, Python 2      n==1             1/n
1
source | link

Arithmetic tricks

Here are some arithmetic tricks which are either shorter or are more useful due to precedence rules.

Assumptions                  Version 1        Version 2
-------------------------------------------------------------------
n float                      n==0             0**n
n > 0 integer                n!=1             1%n
n > 0 integer, Python 2      n==1             1/n