Very odd behaviour in Mod/N
- To: mathgroup@smc.vnet.net
- Subject: [mg12048] Very odd behaviour in Mod/N
- From: Adrian Cable <megalith@jimc.demon.co.uk>
- Date: Fri, 24 Apr 1998 01:52:19 -0400
- Organization: MeGALiTH Software Ltd
Hi there, I've observed some very odd behaviour when using Mod and N. It seems that, when handling very large numbers, Mathematica (3.0.1, Win32) does not display machine-precision results correctly. Here's an example which behaves as it should: In[12]:= Q = 10^8 Out[12]= 100000000 In[13]:= t = Mod[Q, 2 Pi] Out[13]= 100000000 - 31830988 Pi In[14]:= N[t] Out[14]= 1.9427 In[15]:= N[t, 20] Out[15]= 1.9426951345040144600 Now for a very similar example which obviously behaves wrongly: In[16]:= Q = 10^18 Out[16]= 1000000000000000000 In[17]:= t = Mod[Q, 2 Pi] Out[17]= 1000000000000000000 - 318309886183790670 Pi In[18]:= N[t] Out[18]= 128. In[19]:= N[t, 20] Out[19]= 4.831039164951128133 What exactly is going on here? Thanks, cheers, Adrian Cable.
- Follow-Ups:
- Re: Very odd behaviour in Mod/N
- From: Daniel Lichtblau <danl@wolfram.com>
- Re: Very odd behaviour in Mod/N