Re: Why Doesn't N[Pi,i] Give i Digits For Small i, Mathematica
- To: mathgroup at smc.vnet.net
- Subject: [mg20234] Re: Why Doesn't N[Pi,i] Give i Digits For Small i, Mathematica
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Fri, 8 Oct 1999 18:30:13 -0400
- Organization: Universitaet Leipzig
- References: <7tgsdm$snl@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi, N[] just create a double from its argument. Since double has 16 digits it will be always work with this precision. You need something like TruncateReal[r_, i_Integer] := N[FromDigits[RealDigits[N[Pi, i], 10, i]]] Hope that helps Jens R&M wrote: > > If I execute: > > Table[{i, N[Pi, i]}, {i, 1, 20}] > > I get: > SNIP SNAP > I'd expect something like > {{1,3},{2,3.1},{3,3.14},{4,3.141},{5,3.1416},{6,3.14159},{7,3.141593},.... > > It seems N[] only works as expected above 16 digits of requested > precision. > > Is my expectation wrong? What should I do to get what I want? > > My platform is WinNT 4 SP4.