Permutations - and BIG numbers
Posted: Thu Jul 10, 2008 7:53 pm
As a mental challenge I wrote a prog
to calculate permutations i.e. the number
of possible sets of unique numbers in a
larger set of numbers.
The formula involves factorial calculations
i.e. factorial 10 is 10 x 9 x 8 x 7 ..... x 2 x 1.
The numbers get BIG as you can imagine.
Try factorial 99 (99!) on your calculator
and see how far you get.
Rev hits the limit at around 200 so instead of
using an "int" one would normally go for a "long".
But (and I don't regard this as a deficiency) Rev
doesn't seem to have one or a way to use
"scientific" notation.
This was a problem way back (before Win, perhaps
before you were born) when "micro-computers" were
limited to 640k memory less what the OS needed.
One of the techniques I recall was called "scaling" and
involved dividing the numbers by a factor which moved
the decimal point to the left so that the available slots
to the right of the decimal point were used.
The trick was deciding the divisor so as to not cause
an overflow and loss of accuracy.
Does anyone have any info. on the "capacity" of Rev
when dealing with large numbers and/or scaling?
Had a quick look in the Rev help without any luck.
to calculate permutations i.e. the number
of possible sets of unique numbers in a
larger set of numbers.
The formula involves factorial calculations
i.e. factorial 10 is 10 x 9 x 8 x 7 ..... x 2 x 1.
The numbers get BIG as you can imagine.
Try factorial 99 (99!) on your calculator
and see how far you get.
Rev hits the limit at around 200 so instead of
using an "int" one would normally go for a "long".
But (and I don't regard this as a deficiency) Rev
doesn't seem to have one or a way to use
"scientific" notation.
This was a problem way back (before Win, perhaps
before you were born) when "micro-computers" were
limited to 640k memory less what the OS needed.
One of the techniques I recall was called "scaling" and
involved dividing the numbers by a factor which moved
the decimal point to the left so that the available slots
to the right of the decimal point were used.
The trick was deciding the divisor so as to not cause
an overflow and loss of accuracy.
Does anyone have any info. on the "capacity" of Rev
when dealing with large numbers and/or scaling?
Had a quick look in the Rev help without any luck.