Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

functions like Sin and Log that are defined for Float and Long_Float?

0
Posted

functions like Sin and Log that are defined for Float and Long_Float?

0

(from Jonathan Parker) Ada 83 was slow to arrive at a standard naming convention for elementary math functions and complex numbers. Furthermore, you’ll find that some compilers call the 64-bit floating point type Long_Float; other compilers call it Float. Fortunately, it is easy to write programs in Ada that are independent of the naming conventions for floating point types and independent of the naming conventions of math functions defined on those types. One of the cleanest ways is to make the program generic: generic type Real is digits <>; with function Arcsin (X : Real) return Real is <>; with function Log (X : Real) return Real is <>; — This is the natural log, inverse of Exp(X), sometimes written Ln(X). package Example_1 is … end Example_1; So the above package doesn’t care what the name of the floating point type is, or what package the Math functions are defined in, just as long as the floating point type has the right attributes (precision and range) for the algorithm, and

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123