Subject: Re: [boost] [math] lcm errors
From: Stefan Floeren (lists_at_[hidden])
Date: 2015-08-31 16:24:19
> 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.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk