Does anyone know the precision of Real_Matrix in ada, using the below package?
with Ada.Numerics.Real_Arrays
And is there anyway of increasing it?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
According to the LRM, “The library package Numerics.Real_Arrays is declared pure and defines the same types and subprograms as Numerics.Generic_Real_Arrays, except that the predefined type Float is systematically substituted for Real’Base throughout.”
This means that the precision of Real_Matrix values will be that of the predefined Float type, which can be ascertained for your platform as the value of Float’Digits.
(Interestingly, the wording suggests a textual substitution of ‘Float’ for all ‘Real’ and Real’Base subprogram arguments, however, GNAT GPL 2012’s version of Real_Arrays simply instantiates the Generic_Real_Arrays package with Float.)
Increasing the precision can be done by either utilizing one of the higher precision instantiations: Long_Real_Arrays or Long_Long_Real_Arrays, or by defining your own floating point type with the desired precision and instantiating Generic_Real_Arrays with it.