Copyright (c) Hyperion Entertainment and contributors.
Difference between revisions of "Math Libraries"
Steven Solie (talk | contribs) |
Rob Cranley (talk | contribs) (→FFP Floating Point Data Format: Added "(bit 7)" to identify the sign bit as it was not otherwise obvious) |
||
(8 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
+ | == Introduction == |
||
− | {{WIP}} |
||
+ | |||
+ | The math libraries described in this section are implemented in 68K assembly language and are designed to only be callable from 68K code. They are provided for backwards compatibility with pre-4.0 versions of AmigaOS. |
||
+ | |||
+ | For AmigaOS 4.0 and higher the math libraries you choose will depend on the application. A vast majority of the time the built-in math routines provided by the [[Newlib_Library|Newlib Library]] and built-in functions of GCC will suffice. |
||
+ | |||
== Math Libraries == |
== Math Libraries == |
||
This chapter describes the structure and calling sequences required to access the Motorola Fast Floating Point (FFP), the IEEE single-precision math libraries and the IEEE double-precision math libraries via the Amiga-supplied interfaces. |
This chapter describes the structure and calling sequences required to access the Motorola Fast Floating Point (FFP), the IEEE single-precision math libraries and the IEEE double-precision math libraries via the Amiga-supplied interfaces. |
||
− | In its present state, the FFP library consists of three separate entities: the basic math library, the transcendental math library, and C and assembly-language interfaces to the basic math library plus FFP conversion functions. The IEEE single-precision |
+ | In its present state, the FFP library consists of three separate entities: the basic math library, the transcendental math library, and C and assembly-language interfaces to the basic math library plus FFP conversion functions. The IEEE single-precision and the double-precision libraries each presently consists of two entities: the basic math library and the transcendental math library. |
{{Note|title=Open Each Library Separately|text=Each Task using an IEEE math library must open the library itself. Library base pointers to these libraries may ''not'' be shared. Libraries can be context sensitive and may use the Task structure to keep track of the current context. Sharing of library bases by Tasks may seem to work in some systems. This is true for any of the IEEE math libraries.}} |
{{Note|title=Open Each Library Separately|text=Each Task using an IEEE math library must open the library itself. Library base pointers to these libraries may ''not'' be shared. Libraries can be context sensitive and may use the Task structure to keep track of the current context. Sharing of library bases by Tasks may seem to work in some systems. This is true for any of the IEEE math libraries.}} |
||
Line 45: | Line 50: | ||
The mantissa is considered to be a binary fixed-point fraction; except for 0, it is always normalized (the mantissa is shifted over and the exponent adjusted, so that the mantissa has a 1 bit in its highest position). Thus, it represents a value of less than 1 but greater than or equal to 1/2. |
The mantissa is considered to be a binary fixed-point fraction; except for 0, it is always normalized (the mantissa is shifted over and the exponent adjusted, so that the mantissa has a 1 bit in its highest position). Thus, it represents a value of less than 1 but greater than or equal to 1/2. |
||
− | The sign bit is reset (0) for a positive value and set (1) for a negative value. |
+ | The sign bit (bit 7) is reset (0) for a positive value and set (1) for a negative value. |
The exponent is the power of two needed to correctly position the mantissa to reflect the number's true arithmetic value. It is held in excess-64 notation, which means that the two's-complement values are adjusted upward by 64, thus changing $40 (-64) through $3F (+63) to $00 through $7F. This facilitates comparisons among floating-point values. |
The exponent is the power of two needed to correctly position the mantissa to reflect the number's true arithmetic value. It is held in excess-64 notation, which means that the two's-complement values are adjusted upward by 64, thus changing $40 (-64) through $3F (+63) to $00 through $7F. This facilitates comparisons among floating-point values. |
||
Line 1,110: | Line 1,115: | ||
</pre> |
</pre> |
||
+ | {| class="wikitable" |
||
− | '''SP IEEE Transcendental Assembly Functions''' |
||
+ | |+ SP IEEE Transcendental Assembly Functions |
||
− | |||
+ | ! Function |
||
− | <table> |
||
+ | ! Input |
||
− | <thead> |
||
+ | ! Output |
||
− | <tr class="header"> |
||
+ | ! Condition Codes |
||
− | <th align="left">Function</th> |
||
+ | |- |
||
− | <th align="left">Input</th> |
||
+ | | _LVOIEEESPAsin |
||
− | <th align="left">Output</th> |
||
+ | | D0 = IEEE argument |
||
− | <th align="left">Condition Codes</th> |
||
+ | | D0 = IEEE arcsine radian |
||
− | </tr> |
||
+ | | N = undefined<br/> |
||
− | </thead> |
||
+ | Z = undefined<br/> |
||
− | <tbody> |
||
+ | V = undefined<br/> |
||
− | <tr class="odd"> |
||
+ | C = undefined<br/> |
||
− | <td align="left">_LVOIEEESPAsin</td> |
||
+ | X = undefined |
||
− | <td align="left">D0 = IEEE argument</td> |
||
+ | |- |
||
− | <td align="left">D0 = IEEE arcsine</td> |
||
+ | | _LVOIEEESPAcos |
||
− | <td align="left">N = undefined</td> |
||
+ | | D0 = IEEE single-precision argument |
||
− | </tr> |
||
+ | | D0 = IEEE arccosine radian |
||
− | <tr class="even"> |
||
+ | | N = undefined<br/> |
||
− | <td align="left"></td> |
||
+ | Z = undefined<br/> |
||
− | <td align="left"></td> |
||
+ | V = undefined<br/> |
||
− | <td align="left">radian</td> |
||
− | + | C = undefined<br/> |
|
+ | X = undefined |
||
− | </tr> |
||
+ | |- |
||
− | <tr class="odd"> |
||
+ | | _LVOIEEESPAtan |
||
− | <td align="left"></td> |
||
+ | | D0 = IEEE single-precision argument |
||
− | <td align="left"></td> |
||
+ | | D0 = IEEE arctangent radian |
||
− | <td align="left"></td> |
||
− | + | | N = undefined<br/> |
|
+ | Z = undefined<br/> |
||
− | </tr> |
||
+ | V = undefined<br/> |
||
− | <tr class="even"> |
||
+ | C = undefined<br/> |
||
− | <td align="left"></td> |
||
+ | X = undefined |
||
− | <td align="left"></td> |
||
+ | |- |
||
− | <td align="left"></td> |
||
+ | | _LVOIEEESPSin |
||
− | <td align="left">C = undefined</td> |
||
+ | | D0 = IEEE single-precision argument in radians |
||
− | </tr> |
||
+ | | D0 = IEEE sine |
||
− | <tr class="odd"> |
||
+ | | N = undefined<br/> |
||
− | <td align="left"></td> |
||
+ | Z = undefined<br/> |
||
− | <td align="left"></td> |
||
+ | V = undefined<br/> |
||
− | <td align="left"></td> |
||
− | + | C = undefined<br/> |
|
+ | X = undefined |
||
− | </tr> |
||
+ | |- |
||
− | <tr class="even"> |
||
+ | | _LVOIEEESPCos |
||
− | <td align="left">_LVOIEEESPAcos</td> |
||
− | + | | D0 = IEEE single-precision argument in radians |
|
− | + | | D0 = IEEE cosine |
|
− | + | | N = undefined<br/> |
|
+ | Z = undefined<br/> |
||
− | </tr> |
||
+ | V = undefined<br/> |
||
− | <tr class="odd"> |
||
+ | C = undefined<br/> |
||
− | <td align="left"></td> |
||
+ | X = undefined |
||
− | <td align="left">argument</td> |
||
+ | |- |
||
− | <td align="left">radian</td> |
||
+ | | _LVOIEEESPTan |
||
− | <td align="left">Z = undefined</td> |
||
+ | | D0 = IEEE single-precision argument in radians |
||
− | </tr> |
||
+ | | D0 = IEEE tangent |
||
− | <tr class="even"> |
||
+ | | N = undefined<br/> |
||
− | <td align="left"></td> |
||
+ | Z = undefined<br/> |
||
− | <td align="left"></td> |
||
+ | V = undefined<br/> |
||
− | <td align="left"></td> |
||
− | + | C = undefined<br/> |
|
+ | X = undefined |
||
− | </tr> |
||
+ | |- |
||
− | <tr class="odd"> |
||
+ | | _LVOIEEESPSincos |
||
− | <td align="left"></td> |
||
+ | | A0 = Address to store cosine result<br/> |
||
− | <td align="left"></td> |
||
+ | D0 = IEEE argument in radians |
||
− | <td align="left"></td> |
||
+ | | D0 = IEEE sine<br/> |
||
− | <td align="left">C = undefined</td> |
||
+ | (A0) = IEEE cosine |
||
− | </tr> |
||
+ | | N = undefined<br/> |
||
− | <tr class="even"> |
||
+ | Z = undefined<br/> |
||
− | <td align="left"></td> |
||
+ | V = undefined<br/> |
||
− | <td align="left"></td> |
||
+ | C = undefined<br/> |
||
− | <td align="left"></td> |
||
− | + | X = undefined |
|
+ | |- |
||
− | </tr> |
||
+ | | _LVOIEEESPSinh |
||
− | <tr class="odd"> |
||
+ | | D0 = IEEE single-precision argument in radians |
||
− | <td align="left">_LVOIEEESPAtan</td> |
||
− | + | | D0 = IEEE hyperbolic sine |
|
+ | | N = undefined<br/> |
||
− | <td align="left">D0 = IEEE arctangent</td> |
||
− | + | Z = undefined<br/> |
|
+ | V = undefined<br/> |
||
− | </tr> |
||
+ | C = undefined<br/> |
||
− | <tr class="even"> |
||
+ | X = undefined |
||
− | <td align="left"></td> |
||
+ | |- |
||
− | <td align="left">argument</td> |
||
+ | | _LVOIEEESPCosh |
||
− | <td align="left">radian</td> |
||
+ | | D0 = IEEE single-precision argument in radians |
||
− | <td align="left">Z = undefined</td> |
||
+ | | D0 = IEEE hyperbolic cosine |
||
− | </tr> |
||
+ | | N = undefined<br/> |
||
− | <tr class="odd"> |
||
+ | Z = undefined<br/> |
||
− | <td align="left"></td> |
||
+ | V = undefined<br/> |
||
− | <td align="left"></td> |
||
+ | C = undefined<br/> |
||
− | <td align="left"></td> |
||
− | + | X = undefined |
|
+ | |- |
||
− | </tr> |
||
+ | | _LVOIEEESPTanh |
||
− | <tr class="even"> |
||
+ | | D0 = IEEE single-precision argument in radians |
||
− | <td align="left"></td> |
||
+ | | D0 = IEEE hyperbolic tangent |
||
− | <td align="left"></td> |
||
+ | | N = undefined<br/> |
||
− | <td align="left"></td> |
||
− | + | Z = undefined<br/> |
|
+ | V = undefined<br/> |
||
− | </tr> |
||
+ | C = undefined<br/> |
||
− | <tr class="odd"> |
||
+ | X = undefined |
||
− | <td align="left"></td> |
||
+ | |- |
||
− | <td align="left"></td> |
||
+ | | _LVOIEEESPExp |
||
− | <td align="left"></td> |
||
+ | | D0 = IEEE single-precision argument |
||
− | <td align="left">X = undefined</td> |
||
+ | | D0 = IEEE exponential |
||
− | </tr> |
||
+ | | N = undefined<br/> |
||
− | <tr class="even"> |
||
+ | Z = undefined<br/> |
||
− | <td align="left">_LVOIEEESPSin</td> |
||
+ | V = undefined<br/> |
||
− | <td align="left">D0 = IEEE single-precision</td> |
||
+ | C = undefined<br/> |
||
− | <td align="left">D0 = IEEE sine</td> |
||
− | + | X = undefined |
|
+ | |- |
||
− | </tr> |
||
+ | | _LVOIEEESPLog |
||
− | <tr class="odd"> |
||
+ | | D0 = IEEE single-precision argument |
||
− | <td align="left"></td> |
||
+ | | D0 = IEEE natural logarithm |
||
− | <td align="left">argument in radians</td> |
||
+ | | N = undefined<br/> |
||
− | <td align="left"></td> |
||
− | + | Z = undefined<br/> |
|
+ | V = undefined<br/> |
||
− | </tr> |
||
+ | C = undefined<br/> |
||
− | <tr class="even"> |
||
+ | X = undefined |
||
− | <td align="left"></td> |
||
+ | |- |
||
− | <td align="left"></td> |
||
+ | | _LVOIEEESPLog10 |
||
− | <td align="left"></td> |
||
+ | | D0 = IEEE single-precision argument |
||
− | <td align="left">V = undefined</td> |
||
+ | | D0 = IEEE logarithm (base 10) |
||
− | </tr> |
||
+ | | N = undefined<br/> |
||
− | <tr class="odd"> |
||
+ | Z = undefined<br/> |
||
− | <td align="left"></td> |
||
+ | V = undefined<br/> |
||
− | <td align="left"></td> |
||
+ | C = undefined<br/> |
||
− | <td align="left"></td> |
||
− | + | X = undefined |
|
+ | |- |
||
− | </tr> |
||
+ | | _LVOIEEESPPow |
||
− | <tr class="even"> |
||
+ | | D0 = IEEE single-precision exponent value<br/> |
||
− | <td align="left"></td> |
||
+ | D1 = IEEE single-precision argument value |
||
− | <td align="left"></td> |
||
+ | | D0 = IEEE result of arg taken to exp power |
||
− | <td align="left"></td> |
||
− | + | | N = undefined<br/> |
|
+ | Z = undefined<br/> |
||
− | </tr> |
||
+ | V = undefined<br/> |
||
− | <tr class="odd"> |
||
+ | C = undefined<br/> |
||
− | <td align="left">_LVOIEEESPCos</td> |
||
+ | X = undefined |
||
− | <td align="left">D0 = IEEE single-precision</td> |
||
+ | |- |
||
− | <td align="left">D0 = IEEE cosine</td> |
||
+ | | _LVOIEEESPSqrt |
||
− | <td align="left">N = undefined</td> |
||
+ | | D0 = IEEE single-precision argument |
||
− | </tr> |
||
+ | | D0 = IEEE square root |
||
− | <tr class="even"> |
||
+ | | N = undefined<br/> |
||
− | <td align="left"></td> |
||
+ | Z = undefined<br/> |
||
− | <td align="left">argument in radians</td> |
||
+ | V = undefined<br/> |
||
− | <td align="left"></td> |
||
− | + | C = undefined<br/> |
|
+ | X = undefined |
||
− | </tr> |
||
+ | |} |
||
− | <tr class="odd"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">V = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">C = undefined</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">X = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left">_LVOIEEESPTan</td> |
||
− | <td align="left">D0 = IEEE single-precision</td> |
||
− | <td align="left">D0 = IEEE tangent</td> |
||
− | <td align="left">N = undefined</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left"></td> |
||
− | <td align="left">argument in radians</td> |
||
− | <td align="left"></td> |
||
− | <td align="left">Z = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">V = undefined</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">C = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">X = undefined</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left">_LVOIEEESPSincos</td> |
||
− | <td align="left">A0 = Address to store</td> |
||
− | <td align="left">D0 = IEEE sine</td> |
||
− | <td align="left">N = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left"></td> |
||
− | <td align="left">cosine result</td> |
||
− | <td align="left">(A0) = IEEE cosine</td> |
||
− | <td align="left">Z = undefined</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left"></td> |
||
− | <td align="left">D0 = IEEE argument</td> |
||
− | <td align="left"></td> |
||
− | <td align="left">V = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left"></td> |
||
− | <td align="left">in radians</td> |
||
− | <td align="left"></td> |
||
− | <td align="left">C = undefined</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">X = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left">_LVOIEEESPSinh</td> |
||
− | <td align="left">D0 = IEEE single-precision</td> |
||
− | <td align="left">D0 = IEEE hyperbolic</td> |
||
− | <td align="left">N = undefined</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left"></td> |
||
− | <td align="left">argument in radians</td> |
||
− | <td align="left">sine</td> |
||
− | <td align="left">Z = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">V = undefined</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">C = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">X = undefined</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left">_LVOIEEESPCosh</td> |
||
− | <td align="left">D0 = IEEE single-precision</td> |
||
− | <td align="left">D0 = IEEE hyperbolic</td> |
||
− | <td align="left">N = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left"></td> |
||
− | <td align="left">argument in radians</td> |
||
− | <td align="left">cosine</td> |
||
− | <td align="left">Z = undefined</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">V = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">C = undefined</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">X = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left">_LVOIEEESPTanh</td> |
||
− | <td align="left">D0 = IEEE single-precision</td> |
||
− | <td align="left">D0 = IEEE hyperbolic</td> |
||
− | <td align="left">N = undefined</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left"></td> |
||
− | <td align="left">argument in radians</td> |
||
− | <td align="left">tangent</td> |
||
− | <td align="left">Z = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">V = undefined</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">C = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">X = undefined</td> |
||
− | </tr> |
||
− | </tbody> |
||
− | </table> |
||
− | |||
− | '''SP IEEE Transcendental Assembly Functions (continued)''' |
||
− | |||
− | <table> |
||
− | <thead> |
||
− | <tr class="header"> |
||
− | <th align="left">Function</th> |
||
− | <th align="left">Input</th> |
||
− | <th align="left">Output</th> |
||
− | <th align="left">Condition Codes</th> |
||
− | </tr> |
||
− | </thead> |
||
− | <tbody> |
||
− | <tr class="odd"> |
||
− | <td align="left">_LVOIEEESPExp</td> |
||
− | <td align="left">D0 = IEEE single-precision</td> |
||
− | <td align="left">D0 = IEEE exponential</td> |
||
− | <td align="left">N = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left"></td> |
||
− | <td align="left">argument</td> |
||
− | <td align="left"></td> |
||
− | <td align="left">Z = undefined</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">V = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">C = undefined</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">X = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left">_LVOIEEESPLog</td> |
||
− | <td align="left">D0 = IEEE single-precision</td> |
||
− | <td align="left">D0 = IEEE natural</td> |
||
− | <td align="left">N = undefined</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left"></td> |
||
− | <td align="left">argument</td> |
||
− | <td align="left">logarithm</td> |
||
− | <td align="left">Z = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">V = undefined</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">C = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">X = undefined</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left">_LVOIEEESPLog10</td> |
||
− | <td align="left">D0 = IEEE single-precision</td> |
||
− | <td align="left">D0 = IEEE logarithm</td> |
||
− | <td align="left">N = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left"></td> |
||
− | <td align="left">argument</td> |
||
− | <td align="left">(base 10)</td> |
||
− | <td align="left">Z = undefined</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">V = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">C = undefined</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">X = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left">_LVOIEEESPPow</td> |
||
− | <td align="left">D0 = IEEE single-precision</td> |
||
− | <td align="left">D0 = IEEE result of arg</td> |
||
− | <td align="left">N = undefined</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left"></td> |
||
− | <td align="left">exponent value</td> |
||
− | <td align="left">taken to exp power</td> |
||
− | <td align="left">Z = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left"></td> |
||
− | <td align="left">D1 = IEEE single-precision</td> |
||
− | <td align="left"></td> |
||
− | <td align="left">V = undefined</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left"></td> |
||
− | <td align="left">argument value</td> |
||
− | <td align="left"></td> |
||
− | <td align="left">C = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">X = undefined</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left">_LVOIEEESPSqrt</td> |
||
− | <td align="left">D0 = IEEE single-precision</td> |
||
− | <td align="left">D0 = IEEE square root</td> |
||
− | <td align="left">N = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left"></td> |
||
− | <td align="left">argument</td> |
||
− | <td align="left"></td> |
||
− | <td align="left">Z = undefined</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">V = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">C = undefined</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">X = undefined</td> |
||
− | </tr> |
||
− | </tbody> |
||
− | </table> |
||
== IEEE Double-Precision Data Format == |
== IEEE Double-Precision Data Format == |
||
Line 1,612: | Line 1,283: | ||
== IEEE Double-Precision Basic Math Library == |
== IEEE Double-Precision Basic Math Library == |
||
− | The IEEE double-precision basic math library contains entries for the basic IEEE mathematics functions, such as add, subtract, and divide. This library resides on disk and is opened by calling OpenLibrary() with "mathieeedoubbas.library" as the argument. Do not share the library base pointer between tasks |
+ | The IEEE double-precision basic math library contains entries for the basic IEEE mathematics functions, such as add, subtract, and divide. This library resides on disk and is opened by calling OpenLibrary() with "mathieeedoubbas.library" as the argument. Do not share the library base pointer between tasks - see note at beginning of chapter for details. |
+ | <syntaxhighlight> |
||
− | <pre>#include <exec/types.h> |
||
− | #include |
+ | #include <exec/types.h> |
+ | #include <libraries/mathieeedp.h> |
||
− | #include |
+ | #include <clib/mathdoubbas_protos.h> |
struct Library *MathIeeeDoubBasBase; |
struct Library *MathIeeeDoubBasBase; |
||
Line 1,624: | Line 1,296: | ||
{ |
{ |
||
/* do not share base pointer between tasks. */ |
/* do not share base pointer between tasks. */ |
||
− | if (MathIeeeDoubBasBase = OpenLibrary( |
+ | if (MathIeeeDoubBasBase = OpenLibrary("mathieeedoubbas.library", 34)) |
{ |
{ |
||
. . . |
. . . |
||
Line 1,630: | Line 1,302: | ||
CloseLibrary(MathIeeeDoubBasBase); |
CloseLibrary(MathIeeeDoubBasBase); |
||
} |
} |
||
− | else printf( |
+ | else printf("Can't open mathieeedoubbas.library\n"); |
+ | } |
||
− | }</pre> |
||
+ | </syntaxhighlight> |
||
+ | |||
The global variable MathIeeeDoubBasBase is used internally for all future library references. |
The global variable MathIeeeDoubBasBase is used internally for all future library references. |
||
Line 1,638: | Line 1,312: | ||
=== DP IEEE Basic Functions === |
=== DP IEEE Basic Functions === |
||
+ | ; IEEEDPAbs() DOUBLE IEEEDPAbs( DOUBLE parm ); |
||
− | Take absolute value of IEEE double-precision variable. |
||
+ | : Take absolute value of IEEE double-precision variable. |
||
+ | ; IEEEDPAdd() DOUBLE IEEEDPAdd( DOUBLE leftParm, DOUBLE rightParm ); |
||
− | Add two IEEE double-precision variables. |
||
+ | : Add two IEEE double-precision variables. |
||
+ | ; IEEEDPCeil() DOUBLE IEEEDPCeil( DOUBLE parm ); |
||
− | Compute least integer greater than or equal to variable. |
||
+ | : Compute least integer greater than or equal to variable. |
||
+ | ; IEEEDPCmp() LONG IEEEDPCmp( DOUBLE leftParm, DOUBLE rightParm ); |
||
− | Compare two IEEE double-precision variables. |
||
+ | : Compare two IEEE double-precision variables. |
||
+ | ; IEEEDPDiv() DOUBLE IEEEDPDiv( DOUBLE dividend, DOUBLE divisor ); |
||
− | Divide two IEEE double-precision variables. |
||
+ | : Divide two IEEE double-precision variables. |
||
+ | ; IEEEDPFix() LONG IEEEDPFix( DOUBLE parm ); |
||
− | Convert IEEE double-precision variable to integer. |
||
+ | : Convert IEEE double-precision variable to integer. |
||
+ | ; IEEEDPFloor() DOUBLE IEEEDPFloor( DOUBLE parm ); |
||
− | Compute largest integer less than or equal to variable. |
||
+ | : Compute largest integer less than or equal to variable. |
||
+ | ; IEEEDPFlt() DOUBLE IEEEDPFlt( long integer ); |
||
− | Convert integer variable to IEEE double-precision. |
||
+ | : Convert integer variable to IEEE double-precision. |
||
+ | ; IEEEDPMul() DOUBLE IEEEDPMul( DOUBLE factor1, DOUBLE factor2 ); |
||
− | Multiply two IEEE double-precision variables. |
||
+ | : Multiply two IEEE double-precision variables. |
||
+ | ; IEEEDPNeg() DOUBLE IEEEDPNeg( DOUBLE parm ); |
||
− | Take two‚Äôs complement of IEEE double-precision variable. |
||
+ | : Take two's complement of IEEE double-precision variable. |
||
+ | ; IEEEDPSub() DOUBLE IEEEDPSub( DOUBLE leftParm, DOUBLE rightParm ); |
||
− | Subtract two IEEE double-precision variables. |
||
+ | : Subtract two IEEE double-precision variables. |
||
+ | ; IEEEDPTst() LONG IEEEDPTst( DOUBLE parm ); |
||
− | Test an IEEE double-precision variable against zero. |
||
+ | : Test an IEEE double-precision variable against zero. |
||
Be sure to include proper data type definitions, as shown in the example below. |
Be sure to include proper data type definitions, as shown in the example below. |
||
+ | <syntaxhighlight> |
||
− | <pre>#include <exec/types.h> |
||
− | #include |
+ | #include <exec/types.h> |
+ | #include <libraries/mathieeedp.h> |
||
− | #include |
+ | #include <clib/mathieeedoubbas_protos.h> |
struct Library *MathIeeeDoubBasBase; |
struct Library *MathIeeeDoubBasBase; |
||
Line 1,676: | Line 1,363: | ||
LONG i1; |
LONG i1; |
||
− | if (MathIeeeDoubBasBase = OpenLibrary( |
+ | if (MathIeeeDoubBasBase = OpenLibrary("mathieeedoubbas.library",34)) |
{ |
{ |
||
Line 1,694: | Line 1,381: | ||
CloseLibrary(MathIeeeDoubBasBase); |
CloseLibrary(MathIeeeDoubBasBase); |
||
} |
} |
||
− | else printf( |
+ | else printf("Can't open mathieeedoubbas.library\n"); |
+ | } |
||
− | }</pre> |
||
+ | </syntaxhighlight> |
||
+ | |||
The Amiga assembly language interface to the IEEE double-precision floating-point basic math routines is shown below, including some details about how the system flags are affected by each operation. The access mechanism from assembly language is: |
The Amiga assembly language interface to the IEEE double-precision floating-point basic math routines is shown below, including some details about how the system flags are affected by each operation. The access mechanism from assembly language is: |
||
+ | <pre> |
||
− | <pre>MOVEA.L _MathIeeeDoubBasBase,A6 |
||
+ | MOVEA.L _MathIeeeDoubBasBase,A6 |
||
− | JSR _LVOIEEEDPFix(A6)</pre> |
||
+ | JSR _LVOIEEEDPFix(A6) |
||
− | '''DP IEEE Basic Assembly Functions''' |
||
+ | </pre> |
||
+ | {| class="wikitable" |
||
− | <table> |
||
+ | |+ DP IEEE Basic Assembly Functions |
||
− | <thead> |
||
+ | ! Function |
||
− | <tr class="header"> |
||
+ | ! Input |
||
− | <th align="left">Function</th> |
||
+ | ! Output |
||
− | <th align="left">Input</th> |
||
+ | ! Condition Codes |
||
− | <th align="left">Output</th> |
||
+ | |- |
||
− | <th align="left">Condition Codes</th> |
||
+ | | _LVOIEEEDPFix |
||
− | </tr> |
||
+ | | D0/D1 = IEEE double-precision argument |
||
− | </thead> |
||
+ | | D0 = Integer (two's complement) |
||
− | <tbody> |
||
+ | | N = undefined<br/> |
||
− | <tr class="odd"> |
||
+ | Z = undefined<br/> |
||
− | <td align="left">_LVOIEEEDPFix</td> |
||
+ | V = undefined<br/> |
||
− | <td align="left">D0/D1 = IEEE</td> |
||
+ | C = undefined<br/> |
||
− | <td align="left">D0 = Integer</td> |
||
− | + | X = undefined |
|
+ | |- |
||
− | </tr> |
||
+ | | _LVOIEEEDPFl |
||
− | <tr class="even"> |
||
+ | | D0 = Integer (two's complement) argument |
||
− | <td align="left"></td> |
||
− | + | | D0/D1 = IEEE double-precision |
|
+ | | N = undefined<br/> |
||
− | <td align="left">(two‚Äôs complement)</td> |
||
− | + | Z = undefined<br/> |
|
+ | V = undefined<br/> |
||
− | </tr> |
||
+ | C = undefined<br/> |
||
− | <tr class="odd"> |
||
+ | X = undefined |
||
− | <td align="left"></td> |
||
+ | |- |
||
− | <td align="left">argument</td> |
||
+ | | _LVOIEEEDPCmp |
||
− | <td align="left"></td> |
||
+ | | D0/D1 = IEEE double-precision argument 1<br/> |
||
− | <td align="left">V = undefined</td> |
||
+ | D2/D3 = IEEE double-precision argument 2 |
||
− | </tr> |
||
+ | | D0 = +1 if arg1 > arg2<br/> |
||
− | <tr class="even"> |
||
+ | D0 = -1 if arg1 < arg2<br/> |
||
− | <td align="left"></td> |
||
+ | D0 = 0 if arg1 = arg2 |
||
− | <td align="left"></td> |
||
+ | | N = 1 if result is negative<br/> |
||
− | <td align="left"></td> |
||
+ | Z = 1 if result is zero<br/> |
||
− | <td align="left">C = undefined</td> |
||
− | </ |
+ | V = 0<br/> |
+ | C = undefined<br/> |
||
− | <tr class="odd"> |
||
+ | X = undefined<br/> |
||
− | <td align="left"></td> |
||
− | + | GT = arg2 > arg1<br/> |
|
+ | GE = arg2 >= arg1<br/> |
||
− | <td align="left"></td> |
||
− | + | EQ = arg2 = arg1<br/> |
|
+ | NE = arg2 != arg1<br/> |
||
− | </tr> |
||
+ | LT = arg2 < arg1<br/> |
||
− | <tr class="even"> |
||
+ | LE = arg2 <= arg1 |
||
− | <td align="left">_LVOIEEEDPFl</td> |
||
+ | |- |
||
− | <td align="left">D0 = Integer (two‚Äôs</td> |
||
+ | | _LVOIEEEDPTst |
||
− | <td align="left">D0/D1 = IEEE</td> |
||
+ | | D0/D1 = IEEE double-precision argument |
||
− | <td align="left">N = undefined</td> |
||
+ | | D0 = +1 if arg > 0.0<br/> |
||
− | </tr> |
||
+ | D0 = -1 if arg < 0.0<br/> |
||
− | <tr class="odd"> |
||
+ | D0 = 0 if arg = 0.0 |
||
− | <td align="left"></td> |
||
+ | | N = 1 if result is negative<br/> |
||
− | <td align="left">complement) argument</td> |
||
+ | Z = 1 if result is zero<br/> |
||
− | <td align="left">double-precision</td> |
||
+ | V = 0<br/> |
||
− | <td align="left">Z = undefined</td> |
||
+ | C = undefined<br/> |
||
− | </tr> |
||
+ | X = undefined<br/> |
||
− | <tr class="even"> |
||
+ | EQ = arg = 0.0<br/> |
||
− | <td align="left"></td> |
||
+ | NE = arg != 0.0<br/> |
||
− | <td align="left"></td> |
||
− | + | PL = arg >= 0.0<br/> |
|
+ | MI = arg < 0.0 |
||
− | <td align="left">V = undefined</td> |
||
+ | |- |
||
− | </tr> |
||
+ | | _LVOIEEEDPAbs |
||
− | <tr class="odd"> |
||
+ | | D0/D1 = IEEE double-precision argument |
||
− | <td align="left"></td> |
||
+ | | D0/D1 = IEEE double-precision absolute value |
||
− | <td align="left"></td> |
||
+ | | N = undefined<br/> |
||
− | <td align="left"></td> |
||
− | + | Z = undefined<br/> |
|
+ | V = undefined<br/> |
||
− | </tr> |
||
+ | C = undefined<br/> |
||
− | <tr class="even"> |
||
+ | X = undefined |
||
− | <td align="left"></td> |
||
+ | |- |
||
− | <td align="left"></td> |
||
+ | | _LVOIEEEDPNeg |
||
− | <td align="left"></td> |
||
+ | | D0/D1 = IEEE double-precision argument |
||
− | <td align="left">X = undefined</td> |
||
+ | | D0/D1 = IEEE double-precision negated |
||
− | </tr> |
||
+ | | N = undefined<br/> |
||
− | <tr class="odd"> |
||
+ | Z = undefined<br/> |
||
− | <td align="left">_LVOIEEEDPCmp</td> |
||
+ | V = undefined<br/> |
||
− | <td align="left">D0/D1 = IEEE</td> |
||
+ | C = undefined<br/> |
||
− | <td align="left">D0 = +1 if arg1 <math>></math> arg2</td> |
||
+ | X = undefined |
||
− | <td align="left">N = 1 if result is negative</td> |
||
+ | |- |
||
− | </tr> |
||
+ | | _LVOIEEEDPAdd |
||
− | <tr class="even"> |
||
+ | | D0/D1 = IEEE double-precision argument 1<br/> |
||
− | <td align="left"></td> |
||
− | + | D2/D3 = IEEE double-precision argument 2 |
|
+ | | D0/D1 = IEEE double-precision addition of arg1+arg2 |
||
− | <td align="left">D0 = -1 if arg1 <math><</math> arg2</td> |
||
+ | | N = undefined<br/> |
||
− | <td align="left">Z = 1 if result is zero</td> |
||
+ | Z = undefined<br/> |
||
− | </tr> |
||
+ | V = undefined<br/> |
||
− | <tr class="odd"> |
||
+ | C = undefined<br/> |
||
− | <td align="left"></td> |
||
+ | X = undefined |
||
− | <td align="left">argument 1</td> |
||
+ | |- |
||
− | <td align="left">D0 = 0 if arg1 = arg2</td> |
||
+ | | _LVOIEEEDPSub |
||
− | <td align="left">V = 0</td> |
||
+ | | D0/D1 = IEEE double-precision argument 1<br/> |
||
− | </tr> |
||
+ | D2/D3 = IEEE double-precision argument 2 |
||
− | <tr class="even"> |
||
+ | | D0/D1 = IEEE double-precision subtraction of arg1-arg2 |
||
− | <td align="left"></td> |
||
+ | | N = undefined<br/> |
||
− | <td align="left">D2/D3 = IEEE</td> |
||
+ | Z = undefined<br/> |
||
− | <td align="left"></td> |
||
− | + | V = undefined<br/> |
|
+ | C = undefined<br/> |
||
− | </tr> |
||
+ | X = undefined |
||
− | <tr class="odd"> |
||
+ | |- |
||
− | <td align="left"></td> |
||
+ | | _LVOIEEEDPMul |
||
− | <td align="left">double-precision</td> |
||
+ | | D0/D1 = IEEE double-precision argument 1<br/> |
||
− | <td align="left"></td> |
||
+ | D2/D3 = IEEE double-precision argument 2 |
||
− | <td align="left">X = undefined</td> |
||
+ | | D0/D1 = IEEE double-precision multiplication of arg1*arg2 |
||
− | </tr> |
||
+ | | N = undefined<br/> |
||
− | <tr class="even"> |
||
+ | Z = undefined<br/> |
||
− | <td align="left"></td> |
||
+ | V = undefined<br/> |
||
− | <td align="left">argument 2</td> |
||
+ | C = undefined<br/> |
||
− | <td align="left"></td> |
||
+ | X = undefined |
||
− | <td align="left">GT = arg2 <math>></math> arg1</td> |
||
+ | |- |
||
− | </tr> |
||
+ | | _LVOIEEEDPDiv |
||
− | <tr class="odd"> |
||
+ | | D0/D1 = IEEE double-precision argument 1<br/> |
||
− | <td align="left"></td> |
||
+ | D2/D3 = IEEE double-precision argument 2 |
||
− | <td align="left"></td> |
||
+ | | D0/D1 = IEEE double-precision division of arg1/arg2 |
||
− | <td align="left"></td> |
||
+ | | N = undefined<br/> |
||
− | <td align="left">GE = arg2 <math>\ge</math> arg1</td> |
||
+ | Z = undefined<br/> |
||
− | </tr> |
||
+ | V = undefined<br/> |
||
− | <tr class="even"> |
||
+ | C = undefined<br/> |
||
− | <td align="left"></td> |
||
+ | X = undefined |
||
− | <td align="left"></td> |
||
+ | |- |
||
− | <td align="left"></td> |
||
+ | | _LVOIEEEDPCeil |
||
− | <td align="left">EQ = arg2 = arg1</td> |
||
+ | | D0/D1 = IEEE double-precision argument |
||
− | </tr> |
||
+ | | D0/D1 = least integer >= argument |
||
− | <tr class="odd"> |
||
+ | | N = undefined<br/> |
||
− | <td align="left"></td> |
||
+ | Z = undefined<br/> |
||
− | <td align="left"></td> |
||
+ | V = undefined<br/> |
||
− | <td align="left"></td> |
||
+ | C = undefined<br/> |
||
− | <td align="left">NE = arg2 <math>\not=</math> arg1</td> |
||
+ | X = undefined |
||
− | </tr> |
||
+ | |- |
||
− | <tr class="even"> |
||
+ | | _LVOIEEEDPFloor |
||
− | <td align="left"></td> |
||
+ | | D0/D1 = IEEE double-precision argument |
||
− | <td align="left"></td> |
||
+ | | D0/D1 = largest integer <= argument |
||
− | <td align="left"></td> |
||
+ | | N = undefined<br/> |
||
− | <td align="left">LT = arg2 <math><</math> arg1</td> |
||
+ | Z = undefined<br/> |
||
− | </tr> |
||
+ | V = undefined<br/> |
||
− | <tr class="odd"> |
||
+ | C = undefined<br/> |
||
− | <td align="left"></td> |
||
+ | X = undefined |
||
− | <td align="left"></td> |
||
+ | |} |
||
− | <td align="left"></td> |
||
− | <td align="left">LE = arg2 <math>\le</math> arg1</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left">_LVOIEEEDPTst</td> |
||
− | <td align="left">D0/D1 = IEEE</td> |
||
− | <td align="left">D0 = +1 if arg <math>></math> 0.0</td> |
||
− | <td align="left">N = 1 if result is negative</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left"></td> |
||
− | <td align="left">double-precision</td> |
||
− | <td align="left">D0 = -1 if arg <math><</math> 0.0</td> |
||
− | <td align="left">Z = 1 if result is zero</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left"></td> |
||
− | <td align="left">argument</td> |
||
− | <td align="left">D0 = 0 if arg = 0.0</td> |
||
− | <td align="left">V = 0</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">C = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">X = undefined</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">EQ = arg = 0.0</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">NE = arg <math>\not=</math> 0.0</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">PL = arg <math>\ge</math> 0.0</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">MI = arg <math><</math> 0.0</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left">_LVOIEEEDPAbs</td> |
||
− | <td align="left">D0/D1 = IEEE double-</td> |
||
− | <td align="left">D0/D1 = IEEE double-precision</td> |
||
− | <td align="left">N = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left"></td> |
||
− | <td align="left">precision argument</td> |
||
− | <td align="left">absolute value</td> |
||
− | <td align="left">Z = undefined</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">V = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">C = undefined</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">X = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left">_LVOIEEEDPNeg</td> |
||
− | <td align="left">D0/D1 = IEEE double-</td> |
||
− | <td align="left">D0/D1 = IEEE double-precision</td> |
||
− | <td align="left">N = undefined</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left"></td> |
||
− | <td align="left">precision argument</td> |
||
− | <td align="left">negated</td> |
||
− | <td align="left">Z = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">V = undefined</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">C = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">X = undefined</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left">_LVOIEEEDPAdd</td> |
||
− | <td align="left">D0/D1 = IEEE double-</td> |
||
− | <td align="left">D0/D1 = IEEE double-precision</td> |
||
− | <td align="left">N = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left"></td> |
||
− | <td align="left">precision argument 1</td> |
||
− | <td align="left">addition of arg1+arg2</td> |
||
− | <td align="left">Z = undefined</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">V = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left"></td> |
||
− | <td align="left">D2/D3 = IEEE double-</td> |
||
− | <td align="left"></td> |
||
− | <td align="left">C = undefined</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left"></td> |
||
− | <td align="left">precision argument 2</td> |
||
− | <td align="left"></td> |
||
− | <td align="left">X = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left">_LVOIEEEDPSub</td> |
||
− | <td align="left">D0/D1 = IEEE double-</td> |
||
− | <td align="left">D0/D1 = IEEE double-precision</td> |
||
− | <td align="left">N = undefined</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left"></td> |
||
− | <td align="left">precision argument 1</td> |
||
− | <td align="left">subtraction of arg1-arg2</td> |
||
− | <td align="left">Z = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">V = undefined</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left"></td> |
||
− | <td align="left">D2/D3 = IEEE double-</td> |
||
− | <td align="left"></td> |
||
− | <td align="left">C = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left"></td> |
||
− | <td align="left">precision argument 2</td> |
||
− | <td align="left"></td> |
||
− | <td align="left">X = undefined</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left">_LVOIEEEDPMul</td> |
||
− | <td align="left">D0/D1 = IEEE double-</td> |
||
− | <td align="left">D0/D1 = IEEE double-precision</td> |
||
− | <td align="left">N = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left"></td> |
||
− | <td align="left">precision argument 1</td> |
||
− | <td align="left">multiplication of arg1<math>\times</math>arg2</td> |
||
− | <td align="left">Z = undefined</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">V = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left"></td> |
||
− | <td align="left">D2/D3 = IEEE double-</td> |
||
− | <td align="left"></td> |
||
− | <td align="left">C = undefined</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left"></td> |
||
− | <td align="left">precision argument 2</td> |
||
− | <td align="left"></td> |
||
− | <td align="left">X = undefined</td> |
||
− | </tr> |
||
− | </tbody> |
||
− | </table> |
||
− | |||
− | '''DP IEEE Basic Assembly Functions (continued)''' |
||
− | |||
− | <table> |
||
− | <thead> |
||
− | <tr class="header"> |
||
− | <th align="left">Function</th> |
||
− | <th align="left">Input</th> |
||
− | <th align="left">Output</th> |
||
− | <th align="left">Condition Codes</th> |
||
− | </tr> |
||
− | </thead> |
||
− | <tbody> |
||
− | <tr class="odd"> |
||
− | <td align="left">_LVOIEEEDPDiv</td> |
||
− | <td align="left">D0/D1 = IEEE double-</td> |
||
− | <td align="left">D0/D1 = IEEE double-precision</td> |
||
− | <td align="left">N = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left"></td> |
||
− | <td align="left">precision argument 1</td> |
||
− | <td align="left">division of arg1/arg2</td> |
||
− | <td align="left">Z = undefined</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">V = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left"></td> |
||
− | <td align="left">D2/D3 = IEEE double-</td> |
||
− | <td align="left"></td> |
||
− | <td align="left">C = undefined</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left"></td> |
||
− | <td align="left">precision argument 2</td> |
||
− | <td align="left"></td> |
||
− | <td align="left">X = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left">_LVOIEEEDPCeil</td> |
||
− | <td align="left">D0/D1 = IEEE double-</td> |
||
− | <td align="left">D0/D1 = least integer</td> |
||
− | <td align="left">N = undefined</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left"></td> |
||
− | <td align="left">precision argument</td> |
||
− | <td align="left"><math>\ge</math> argument</td> |
||
− | <td align="left">Z = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">V = undefined</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">C = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">X = undefined</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left">_LVOIEEEDPFloor</td> |
||
− | <td align="left">D0/D1 = IEEE double-</td> |
||
− | <td align="left">D0/D1 = largest integer</td> |
||
− | <td align="left">N = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left"></td> |
||
− | <td align="left">precision argument</td> |
||
− | <td align="left"><math>\le</math> argument</td> |
||
− | <td align="left">Z = undefined</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">V = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">C = undefined</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">X = undefined</td> |
||
− | </tr> |
||
− | </tbody> |
||
− | </table> |
||
== IEEE Double-Precision Transcendental Math Library == |
== IEEE Double-Precision Transcendental Math Library == |
||
− | The IEEE double-precision transcendental math library contains entries for the transcendental math functions such as sine, cosine, and square root. The library resides on disk and is opened by calling OpenLibrary() with "mathieeedoubtrans.library" as the argument. Do not share the library base pointer between tasks |
+ | The IEEE double-precision transcendental math library contains entries for the transcendental math functions such as sine, cosine, and square root. The library resides on disk and is opened by calling OpenLibrary() with "mathieeedoubtrans.library" as the argument. Do not share the library base pointer between tasks - see note at beginning of chapter for details. |
+ | <syntaxhighlight> |
||
− | <pre>#include <exec/types.h> |
||
− | #include |
+ | #include <exec/types.h> |
+ | #include <libraries/mathieeedp.h> |
||
− | #include |
+ | #include <clib/mathdoubtrans_protos.h> |
struct Library *MathIeeeDoubTransBase; |
struct Library *MathIeeeDoubTransBase; |
||
Line 2,163: | Line 1,541: | ||
VOID main() |
VOID main() |
||
{ |
{ |
||
− | if (MathIeeeDoubTransBase = OpenLibrary( |
+ | if (MathIeeeDoubTransBase = OpenLibrary("mathieeedoubtrans.library",34)) |
{ |
{ |
||
. . . |
. . . |
||
Line 2,169: | Line 1,547: | ||
CloseLibrary(MathIeeeDoubTransBase); |
CloseLibrary(MathIeeeDoubTransBase); |
||
} |
} |
||
− | else printf( |
+ | else printf("Can't open mathieeedoubtrans.library\n"); |
+ | } |
||
− | }</pre> |
||
+ | </syntaxhighlight> |
||
+ | |||
The global variable MathIeeeDoubTransBase is used internally for all future library references. |
The global variable MathIeeeDoubTransBase is used internally for all future library references. |
||
Line 2,179: | Line 1,559: | ||
=== DP IEEE Transcendental Functions === |
=== DP IEEE Transcendental Functions === |
||
+ | ; IEEEDPAsin() DOUBLE IEEEDPAsin( DOUBLE parm ); |
||
− | Return arcsine of IEEE variable. |
||
+ | : Return arcsine of IEEE variable. |
||
+ | ; IEEEDPAcos() DOUBLE IEEEDPAcos( DOUBLE parm ); |
||
− | Return arccosine of IEEE variable. |
||
+ | : Return arccosine of IEEE variable. |
||
+ | ; IEEEDPAtan() DOUBLE IEEEDPAtan( DOUBLE parm ); |
||
− | Return arctangent of IEEE variable. |
||
+ | : Return arctangent of IEEE variable. |
||
+ | ; IEEEDPSin() DOUBLE IEEEDPSin( DOUBLE parm ); |
||
− | Return sine of IEEE variable. This function accepts an IEEE radian argument and returns the trigonometric sine value. |
||
+ | : Return sine of IEEE variable. This function accepts an IEEE radian argument and returns the trigonometric sine value. |
||
+ | ; IEEEDPCos() DOUBLE IEEEDPCos( DOUBLE parm ) |
||
− | Return cosine of IEEE variable. This function accepts an IEEE radian argument and returns the trigonometric cosine value. |
||
+ | : Return cosine of IEEE variable. This function accepts an IEEE radian argument and returns the trigonometric cosine value. |
||
+ | ; IEEEDPTan() DOUBLE IEEEDPTan( DOUBLE parm ); |
||
− | Return tangent of IEEE variable. This function accepts an IEEE radian argument and returns the trigonometric tangent value. |
||
+ | : Return tangent of IEEE variable. This function accepts an IEEE radian argument and returns the trigonometric tangent value. |
||
+ | ; IEEEDPSincos() DOUBLE IEEEDPSincos( DOUBLE *pf2, DOUBLE parm ); |
||
− | Return sine and cosine of IEEE variable. This function accepts an IEEE radian argument and returns the trigonometric sine as its result and the trigonometric cosine in the first parameter. |
||
+ | : Return sine and cosine of IEEE variable. This function accepts an IEEE radian argument and returns the trigonometric sine as its result and the trigonometric cosine in the first parameter. |
||
+ | ; IEEEDPSinh() DOUBLE IEEEDPSinh( DOUBLE parm ); |
||
− | Return hyperbolic sine of IEEE variable. |
||
+ | : Return hyperbolic sine of IEEE variable. |
||
+ | ; IEEEDPCosh() DOUBLE IEEEDPCosh( DOUBLE parm ); |
||
− | Return hyperbolic cosine of IEEE variable. |
||
+ | : Return hyperbolic cosine of IEEE variable. |
||
+ | ; IEEEDPTanh() DOUBLE IEEEDPTanh( DOUBLE parm ); |
||
− | Return hyperbolic tangent of IEEE variable. |
||
+ | : Return hyperbolic tangent of IEEE variable. |
||
+ | ; IEEEDPExp() DOUBLE IEEEDPExp( DOUBLE parm ); |
||
− | Return ''e'' to the IEEE variable power. This function accept an IEEE argument and returns the result representing the value of ''e'' (2.712828<math>\ldots</math>) raised to that power. |
||
+ | : Return ''e'' to the IEEE variable power. This function accept an IEEE argument and returns the result representing the value of ''e'' (2.712828...) raised to that power. |
||
+ | ; IEEEDPFieee() DOUBLE IEEEDPFieee( FLOAT single ); |
||
− | Convert IEEE single-precision number to IEEE double-precision number. |
||
+ | : Convert IEEE single-precision number to IEEE double-precision number. |
||
+ | ; IEEEDPLog() DOUBLE IEEEDPLog( DOUBLE parm ); |
||
− | Return natural log (base ''e'' of IEEE variable. |
||
+ | : Return natural log (base ''e'' of IEEE variable. |
||
+ | ; IEEEDPLog10() DOUBLE IEEEDPLog10( DOUBLE parm ); |
||
− | Return log (base 10) of IEEE variable. |
||
+ | : Return log (base 10) of IEEE variable. |
||
+ | ; IEEEDPPow() DOUBLE IEEEDPPow( DOUBLE exp, DOUBLE arg ); |
||
− | Return IEEE arg2 to IEEE arg1. |
||
+ | : Return IEEE arg2 to IEEE arg1. |
||
+ | ; IEEEDPSqrt() DOUBLE IEEEDPSqrt( DOUBLE parm ); |
||
− | Return square root of IEEE variable. |
||
+ | : Return square root of IEEE variable. |
||
+ | ; IEEEDPTieee() FLOAT IEEEDPTieee( DOUBLE parm ); |
||
− | Convert IEEE double-precision number to IEEE single-precision number. |
||
+ | : Convert IEEE double-precision number to IEEE single-precision number. |
||
Be sure to include proper data type definitions as shown below. |
Be sure to include proper data type definitions as shown below. |
||
+ | <syntaxhighlight> |
||
− | <pre>#include <exec/types.h> |
||
− | #include |
+ | #include <exec/types.h> |
− | #include |
+ | #include <libraries/mathieeedp.h> |
+ | #include <clib/mathdoubtrans_protos.h> |
||
struct Library *MathIeeeDoubTransBase; |
struct Library *MathIeeeDoubTransBase; |
||
Line 2,226: | Line 1,624: | ||
FLOAT f1; |
FLOAT f1; |
||
− | if (MathIeeeDoubTransBase = OpenLibrary( |
+ | if (MathIeeeDoubTransBase = OpenLibrary("mathieeedoubtrans.library",34)) |
{ |
{ |
||
d1 = IEEEDPAsin(d2); /* Call IEEEDPAsin entry */ |
d1 = IEEEDPAsin(d2); /* Call IEEEDPAsin entry */ |
||
Line 2,234: | Line 1,632: | ||
d1 = IEEEDPCos(d2); /* Call IEEEDPCos entry */ |
d1 = IEEEDPCos(d2); /* Call IEEEDPCos entry */ |
||
d1 = IEEEDPTan(d2); /* Call IEEEDPTan entry */ |
d1 = IEEEDPTan(d2); /* Call IEEEDPTan entry */ |
||
− | d1 = IEEEDPSincos(& |
+ | d1 = IEEEDPSincos(&d3, d2); /* Call IEEEDPSincos entry */ |
d1 = IEEEDPSinh(d2); /* Call IEEEDPSinh entry */ |
d1 = IEEEDPSinh(d2); /* Call IEEEDPSinh entry */ |
||
d1 = IEEEDPCosh(d2); /* Call IEEEDPCosh entry */ |
d1 = IEEEDPCosh(d2); /* Call IEEEDPCosh entry */ |
||
Line 2,248: | Line 1,646: | ||
CloseLibrary(MathIeeeDoubTransBase); |
CloseLibrary(MathIeeeDoubTransBase); |
||
} |
} |
||
− | else printf( |
+ | else printf("Can't open mathieeedoubtrans.library\n"); |
+ | } |
||
− | }</pre> |
||
+ | </syntaxhighlight> |
||
+ | |||
The section below describes the Amiga assembly interface to the IEEE double-precision transcendental math library. The access mechanism from assembly language is: |
The section below describes the Amiga assembly interface to the IEEE double-precision transcendental math library. The access mechanism from assembly language is: |
||
+ | <pre> |
||
− | <pre>MOVEA.L _MathIeeeDoubTransBase,A6 |
||
+ | MOVEA.L _MathIeeeDoubTransBase,A6 |
||
− | JSR _LVOIEEEDPAsin(A6)</pre> |
||
+ | JSR _LVOIEEEDPAsin(A6) |
||
− | '''DP IEEE Transcendental Assembly Functions''' |
||
+ | </pre> |
||
+ | {| class="wikitable" |
||
− | <table> |
||
+ | |+ DP IEEE Transcendental Assembly Functions |
||
− | <thead> |
||
+ | ! Function |
||
− | <tr class="header"> |
||
+ | ! Input |
||
− | <th align="left">Function</th> |
||
+ | ! Output |
||
− | <th align="left">Input</th> |
||
+ | ! Condition Codes |
||
− | <th align="left">Output</th> |
||
+ | |- |
||
− | <th align="left">Condition Codes</th> |
||
+ | | _LVOIEEEDPAsin |
||
− | </tr> |
||
+ | | D0/D1 = IEEE argument |
||
− | </thead> |
||
+ | | D0/D1 = IEEE arcsine radian |
||
− | <tbody> |
||
+ | | N = undefined<br/> |
||
− | <tr class="odd"> |
||
+ | Z = undefined<br/> |
||
− | <td align="left">_LVOIEEEDPAsin</td> |
||
+ | V = undefined<br/> |
||
− | <td align="left">D0/D1 = IEEE argument</td> |
||
+ | C = undefined<br/> |
||
− | <td align="left">D0/D1 = IEEE</td> |
||
− | + | X = undefined |
|
+ | |- |
||
− | </tr> |
||
+ | | _LVOIEEEDPAcos |
||
− | <tr class="even"> |
||
+ | | D0/D1 = IEEE argument |
||
− | <td align="left"></td> |
||
+ | | D0/D1 = IEEE arccosine radian |
||
− | <td align="left"></td> |
||
+ | | N = undefined<br/> |
||
− | <td align="left">arcsine radian</td> |
||
− | + | Z = undefined<br/> |
|
+ | V = undefined<br/> |
||
− | </tr> |
||
+ | C = undefined<br/> |
||
− | <tr class="odd"> |
||
+ | X = undefined |
||
− | <td align="left"></td> |
||
+ | |- |
||
− | <td align="left"></td> |
||
+ | | _LVOIEEEDPAtan |
||
− | <td align="left"></td> |
||
+ | | D0/D1 = IEEE argument |
||
− | <td align="left">V = undefined</td> |
||
+ | | D0/D1 = IEEE arctangent radian |
||
− | </tr> |
||
+ | | N = undefined<br/> |
||
− | <tr class="even"> |
||
+ | Z = undefined<br/> |
||
− | <td align="left"></td> |
||
+ | V = undefined<br/> |
||
− | <td align="left"></td> |
||
+ | C = undefined<br/> |
||
− | <td align="left"></td> |
||
− | + | X = undefined |
|
+ | |- |
||
− | </tr> |
||
+ | | _LVOIEEEDPSin |
||
− | <tr class="odd"> |
||
+ | | D0/D1 = IEEE argument in radians |
||
− | <td align="left"></td> |
||
+ | | D0/D1 = IEEE sine |
||
− | <td align="left"></td> |
||
+ | | N = undefined<br/> |
||
− | <td align="left"></td> |
||
− | + | Z = undefined<br/> |
|
+ | V = undefined<br/> |
||
− | </tr> |
||
+ | C = undefined<br/> |
||
− | <tr class="even"> |
||
+ | X = undefined |
||
− | <td align="left">_LVOIEEEDPAcos</td> |
||
+ | |- |
||
− | <td align="left">D0/D1 = IEEE argument</td> |
||
+ | | _LVOIEEEDPCos |
||
− | <td align="left">D0/D1 = IEEE</td> |
||
+ | | D0/D1 = IEEE argument in radians |
||
− | <td align="left">N = undefined</td> |
||
+ | | D0/D1 = IEEE cosine |
||
− | </tr> |
||
+ | | N = undefined<br/> |
||
− | <tr class="odd"> |
||
+ | Z = undefined<br/> |
||
− | <td align="left"></td> |
||
+ | V = undefined<br/> |
||
− | <td align="left"></td> |
||
+ | C = undefined<br/> |
||
− | <td align="left">arccosine radian</td> |
||
− | + | X = undefined |
|
+ | |- |
||
− | </tr> |
||
+ | | _LVOIEEEDPTan |
||
− | <tr class="even"> |
||
+ | | D0/D1 = IEEE argument in radians |
||
− | <td align="left"></td> |
||
+ | | D0/D1 = IEEE tangent |
||
− | <td align="left"></td> |
||
+ | | N = undefined<br/> |
||
− | <td align="left"></td> |
||
− | + | Z = undefined<br/> |
|
+ | V = undefined<br/> |
||
− | </tr> |
||
+ | C = undefined<br/> |
||
− | <tr class="odd"> |
||
+ | X = undefined |
||
− | <td align="left"></td> |
||
+ | |- |
||
− | <td align="left"></td> |
||
+ | | _LVOIEEEDPSincos |
||
− | <td align="left"></td> |
||
+ | | A0 = Address to store cosine result<br/> |
||
− | <td align="left">C = undefined</td> |
||
+ | D0/D1 = IEEE argument in radians |
||
− | </tr> |
||
+ | | D0/D1 = IEEE sine<br/> |
||
− | <tr class="even"> |
||
+ | (A0) = IEEE cosine |
||
− | <td align="left"></td> |
||
+ | | N = undefined<br/> |
||
− | <td align="left"></td> |
||
+ | Z = undefined<br/> |
||
− | <td align="left"></td> |
||
− | + | V = undefined<br/> |
|
+ | C = undefined<br/> |
||
− | </tr> |
||
+ | X = undefined |
||
− | <tr class="odd"> |
||
+ | |- |
||
− | <td align="left">_LVOIEEEDPAtan</td> |
||
+ | | _LVOIEEEDPSin |
||
− | <td align="left">D0/D1 = IEEE</td> |
||
− | + | | D0/D1 = IEEE argument in radians |
|
+ | | D0/D1 = IEEE hyperbolic sine |
||
− | <td align="left">N = undefined</td> |
||
+ | | N = undefined<br/> |
||
− | </tr> |
||
+ | Z = undefined<br/> |
||
− | <tr class="even"> |
||
+ | V = undefined<br/> |
||
− | <td align="left"></td> |
||
+ | C = undefined<br/> |
||
− | <td align="left">argument</td> |
||
+ | X = undefined |
||
− | <td align="left">radian</td> |
||
+ | |- |
||
− | <td align="left">Z = undefined</td> |
||
+ | | _LVOIEEEDPCosh |
||
− | </tr> |
||
+ | | D0/D1 = IEEE argument in radians |
||
− | <tr class="odd"> |
||
+ | | D0/D1 = IEEE hyperbolic cosine |
||
− | <td align="left"></td> |
||
+ | | N = undefined<br/> |
||
− | <td align="left"></td> |
||
+ | Z = undefined<br/> |
||
− | <td align="left"></td> |
||
− | + | V = undefined<br/> |
|
+ | C = undefined<br/> |
||
− | </tr> |
||
+ | X = undefined |
||
− | <tr class="even"> |
||
+ | |- |
||
− | <td align="left"></td> |
||
+ | | _LVOIEEEDPTanh |
||
− | <td align="left"></td> |
||
+ | | D0/D1 = IEEE argument in radians |
||
− | <td align="left"></td> |
||
+ | | D0/D1 = IEEE hyperbolic tangent |
||
− | <td align="left">C = undefined</td> |
||
+ | | N = undefined<br/> |
||
− | </tr> |
||
+ | Z = undefined<br/> |
||
− | <tr class="odd"> |
||
+ | V = undefined<br/> |
||
− | <td align="left"></td> |
||
+ | C = undefined<br/> |
||
− | <td align="left"></td> |
||
+ | X = undefined |
||
− | <td align="left"></td> |
||
+ | |- |
||
− | <td align="left">X = undefined</td> |
||
+ | | _LVOIEEEDPExp |
||
− | </tr> |
||
+ | | D0/D1 = IEEE argument |
||
− | <tr class="even"> |
||
+ | | D0/D1 = IEEE exponential |
||
− | <td align="left">_LVOIEEEDPSin</td> |
||
+ | | N = undefined<br/> |
||
− | <td align="left">D0/D1 = IEEE</td> |
||
+ | Z = undefined<br/> |
||
− | <td align="left">D0/D1 = IEEE sine</td> |
||
− | + | V = undefined<br/> |
|
+ | C = undefined<br/> |
||
− | </tr> |
||
+ | X = undefined |
||
− | <tr class="odd"> |
||
+ | |- |
||
− | <td align="left"></td> |
||
+ | | _LVOIEEEDPLog |
||
− | <td align="left">argument in</td> |
||
+ | | D0/D1 = IEEE argument |
||
− | <td align="left"></td> |
||
+ | | D0/D1 = IEEE natural logarithm |
||
− | <td align="left">Z = undefined</td> |
||
+ | | N = undefined<br/> |
||
− | </tr> |
||
+ | Z = undefined<br/> |
||
− | <tr class="even"> |
||
+ | V = undefined<br/> |
||
− | <td align="left"></td> |
||
+ | C = undefined<br/> |
||
− | <td align="left">radians</td> |
||
+ | X = undefined |
||
− | <td align="left"></td> |
||
+ | |- |
||
− | <td align="left">V = undefined</td> |
||
+ | | _LVOIEEEDPLog10 |
||
− | </tr> |
||
+ | | D0/D1 = IEEE argument |
||
− | <tr class="odd"> |
||
+ | | D0/D1 = IEEE logarithm (base 10) |
||
− | <td align="left"></td> |
||
+ | | N = undefined<br/> |
||
− | <td align="left"></td> |
||
+ | Z = undefined<br/> |
||
− | <td align="left"></td> |
||
− | + | V = undefined<br/> |
|
+ | C = undefined<br/> |
||
− | </tr> |
||
+ | X = undefined |
||
− | <tr class="even"> |
||
+ | |- |
||
− | <td align="left"></td> |
||
+ | | _LVOIEEEDPPow |
||
− | <td align="left"></td> |
||
+ | | D0/D1 = IEEE exponent<br/> |
||
− | <td align="left"></td> |
||
+ | D2/D3 = IEEE argument |
||
− | <td align="left">X = undefined</td> |
||
+ | | D0/D1 = IEEE result of arg taken to exp power |
||
− | </tr> |
||
+ | | N = undefined<br/> |
||
− | <tr class="odd"> |
||
+ | Z = undefined<br/> |
||
− | <td align="left">_LVOIEEEDPCos</td> |
||
+ | V = undefined<br/> |
||
− | <td align="left">D0/D1 = IEEE</td> |
||
+ | C = undefined<br/> |
||
− | <td align="left">D0/D1 = IEEE cosine</td> |
||
− | + | X = undefined |
|
+ | |- |
||
− | </tr> |
||
+ | | _LVOIEEEDPSqrt |
||
− | <tr class="even"> |
||
+ | | D0/D1 = IEEE argument |
||
− | <td align="left"></td> |
||
+ | | D0/D1 = IEEE square root |
||
− | <td align="left">argument in</td> |
||
+ | | N = undefined<br/> |
||
− | <td align="left"></td> |
||
− | + | Z = undefined<br/> |
|
+ | V = undefined<br/> |
||
− | </tr> |
||
+ | C = undefined<br/> |
||
− | <tr class="odd"> |
||
+ | X = undefined |
||
− | <td align="left"></td> |
||
+ | |- |
||
− | <td align="left">radians</td> |
||
+ | | _LVOIEEEDPTieee |
||
− | <td align="left"></td> |
||
+ | | D0/D1 = IEEE format argument |
||
− | <td align="left">V = undefined</td> |
||
+ | | D0 = single-precision IEEE floating-point format |
||
− | </tr> |
||
+ | | N = undefined<br/> |
||
− | <tr class="even"> |
||
+ | Z = undefined<br/> |
||
− | <td align="left"></td> |
||
+ | V = undefined<br/> |
||
− | <td align="left"></td> |
||
+ | C = undefined<br/> |
||
− | <td align="left"></td> |
||
− | + | X = undefined |
|
+ | |} |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">X = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left">_LVOIEEEDPTan</td> |
||
− | <td align="left">D0/D1 = IEEE</td> |
||
− | <td align="left">D0/D1 = IEEE tangent</td> |
||
− | <td align="left">N = undefined</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left"></td> |
||
− | <td align="left">argument in</td> |
||
− | <td align="left"></td> |
||
− | <td align="left">Z = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left"></td> |
||
− | <td align="left">radians</td> |
||
− | <td align="left"></td> |
||
− | <td align="left">V = undefined</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">C = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">X = undefined</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left">_LVOIEEEDPSincos</td> |
||
− | <td align="left">A0 = Address to</td> |
||
− | <td align="left">D0/D1 = IEEE sine</td> |
||
− | <td align="left">N = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left"></td> |
||
− | <td align="left">store cosine</td> |
||
− | <td align="left">(A0) = IEEE cosine</td> |
||
− | <td align="left">Z = undefined</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left"></td> |
||
− | <td align="left">result</td> |
||
− | <td align="left"></td> |
||
− | <td align="left">V = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left"></td> |
||
− | <td align="left">D0/D1 = IEEE</td> |
||
− | <td align="left"></td> |
||
− | <td align="left">C = undefined</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left"></td> |
||
− | <td align="left">argument in radians</td> |
||
− | <td align="left"></td> |
||
− | <td align="left">X = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left">_LVOIEEEDPSin</td> |
||
− | <td align="left">D0/D1 = IEEE argument</td> |
||
− | <td align="left">D0/D1 = IEEE hyperbolic</td> |
||
− | <td align="left">N = undefined</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left"></td> |
||
− | <td align="left">in radians</td> |
||
− | <td align="left">sine</td> |
||
− | <td align="left">Z = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">V = undefined</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">C = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">X = undefined</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left">_LVOIEEEDPCosh</td> |
||
− | <td align="left">D0/D1 = IEEE argument</td> |
||
− | <td align="left">D0/D1 = IEEE hyperbolic</td> |
||
− | <td align="left">N = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left"></td> |
||
− | <td align="left">in radians</td> |
||
− | <td align="left">cosine</td> |
||
− | <td align="left">Z = undefined</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">V = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">C = undefined</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">X = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left">_LVOIEEEDPTanh</td> |
||
− | <td align="left">D0/D1 = IEEE argument</td> |
||
− | <td align="left">D0/D1 = IEEE hyperbolic</td> |
||
− | <td align="left">N = undefined</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left"></td> |
||
− | <td align="left">in radians</td> |
||
− | <td align="left">tangent</td> |
||
− | <td align="left">Z = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">V = undefined</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">C = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">X = undefined</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left">_LVOIEEEDPExp</td> |
||
− | <td align="left">D0/D1 = IEEE argument</td> |
||
− | <td align="left">D0/D1 = IEEE exponential</td> |
||
− | <td align="left">N = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">Z = undefined</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">V = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">C = undefined</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">X = undefined</td> |
||
− | </tr> |
||
− | </tbody> |
||
− | </table> |
||
− | |||
− | '''DP IEEE Transcendental Assembly Functions (continued)''' |
||
− | |||
− | <table> |
||
− | <thead> |
||
− | <tr class="header"> |
||
− | <th align="left">Function</th> |
||
− | <th align="left">Input</th> |
||
− | <th align="left">Output</th> |
||
− | <th align="left">Condition Codes</th> |
||
− | </tr> |
||
− | </thead> |
||
− | <tbody> |
||
− | <tr class="odd"> |
||
− | <td align="left">_LVOIEEEDPLog</td> |
||
− | <td align="left">D0/D1 = IEEE argument</td> |
||
− | <td align="left">D0/D1 = IEEE natural</td> |
||
− | <td align="left">N = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">logarithm</td> |
||
− | <td align="left">Z = undefined</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">V = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">C = undefined</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">X = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left">_LVOIEEEDPLog10</td> |
||
− | <td align="left">D0/D1 = IEEE argument</td> |
||
− | <td align="left">D0/D1 = IEEE logarithm</td> |
||
− | <td align="left">N = undefined</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">(base 10)</td> |
||
− | <td align="left">Z = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">V = undefined</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">C = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">X = undefined</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left">_LVOIEEEDPPow</td> |
||
− | <td align="left">D0/D1 = IEEE exponent</td> |
||
− | <td align="left">D0/D1 = IEEE result of</td> |
||
− | <td align="left">N = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left"></td> |
||
− | <td align="left">D2/D3 = IEEE argument</td> |
||
− | <td align="left">arg taken to exp power</td> |
||
− | <td align="left">Z = undefined</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">V = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">C = undefined</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">X = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left">_LVOIEEEDPSqrt</td> |
||
− | <td align="left">D0/D1 = IEEE argument</td> |
||
− | <td align="left">D0/D1 = IEEE square root</td> |
||
− | <td align="left">N = undefined</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">Z = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">V = undefined</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">C = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">X = undefined</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left">_LVOIEEEDPTieee</td> |
||
− | <td align="left">D0/D1 = IEEE format</td> |
||
− | <td align="left">D0 = single-precision</td> |
||
− | <td align="left">N = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left"></td> |
||
− | <td align="left">argument</td> |
||
− | <td align="left">IEEE floating-point</td> |
||
− | <td align="left">Z = undefined</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">format</td> |
||
− | <td align="left">V = undefined</td> |
||
− | </tr> |
||
− | <tr class="even"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">C = undefined</td> |
||
− | </tr> |
||
− | <tr class="odd"> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left"></td> |
||
− | <td align="left">X = undefined</td> |
||
− | </tr> |
||
− | </tbody> |
||
− | </table> |
||
== Function Reference == |
== Function Reference == |
||
Line 2,918: | Line 1,966: | ||
|- |
|- |
||
| IEEESPNeg() |
| IEEESPNeg() |
||
− | | Take |
+ | | Take two's complement of IEEE single-precision variable |
|- |
|- |
||
| IEEESPSub() |
| IEEESPSub() |
||
Line 3,011: | Line 2,059: | ||
|- |
|- |
||
| IEEEDPNeg() |
| IEEEDPNeg() |
||
− | | Take |
+ | | Take two's complement of IEEE double-precision variable |
|- |
|- |
||
| IEEEDPSub() |
| IEEEDPSub() |
Latest revision as of 10:53, 3 August 2023
Contents
- 1 Introduction
- 2 Math Libraries
- 3 Math Libraries and Functions
- 4 FFP Floating Point Data Format
- 5 FFP Basic Mathematics Library
- 6 FFP Transcendental Mathematics Library
- 7 FFP Mathematics Conversion Library
- 8 IEEE Single-Precision Data Format
- 9 IEEE Single-Precision Basic Math Library
- 10 IEEE Single-Precision Transcendental Math Library
- 11 IEEE Double-Precision Data Format
- 12 IEEE Double-Precision Basic Math Library
- 13 IEEE Double-Precision Transcendental Math Library
- 14 Function Reference
Introduction
The math libraries described in this section are implemented in 68K assembly language and are designed to only be callable from 68K code. They are provided for backwards compatibility with pre-4.0 versions of AmigaOS.
For AmigaOS 4.0 and higher the math libraries you choose will depend on the application. A vast majority of the time the built-in math routines provided by the Newlib Library and built-in functions of GCC will suffice.
Math Libraries
This chapter describes the structure and calling sequences required to access the Motorola Fast Floating Point (FFP), the IEEE single-precision math libraries and the IEEE double-precision math libraries via the Amiga-supplied interfaces.
In its present state, the FFP library consists of three separate entities: the basic math library, the transcendental math library, and C and assembly-language interfaces to the basic math library plus FFP conversion functions. The IEEE single-precision and the double-precision libraries each presently consists of two entities: the basic math library and the transcendental math library.
Open Each Library Separately |
---|
Each Task using an IEEE math library must open the library itself. Library base pointers to these libraries may not be shared. Libraries can be context sensitive and may use the Task structure to keep track of the current context. Sharing of library bases by Tasks may seem to work in some systems. This is true for any of the IEEE math libraries. |
Depending on the compiler used, it is not always necessary to explicitly call the library functions for basic floating point operations as adding, subtracting, dividing, etc. Consult the manual supplied with the compiler for information regarding the compiler options for floating point functions.
Math Libraries and Functions
There are six math libraries providing functions ranging from adding two floating point numbers to calculating a hyperbolic cosine. They are:
- mathffp.library
- the basic function library
- mathtrans.library
- the FFP transcendental math library
- mathieeesingbas.library
- the IEEE single-precision library
- mathieesingtrans.library
- the IEEE single-precision transcendental library
- mathieeedoubbas.library
- the IEEE double-precision library
- mathieesingtrans.library
- the IEEE double-precision transcendental library
FFP Floating Point Data Format
FFP floating-point variables are defined within C by the float or FLOAT directive. In assembly language they are simply defined by a DC.L/DS.L statement. All FFP floating-point variables are defined as 32-bit entities (longwords) with the following format:
_____________________________________________ | | | MMMMMMMM MMMMMMMM MMMMMMMM EEEEEEE | | 31 23 15 7 | |_____________________________________________|
The mantissa is considered to be a binary fixed-point fraction; except for 0, it is always normalized (the mantissa is shifted over and the exponent adjusted, so that the mantissa has a 1 bit in its highest position). Thus, it represents a value of less than 1 but greater than or equal to 1/2.
The sign bit (bit 7) is reset (0) for a positive value and set (1) for a negative value.
The exponent is the power of two needed to correctly position the mantissa to reflect the number's true arithmetic value. It is held in excess-64 notation, which means that the two's-complement values are adjusted upward by 64, thus changing $40 (-64) through $3F (+63) to $00 through $7F. This facilitates comparisons among floating-point values.
The value of 0 is defined as all 32 bits being 0s. The sign, exponent, and mantissa are entirely cleared. Thus, 0s are always treated as positive.
The range allowed by this format is as follows:
- DECIMAL
- 9.22337177 * 10^18 > +VALUE > 5.42101070 * 10^-20
- -9.22337177 * 10^18 < -VALUE < -2.71050535 * 10^-20
- BINARY (HEXADECIMAL)
- .FFFFFF * 2^63 > +VALUE > .800000 * 2^-63
- -.FFFFFF * 2^63 < -VALUE < -.800000 * 2^-64
Remember that you cannot perform any arithmetic on these variables without using the fast floating-point libraries. The formats of the variables are incompatible with the arithmetic format of C-generated code; hence, all floating-point operations are performed through function calls.
FFP Basic Mathematics Library
The FFP basic math library contains entries for the basic mathematics functions such as add, subtract and divide. It resides in ROM and is opened by calling OpenLibrary() with "mathffp.library" as the argument.
#include <exec/types.h> #include <libraries/mathffp.h> #include <clib/mathffp_protos.h> struct Library *MathBase; VOID main() { if (MathBase = OpenLibrary("mathffp.library", 0)) { . . . CloseLibrary(MathBase); } else printf("Can't open mathffp.library\n"); }
The global variable MathBase is used internally for all future library references.
FFP Basic Functions
- SPAbs() FLOAT SPAbs( FLOAT parm );
- Take absolute value of FFP variable.
- SPAdd() FLOAT SPAdd( FLOAT leftParm, FLOAT rightParm);
- Add two FFP variables.
- SPCeil() FLOAT SPCeil( FLOAT parm );
- Computer largest integer less than or equal to variable.
- SPCmp() LONG SPCmp( FLOAT leftParm, FLOAT rightParm)
- Compare two FFP variables.
- SPDiv() FLOAT SPDiv( FLOAT leftParm, FLOAT rightParm);
- Divide two FFP variables.
- SPFix() LONG SPFix( FLOAT parm );
- Convert FFP variable to integer.
- SPFloor() FLOAT SPFloor( FLOAT parm );
- Compute least integer greater than or equal to variable.
- SPFlt() FLOAT SPFlt( long integer );
- Convert integer variable to FFP.
- SPMul() FLOAT SPMul( FLOAT leftParm, FLOAT rightParm);
- Multiply two FFP variables.
- SPNeg() FLOAT SPNeg( FLOAT parm );
- Take two's complement of FFP variable.
- SPSub() FLOAT SPSub( FLOAT leftParm, FLOAT rightParm);
- Subtract two FFP variables.
- SPTst() LONG SPTst( FLOAT parm );
- Test an FFP variable against zero.
Be sure to include the proper data type definitions shown below.
#include <exec/types.h> #include <libraries/mathffp.h> #include <clib/mathffp_protos.h> struct Library *MathBase; VOID main() { FLOAT f1, f2, f3; LONG i1; if (MathBase = OpenLibrary("mathffp.library", 0)) { i1 = SPFix(f1); /* Call SPFix entry */ f1 = SPFlt(i1); /* Call SPFlt entry */ if (SPCmp(f1,f2)) {}; /* Call SPCmp entry */ if (!(SPTst(f1))) {}; /* Call SPTst entry */ f1 = SPAbs(f2); /* Call SPAbs entry */ f1 = SPNeg(f2); /* Call SPNeg entry */ f1 = SPAdd(f2, f3); /* Call SPAdd entry */ f1 = SPSub(f2, f3); /* Call SPSub entry */ f1 = SPMul(f2, f3); /* Call SPMul entry */ f1 = SPDiv(f2, f3); /* Call SPDiv entry */ f1 = SPCeil(f2); /* Call SPCeil entry */ f1 = SPFloor(f2); /* Call SPFloor entry */ CloseLibrary(MathBase); } else printf("Can't open mathffp.library\n"); }
The assembly language interface to the FFP basic math routines is shown below, including some details about how the system flags are affected by each operation. The access mechanism is:
MOVEA.L _MathBase,A6 JSR _LVOSPFix(A6)
Function | Input | Output | Condition Codes |
---|---|---|---|
_LVOSPAbs | D0 = FFP argument | D0 = FFP absolute value | N = 0 Z = 1 if result is zero |
_LVOSPAdd | D1 = FFP argument 1 D0 = FFP addition |
D0 = FFP addition of arg1 + arg2 | N = 1 if result is negative Z = 1 if result is zero |
_LVOSPCeil | D0 = FFP argument | D0 = least integer >= arg | N = 1 if result is negative Z = 1 if result is zero |
_LVOSPCmp | D1 = FFP argument 1 D0 = FFP argument 2 |
D0 = +1 if arg1 > arg2 D0 = -1 if arg1 < arg2 |
N = 0 Z = 1 if result is zero |
_LVOSPDiv | D1 = FFP argument 1 D0 = FFP argument 2 |
D0 = FFP division of arg2/arg1 | N = 1 if result is negative Z = 1 if result is zero |
_LVOSPFix | D0 = FFP argument | D0 = Integer (two's complement) | N = 1 if result is negative Z = 1 if result is zero |
_LVOSPFloor | D0 = FFP argument | D0 = largest integer <= argument | N = 1 if result is negative
Z = 1 if result is zero |
_LVOSPFlt | D0 = Integer (two's complement) | D0 = FFP result | N = 1 if result is negative Z = 1 if result is zero |
_LVOSPMul | D0 = FFP argument 1 D1 = FFP argument 2 |
D0 = FFP multiplication of arg1 * arg2 | N = 1 if result is negative Z = 1 if result is zero |
_LVOSPNeg | D0 = FFP argument | D0 = FFP negated | N = 1 if result is negative Z = 1 if result is zero |
_LVOSPSub | D1 = FFP argument 1 D0 = FFP argument 2 |
D0 = FFP subtraction of arg2 - arg1 | N = 1 if result is negative Z = 1 if result is zero |
_LVOSPTst | D1 = FFP argument Note: This routine trashes the argument in D1. |
D0 = +1 if arg > 0.0 D0 = -1 if arg < 0.0 |
N = 1 if result is negative Z = 1 if result is zero |
FFP Transcendental Mathematics Library
The FFP transcendental math library contains entries for the transcendental math functions sine, cosine, and square root. It resides on disk and is opened by calling OpenLibrary() with "mathtrans.library" as the argument.
#include <exec/types.h> #include <libraries/mathffp.h> #include <clib/mathffp_protos.h> #include <clib/mathtrans_protos.h> struct Library *MathTransBase; VOID main() { if (MathTransBase = OpenLibrary("mathtrans.library",0)) { . . . CloseLibrary(MathTransBase); } else printf("Can't open mathtrans.library\n"); }
The global variable MathTransBase is used internally for all future library references. Note that the transcendental math library is dependent upon the basic math library, which it will open if it is not open already. If you want to use the basic math functions in conjunction with the transcendental math functions however, you have to specifically open the basic math library yourself.
FFP Transcendental Functions
- SPAsin() FLOAT SPAsin( FLOAT parm );
- Return arcsine of FFP variable.
- SPAcos() FLOAT SPAcos( FLOAT parm );
- Return arccosine of FFP variable.
- SPAtan() FLOAT SPAtan( FLOAT parm );
- Return arctangent of FFP variable.
- SPSin() FLOAT SPSin( FLOAT parm );
- Return sine of FFP variable. This function accepts an FFP radian argument and returns the trigonometric sine value. For extremely large arguments where little or no precision would result, the computation is aborted and the "V" condition code is set. A direct return to the caller is made.
- SPCos() FLOAT SPCos( FLOAT parm );
- Return cosine of FFP variable. This function accepts an FFP radian argument and returns the trigonometric cosine value. For extremely large arguments where little or no precision would result, the computation is aborted and the "V" condition code is set. A direct return to the caller is made.
- SPTan() FLOAT SPTan( FLOAT parm );
- Return tangent of FFP variable. This function accepts an FFP radian argument and returns the trigonometric tangent value. For extremely large arguments where little or no precision would result, the computation is aborted and the "V" condition code is set. A direct return to the caller is made.
- SPSincos() FLOAT SPSincos( FLOAT *cosResult, FLOAT parm);
- Return sine and cosine of FFP variable. This function accepts an FFP radian argument and returns the trigonometric sine as its result and the trigonometric cosine in the first parameter. If both the sine and cosine are required for a single radian value, this function will result in almost twice the execution speed of calling the SPSin() and SPCos() functions independently. For extremely large arguments where little or no precision would result, the computation is aborted and the "V" condition code is set. A direct return to the caller is made.
- SPSinh() FLOAT SPSinh( FLOAT parm );
- Return hyperbolic sine of FFP variable.
- SPCosh() FLOAT SPCosh( FLOAT parm );
- Return hyperbolic cosine of FFP variable.
- SPTanh() FLOAT SPTanh( FLOAT parm );
- Return hyperbolic tangent of FFP variable.
- SPExp() FLOAT SPExp( FLOAT parm );
- Return e to the FFP variable power. This function accepts an FFP argument and returns the result representing the value of e (2.71828...) raised to that power.
- SPLog() FLOAT SPLog( FLOAT parm );
- Return natural log (base e) of FFP variable.
- SPLog10() FLOAT SPLog10( FLOAT parm );
- Return log (base 10) of FFP variable.
- SPPow() FLOAT SPPow( FLOAT power, FLOAT arg );
- Return FFP arg2 to FFP arg1.
- SPSqrt() FLOAT SPSqrt( FLOAT parm );
- Return square root of FFP variable.
- SPTieee() FLOAT SPTieee( FLOAT parm );
- Convert FFP variable to IEEE format
- SPFieee() FLOAT SPFieee( FLOAT parm );
- Convert IEEE variable to FFP format.
Be sure to include proper data type definitions, as shown in the example below.
#include <exec/types.h> #include <libraries/mathffp.h> #include <clib/mathffp_protos.h> #include <clib/mathtrans_protos.h> struct Library *MathTransBase; VOID main() { FLOAT f1, f2, f3; FLOAT i1; if (MathTransBase = OpenLibrary("mathtrans.library",33)) { f1 = SPAsin(f2); /* Call SPAsin entry */ f1 = SPAcos(f2); /* Call SPAcos entry */ f1 = SPAtan(f2); /* Call SPAtan entry */ f1 = SPSin(f2); /* Call SPSin entry */ f1 = SPCos(f2); /* Call SPCos entry */ f1 = SPTan(f2); /* Call SPTan entry */ f1 = SPSincos(&f3, f2); /* Call SPSincos entry */ f1 = SPSinh(f2); /* Call SPSinh entry */ f1 = SPCosh(f2); /* Call SPCosh entry */ f1 = SPTanh(f2); /* Call SPTanh entry */ f1 = SPExp(f2); /* Call SPExp entry */ f1 = SPLog(f2); /* Call SPLog entry */ f1 = SPLog10(f2); /* Call SPLog10 entry */ f1 = SPPow(f2); /* Call SPPow entry */ f1 = SPSqrt(f2); /* Call SPSqrt entry */ i1 = SPTieee(f2); /* Call SPTieee entry */ f1 = SPFieee(i1); /* Call SPFieee entry */ CloseLibrary(MathTransBase); } else printf("Can't open mathtrans.library\n"); }
The Amiga assembly language interface to the FFP transcendental math routines is shown below, including some details about how the system flags are affected by the operation. This interface resides in the library file amiga.lib and must be linked with the user code. Note that the access mechanism from assembly language is:
MOVEA.L _MathTransBase,A6 JSR _LVOSPAsin(A6)
Function | Input | Output | Condition Codes |
---|---|---|---|
_LVOSPAsin | D0 = FFP argument | D0 = FFP arcsine radian | N = 0
Z = 1 if result is zero |
_LVOSPAcos | D0 = FFP argument | D0 = FFP arccosine radian | N = 0 Z = 1 if result is zero |
_LVOSPAtan | D0 = FFP argument | D0 = FFP arctangent radian | N = 0 Z = 1 if result is zero |
_LVOSPSin | D0 = FFP argument in radians | D0 = FFP sine | N = 1 if result is negative Z = 1 if result is zero |
_LVOSPCos | D0 = FFP argument in radians | D0 = FFP cosine | N = 1 if result is negative Z = 1 if result is zero |
_LVOSPTan | D0 = FFP argument in radians | D0 = FFP tangent | N = 1 if result is negative Z = 1 if result is zero |
_LVOSPSincos | D0 = FFP argument in radians D1 = Address to store cosine result |
D0 = FFP sine (D1) = FFP cosine |
N = 1 if result is negative Z = 1 if result is zero |
_LVOSPSinh | D0 = FFP argument in radians | D0 = FFP hyperbolic sine | N = 1 if result is negative Z = 1 if result is zero |
_LVOSPCosh | D0 = FFP argument in radians | D0 = FFP hyperbolic cosine | N = 1 if result is negative Z = 1 if result is zero |
_LVOSPTanh | D0 = FFP argument in radians | D0 = FFP hyperbolic tangent | N = 1 if result is negative Z = 1 if result is zero |
_LVOSPExp | D0 = FFP argument | D0 = FFP exponential | N = 0 Z = 1 if result is zero |
_LVOSPLog | D0 = FFP argument | D0 = FFP natural logarithm | N = 1 if result is negative Z = 1 if result is zero |
_LVOSPLog10 | D0 = FFP argument | D0 = FFP logarithm (base 10) | N = 1 if result is negative Z = 1 if result is zero |
_LVOSPPow | D0 = FFP exponent value D1 = FFP argument value |
D0 = FFP result of arg taken to exp power | N = 0 Z = 1 if result is zero |
_LVOSPSqrt | D0 = FFP argument | D0 = FFP square root | N = 0 Z = 1 if result is zero |
_LVOSPTieee | D0 = FFP format argument | D0 = IEEE floating-point format | N = 1 if result is negative Z = 1 if result is zero |
_LVOSPFieee | D0 = IEEE floating-point format argument | D0 = FFP format | N = undefined Z = 1 if result is zero |
FFP Mathematics Conversion Library
The FFP mathematics conversion library provides functions to convert ASCII strings to their FFP equivalents and vice versa.
It is accessed by linking code into the executable file being created. The name of the file to include in the library description of the link command line is amiga.lib. When this is included, direct calls are made to the conversion functions. Only a C interface exists for the conversion functions; there is no assembly language interface. The basic math library is required in order to access these functions.
#include <exec/types.h> #include <libraries/mathffp.h> #include <clib/mathffp_protos.h> struct Library *MathBase; VOID main() { if (MathBase = OpenLibrary("mathffp.library", 33)) { . . . CloseLibrary(MathBase); } else printf("Can't open mathffp.library\n"); }
Math Support Functions
- afp() FLOAT afp( BYTE *string );
- Convert ASCII string into FFP equivalent.
- arnd() VOID arnd( LONG place, LONG exp, BYTE *string);
- Round ASCII representation of FFP number.
- dbf() FLOAT dbf( ULONG exp, ULONG mant);
- Convert FFP dual-binary number to FFP equivalent.
- fpa() LONG fpa( FLOAT fnum, BYTE *string);
- Convert FFP variable into ASCII equivalent.
Be sure to include proper data type definitions, as shown in the example below. Print statements have been included to help clarify the format of the math conversion function calls.
#include <exec/types.h> #include <libraries/mathffp.h> #include <clib/mathffp_protos.h> #include <clib/alib_protos.h> struct Library *MathBase; UBYTE st1[80] = "3.1415926535897"; UBYTE st2[80] = "2.718281828459045"; UBYTE st3[80], st4[80]; VOID main() { FLOAT num1, num2; FLOAT n1, n2, n3, n4; LONG exp1, exp2, exp3, exp4; LONG mant1, mant2, mant3, mant4; LONG place1, place2; if (MathBase = OpenLibrary("mathffp.library", 33)) { n1 = afp(st1); /* Call afp entry */ n2 = afp(st2); /* Call afp entry */ printf("\n\nASCII %s converts to floating point %f", st1, n1); printf("\nASCII %s converts to floating point %f", st2, n2); num1 = 3.1415926535897; num2 = 2.718281828459045; exp1 = fpa(num1, st3); /* Call fpa entry */ exp2 = fpa(num2, st4); /* Call fpa entry */ printf("\n\nfloating point %f converts to ASCII %s", num1, st3); printf("\nfloating point %f converts to ASCII %s", num2, st4); place1 = -2; place2 = -1; arnd(place1, exp1, st3); /* Call arnd entry */ arnd(place2, exp2, st4); /* Call arnd entry */ printf("\n\nASCII round of %f to %d places yields %s", num1, place1, st3); printf("\nASCII round of %f to %d places yields %s", num2, place2, st4); exp1 = -3; exp2 = 3; exp3 = -3; exp4 = 3; mant1 = 12345; mant2 = -54321; mant3 = -12345; mant4 = 54321; n1 = dbf(exp1, mant1); /* Call dbf entry */ n2 = dbf(exp2, mant2); /* Call dbf entry */ n3 = dbf(exp3, mant3); /* Call dbf entry */ n4 = dbf(exp4, mant4); /* Call dbf entry */ printf("\n\ndbf of exp = %d and mant = %d yields FFP number of %f", exp1, mant1, n1); printf("\ndbf of exp = %d and mant = %d yields FFP number of %f", exp2, mant2, n2); printf("\ndbf of exp = %d and mant = %d yields FFP number of %f", exp3, mant3, n3); printf("\ndbf of exp = %d and mant = %d yields FFP number of %f", exp4, mant4, n4); CloseLibrary(MathBase); } else printf("Can't open mathffp.library\n"); }
IEEE Single-Precision Data Format
The IEEE single-precision variables are defined as 32-bit entities with the following format:
______________________________________________ | | | SEEEEEEE MMMMMMMM MMMMMMMM MMMMMMMM | | 31 23 15 7 | |______________________________________________|
Hidden Bit In The Mantissa |
---|
There is a "hidden" bit in the mantissa part of the IEEE numbers. Since all numbers are normalized, the integer (high) bit of the mantissa is dropped off. The IEEE single-precision range is 1.3E-38 (1.4E-45 de-normalized) to 3.4E+38. |
The exponent is the power of two needed to correctly position the mantissa to reflect the number's true arithmetic value. If both the exponent and the mantissa have zero in every position, the value is zero. If only the exponent has zero in every position, the value is an unnormal (extremely small). If all bits of the exponent are set to 1 the value is either a positive or negative infinity or a Not a Number (NaN). NaN is sometimes used to indicate an uninitialized variable.
IEEE Single-Precision Basic Math Library
The ROM-based IEEE single-precision basic math library was introduced in V36. This library contains entries for the basic IEEE single-precision mathematics functions, such as add, subtract, and divide.
The library is opened by making calling OpenLibrary() with "mathieeesingbas.library" as the argument. Do not share the library base pointer between tasks - see note at beginning of chapter for details.
#include <exec/types.h> #include <libraries/mathieeesp.h> #include <clib/mathsingbas_protos.h> struct Library *MathIeeeSingBasBase; VOID main() { /* do not share base pointer between tasks. */ if (MathIeeeSingBasBase = OpenLibrary("mathieeesingbas.library", 37)) { . . . CloseLibrary(MathIeeeSingBasBase); } else printf("Can't open mathieeesingbas.library\n"); }
The global variable MathIeeeSingBasBase is used internally for all future library references.
If an 680x0/68881/68882 processor combination is available, it will be used by the IEEE single-precision basic library instead of the software emulation. Also, if an autoconfigured math resource is available, that will be used. Typically this is a 68881 designed as a 16 bit I/O port, but it could be another device as well.
SP IEEE Basic Functions (V36 or greater)
- IEEESPAbs() FLOAT ( FLOAT parm );
- Take absolute value of IEEE single-precision variable.
- IEEESPAdd() FLOAT IEEESPAdd( FLOAT leftParm, FLOAT rightParm);
- Add two IEEE single-precision variables.
- IEEESPCeil() FLOAT IEEESPCeil( FLOAT parm );
- Compute least integer greater than or equal to variable.
- IEEESPCmp() LONG IEEESPCmp( FLOAT leftParm, FLOAT rightParm );
- Compare two IEEE single-precision variables.
- IEEESPDiv() FLOAT IEEESPDiv( FLOAT dividend, FLOAT divisor );
- Divide two IEEE single-precision variables.
- IEEESPFix() LONG IEEESPFix( FLOAT parm );
- Convert IEEE single-precision variable to integer.
- IEEESPFloor() FLOAT IEEESPFloor( FLOAT parm );
- Compute largest integer less than or equal to variable.
- IEEESPFlt() FLOAT IEEESPFlt( long integer );
- Convert integer variable to IEEE single-precision.
- IEEESPMul() FLOAT IEEESPMul( FLOAT leftParm, FLOAT rightParm );
- Multiply two IEEE single-precision variables.
- IEEESPNeg() FLOAT IEEESPNeg( FLOAT parm );
- Take two's complement of IEEE single-precision variable.
- IEEESPSub() FLOAT IEEESPSub( FLOAT leftParm, FLOAT rightParm );
- Subtract two IEEE single-precision variables.
- IEEESPTst() LONG IEEESPTst( FLOAT parm );
- Test an IEEE single-precision variable against zero.
Be sure to include proper data type definitions, as shown in the example below.
#include <exec/types.h> #include <libraries/mathieeesp.h> #include <clib/mathsingbas_protos.h> struct Library *MathIeeeSingBasBase; VOID main() { FLOAT f1, f2, f3; LONG i1; if (MathIeeeSingBasBase = OpenLibrary("mathieeesingbas.library",37)) { i1 = IEEESPFix(f1); /* Call IEEESPFix entry */ fi = IEEESPFlt(i1); /* Call IEEESPFlt entry */ switch (IEEESPCmp(f1, f2)) {}; /* Call IEEESPCmp entry */ switch (IEEESPTst(f1)) {}; /* Call IEEESPTst entry */ f1 = IEEESPAbs(f2); /* Call IEEESPAbs entry */ f1 = IEEESPNeg(f2); /* Call IEEESPNeg entry */ f1 = IEEESPAdd(f2, f3); /* Call IEEESPAdd entry */ f1 = IEEESPSub(f2, f3); /* Call IEEESPSub entry */ f1 = IEEESPMul(f2, f3); /* Call IEEESPMul entry */ f1 = IEEESPDiv(f2, f3); /* Call IEEESPDiv entry */ f1 = IEEESPCeil(f2); /* Call IEEESPCeil entry */ f1 = IEEESPFloor(f2); /* Call IEEESPFloor entry */ CloseLibrary(MathIeeeSingBasBase); } else printf("Can't open mathieeesingbas.library\n"); }
The Amiga assembly language interface to the IEEE single-precision basic math routines is shown below, including some details about how the system flags are affected by each operation. Note that the access mechanism from assembly language is as shown below:
MOVEA.L _MathIeeeSingBasBase,A6 JSR _LVOIEEESPFix(A6)
Function | Input | Output | Condition Codes |
---|---|---|---|
_LVOIEEESPFix | D0 = IEEE double-precision argument | D0 = Integer (two's complement) | N = undefined Z = undefined |
_LVOIEEESPFlt | D0 = Integer argument (two's complement) | D0 = IEEE single-precision | N = undefined Z = undefined |
_LVOIEEESPCmp | D0 = IEEE single-precision argument 1 D1 = IEEE single-precision argument 2 |
D0 = +1 if arg1 > arg2 D0 = -1 if arg1 < arg2 |
N = 1 if result is negative Z = 1 if result is zero |
_LVOIEEESPTst | D0 = IEEE single-precision argument | D0 = +1 if arg > 0.0 D0 = -1 if arg < 0.0 |
N = 1 if result is negative Z = 1 if result is zero |
_LVOIEEESPAbs | D0 = IEEE single-precision argument | D0 = IEEE single-precision absolute value | N = undefined Z = undefined |
_LVOIEEESPNeg | D0 = IEEE single-precision argument | D0 = IEEE single-precision negated | N = undefined Z = undefined |
_LVOIEEESPAdd | D0 = IEEE single-precision argument 1 D1 = IEEE single-precision argument 2 |
D0 = IEEE single-precision addition of arg1+arg2 | N = undefined Z = undefined |
_LVOIEEESPSub | D0 = IEEE single-precision argument 1 D1 = IEEE single-precision argument 2 |
D0 = IEEE single-precision subtraction of arg1-arg2 | N = undefined Z = undefined |
_LVOIEEESPMul | D0 = IEEE single-precision argument 1 D1 = IEEE single-precision argument 2 |
D0 = IEEE single-precision multiplication of arg1 * arg2 | N = undefined Z = undefined |
_LVOIEEESPDiv | D0 = IEEE single-precision argument 1 D1 = IEEE single-precision argument 2 |
D0 = IEEE single-precision division of arg1/arg2 | N = undefined Z = undefined |
_LVOIEEESPCeil | D0 = IEEE single-precision variable | D0 = least integer >= variable | N = undefined Z = undefined |
_LVOIEEESPFloor | D0 = IEEE single-precision variable | D0 = largest integer <= argument | N = undefined Z = undefined |
IEEE Single-Precision Transcendental Math Library
The IEEE single-precision transcendental math library was introduced in V36. It contains entries for transcendental math functions such as sine, cosine, and square root.
This library resides on disk and is opened by calling OpenLibrary() with "mathieeesingtrans.library" as the argument. Do not share the library base pointer between tasks - see note at beginning of chapter.
#include <exec/types.h> #include <libraries/mathieeesp.h> struct Library *MathIeeeSingTransBase; #include <clib/mathsingtrans_protos.h> VOID main() { if (MathIeeeSingTransBase = OpenLibrary("mathieeesingtrans.library",37)) { . . . CloseLibrary(MathIeeeSingTransBase); } else printf("Can't open mathieeesingtrans.library\n"); }
The global variable MathIeeeSingTransBase is used internally for all future library references.
The IEEE single-precision transcendental math library is dependent upon the IEEE single-precision basic math library, which it will open if it is not open already. If you want to use the IEEE single-precision basic math functions in conjunction with the transcendental math functions however, you have to specifically open the basic math library yourself.
Just as the IEEE single-precision basic math library, the IEEE single-precision transcendental math library will take advantage of a 680x0/68881 combination or another math resource, if present.
SP IEEE Transcendental Functions (V36 or greater)
- IEEESPAsin() FLOAT IEEESPAsin( FLOAT parm );
- Return arcsine of IEEE single-precision variable.
- IEEESPAcos() FLOAT IEEESPAcos( FLOAT parm );
- Return arccosine of IEEE single-precision variable.
- IEEESPAtan() FLOAT IEEESPAtan( FLOAT parm );
- Return arctangent of IEEE single-precision variable.
- IEEESPSin() FLOAT IEEESPSin( FLOAT parm );
- Return sine of IEEE single-precision variable. This function accepts an IEEE radian argument and returns the trigonometric sine value.
- IEEESPCos() FLOAT IEEESPCos( FLOAT parm );
- Return cosine of IEEE single-precision variable. This function accepts an IEEE radian argument and returns the trigonometric cosine value.
- IEEESPTan() FLOAT IEEESPTan( FLOAT parm );
- Return tangent of IEEE single-precision variable. This function accepts an IEEE radian argument and returns the trigonometric tangent value.
- IEEESPSincos() FLOAT IEEESPSincos( FLOAT *cosptr, FLOAT parm );
- Return sine and cosine of IEEE single-precision variable. This function accepts an IEEE radian argument and returns the trigonometric sine as its result and the cosine in the first parameter.
- IEEESPSinh() FLOAT IEEESPSinh( FLOAT parm );
- Return hyperbolic sine of IEEE single-precision variable.
- IEEESPCosh() FLOAT IEEESPCosh( FLOAT parm );
- Return hyperbolic cosine of IEEE single-precision variable.
- IEEESPTanh() FLOAT IEEESPTanh( FLOAT parm );
- Return hyperbolic tangent of IEEE single-precision variable.
- IEEESPExp() FLOAT IEEESPExp( FLOAT parm );
- Return e to the IEEE variable power. This function accept an IEEE single-precision argument and returns the result representing the value of e (2.712828...) raised to that power.
- IEEESPFieee() FLOAT IEEESPFieee( FLOAT parm );
- Convert IEEE single-precision number to IEEE single-precision number. The only purpose of this function is to provide consistency with the double-precision math IEEE library.
- IEEESPLog() FLOAT IEEESPLog( FLOAT parm );
- Return natural log (base e of IEEE single-precision variable.
- IEEESPLog10() FLOAT IEEESPLog10( FLOAT parm );
- Return log (base 10) of IEEE single-precision variable.
- IEEESPPow() FLOAT IEEESPPow( FLOAT exp, FLOAT arg );
- Return IEEE single-precision arg2 to IEEE single-precision arg1.
- IEEESPSqrt() FLOAT IEEESPSqrt( FLOAT parm );
- Return square root of IEEE single-precision variable.
- IEEESPTieee() FLOAT IEEESPTieee( FLOAT parm );
- Convert IEEE single-precision number to IEEE single-precision number. The only purpose of this function is to provide consistency with the double-precision math IEEE library.
Be sure to include the proper data type definitions as shown below.
#include <exec/types.h> #include <libraries/mathieeesp.h> #include <clib/mathsingtrans_protos.h> struct Library *MathIeeeSingTransBase; VOID main() { FLOAT f1, f2, f3; if (MathIeeeSingTransBase = OpenLibrary("mathieeesingtrans.library",37)) { f1 = IEEEDPAsin(f2); /* Call IEEESPAsin entry */ f1 = IEEEDPAcos(f2); /* Call IEEESPAcos entry */ f1 = IEEEDPAtan(f2); /* Call IEEESPAtan entry */ f1 = IEEEDPSin(f2); /* Call IEEESPSin entry */ f1 = IEEEDPCos(f2); /* Call IEEESPCos entry */ f1 = IEEEDPTan(f2); /* Call IEEESPTan entry */ f1 = IEEEDPSincos(&f3, f2); /* Call IEEESPSincos entry */ f1 = IEEEDPSinh(f2); /* Call IEEESPSinh entry */ f1 = IEEEDPCosh(f2); /* Call IEEESPCosh entry */ f1 = IEEEDPTanh(f2); /* Call IEEESPTanh entry */ f1 = IEEEDPExp(f2); /* Call IEEESPExp entry */ f1 = IEEEDPLog(f2); /* Call IEEESPLog entry */ f1 = IEEEDPLog10(f2); /* Call IEEESPLog10 entry */ f1 = IEEEDPPow(d2, f3); /* Call IEEESPPow entry */ f1 = IEEEDPSqrt(f2); /* Call IEEESPSqrt entry */ CloseLibrary(MathIeeeSingTransBase); } else printf("Can't open mathieeesingtrans.library\n"); }
The section below describes the Amiga assembly interface to the IEEE single-precision transcendental math library. The access mechanism from assembly language is:
MOVEA.L _MathIeeeSingTransBase,A6 JSR _LVOIEEESPAsin(A6)
Function | Input | Output | Condition Codes |
---|---|---|---|
_LVOIEEESPAsin | D0 = IEEE argument | D0 = IEEE arcsine radian | N = undefined Z = undefined |
_LVOIEEESPAcos | D0 = IEEE single-precision argument | D0 = IEEE arccosine radian | N = undefined Z = undefined |
_LVOIEEESPAtan | D0 = IEEE single-precision argument | D0 = IEEE arctangent radian | N = undefined Z = undefined |
_LVOIEEESPSin | D0 = IEEE single-precision argument in radians | D0 = IEEE sine | N = undefined Z = undefined |
_LVOIEEESPCos | D0 = IEEE single-precision argument in radians | D0 = IEEE cosine | N = undefined Z = undefined |
_LVOIEEESPTan | D0 = IEEE single-precision argument in radians | D0 = IEEE tangent | N = undefined Z = undefined |
_LVOIEEESPSincos | A0 = Address to store cosine result D0 = IEEE argument in radians |
D0 = IEEE sine (A0) = IEEE cosine |
N = undefined Z = undefined |
_LVOIEEESPSinh | D0 = IEEE single-precision argument in radians | D0 = IEEE hyperbolic sine | N = undefined Z = undefined |
_LVOIEEESPCosh | D0 = IEEE single-precision argument in radians | D0 = IEEE hyperbolic cosine | N = undefined Z = undefined |
_LVOIEEESPTanh | D0 = IEEE single-precision argument in radians | D0 = IEEE hyperbolic tangent | N = undefined Z = undefined |
_LVOIEEESPExp | D0 = IEEE single-precision argument | D0 = IEEE exponential | N = undefined Z = undefined |
_LVOIEEESPLog | D0 = IEEE single-precision argument | D0 = IEEE natural logarithm | N = undefined Z = undefined |
_LVOIEEESPLog10 | D0 = IEEE single-precision argument | D0 = IEEE logarithm (base 10) | N = undefined Z = undefined |
_LVOIEEESPPow | D0 = IEEE single-precision exponent value D1 = IEEE single-precision argument value |
D0 = IEEE result of arg taken to exp power | N = undefined Z = undefined |
_LVOIEEESPSqrt | D0 = IEEE single-precision argument | D0 = IEEE square root | N = undefined Z = undefined |
IEEE Double-Precision Data Format
The IEEE double-precision variables are defined as 64-bit entities with the following format:
______________________________________________ | | | SEEEEEEE EEEEEIMM MMMMMMMM MMMMMMMM | | 63 55 47 39 | |______________________________________________|
______________________________________________ | | | MMMMMMMM MMMMMMMM MMMMMMMM MMMMMMMM | | 31 23 15 7 | |______________________________________________|
Hidden Bit In The Mantissa |
---|
There is a "hidden" bit in the mantissa part of the IEEE numbers. Since all numbers are normalized, the integer (high) bit of the mantissa is dropped off. The IEEE double-precision range is 2.2E-308 (4.9E-324 de-normalized) to 1.8E+307. |
The exponent is the power of two needed to correctly position the mantissa to reflect the number's true arithmetic value. If both the exponent and the mantissa have zero in every position, the value is zero. If only the exponent has zero in every position, the value is an unnormal (extremely small). If all bits of the exponent are set to 1 the value is either a positive or negative infinity or a Not a Number (NaN). NaN is sometimes used to indicate an uninitialized variable.
IEEE Double-Precision Basic Math Library
The IEEE double-precision basic math library contains entries for the basic IEEE mathematics functions, such as add, subtract, and divide. This library resides on disk and is opened by calling OpenLibrary() with "mathieeedoubbas.library" as the argument. Do not share the library base pointer between tasks - see note at beginning of chapter for details.
#include <exec/types.h> #include <libraries/mathieeedp.h> #include <clib/mathdoubbas_protos.h> struct Library *MathIeeeDoubBasBase; VOID main() { /* do not share base pointer between tasks. */ if (MathIeeeDoubBasBase = OpenLibrary("mathieeedoubbas.library", 34)) { . . . CloseLibrary(MathIeeeDoubBasBase); } else printf("Can't open mathieeedoubbas.library\n"); }
The global variable MathIeeeDoubBasBase is used internally for all future library references.
If an 680x0/68881/68882 processor combination is available, it will be used by the IEEE basic library instead of the software emulation. Also, if an autoconfigured math resource is available, that will be used. Typically this is a 68881 designed as a 16 bit I/O port, but it could be another device as well.
DP IEEE Basic Functions
- IEEEDPAbs() DOUBLE IEEEDPAbs( DOUBLE parm );
- Take absolute value of IEEE double-precision variable.
- IEEEDPAdd() DOUBLE IEEEDPAdd( DOUBLE leftParm, DOUBLE rightParm );
- Add two IEEE double-precision variables.
- IEEEDPCeil() DOUBLE IEEEDPCeil( DOUBLE parm );
- Compute least integer greater than or equal to variable.
- IEEEDPCmp() LONG IEEEDPCmp( DOUBLE leftParm, DOUBLE rightParm );
- Compare two IEEE double-precision variables.
- IEEEDPDiv() DOUBLE IEEEDPDiv( DOUBLE dividend, DOUBLE divisor );
- Divide two IEEE double-precision variables.
- IEEEDPFix() LONG IEEEDPFix( DOUBLE parm );
- Convert IEEE double-precision variable to integer.
- IEEEDPFloor() DOUBLE IEEEDPFloor( DOUBLE parm );
- Compute largest integer less than or equal to variable.
- IEEEDPFlt() DOUBLE IEEEDPFlt( long integer );
- Convert integer variable to IEEE double-precision.
- IEEEDPMul() DOUBLE IEEEDPMul( DOUBLE factor1, DOUBLE factor2 );
- Multiply two IEEE double-precision variables.
- IEEEDPNeg() DOUBLE IEEEDPNeg( DOUBLE parm );
- Take two's complement of IEEE double-precision variable.
- IEEEDPSub() DOUBLE IEEEDPSub( DOUBLE leftParm, DOUBLE rightParm );
- Subtract two IEEE double-precision variables.
- IEEEDPTst() LONG IEEEDPTst( DOUBLE parm );
- Test an IEEE double-precision variable against zero.
Be sure to include proper data type definitions, as shown in the example below.
#include <exec/types.h> #include <libraries/mathieeedp.h> #include <clib/mathieeedoubbas_protos.h> struct Library *MathIeeeDoubBasBase; VOID main() { DOUBLE d1, d2, d3; LONG i1; if (MathIeeeDoubBasBase = OpenLibrary("mathieeedoubbas.library",34)) { i1 = IEEEDPFix(d1); /* Call IEEEDPFix entry */ fi = IEEEDPFlt(i1); /* Call IEEEDPFlt entry */ switch (IEEEDPCmp(d1, d2)) {}; /* Call IEEEDPCmp entry */ switch (IEEEDPTst(d1)) {}; /* Call IEEEDPTst entry */ d1 = IEEEDPAbs(d2); /* Call IEEEDPAbs entry */ d1 = IEEEDPNeg(d2); /* Call IEEEDPNeg entry */ d1 = IEEEDPAdd(d2, d3); /* Call IEEEDPAdd entry */ d1 = IEEEDPSub(d2, d3); /* Call IEEEDPSub entry */ d1 = IEEEDPMul(d2, d3); /* Call IEEEDPMul entry */ d1 = IEEEDPDiv(d2, d3); /* Call IEEEDPDiv entry */ d1 = IEEEDPCeil(d2); /* Call IEEEDPCeil entry */ d1 = IEEEDPFloor(d2); /* Call IEEEDPFloor entry */ CloseLibrary(MathIeeeDoubBasBase); } else printf("Can't open mathieeedoubbas.library\n"); }
The Amiga assembly language interface to the IEEE double-precision floating-point basic math routines is shown below, including some details about how the system flags are affected by each operation. The access mechanism from assembly language is:
MOVEA.L _MathIeeeDoubBasBase,A6 JSR _LVOIEEEDPFix(A6)
Function | Input | Output | Condition Codes |
---|---|---|---|
_LVOIEEEDPFix | D0/D1 = IEEE double-precision argument | D0 = Integer (two's complement) | N = undefined Z = undefined |
_LVOIEEEDPFl | D0 = Integer (two's complement) argument | D0/D1 = IEEE double-precision | N = undefined Z = undefined |
_LVOIEEEDPCmp | D0/D1 = IEEE double-precision argument 1 D2/D3 = IEEE double-precision argument 2 |
D0 = +1 if arg1 > arg2 D0 = -1 if arg1 < arg2 |
N = 1 if result is negative Z = 1 if result is zero |
_LVOIEEEDPTst | D0/D1 = IEEE double-precision argument | D0 = +1 if arg > 0.0 D0 = -1 if arg < 0.0 |
N = 1 if result is negative Z = 1 if result is zero |
_LVOIEEEDPAbs | D0/D1 = IEEE double-precision argument | D0/D1 = IEEE double-precision absolute value | N = undefined Z = undefined |
_LVOIEEEDPNeg | D0/D1 = IEEE double-precision argument | D0/D1 = IEEE double-precision negated | N = undefined Z = undefined |
_LVOIEEEDPAdd | D0/D1 = IEEE double-precision argument 1 D2/D3 = IEEE double-precision argument 2 |
D0/D1 = IEEE double-precision addition of arg1+arg2 | N = undefined Z = undefined |
_LVOIEEEDPSub | D0/D1 = IEEE double-precision argument 1 D2/D3 = IEEE double-precision argument 2 |
D0/D1 = IEEE double-precision subtraction of arg1-arg2 | N = undefined Z = undefined |
_LVOIEEEDPMul | D0/D1 = IEEE double-precision argument 1 D2/D3 = IEEE double-precision argument 2 |
D0/D1 = IEEE double-precision multiplication of arg1*arg2 | N = undefined Z = undefined |
_LVOIEEEDPDiv | D0/D1 = IEEE double-precision argument 1 D2/D3 = IEEE double-precision argument 2 |
D0/D1 = IEEE double-precision division of arg1/arg2 | N = undefined Z = undefined |
_LVOIEEEDPCeil | D0/D1 = IEEE double-precision argument | D0/D1 = least integer >= argument | N = undefined Z = undefined |
_LVOIEEEDPFloor | D0/D1 = IEEE double-precision argument | D0/D1 = largest integer <= argument | N = undefined Z = undefined |
IEEE Double-Precision Transcendental Math Library
The IEEE double-precision transcendental math library contains entries for the transcendental math functions such as sine, cosine, and square root. The library resides on disk and is opened by calling OpenLibrary() with "mathieeedoubtrans.library" as the argument. Do not share the library base pointer between tasks - see note at beginning of chapter for details.
#include <exec/types.h> #include <libraries/mathieeedp.h> #include <clib/mathdoubtrans_protos.h> struct Library *MathIeeeDoubTransBase; VOID main() { if (MathIeeeDoubTransBase = OpenLibrary("mathieeedoubtrans.library",34)) { . . . CloseLibrary(MathIeeeDoubTransBase); } else printf("Can't open mathieeedoubtrans.library\n"); }
The global variable MathIeeeDoubTransBase is used internally for all future library references.
The IEEE double-precision transcendental math library is dependent upon the IEEE double-precision basic math library, which it will open if it is not open already. If you want to use the IEEE double-precision basic math functions in conjunction with the transcendental math functions however, you have to specifically open the basic math library yourself.
Just as the IEEE double-precision basic math library, the IEEE double-precision transcendental math library will take advantage of a 680x0/68881 combination or another math resource, if present.
DP IEEE Transcendental Functions
- IEEEDPAsin() DOUBLE IEEEDPAsin( DOUBLE parm );
- Return arcsine of IEEE variable.
- IEEEDPAcos() DOUBLE IEEEDPAcos( DOUBLE parm );
- Return arccosine of IEEE variable.
- IEEEDPAtan() DOUBLE IEEEDPAtan( DOUBLE parm );
- Return arctangent of IEEE variable.
- IEEEDPSin() DOUBLE IEEEDPSin( DOUBLE parm );
- Return sine of IEEE variable. This function accepts an IEEE radian argument and returns the trigonometric sine value.
- IEEEDPCos() DOUBLE IEEEDPCos( DOUBLE parm )
- Return cosine of IEEE variable. This function accepts an IEEE radian argument and returns the trigonometric cosine value.
- IEEEDPTan() DOUBLE IEEEDPTan( DOUBLE parm );
- Return tangent of IEEE variable. This function accepts an IEEE radian argument and returns the trigonometric tangent value.
- IEEEDPSincos() DOUBLE IEEEDPSincos( DOUBLE *pf2, DOUBLE parm );
- Return sine and cosine of IEEE variable. This function accepts an IEEE radian argument and returns the trigonometric sine as its result and the trigonometric cosine in the first parameter.
- IEEEDPSinh() DOUBLE IEEEDPSinh( DOUBLE parm );
- Return hyperbolic sine of IEEE variable.
- IEEEDPCosh() DOUBLE IEEEDPCosh( DOUBLE parm );
- Return hyperbolic cosine of IEEE variable.
- IEEEDPTanh() DOUBLE IEEEDPTanh( DOUBLE parm );
- Return hyperbolic tangent of IEEE variable.
- IEEEDPExp() DOUBLE IEEEDPExp( DOUBLE parm );
- Return e to the IEEE variable power. This function accept an IEEE argument and returns the result representing the value of e (2.712828...) raised to that power.
- IEEEDPFieee() DOUBLE IEEEDPFieee( FLOAT single );
- Convert IEEE single-precision number to IEEE double-precision number.
- IEEEDPLog() DOUBLE IEEEDPLog( DOUBLE parm );
- Return natural log (base e of IEEE variable.
- IEEEDPLog10() DOUBLE IEEEDPLog10( DOUBLE parm );
- Return log (base 10) of IEEE variable.
- IEEEDPPow() DOUBLE IEEEDPPow( DOUBLE exp, DOUBLE arg );
- Return IEEE arg2 to IEEE arg1.
- IEEEDPSqrt() DOUBLE IEEEDPSqrt( DOUBLE parm );
- Return square root of IEEE variable.
- IEEEDPTieee() FLOAT IEEEDPTieee( DOUBLE parm );
- Convert IEEE double-precision number to IEEE single-precision number.
Be sure to include proper data type definitions as shown below.
#include <exec/types.h> #include <libraries/mathieeedp.h> #include <clib/mathdoubtrans_protos.h> struct Library *MathIeeeDoubTransBase; VOID main() { DOUBLE d1, d2, d3; FLOAT f1; if (MathIeeeDoubTransBase = OpenLibrary("mathieeedoubtrans.library",34)) { d1 = IEEEDPAsin(d2); /* Call IEEEDPAsin entry */ d1 = IEEEDPAcos(d2); /* Call IEEEDPAcos entry */ d1 = IEEEDPAtan(d2); /* Call IEEEDPAtan entry */ d1 = IEEEDPSin(d2); /* Call IEEEDPSin entry */ d1 = IEEEDPCos(d2); /* Call IEEEDPCos entry */ d1 = IEEEDPTan(d2); /* Call IEEEDPTan entry */ d1 = IEEEDPSincos(&d3, d2); /* Call IEEEDPSincos entry */ d1 = IEEEDPSinh(d2); /* Call IEEEDPSinh entry */ d1 = IEEEDPCosh(d2); /* Call IEEEDPCosh entry */ d1 = IEEEDPTanh(d2); /* Call IEEEDPTanh entry */ d1 = IEEEDPExp(d2); /* Call IEEEDPExp entry */ d1 = IEEEDPLog(d2); /* Call IEEEDPLog entry */ d1 = IEEEDPLog10(d2); /* Call IEEEDPLog10 entry */ d1 = IEEEDPPow(d2, d3); /* Call IEEEDPPow entry */ d1 = IEEEDPSqrt(d2); /* Call IEEEDPSqrt entry */ f1 = IEEEDPTieee(d2); /* Call IEEEDPTieee entry */ d1 = IEEEDPFieee(f1); /* Call IEEEDPFieee entry */ CloseLibrary(MathIeeeDoubTransBase); } else printf("Can't open mathieeedoubtrans.library\n"); }
The section below describes the Amiga assembly interface to the IEEE double-precision transcendental math library. The access mechanism from assembly language is:
MOVEA.L _MathIeeeDoubTransBase,A6 JSR _LVOIEEEDPAsin(A6)
Function | Input | Output | Condition Codes |
---|---|---|---|
_LVOIEEEDPAsin | D0/D1 = IEEE argument | D0/D1 = IEEE arcsine radian | N = undefined Z = undefined |
_LVOIEEEDPAcos | D0/D1 = IEEE argument | D0/D1 = IEEE arccosine radian | N = undefined Z = undefined |
_LVOIEEEDPAtan | D0/D1 = IEEE argument | D0/D1 = IEEE arctangent radian | N = undefined Z = undefined |
_LVOIEEEDPSin | D0/D1 = IEEE argument in radians | D0/D1 = IEEE sine | N = undefined Z = undefined |
_LVOIEEEDPCos | D0/D1 = IEEE argument in radians | D0/D1 = IEEE cosine | N = undefined Z = undefined |
_LVOIEEEDPTan | D0/D1 = IEEE argument in radians | D0/D1 = IEEE tangent | N = undefined Z = undefined |
_LVOIEEEDPSincos | A0 = Address to store cosine result D0/D1 = IEEE argument in radians |
D0/D1 = IEEE sine (A0) = IEEE cosine |
N = undefined Z = undefined |
_LVOIEEEDPSin | D0/D1 = IEEE argument in radians | D0/D1 = IEEE hyperbolic sine | N = undefined Z = undefined |
_LVOIEEEDPCosh | D0/D1 = IEEE argument in radians | D0/D1 = IEEE hyperbolic cosine | N = undefined Z = undefined |
_LVOIEEEDPTanh | D0/D1 = IEEE argument in radians | D0/D1 = IEEE hyperbolic tangent | N = undefined Z = undefined |
_LVOIEEEDPExp | D0/D1 = IEEE argument | D0/D1 = IEEE exponential | N = undefined Z = undefined |
_LVOIEEEDPLog | D0/D1 = IEEE argument | D0/D1 = IEEE natural logarithm | N = undefined Z = undefined |
_LVOIEEEDPLog10 | D0/D1 = IEEE argument | D0/D1 = IEEE logarithm (base 10) | N = undefined Z = undefined |
_LVOIEEEDPPow | D0/D1 = IEEE exponent D2/D3 = IEEE argument |
D0/D1 = IEEE result of arg taken to exp power | N = undefined Z = undefined |
_LVOIEEEDPSqrt | D0/D1 = IEEE argument | D0/D1 = IEEE square root | N = undefined Z = undefined |
_LVOIEEEDPTieee | D0/D1 = IEEE format argument | D0 = single-precision IEEE floating-point format | N = undefined Z = undefined |
Function Reference
Here's a brief summary of the functions covered in this chapter. Refer to the SDK for additional information.
Function | Description |
---|---|
SPAbs() | Take absolute value of FFP variable |
SPAdd() | Add two FFP variables |
SPCeil() | Compute least integer greater than or equal to variable. |
SPCmp() | Compare two FFP variables |
SPDiv() | Divide two FFP variables |
SPFix() | Convert FFP variable to integer |
SPFloor() | Computer largest integer less than or equal to variable. |
SPFlt() | Convert integer variable to FFP |
SPMul() | Multiply two FFP variables |
SPNeg() | Take two’s complement of FFP variable |
SPSub() | Subtract two FFP variables |
SPTst() | Test an FFP variable against zero |
Function | Description |
---|---|
SPAcos() | Return arccosine of FFP variable. |
SPAsin() | Return arcsine of FFP variable. |
SPAtan() | Return arctangent of FFP variable. |
SPCos() | Return cosine of FFP variable. |
SPCosh() | Return hyperbolic cosine of FFP variable. |
SPExp() | Return e to the FFP variable power. |
SPFieee() | Convert IEEE variable to FFP format. |
SPLog() | Return natural log (base e) of FFP variable. |
SPLog10() | Return log (base 10) of FFP variable. |
SPPow() | Return FFP arg2 to FFP arg1. |
SPSin() | Return sine of FFP variable. |
SPSincos() | Return sine and cosine of FFP variable. |
SPSinh() | Return hyperbolic sine of FFP variable. |
SPSqrt() | Return square root of FFP variable. |
SPTan() | Return tangent of FFP variable. |
SPTanh() | Return hyperbolic tangent of FFP variable. |
SPTieee() | Convert FFP variable to IEEE format |
Function | Description |
---|---|
afp() | Convert ASCII string into FFP equivalent. |
fpa() | Convert FFP variable into ASCII equivalent. |
arnd() | Round ASCII representation of FFP number. |
dbf() | Convert FFP dual-binary number to FFP equivalent. |
Function | Description |
---|---|
IEEESPAbs() | Take absolute value of IEEE single-precision variable |
IEEESPAdd() | Add two IEEE single-precision variables |
IEEESPCeil() | Compute least integer greater than or equal to variable |
IEEESPCmp() | Compare two IEEE single-precision variables |
IEEESPDiv() | Divide two IEEE single-precision variables |
IEEESPFix() | Convert IEEE single-precision variable to integer |
IEEESPFloor() | Compute largest integer less than or equal to variable |
IEEESPFlt() | Convert integer variable to IEEE single-precision |
IEEESPMul() | Multiply two IEEE single-precision variables |
IEEESPNeg() | Take two's complement of IEEE single-precision variable |
IEEESPSub() | Subtract two IEEE single-precision variables |
IEEESPTst() | Test an IEEE single-precision variable against zero |
Function | Description |
---|---|
IEEESPACos() | Return arccosine of IEEE single-precision variable. |
IEEESPASin() | Return arcsine of IEEE single-precision variable. |
IEEESPAtan() | Return arctangent of IEEE single-precision variable. |
IEEESPCos() | Return cosine of IEEE single-precision variable. |
IEEESPCosh() | Return hyperbolic cosine of IEEE single-precision variable. |
IEEESPExp() | Return e to the IEEE variable power. |
IEEESPLog() | Return natural log (base e of IEEE single-precision variable. |
IEEESPLog10() | Return log (base 10) of IEEE single-precision variable. |
IEEESPPow() | Return power of IEEE single-precision variable. |
IEEESPSin() | Return sine of IEEE single-precision variable. |
IEEESPSincos() | Return sine and cosine of IEEE single-precision variable. |
IEEESPSinh() | Return hyperbolic sine of IEEE single-precision variable. |
IEEESPSqrt() | Return square root of IEEE single-precision variable. |
IEEESPTan() | Return tangent of IEEE single-precision variable. |
IEEESPTanh() | Return hyperbolic tangent of IEEE single-precision variable. |
Function | Description |
---|---|
IEEEDPAbs() | Take absolute value of IEEE double-precision variable |
IEEEDPAdd() | Add two IEEE double-precision variables |
IEEEDPCeil() | Compute least integer greater than or equal to variable |
IEEEDPCmp() | Compare two IEEE double-precision variables |
IEEEDPDiv() | Divide two IEEE double-precision variables |
IEEEDPFix() | Convert IEEE double-precision variable to integer |
IEEEDPFloor() | Compute largest integer less than or equal to variable |
IEEEDPFlt() | Convert integer variable to IEEE double-precision |
IEEEDPMul() | Multiply two IEEE double-precision variables |
IEEEDPNeg() | Take two's complement of IEEE double-precision variable |
IEEEDPSub() | Subtract two IEEE single-precision variables |
IEEEDPTst() | Test an IEEE double-precision variable against zero |
Function | Description |
---|---|
IEEEDPACos() | Return arccosine of IEEE double-precision variable. |
IEEEDPASin() | Return arcsine of IEEE double-precision variable. |
IEEEDPAtan() | Return arctangent of IEEE double-precision variable. |
IEEEDPCos() | Return cosine of IEEE double-precision variable. |
IEEEDPCosh() | Return hyperbolic cosine of IEEE double-precision variable. |
IEEEDPExp() | Return e to the IEEE variable power. |
IEEEDPFieee() | Convert IEEE single-precision number to IEEE double-precision number. |
IEEEDPLog() | Return natural log (base e of IEEE double-precision variable. |
IEEEDPLog10() | Return log (base 10) of IEEE double-precision variable. |
IEEEDPPow() | Return power of IEEE double-precision variable. |
IEEEDPSin() | Return sine of IEEE double-precision variable. |
IEEEDPSincos() | Return sine and cosine of IEEE double-precision variable. |
IEEEDPSinh() | Return hyperbolic sine of IEEE double-precision variable. |
IEEEDPSqrt() | Return square root of IEEE double-precision variable. |
IEEEDPTan() | Return tangent of IEEE double-precision variable. |
IEEEDPTanh() | Return hyperbolic tangent of IEEE double-precision variable. |
IEEEDPTieee() | Convert IEEE double-precision number to IEEE single-precision number. |