comp.lang.ada
 help / color / mirror / Atom feed
From: "Frank Jørgen Jørgensen" <fjj@itema.no>
Subject: GNAT Community 2020 (20200818-93):   Big_Integer
Date: Fri, 30 Jun 2023 12:28:22 -0700 (PDT)	[thread overview]
Message-ID: <55561d4b-8288-4770-a7b5-681567752ab0n@googlegroups.com> (raw)

Hi

I'm running the below program with GNAT Community 2020 (20200818-93)
on Windows 11 Home.
I have some problems trying to save big numbers to a file - so I noticed this behaviour:
If I open Test.dat in Visual Studio Hex editor,  it seems like this program saves this big number with a different bit pattern each time.
Is that as expected?
I do have some problems reading back the big numbers in my real code.
When I compile I get the warning: "Ada.Numerics.Big_Numbers.Big_Integers"  is an Ada 202x unit.

Frank

--
with Ada.Streams.Stream_IO; use Ada.Streams.Stream_IO;
with Ada.Numerics.Big_Numbers.Big_Integers;

procedure Test is

      B1 : Ada.Numerics.Big_Numbers.Big_Integers.Big_Integer;
      F1 : File_Type;
      S1 : Stream_Access;
   begin
      B1 := 1;

      Ada.Streams.Stream_IO.Create (F1, Out_File, "Test.dat");
      S1 := Ada.Streams.Stream_IO.Stream (F1);
      Ada.Numerics.Big_Numbers.Big_Integers.Big_Integer'Write(S1, B1);
      Ada.Numerics.Big_Numbers.Big_Integers.Big_Integer'Output(S1, B1);
      Ada.Streams.Stream_IO.Close (F1);
end Test;

             reply	other threads:[~2023-06-30 19:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-30 19:28 Frank Jørgen Jørgensen [this message]
2023-06-30 21:07 ` GNAT Community 2020 (20200818-93): Big_Integer Dmitry A. Kazakov
2023-07-01 12:12 ` Simon Wright
2023-07-08  2:58   ` Randy Brukardt
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox