[Scilab-users] [SEP] factorial() extension on [171, 10^4]

classic Classic list List threaded Threaded
4 messages Options
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

[Scilab-users] [SEP] factorial() extension on [171, 10^4]

Hello,

While fixing the bug 7562 about a bad memory usage by factorial(),
i was wondering about the poor factorial() result, since currently
it can process only integers in [0, 170] before saturating and returning %inf.

This Scilab Enhancement Proposed (SEP) aims to extend factorial()
to all integers in [0, 10^4].
To do this, two new output arguments are proposed :

  • p : the power of 10 of the result
  • m : the mantissa of the result, in [1, 10[

The new syntaxes with p and m, and relative errors are presented in the
prospective factorial help page http://bugzilla.scilab.org/attachment.cgi?id=4702

This SEP comes after a wish reported as bug 15517.

Comments are welcome.

Regards
Samuel


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

Re: [SEP] factorial() extension on [171, 10^14]

Le 14/04/2018 à 15:44, Samuel Gougeon a écrit :
> While fixing the bug 7562 about a bad memory usage by factorial(),
>
> i was wondering about the poor factorial() result, since currently
> it can process only integers in [0, 170] before saturating and
> returning %inf.
>
> This Scilab Enhancement Proposed (SEP) aims to extend factorial()
> to all integers in [0, 10^4].
>

The proposed extension goes up to n=10^14 (not 10^4)

Samuel

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Rafael Guerra Rafael Guerra
Reply | Threaded
Open this post in threaded view
|

Re: [SEP] factorial() extension on [171, 10^14]

Hi Samuel,

How are in the proposed extension the resulting very large numbers represented?
In other words, how are the limitations of double precision overcome and can we do math with such very large integers?

PS: In Scilab the gammaln() function allows computing the logarithm of the factorial for large integers.

Regards,
Rafael

-----Original Message-----
From: users [mailto:[hidden email]] On Behalf Of Samuel Gougeon
Sent: Friday, May 04, 2018 3:32 PM
To: International users mailing list for Scilab. <[hidden email]>
Subject: Re: [Scilab-users] [SEP] factorial() extension on [171, 10^14]

Le 14/04/2018 à 15:44, Samuel Gougeon a écrit :
> While fixing the bug 7562 about a bad memory usage by factorial(),
>
> i was wondering about the poor factorial() result, since currently it
> can process only integers in [0, 170] before saturating and returning
> %inf.
>
> This Scilab Enhancement Proposed (SEP) aims to extend factorial() to
> all integers in [0, 10^4].
>

The proposed extension goes up to n=10^14 (not 10^4)

Samuel

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

Re: [SEP] factorial() extension on [171, 10^14]

Le 04/05/2018 à 16:13, Rafael Guerra a écrit :
> Hi Samuel,
>
> How are in the proposed extension the resulting very large numbers represented?
> In other words, how are the limitations of double precision overcome and can we do math with such very large integers?
>
> PS: In Scilab the gammaln() function allows computing the logarithm of the factorial for large integers.

Hello Rafael,

Please see the link to the help page posted in my first message. It is
documented in the page.
The algorithm can be seen on CodeReview (ref in the message/bugzilla
entry). It uses a careful
processing with log(). It is more accurate than gammaln() by a factor of
up to 100 (it is also
documented in the test).

Regards
Samuel

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users