Observation on ! in V13.1

General APL language issues
Post Reply
paulmansour
Posts: 431
Joined: Fri Oct 03, 2008 4:14 pm

Observation on ! in V13.1

Post by paulmansour »

Here is an interesting change from version 12 to 13 that I did not notice in the new release notes:

In version 12:

      ⎕DR¨!¨⍳14
83 83 83 83 645 645 645 645 645 645 645 645 645 645


and in version 13.1:

      ⎕DR¨!¨⍳14
83 83 83 83 83 83 163 163 323 323 323 323 323 645
Vince|Dyalog
Posts: 439
Joined: Wed Oct 01, 2008 9:39 am

Re: Observation on ! in V13.1

Post by Vince|Dyalog »

Hi Paul,

This was announced in a DSS email in 20th July 2011,

Re: 003299: V13.0 Enhancement: Ensure that the result of the factorial of an integer is itself an integer.
This was an enhancement that was included in the initial V13.0 release, rather than a subsequently added enhancement.
Factorial is calculated using a series of Gamma functions, the results of which are floating point values. In version 12.1 and prior, it is these values which were returned. In 13.0 the code has been enhanced so that although the result of factorial of positive integer values are still represented by floating point values, they are rounded to the appropriate integer value.


Regards,

Vince
paulmansour
Posts: 431
Joined: Fri Oct 03, 2008 4:14 pm

Re: Observation on ! in V13.1

Post by paulmansour »

Thanks Vince. I must have glossed over that email. No big deal anyway, I just noticed the change and thought it interesting.
Roger|Dyalog
Posts: 238
Joined: Thu Jul 28, 2011 10:53 am

Re: Observation on ! in V13.1

Post by Roger|Dyalog »

In addition to Vince's comments, I should say that from v12.1 to v13.0 !x and x!y are:

  • more accurate: e.g. 24-!4 is 7.10543E¯15 in v12.1 and 0 in v13.0.
  • takes less time: e.g. try 1!1e7 in v12.1 and in v13.0
  • takes less space: result is in a smaller datatype (as you noted)
Post Reply