Changes between Initial Version and Version 1 of Ticket #658, comment 7


Ignore:
Timestamp:
Jan 26, 2015, 9:20:41 AM (10 years ago)
Author:
Dimitar Misev

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #658, comment 7

    initial v1  
    44 > 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
     6 * it's similar in Matlab, except Matlab automatically converts to float on integer division and correspondingly returns inf/nan
    67* From wikipedia on [http://en.wikipedia.org/wiki/Division_by_zero#In_computer_arithmetic integer division]:
    78 > 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.