From: AdaMagica <christ-usch.grein@t-online.de>
Subject: Re: Any good package for mathematical function in Ada?
Date: Sat, 6 Jun 2020 06:58:51 -0700 (PDT)
Date: 2020-06-06T06:58:51-07:00 [thread overview]
Message-ID: <bb30b065-1d67-49a2-94cc-2935c1a6f702o@googlegroups.com> (raw)
In-Reply-To: <rbffae$1u3p$1@gioia.aioe.org>
Am Samstag, 6. Juni 2020 09:06:57 UTC+2 schrieb Dmitry A. Kazakov:
> No, it is the type system. Randy posted links to the drafts for
> unbounded integer and real. Same story. They are not numbers. As a
> consequence you have no conversions to/from legal numeric types, you
> need to instantiate generics. They do not match formal numeric types in
> generics. They have no attributes (some of which would have no sense
> anyway).
GNAT CE 2020 has them (albeit not in the latest RM form). They behave much like numbers.
pragma Warnings (Off);
with Ada.Numerics.Big_Numbers.Big_Integers, Ada.Numerics.Big_Numbers.Big_Reals;
use Ada.Numerics.Big_Numbers.Big_Integers, Ada.Numerics.Big_Numbers.Big_Reals;
pragma Warnings (On);
with Ada.Text_IO;
use Ada.Text_IO;
procedure Main is
I: Big_Integer := From_String (" 42 ");
J: Big_Integer := 42;
R: Big_Real := From_String("10.0")**100 - 1.0;
S: Big_Real := 10.0**100 - 1/1;
D: Big_Real := 1 / 3;
begin
Put_Line (Boolean'(I=J)'Image);
Put_Line (to_String (R));
Put_Line (Boolean'Image(R=S));
Put_Line (to_String (Numerator (S)) & to_String (Denominator (S)));
Put_Line (to_String (D, Aft => 110));
Put_Line (to_String (Numerator (D)) & to_String (Denominator (D)));
end Main;
next prev parent reply other threads:[~2020-06-06 13:58 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-31 10:46 Any good package for mathematical function in Ada? reinert
2020-05-31 11:26 ` Dmitry A. Kazakov
2020-06-01 8:17 ` reinert
2020-05-31 23:25 ` Jerry
2020-06-01 8:24 ` reinert
2020-06-01 10:19 ` Dmitry A. Kazakov
2020-06-01 10:48 ` Nasser M. Abbasi
2020-06-01 11:34 ` Dmitry A. Kazakov
2020-06-01 11:52 ` Nasser M. Abbasi
2020-06-01 13:37 ` Dmitry A. Kazakov
2020-06-02 1:48 ` Jerry
2020-06-05 22:49 ` Randy Brukardt
2020-06-05 22:54 ` Paul Rubin
2020-06-06 7:06 ` Dmitry A. Kazakov
2020-06-06 13:58 ` AdaMagica [this message]
2020-06-01 10:43 ` Dmitry A. Kazakov
2020-06-02 1:51 ` Jerry
2020-06-03 15:07 ` reinert
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox