Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.math.mathematica

Topic: Mod and QuotientRemainder are inconsistent
Replies: 2   Last Post: Feb 10, 2012 6:02 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Andrzej Kozlowski

Posts: 2,112
Registered: 1/29/05
Re: Mod and QuotientRemainder are inconsistent
Posted: Feb 10, 2012 5:52 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Note also that:

Mod[12, 0.1, 1]

1.

etc., which suggest to me that the result for Mod[12,0.1] must be a bug.

Andrzej Kozlowski




On 9 Feb 2012, at 11:35, Szabolcs wrote:

>
> Mod[12, 0.1] gives 0.1 despite 120*0.1 = 12. I expect this is because 0.1 is not representable in binary.
>
> QuotientRemainder[12, 0.1] gives {120, 0.} however, which is inconsistent with the result above.
>
> Quotient[12,0.1] gives 120 which is also inconsistent with Mod.
>
> Is this a bug or is it by design? It seems it is not safe to assume that
>
> QuotientRemainder[a,b] = {Quotient[a,b], Mod[a,b]}
>
> or that
>
> Quotient[a,b]*b + Mod[a,b] = a
>






Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.