-- To_Integer --
----------------
- function To_Integer (Arg : Big_Integer) return Integer is
+ function To_Integer (Arg : Valid_Big_Integer) return Integer is
begin
return Integer (From_Bignum (Get_Bignum (Arg)));
end To_Integer;
-- From_Big_Integer --
----------------------
- function From_Big_Integer (Arg : Big_Integer) return Int is
+ function From_Big_Integer (Arg : Valid_Big_Integer) return Int is
begin
return Int (From_Bignum (Get_Bignum (Arg)));
end From_Big_Integer;
-- From_Big_Integer --
----------------------
- function From_Big_Integer (Arg : Big_Integer) return Int is
+ function From_Big_Integer (Arg : Valid_Big_Integer) return Int is
begin
return Int (From_Bignum (Get_Bignum (Arg)));
end From_Big_Integer;
then Big_Natural >= To_Big_Integer (0)),
Predicate_Failure => (raise Constraint_Error);
- function In_Range (Arg, Low, High : Big_Integer) return Boolean is
- ((Low <= Arg) and (Arg <= High));
+ function In_Range
+ (Arg : Valid_Big_Integer; Low, High : Big_Integer) return Boolean
+ is (Low <= Arg and Arg <= High);
- function To_Integer (Arg : Big_Integer) return Integer
+ function To_Integer (Arg : Valid_Big_Integer) return Integer
with Pre => In_Range (Arg,
Low => To_Big_Integer (Integer'First),
High => To_Big_Integer (Integer'Last))
function To_Big_Integer (Arg : Int) return Valid_Big_Integer;
- function From_Big_Integer (Arg : Big_Integer) return Int
+ function From_Big_Integer (Arg : Valid_Big_Integer) return Int
with Pre => In_Range (Arg,
Low => To_Big_Integer (Int'First),
High => To_Big_Integer (Int'Last))
function To_Big_Integer (Arg : Int) return Valid_Big_Integer;
- function From_Big_Integer (Arg : Big_Integer) return Int
+ function From_Big_Integer (Arg : Valid_Big_Integer) return Int
with Pre => In_Range (Arg,
Low => To_Big_Integer (Int'First),
High => To_Big_Integer (Int'Last))
-- From_String --
-----------------
- function From_String (Arg : String) return Valid_Big_Integer is
+ function From_String (Arg : String) return Big_Integer is
function mpz_set_str
(this : access mpz_t;
str : System.Address;
-- Put_Image --
---------------
- procedure Put_Image (S : in out Sink'Class; V : Big_Real) is
+ procedure Put_Image (S : in out Sink'Class; V : Big_Integer) is
-- This is implemented in terms of To_String. It might be more elegant
-- and more efficient to do it the other way around, but this is the
-- most expedient implementation for now.