If I am doing some odd maths how does one get large numbers into integer64 variables and constants.
There is a unsigned64:value function I think that takes two parameters.
One of my constants is 80 characters for I might have to call a 128 bit library.
In C and C++ one always added a L to the end of your number constant.
unsigned var = 7362398263876L;
I believe that C++ 11 has 128 bit numbers now.
Cheers
Giant constant numbers.
 Thomas Linder Puls
 VIP Member
 Posts: 1622
 Joined: 28 Feb 2000 0:01
I do not think there are 128 bit numbers (by default) in C++ 11, but it is not something I know for sure.
However, the 'L' in C/C++ literals indicates a 64 bit number.
I Visual Prolog you can use the types unsigned64 and integer64 and you do not need to use any special marks to write such numbers:
unsigned64 have the range [0..18446744073709551615].
integer64 have the range [9223372036854775808..9223372036854775807].
128 bit numbers cannot hold a 80 digit number, the largest number in an 128 bit unsigned is 2^128 ~ 3,4e38 (i.e. 39 digits).
A real can hold very large numbers, but (only) with ~15 digits precision.
However, the 'L' in C/C++ literals indicates a 64 bit number.
I Visual Prolog you can use the types unsigned64 and integer64 and you do not need to use any special marks to write such numbers:
Code: Select all
constants
value : unsigned64 = 7362398263876.
class predicates
p : (unsigned64 X) > unsigned64 Y.
clauses
p(X) = 7362398263876 + value + X.
integer64 have the range [9223372036854775808..9223372036854775807].
128 bit numbers cannot hold a 80 digit number, the largest number in an 128 bit unsigned is 2^128 ~ 3,4e38 (i.e. 39 digits).
A real can hold very large numbers, but (only) with ~15 digits precision.
Regards Thomas Linder Puls
PDC
PDC

 VIP Member
 Posts: 289
 Joined: 14 Nov 2002 0:01
Hello Chris (and Thomas and all),
the below attached project gives an example how one could deal with numbers which exceed the limits of the buildin number domains. The example implements large unsigned integer numbers encoded in binaries. The implemented arithmetics uses however only the simple school methods. For multiplication and especially for division faster (but more complicated) algorithms are known.
the below attached project gives an example how one could deal with numbers which exceed the limits of the buildin number domains. The example implements large unsigned integer numbers encoded in binaries. The implemented arithmetics uses however only the simple school methods. For multiplication and especially for division faster (but more complicated) algorithms are known.
 Attachments

 bigUnsigned.zip
 (12.24 KiB) Downloaded 85 times
Regards Martin