[futurebasic] Re: [FB] Really Long Integer

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : May 1999 : Group Archive : Group : All Groups

From: Jay Reeve <jktr@...>
Date: Thu, 6 May 99 23:17:23 -0500
Stephen,

>Is it possible to get a long integer to hold a number of a possible length
>of 255 characters, making the highest possible number 9.999... E254  if you
>get my drift.
P. 16 in the Reference Manual says:
"To have up to 16,000 digits of accuracy, enter the number of digits with the "" [opt-2] symbolinto the single-, double-, or scientific-precision setting to override the default 240 digit limit."
This is set in the preferences window (see p. 15). I've never tried this, but it sounds as if you just set the prefs for the digits of accuracy you want, and the compiler will handle memory allocation for your variables of that type.

BTW, p. 362 suggests that a 255-digit BCD number would require only 128 bytes.
>
>If it is possible, how do I do, I tried to assign more memory (well at
>least I think I did). var&;256
>
>Why do I just use scientific notation, well I want the number to be exact.
>
I'm curious--what requires this level of precision? I couldn't be sure from your post whether you are clear on the difference between the _range_ of a number and the _precision_ of a number. A 16,000-digit BCD number has a range of ±E 16,383, the same as the default 8-byte double-precision number. Whether or not you use scientific notation has nothing to do with the precision or the range of your number--it's just a different way of displaying it.

If you plan on doing calculations with these numbers, be sure to set the scientific precision pref to the precision you want, as that determines the precision of any calculations--then be aware that it will do _all_ floating-point calculations at this precision, which could slow things down to a crawl!

I'm no expert--just reading the manual. Someone please correct me if I've got it wrong.

If you want to do integer math at this precision, it shouldn't be too difficult (though a bit cumbersome) to write your own routines for dealing with binaries, rather than the slower BCD's.

HTH
 0"0
 =J= a  y
  "