Gentoo Archives: gentoo-user

From: Philip Webb <purslow@××××××××.net>
To: gentoo-user@l.g.o
Subject: [gentoo-user] Re: Python precision
Date: Fri, 21 Sep 2012 06:34:01
Message-Id: 20120921063145.GA938@ca.inter.net
In Reply to: Re: [gentoo-user] new machine : suddenly Python 3 appears by Willie WY Wong
1 120920 Willie WY Wong wrote:
2 > Unless you want to load the math module every time you start Python,
3 > it is perhaps better to create an alias in Bash
4 > using the `-i' option of Python:
5 > alias python-calc='python -i loadmath.py'
6 > or if you only need one single command
7 > alias python-calc='python -i -c "from math import *"'
8 > which will give you an interactive session with math functions preloaded.
9
10 Yes thanks: the 2nd is the simplest way to do what I want.
11
12 > 120919 Marc Joliet described how to set a level of precision:
13
14 Thanks too, but that's not what I wanted: it's not for printing,
15 but simply to limit the display to eg 4 decimal places, not 16 ;
16 the calculations still wb as accurate, but the output easier to read.
17 Is that possible with Python ? -- ie a setting in ascript.py
18 to tell Python to display only the 1st 4 places in all output
19 without any further input from the user when doing the calculations;
20 presumably it wb a command s/he could enter when in interactive mode too.
21
22 --
23 ========================,,============================================
24 SUPPORT ___________//___, Philip Webb
25 ELECTRIC /] [] [] [] [] []| Cities Centre, University of Toronto
26 TRANSIT `-O----------O---' purslowatchassdotutorontodotca

Replies

Subject Author
Re: [gentoo-user] Re: Python precision Marc Joliet <marcec@×××.de>
Re: [gentoo-user] Re: Python precision Helmut Jarausch <jarausch@××××××××××××××××.de>