Hi,
I found out, lcm (RT) is silent about errors. (the bad way)
Is there any way to activate them?
For example, the following code:
#include<iostream>
#include
Hi,
I found out, lcm (RT) is silent about errors. (the bad way) Is there any way to activate them?
From the docs: If the least common multiple is beyond the range of the integer type, the results are undefined.
For example, the following code: [...]
Obtains the following result:
lcm of :1073741824 & 3 is 1073741824
Which is not the right answer (because it is not divisible by 3), but neither it raised an exception or returned some special value.
To further define undefined: Currently, if the result is negative (i.e. signed integer overflow) the absolute value of the result is taken, which happens to also be 2^30. Best regards, Stefan
participants (2)
-
Damian Vicino
-
Stefan Floeren