Re: pilib.e (was: Re: How to handle crashes?)

new topic     » goto parent     » topic index » view thread      » older message » newer message

On Wed, Jun 11, 2003 at 12:53:10AM +0100, Pete Lomax wrote:
> 
> 
> On Tue, 10 Jun 2003 17:33:44 -0400, jbrown105 at speedymail.org wrote:
> 
> >I haven't added the ability to do ((PI*7)/PI == 7) in fraclib.e,
> <snip>
> >If anyone has ideas on how this could be simplified, feel free to let me
> >know.
> Something else on this list recently prompted me to comment:
> -- PL 7/6/3 It just struck me that rather than holding values as
> fractions, they should
> -- remain as (simplified) expressions; instead of fraction
> ={numerator,denominator},
> -- it should be stored as a tree, eg div(PI,2). This would also allow
> eg cos(expr) to
> -- unambiguously return 0 when expr is -PI/2, PI/2, 3PI/2 etc.
> 
> So we store not 1.57079632679489661923132169163975, but div(PI,2), and
> then cos(div(PI,2)) ==> 0. Equally we do not store
> 21.9911485751285526692385036829565 but mul(PI,7), then
> div(mul(PI,7),7) ==> PI.
> 

Hmm, that would be a less expesive way to hold it (and also would be easier
to apply more generally). But it also requires a more complex parser.

> I shudder to think how difficult that might be to generalise.

The hard part would be figuring how to parse and store it internally, once
that is done the rest is not as difficult.

> 
> Pete
> PS there are other natural numbers and constants besides PI
> 

Such as e, sqrt(2), etc.... Yes I do hope to be able to represent those
symbolicly
as well... eventually.

jbrown

-- 
 /"\  ASCII ribbon              | http://www.geocities.com/jbrown1050/
 \ /  campain against           | Linux User:190064
  X   HTML in e-mail and        | Linux Machine:84163
 /*\  news, and unneeded MIME   | http://verify.stanford.edu/evote.html

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu