Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #59930
| From | Dennis Lee Bieber <wlfraed@ix.netcom.com> |
|---|---|
| Subject | Re: Setting longer default decimal precision |
| Date | 2013-11-18 20:29 -0500 |
| Organization | IISS Elusive Unicorn |
| References | <l6d7c7$402$1@speranza.aioe.org> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2874.1384824591.18130.python-list@python.org> (permalink) |
On Mon, 18 Nov 2013 14:14:33 +0000, "Kay Y. Jheallee" <nospam@use.net>
declaimed the following:
>Using 1/3 as an example,
>
> >>> 1./3
>0.3333333333333333
> >>> print "%.50f" % (1./3)
>0.33333333333333331482961625624739099293947219848633
> >>> print "%.50f" % (10./3)
>3.33333333333333348136306995002087205648422241210938
> >>> print "%.50f" % (100./3)
>33.33333333333333570180911920033395290374755859375000
>
>which seems to mean real (at least default) decimal precision
The default double precision FLOATING POINT is limited to ~15
significant digits. That's a hardware limit for double on most machines
(64-bits). Most floating point processors may use 80 bits internally, but
truncate back down on output.
Python has supported a DECIMAL package for some years, but math with
that package will be slower as it can't go through the FPU.
Check the help file for your installation, look for decimal
--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Setting longer default decimal precision "Kay Y. Jheallee" <nospam@use.net> - 2013-11-18 14:14 +0000
Re: Setting longer default decimal precision Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-11-18 14:43 +0000
Re: Setting longer default decimal precision Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-11-18 20:29 -0500
Re: Setting longer default decimal precision Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-11-20 14:02 +0000
Re: Setting longer default decimal precision Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2013-11-20 14:40 +0000
Re: Setting longer default decimal precision "Kay Y. Jheallee" <nospam@use.net> - 2013-11-20 19:34 +0000
Re: Setting longer default decimal precision Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-11-20 19:59 +0000
Re: Setting longer default decimal precision Tim Golden <mail@timgolden.me.uk> - 2013-11-20 20:04 +0000
Re: Setting longer default decimal precision Tim Golden <mail@timgolden.me.uk> - 2013-11-20 20:24 +0000
Re: Setting longer default decimal precision Larry Hudson <orgnut@yahoo.com> - 2013-11-20 23:04 -0800
csiph-web