Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #16702

Re: standard floating point arithmetic in Mathematica?

From Bob Hanlon <hanlonr357@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: standard floating point arithmetic in Mathematica?
Date 2014-03-28 07:31 +0000
Message-ID <lh38hd$s18$1@smc.vnet.net> (permalink)
References <20140327090014.228D06A2F@smc.vnet.net>
Organization Time-Warner Telecom

Show all headers | View raw


It is not clear to me whether you want only results that are Real to be
displayed at that precision or all reals in an expression. Use one of the
following

$Post = If[Head[#]===Real,SetPrecision[#,17],#]&;

.1+.2

0.30000000000000004

1/3. E^(-Pi x)

0.333333 E^(-\[Pi] x)

%//N

0.333333 2.71828^(-3.14159 x)

$Post = (# /. x_Real:>SetPrecision[x,17])&;

.1+.2

0.30000000000000004

1/3. E^(-Pi x)

0.33333333333333331 E^(-\[Pi] x)

%//N

0.33333333333333331 2.7182818284590451^(-3.1415926535897931 x)


Bob Hanlon



On Thu, Mar 27, 2014 at 5:00 AM, Alan <alan.isaac@gmail.com> wrote:

> I would like to illustrate some limitations with floating point
> calculations.  Can I force Mathematica to do floating point computations at
> a standard float size and the display the full results (as the same size
> float)?
>
> E.g., if I enter
> 0.1+0.2
> I would like to see
> 0.30000000000000004
>
> Thanks,
> Alan Isaac
>
>

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar


Thread

Re: standard floating point arithmetic in Mathematica? Bob Hanlon <hanlonr357@gmail.com> - 2014-03-28 07:31 +0000

csiph-web