       # RE: Very odd behaviour in Mod/

```
I would like to be able to do the following:

In:= t = Mod[Q, 2 Pi]
Out= 1000000000000000000 - 318309886183790670 Pi

In:= N[t,3]
Out= 4.83677

Where the correct value is:
4.831039164951128133.......

If you want to be sure even a few digits are right, you can currently
use N[t,17].
Then Mathematica will go to all the trouble to get 17 digits correct,
when you only care about a few of them.

Ted Ersek
----------
|From: "megalith"@jimc.demon.co.uk@PMDF@PAXMB1 To:
mathgroup@smc.vnet.net
|To: ersek ted; "mathgroup"@smc.vnet.net@PMDF@PAXMB1 |Subject: [mg12133] [mg12048]
Very odd behaviour in Mod/N |Date: Friday, April 24, 1998 8:57AM |
|<<File Attachment: 00000000.TXT>>
|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:= Q = 10^8
|Out= 100000000
|
|In:= t = Mod[Q, 2 Pi]
|Out= 100000000 - 31830988 Pi
|
|In:= N[t]
|Out= 1.9427
|
|In:= N[t, 20]
|Out= 1.9426951345040144600
|
|Now for a very similar example which obviously behaves wrongly: |
|In:= Q = 10^18
|Out= 1000000000000000000
|
|In:= t = Mod[Q, 2 Pi]
|Out= 1000000000000000000 - 318309886183790670 Pi |
|In:= N[t]
|Out= 128.
|
|In:= N[t, 20]
|Out= 4.831039164951128133
|
|What exactly is going on here?
|
|Thanks, cheers,