[Nickle]Re: Printing of rationals

Barton C Massey bart@cs.pdx.edu
Tue, 10 Jul 2001 11:27:27 -0700


Carl!  Good to hear from you again!  We like dealing with
users: it means we have users :-).

The behaviour you are seeing is as designed.

As you have guessed, the repeat will be truncated if it is
too large to fit the format, and the default is 18 digits.
You can get more digits by changing the default print
format:
  format="%.1000g"
gets you 1000 digits.  Unfortunately, this still isn't
enough to capture the repeat in 1/16! :-).  To get this,
try
  format="%.-g"
which will show close to 1200 digits when closing the
repeat.  Perhaps this format should be the default?
In any case, you can stick it in your .nicklerc if you
like, but don't forget the trailing semicolon to stop
the echo:
  format="%.-g";

In general, the repeating decimals are really nice if you
are dealing with "real-world" stuff, but they don't work
well with rationals with lots of primes in the canonical
representation.  You can also set the format to "%v" if you
would just like the reduced-fraction representation: for
some kinds of work this is more useful, although it usually
drives me nuts.  (Quick, which is bigger, 1/20922789888000
or 13/279945700001234?)

We are currently meditating over the issue of what to do in
this situation: you are seeing the best we've come up with
so far.  The other possibility I've considered is to print a
sum...
   (4.779477332387385+303869/1021620600000000000000)e-14
but this is ugly as heck, and still takes a ton of space.
Suggestions are welcome.  Mike thinks he wants the quotient
or the repeat, whichever is shorter.  I think it would drive
me nuts, but it is really easy to add, so I have encouraged
him to do so :-).

BTW, Keith, the reader still won't accept 1.2{5 as 1.25.
I'm sure I fixed this once: should I do so again?

		Bart

In message <15179.16178.106979.471543@thump.east.isi.edu> you wrote:
> Keith and Bart,
> 
> To start off... Thanks for nickle! It make a dandy calculator.
> 
> Now, the first thing I tried to do was to show off the fancy arbitrary
> precision rationals to my friend. Unfortunately, this is what I got:
> 
> 	$ nickle
> 	> 1/8! 
> 	0.0000248{015873}
> 	> 1/16!
> 	4.7{79477332387385e-14
> 
> I tried this with the CVS version as well as 1.99.1 and 1.99.2 and got
> the same behavior.
> 
> Keith, I know I saw longer repeating parts in the output you showed me
> a couple of weeks ago. Do I need to configure something to get more
> than 18 digits printed? (didn't see much in the man page with regard to
> output formatting).
> 
> -Carl
> 
> PS. Don't you hate having to deal with users... <sigh>. ;-)