https://issues.dlang.org/show_bug.cgi?id=14569

Simen Kjaeraas <simen.kja...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |simen.kja...@gmail.com
         Resolution|---                         |INVALID

--- Comment #1 from Simen Kjaeraas <simen.kja...@gmail.com> ---
Your expectations of what e.to!BigInt should do does not square up with what's
being done for int and uint, and you even point that out in the bug report
itself - e.to!int gives a different result from what you expect. It could be
argued that BigInt should have the same behavior as does int and uint, but
having a different behavior for BigInt would break the principle of least
astonishment, and thus be a Bad Thing™. 

Judging from the report, you're implementing a sum of digits. If s in your case
was "123", you probably expect sum1, sum2, sum3 and sum4 to be 6, as that would
be the sum of digits.  As sum2 and sum3 shows, you instead get a sum of the
values of the unicode code points making up the string.

--

Reply via email to