Logo

Programming-Idioms

History of Idiom 86 > diff from v20 to v21

Edit summary for version 21 by DantHimself:
New Csharp implementation by user [DantHimself]

Version 20

2019-09-29, 11:23:41

Version 21

2019-10-08, 14:34:04

Idiom #86 Check if integer multiplication will overflow

Write boolean function multiplyWillOverflow which takes two integers x, y and return true if (x*y) overflows.

Idiom #86 Check if integer multiplication will overflow

Write boolean function multiplyWillOverflow which takes two integers x, y and return true if (x*y) overflows.

Code
public bool WillOverwflow(int x, int y) => int.MaxValue / x > y;