# [Edu-sig] Using the Decimal type in Martian Math

kirby urner kirby.urner at gmail.com
Sun Nov 29 23:52:38 CET 2009

```On Sun, Nov 29, 2009 at 10:58 AM, kirby urner <kirby.urner at gmail.com> wrote:

<< SNIP >>

> print "K Module"
> print "K in tetravolumes: ", kvol * syn3
> print "Rh Triacontrahedron: ", 120 * kvol * syn3
>

I'm now comparing output from this script on Ubuntu netbook Python 2.6
and WinXP HP desktop Python 3.1.

Here's Python 3.1rc1 (r31rc1:73069, May 31 2009, 08:57:10):

getcontext().prec = 31

T Module
T in tetravolumes:  0.04166666666666666666666666666670
Rh Triacontrahedron:  5.000000000000000000000000000005
E Module
E in tetravolumes:  0.04173131692777365429943951200165
Rh Triacontrahedron:  5.007758031332838515932741440198
K Module
K in tetravolumes:  0.06250000000000000000000000000008
Rh Triacontrahedron:  7.500000000000000000000000000009

getcontext().prec = 50

T Module
T in tetravolumes:  0.041666666666666666666666666666666666666666666666678
Rh Triacontrahedron:  5.0000000000000000000000000000000000000000000000013
E Module
E in tetravolumes:  0.041731316927773654299439512001665297072526423571419
Rh Triacontrahedron:  5.0077580313328385159327414401998356487031708285702
K Module
K in tetravolumes:  0.062500000000000000000000000000000000000000000000014
Rh Triacontrahedron:  7.5000000000000000000000000000000000000000000000018

Here's from Python 2.6 on Ubuntu Starling-1:

Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41)
[GCC 4.3.3] on linux2

getcontext().prec = 31

T Module
T in tetravolumes:  0.04166666666666666666666666666670
Rh Triacontrahedron:  5.000000000000000000000000000005
E Module
E in tetravolumes:  0.04173131692777365429943951200165
Rh Triacontrahedron:  5.007758031332838515932741440198
K Module
K in tetravolumes:  0.06250000000000000000000000000008
Rh Triacontrahedron:  7.500000000000000000000000000009

getcontext().prec = 50

T Module
T in tetravolumes:  0.041666666666666666666666666666666666666666666666678
Rh Triacontrahedron:  5.0000000000000000000000000000000000000000000000013
E Module
E in tetravolumes:  0.041731316927773654299439512001665297072526423571419
Rh Triacontrahedron:  5.0077580313328385159327414401998356487031708285702
K Module
K in tetravolumes:  0.062500000000000000000000000000000000000000000000014
Rh Triacontrahedron:  7.5000000000000000000000000000000000000000000000018

Note that 0.041666666... is our 1/24, the volume of T,A and B slices
(tetrahedra) in Martian Math.

Kirby

--
>>> from mars import math
http://www.wikieducator.org/Martian_Math
```