Changes between Version 2 and Version 3 of Ticket #658, comment 7


Ignore:
Timestamp:
Jan 26, 2015, 9:22:30 AM (9 years ago)
Author:
Dimitar Misev

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #658, comment 7

    v2 v3  
    1 * [http://docs.scipy.org/doc/numpy/reference/generated/numpy.divide.html python numpy]
    2  > Behavior on division by zero can be changed using seterr.
    3  > ..
    4  > When both x1 and x2 are of an integer type, divide will return integers and throw away the fractional part. Moreover, division by zero always yields zero in integer arithmetic.
     1[http://docs.scipy.org/doc/numpy/reference/generated/numpy.divide.html python numpy]
     2> Behavior on division by zero can be changed using seterr.
     3> ..
     4> When both x1 and x2 are of an integer type, divide will return integers and throw away the fractional part. Moreover, division by zero always yields zero in integer arithmetic.
    55 * so integer division by zero sets 0, floating point corresponds to IEEE 754 which results in +/- inf or nan, for which we don't need to care as C++ implements it already
    66 * it's similar in Matlab, except Matlab automatically converts to float on integer division and correspondingly returns inf/nan
    77 * similar in R as far as I could see
    8 * From wikipedia on [http://en.wikipedia.org/wiki/Division_by_zero#In_computer_arithmetic integer division]:
    9  > Integer division by zero is usually handled differently from floating point since there is no integer representation for the result. Some processors generate an exception when an attempt is made to divide an integer by zero, although others will simply continue and generate an incorrect result for the division. The result depends on how division is implemented, and can either be zero, or sometimes the largest possible integer.
     8
     9From wikipedia on [http://en.wikipedia.org/wiki/Division_by_zero#In_computer_arithmetic integer division]:
     10> Integer division by zero is usually handled differently from floating point since there is no integer representation for the result. Some processors generate an exception when an attempt is made to divide an integer by zero, although others will simply continue and generate an incorrect result for the division. The result depends on how division is implemented, and can either be zero, or sometimes the largest possible integer.