Menu

#11 Modulo of great numbers is always 0

open-remind
None
1
2008-01-15
2008-01-14
Anonymous
No

I have this problem on Nokia 6233 as well as Siemens S55. I didnt try any other phones.

Discussion

  • Nobody/Anonymous

    Logged In: NO

    I mean, GREAT number Modulo ANY number is always zero...

     
  • Roar Lauritzsen

    Roar Lauritzsen - 2008-01-15

    Logged In: YES
    user_id=1189103
    Originator: NO

    The Calc program has limited precision and can only accurately represent integers up to 2^61-1. Originally modulo was only implemented for integers, and it seemed to make no sense to perform the modulo operation when the number is not represented exactly. However, modulo has been extended to work with fractional numbers, and as long as the magnitude of the two operands to the modulo operator is comparable, modulo makes perfect sense. In the case of (a modulo b), a must be smaller than b*(2^61) for modulo to be interesting. E.g. 44e100 modulo 5e100 = 4e100 works in the current implementation. The question is what to return in the case of 44e100 modulo 3 ? Because of the limited precision, the program cannot distinguish between 44e100 and 44e100 + 1. If it cannot be accurately calculated by the program, what should the result be? Of the candidates I could think of, 0 or "nan", I chose 0. I didn't think more about it at the time, but I realize that "nan" may more accurately represent the situation: that we have no clue what the result should be. Any comments?

     
  • Roar Lauritzsen

    Roar Lauritzsen - 2008-01-15
    • assigned_to: nobody --> roarl
    • status: open --> pending-remind
     
  • Roar Lauritzsen

    Roar Lauritzsen - 2008-01-15
    • priority: 5 --> 1
    • status: pending-remind --> open-remind
     
  • Nobody/Anonymous

    Logged In: NO

    Yes, i think "nan" would be more appropriate.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.