Hi Ala'a, thanks, fixed in SVN 993. /// Jürgen On 08/11/2017 03:22 PM, Ala'a Mohammad wrote: Hi Jürgen, I was playing with experimental support for rational numbers and found that result was converted to float while using dyadic maximum, minimum, even though I did not use the monadic +(1÷3) ⌈ (3÷4) 0.75 (1÷3) ⌊ (3÷4) 0.3333333333 Is this the intended display? Also by accident, I was playing with the support and the strange display of the following occurred ÷¯1÷3 3÷18446744073709551615 Entering the above result gives another number 3÷18446744073709551615 1.626303259E¯19 The positive case works better (even though I had expected one digit display only '3'), but somehow the neg mess-up the display ÷1÷3 3÷1 Regards, Ala'a On Sun, Jul 23, 2017 at 5:28 PM, Juergen Sauermann <juergen.sauerm...@t-online.de> wrote:Hi Elias, the format bug is fixed in SVN 983. Rational numbers are exact, they are stored as a 64 bit numerator and a 64 bit denominator. You can convert a rational to a float with monadic +: ⎕PS←1 0 ⍝ display quotients 2÷3 2÷3 +2÷3 0.6666666667 Normally monadic + is not needed because conversion to double happens automatically where needed. /// Jürgen On 07/21/2017 06:19 AM, Elias Mårtenson wrote: There is an error in the rational code: In Archive.cc, line 218, the snprintf format is wrong. %lld is used, while the types of the arguments are actually "long". Thus, "%lld÷%lld" should be "%ld÷%ld" instead. On 21 July 2017 at 12:06, Elias Mårtenson <loke...@gmail.com> wrote:I haven't looked at this yet, but is this purely a display feature, or is it a full implementation of rational numbers? In other words, is the result of 1÷3 exact? And if so, how do I convert a rational number into a floating-point number? Regards, Elias On 21 July 2017 at 00:05, Juergen Sauermann <juergen.sauerm...@t-online.de> wrote:Hi, coming back to a proposal from Elias, I have added (experimental) support for rational numbers in GNU APL. SVN 982. It has to be enabled explicitly: ./configure RATIONAL_NUMBERS_WANTED=yes In APL you can display rational numbers by setting ⎕PS[1]: ⎕PS←0 22 2÷3 ╔════════════╗ ║0.6666666667║ ╚════════════╝ ⎕PS←1 22 2÷3 ╔═══╗ ║2÷3║ ╚═══╝ (The second item in ⎕PS is a boxing style as in the ]BOXING command). Best Regards, Jürgen |
- [Bug-apl] Rational Numbers Juergen Sauermann
- Re: [Bug-apl] Rational Numbers Elias Mårtenson
- Re: [Bug-apl] Rational Numbers Elias Mårtenson
- Re: [Bug-apl] Rational Numbers Juergen Sauermann
- Re: [Bug-apl] Rational Numbers Ala'a Mohammad
- Re: [Bug-apl] Rational Numbers Juergen Sauermann
- Re: [Bug-apl] Rational Numbers Ala'a Mohammad