File : print_precisions.adb
-------------------------------------------------------------------------------
-- Copyright (C) 2000-2001 Centre National de la Recherche Scientifique --
-- --
-- This program is free software; you can redistribute it and/or modify --
-- it under the terms of the GNU General Public License as published by --
-- the Free Software Foundation; either version 2 of the License, or --
-- (at your option) any later version. --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
-- This program is distributed in the hope that it will be useful, --
-- but WITHOUT ANY WARRANTY; without even the implied warranty of --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --
-- GNU General Public License for more details. --
-- --
-- You should have received a copy of the GNU General Public License --
-- along with this program; if not, write to the Free Software --
-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --
-- --
-- Author: Duncan Sands (Duncan.Sands@math.u-psud.fr) --
-- Departement de Mathematiques, Batiment 425, --
-- Universite de Paris-XI, Orsay, France. --
-- http://topo.math.u-psud.fr/~sands --
-------------------------------------------------------------------------------
-- Show the BLAS precisions corresponding to a sample of floating point types.
with Ada.Text_IO;
with Ada_BLAS.Get_Precision;
with System;
procedure Print_Precisions is
package Precision_IO is
new Ada.Text_IO.Enumeration_IO (Ada_BLAS.Precision_Type);
generic
type Float_Type is digits <>;
procedure Print_Info;
procedure Print_Info is
package Fortran_Precision is new Ada_BLAS.Get_Precision (Float_Type);
begin
Ada.Text_IO.Put_Line ("Float_Type'Digits:" &
Integer'Image (Float_Type'Digits));
Ada.Text_IO.Put_Line ("Float_Type'Base'Digits:" &
Integer'Image (Float_Type'Base'Digits));
Ada.Text_IO.Put ("BLAS precision: ");
Precision_IO.Put (Fortran_Precision.Precision);
Ada.Text_IO.New_Line;
end Print_Info;
type Float_1 is digits 1;
type Float_2 is digits System.Max_Digits / 4;
type Float_3 is digits System.Max_Digits / 2;
type Float_4 is digits 3 * System.Max_Digits / 4;
type Float_5 is digits System.Max_Digits;
procedure Print_1 is new Print_Info (Float_1);
procedure Print_2 is new Print_Info (Float_2);
procedure Print_3 is new Print_Info (Float_3);
procedure Print_4 is new Print_Info (Float_4);
procedure Print_5 is new Print_Info (Float_5);
begin
Ada.Text_IO.Put_Line ("-- Various BLAS precisions --");
Print_1;
Ada.Text_IO.New_Line;
Print_2;
Ada.Text_IO.New_Line;
Print_3;
Ada.Text_IO.New_Line;
Print_4;
Ada.Text_IO.New_Line;
Print_5;
Ada.Text_IO.New_Line;
end Print_Precisions;