[Edu-sig] Long floats?

Kirby Urner pdx4d@teleport.com
Wed, 10 Jan 2001 12:02:18 -0800


Here's something from a math teacher who hangs out on math-teach
(where I've been cross-posting a few of my "math through 
programming" essays).

He wonders if there's a way to get "long floats".  I don't 
think there is, except maybe there's an add-on module I don't
know about.  Any clues?

Kirby

==============================================================

Date: Tue, 09 Jan 2001 20:49:15 -0800
From: ...@stanfordalumni.org>
Subject: Re: Math through Programming (CP4E)
To: urner@alumni.princeton.edu


Thanks to your posts, I started playing with Python a bit.
The first thing I wanted to explore was something a student pointed out:
on their calculator, there are patterns around the last few digits of
(1 / sqrt(5)) * ((1 + sqrt(5))/2)^n, and they wondered if it was just
rounding error or something interesting going on or a coincidence or what.

I figured getting some further decimal places would be easy in Python,
but while long integers are there for the having, I couldn't find any way
to get additional precision in my floats.

I read the manual a bit and was still lost.  It wasn't hard to put
together the loop to do the nth powers, and it only took me a little
while to realize that I needed to type math.sqrt instead of sqrt (or
define my own function to be math.sqrt).

I still forget to put the : at the end of the line when I need to,
and haven't quite gotten used to the interpreter yet, so I end up retyping
stuff more than I should.  I'm running it on a mac; probably if I ran it
under linux instead I'd be happier living in my emacs window.

Anyway, if you know anything about python packages that do floating point
with 100 digits of precision, that would be nifty.

In any case, thanks for writing something on math-teach that isn't just
still more arguing between GG and MPG and their ilk.  Actual math
content!  Wow!

--XXXXX