Hi Fred,
Rational. and non-rational numbers use the same Cell type
(FloatCell).
Non-Rational numbers have a denominator = 0 and store their
value in value.fval.u1.flt (which is a double in
union u1)
Rational numbers have a denominator >= 1 and stor
Hello Jürgen,
After reading your email and the apl.html documentation on ⎕CR
and so, I've have two questions:
1) How does one know B is a rational number? The apl.html
documentation for 26 ⎕CR B does not showthat there is a cell type for
rationals and I could not locate one in the
Hi Fred,
the existing mechanism is 27 ⎕CR B to get the numerator of
B and 28 ⎕CR to get the denominator > 0
of a quotient or 0 if the number is not a quotient (and then 27
⎕CR is the double B cast to uint64_t.
Unfortunately there was a bug 28 ⎕
Guys,
To make it clear, I'm not asking for bigints. I'm just seeking
to get the maximum benefit of having rational numbers with, as Xtian
says, ~63-bit numerator and denominators. As long as you limit
yourself to using addition, subtraction, multiplication, and division
and avoid overrunn
A bigint is an arbitrary-precision integer. Such as what is provided in
Lisp:
In Lisp, I get the correct rational number:
CL> *(/ (expt 2 1000) 3)*
10715086071862673209484250490600018105614048117055336074437503883703510511249361224931983788156958581275946729175531468251871452856923140435984577574
what is "bigints" ?
larger than ~62 bits or 920 ?
If so, I would agree 100%. Having a limit that is less than exact 64 bits
(signed or unsigned)
is wrong. encode & decode can't manage more than ~62-~63 bits limit.
my 2 cents,
Xtian.
On 2017-08-28 22:33, Elias Mårtenson wrote:
The true benefit of rational numbers is realised once there is support for
bigints. Jürgen has suggested that that is planned, and personally I can't
wait.
Regards,
Elias
On 29 August 2017 at 08:59, Frederick Pitts wrote:
> Louis,
>
> Thanks for the quick response.
>
> After wor
Louis,
Thanks for the quick response.
After working with the technique a bit, I observe that as long
as the rational number denominator is well within the range of integers
representable by floating numbers, 1 ∧ n returns the correct result.
But if the absolute value of the denomi
Hi,
No APL kb with me right now, sorry :(
1 LCM n
gives the numerator of a fraction (floating or exact). If you need the
denominator, do the same with the inverse of n. If you need both, for example:
1 LCM n POW 1 _1
Cheers,
Louis
> On 28 Aug 2017, at 23:24, Frederick Pitts wrote:
>
> Hell