[scilab-Users] Re: format(): limit of the number of digits

Mike Page Mike at Page-One.Waitrose.com
Thu Mar 1 13:09:11 CET 2012


Hi Jonas,

I don't think you can do that.  The longest native integer type is (AFAIK)
32 bits.  This will only hold about 9 decimal digits.  So the result of
factorial 24 in integer form would be an overflow.

-->i=int32(factorial(24))
 i  =

 -2147483648

while
-->i=int32(factorial(12))
 i  =

  479001600
works correctly and is the limit of how far you can get with an integer
type.

As I mentioned before, the only way I know to go beyond these limits is to
do your own arithmetic with a structured type holding the extended words of
the data.  If your arithmetic is complicated, then this would be hard.
Maybe Scilab is not the best tool for your purposes?  You can find some
information about this problem in Wikipedia
(http://en.wikipedia.org/wiki/Arbitrary-precision_arithmetic).

HTH
Mike.


-----Original Message-----
From: jonas [mailto:jonathanattia at gmail.com]
Sent: 01 March 2012 11:50
To: users at lists.scilab.org
Subject: [scilab-Users] Re: format(): limit of the number of digits


Thank you for your post.

This syntax/function is valid for a floating-point number.
How can I get a high number of digits for a positive integer?

Here's a numerical example: factorial(24) = 6.204484017332394100D+23

Thank you in advance.

Best regards,
Jonas.

--
View this message in context:
http://mailinglists.scilab.org/format-limit-of-the-number-of-digits-tp378838
0p3790178.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at
Nabble.com.

--
To unsubscribe from this mailing-list, please send an empty mail to
users-unsubscribe at lists.scilab.org
To check the archives of this mailing list, see
http://mailinglists.scilab.org/




More information about the users mailing list