Skip to content
thvnxPublic

About

Ada bindings for MPFR

Topics

Resources

Stars

2 stars

Watchers

2 watching

Forks

Latest commit

 

History

203 Commits

Folders and files

Repository files navigation

main Alire

Ada bindings for MPFR

This package introduces a new type: Mpfloat, allowing to use mpfr_t C objects in Ada code. Mpfloat is a Limited_Controlled type, therefore memory initialization and freeing is automatically handled by Admpfr, thanks to the Initialize and Finalize operations given by the controlled type.

The C developer can consult this document if familiar with the C library.

Build

This section describes how to build Admpfr from the sources. Note that you can use Alire to get the Admpfr crate by running alr get admpfr.

Prerequisites

Using Alire

Simply get Alire and run the following commands:

$ cd admpfr
$ alr build

You can also run the testsuite to ensure everything is properly supported on your system:

$ alr exec -- testsuite/testsuite.py

or just play around with the examples:

$ cd examples
$ alr exec -- gprbuild -Pexamples
$ ./obj/main
1.0000000000000001e-01

Example

The following code:

with Ada.Text_IO; use Ada.Text_IO;
with Admpfr;      use Admpfr;

procedure Main is
   N : Mpfloat;
begin
   N.Set ("0.1");
   Put_Line (N'Image);
end Main;

will print:

1.0000000000000001e-01

About

Ada bindings for MPFR

Topics

Resources

Stars

2 stars

Watchers

2 watching

Forks

Releases

Used by

Contributors

Languages