floating point - Are there errors in purely integer multiplication? -


i know there errors in floating point multiplication there errors in purely integer multiplication? let's i'm using python, how large of integers , b can compute a*b , answers right? wall? same addition?

there no error in (correct) floating-point multiplication. rounding may occur, that’s not error, that’s defined behavior of arithmetic. colloquially called “rounding error”, not “error” in normal sense of word.

there no error in (correct) integer multiplication. in languages, overflow may occur, that’s not error, that’s defined behavior of arithmetic*.

in python in particular, overflow not occur integer multiplication**; result equal “mathematically exact” result, , silently promoted bignum if necessary. same holds true addition.

[*] there languages overflow produces trap or throws exception; again, however, that’s defined behavior in languages.

[**] long result isn’t large storage cannot allocated.


Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -

php - $params->set Array between square bracket -