Re: Question on Mod[]
- To: mathgroup at smc.vnet.net
- Subject: [mg35991] Re: [mg35970] Question on Mod[]
- From: Andrzej Kozlowski <andrzej at tuins.ac.jp>
- Date: Sun, 11 Aug 2002 05:13:52 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
I think the Help Browser is only "approximately correct on this point". Although it says: Mod[m, n] is equivalent to m - n Quotient[m, n] this is only really always true for exact numbers. Thus in your case: In[21]:= Mod[Rationalize[3.5],Rationalize[0.1]] Out[21]= 0 and same for In[22]:= Rationalize[3.5]-Rationalize[0.1 ]Quotient[Rationalize[3.5],Rationalize[0.1]] Out[22]= 0 For inexact numbers this relationship holds "almost everywhere". I suspect this is due to the fact that arithmetic in Mathematica is in fact binary. Andrzej Kozlowski Toyama International University JAPAN http://platon.c.u-tokyo.ac.jp/andrzej/ On Saturday, August 10, 2002, at 05:05 AM, Souvik Banerjee wrote: > Hello Group, > > Why does Mod[3.5,0.1] gives 0.1? > > However, > 3.5 - 0.1 Quotient[3.5,0.1] gives 0 > > Thanks, > > -Souvik > > > > > >