Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2012

[Date Index] [Thread Index] [Author Index]

Search the Archive

Mod and QuotientRemainder are inconsistent

  • To: mathgroup at smc.vnet.net
  • Subject: [mg124837] Mod and QuotientRemainder are inconsistent
  • From: Szabolcs <szhorvat at gmail.com>
  • Date: Thu, 9 Feb 2012 05:35:54 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Reply-to: comp.soft-sys.math.mathematica at googlegroups.com

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



  • Prev by Date: Re: The simple command x=0;Dynamic[x=x+1]
  • Next by Date: Looking to "de-simplify"
  • Previous by thread: Re: Dancing "a la Levenberg-Marquardt" to get the best Logistic Model.
  • Next by thread: Re: Mod and QuotientRemainder are inconsistent