< Ada Programming < Libraries 
 
 
      
Ada. Time-tested, safe and secure.
This language feature is available from Ada 95 on. Ada.Numerics.Generic_Elementary_Functions is a unit of the Predefined Language Environment since Ada 95.
The generic package Ada.Numerics.Generic_Elementary_Functions defines various mathematical functions for floating point type. Being generic it can not only be used for predefined floating point types but also for any user defined floating type.
Usage
There is an extensive usage guide in Ada Programming/Mathematical calculations. Here the relevant extract:
withAda.Numerics.Generic_Elementary_Functions;procedureNumeric_4istypeValue_Typeisdigits12range-999_999_999_999.0e999 .. 999_999_999_999.0e999;packageValue_FunctionsisnewAda.Numerics.Generic_Elementary_Functions ( Value_Type);
Specification
-- Standard Ada library specification -- Copyright (c) 2003-2018 Maxim Reznik <reznikmm@gmail.com> -- Copyright (c) 2004-2016 AXE Consultants -- Copyright (c) 2004, 2005, 2006 Ada-Europe -- Copyright (c) 2000 The MITRE Corporation, Inc. -- Copyright (c) 1992, 1993, 1994, 1995 Intermetrics, Inc. -- SPDX-License-Identifier: BSD-3-Clause and LicenseRef-AdaReferenceManual -- -------------------------------------------------------------------------generictypeFloat_Typeisdigits<>;packageAda.Numerics.Generic_Elementary_FunctionsispragmaPure (Generic_Elementary_Functions);functionSqrt (X : Float_Type'Base)returnFloat_Type'Base;functionLog (X : Float_Type'Base)returnFloat_Type'Base;functionLog (X, Base : Float_Type'Base)returnFloat_Type'Base;functionExp (X : Float_Type'Base)returnFloat_Type'Base;function"**" (Left, Right : Float_Type'Base)returnFloat_Type'Base;functionSin (X : Float_Type'Base)returnFloat_Type'Base;functionSin (X, Cycle : Float_Type'Base)returnFloat_Type'Base;functionCos (X : Float_Type'Base)returnFloat_Type'Base;functionCos (X, Cycle : Float_Type'Base)returnFloat_Type'Base;functionTan (X : Float_Type'Base)returnFloat_Type'Base;functionTan (X, Cycle : Float_Type'Base)returnFloat_Type'Base;functionCot (X : Float_Type'Base)returnFloat_Type'Base;functionCot (X, Cycle : Float_Type'Base)returnFloat_Type'Base;functionArcsin (X : Float_Type'Base)returnFloat_Type'Base;functionArcsin (X, Cycle : Float_Type'Base)returnFloat_Type'Base;functionArccos (X : Float_Type'Base)returnFloat_Type'Base;functionArccos (X, Cycle : Float_Type'Base)returnFloat_Type'Base;functionArctan (Y : Float_Type'Base; X : Float_Type'Base := 1.0)returnFloat_Type'Base;functionArctan (Y : Float_Type'Base; X : Float_Type'Base := 1.0; Cycle : Float_Type'Base)returnFloat_Type'Base;functionArccot (X : Float_Type'Base; Y : Float_Type'Base := 1.0)returnFloat_Type'Base;functionArccot (X : Float_Type'Base; Y : Float_Type'Base := 1.0; Cycle : Float_Type'Base)returnFloat_Type'Base;functionSinh (X : Float_Type'Base)returnFloat_Type'Base;functionCosh (X : Float_Type'Base)returnFloat_Type'Base;functionTanh (X : Float_Type'Base)returnFloat_Type'Base;functionCoth (X : Float_Type'Base)returnFloat_Type'Base;functionArcsinh (X : Float_Type'Base)returnFloat_Type'Base;functionArccosh (X : Float_Type'Base)returnFloat_Type'Base;functionArctanh (X : Float_Type'Base)returnFloat_Type'Base;functionArccoth (X : Float_Type'Base)returnFloat_Type'Base;endAda.Numerics.Generic_Elementary_Functions;
See also
Wikibook
Ada Reference Manual
Ada 95
Ada 2005
Ada 2012
Open-Source Implementations
FSF GNAT
- Specification: a-ngelfu.ads
- Body: a-ngelfu.adb
drake
- Specification: numerics/a-ngelfu.ads
- Body: numerics/a-ngelfu.adb
    This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.