Copyright (c) Hyperion Entertainment and contributors.

Difference between revisions of "Math Libraries"

From AmigaOS Documentation Wiki
Jump to navigation Jump to search
(→‎FFP Floating Point Data Format: Added "(bit 7)" to identify the sign bit as it was not otherwise obvious)
 
(32 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, introduced in Release 2, and the double-precision libraries each presently consists of two entities: the basic math library and the transcendental math library.
+
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 36: Line 41:
 
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:
 
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:
   
  +
_____________________________________________
<table>
 
  +
| |
<tbody>
 
  +
| MMMMMMMM MMMMMMMM MMMMMMMM EEEEEEE |
<tr class="odd">
 
  +
| 31 23 15 7 |
<td align="left">MMMMMMMM</td>
 
  +
|_____________________________________________|
<td align="left">MMMMMMMM</td>
 
  +
<td align="left">MMMMMMMM</td>
 
<td align="left">SEEEEEEE</td>
 
</tr>
 
<tr class="even">
 
<td align="left">31</td>
 
<td align="left">23</td>
 
<td align="left">15</td>
 
<td align="left">7</td>
 
</tr>
 
</tbody>
 
</table>
 
   
 
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.
   
 
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 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.
Line 63: Line 58:
 
The range allowed by this format is as follows:
 
The range allowed by this format is as follows:
   
  +
; DECIMAL
<table>
 
  +
: 9.22337177 * 10^18 > +VALUE > 5.42101070 * 10^-20
<tbody>
 
  +
: -9.22337177 * 10^18 < -VALUE < -2.71050535 * 10^-20
<tr class="odd">
 
<td align="right">9.22337177 <math>\times</math> 10<math>^{18}</math></td>
 
<td align="center"><math>></math></td>
 
<td align="right">''+Value''</td>
 
<td align="center"><math>></math></td>
 
<td align="right">5.42101070 <math>\times</math> 10<math>^{-20}</math></td>
 
</tr>
 
<tr class="even">
 
<td align="right">-9.22337177 <math>\times</math> 10<math>^{18}</math></td>
 
<td align="center"><math><</math></td>
 
<td align="right">''-Value''</td>
 
<td align="center"><math><</math></td>
 
<td align="right">-2.71050535 <math>\times</math> 10<math>^{-20}</math></td>
 
</tr>
 
</tbody>
 
</table>
 
   
  +
; BINARY (HEXADECIMAL):
<table>
 
  +
: .FFFFFF * 2^63 > +VALUE > .800000 * 2^-63
<tbody>
 
  +
: -.FFFFFF * 2^63 < -VALUE < -.800000 * 2^-64
<tr class="odd">
 
<td align="right">.FFFFFF <math>\times</math> 2<math>^{63}</math></td>
 
<td align="center"><math>></math></td>
 
<td align="right">''+Value''</td>
 
<td align="center"><math>></math></td>
 
<td align="right">.800000 <math>\times</math> 2<math>^{-63}</math></td>
 
</tr>
 
<tr class="even">
 
<td align="right">-.FFFFFF <math>\times</math> 2<math>^{63}</math></td>
 
<td align="center"><math><</math></td>
 
<td align="right">''-Value''</td>
 
<td align="center"><math><</math></td>
 
<td align="right">-.800000 <math>\times</math> 2<math>^{-64}</math></td>
 
</tr>
 
</tbody>
 
</table>
 
   
 
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.
 
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.
Line 107: Line 72:
 
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 &quot;mathffp.library&quot; as the argument.
 
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 &quot;mathffp.library&quot; as the argument.
   
  +
<syntaxhighlight>
<pre>#include &lt;exec/types.h&gt;
 
#include &lt;libraries/mathffp.h&gt;
+
#include <exec/types.h>
  +
#include <libraries/mathffp.h>
   
#include &lt;clib/mathffp_protos.h&gt;
+
#include <clib/mathffp_protos.h>
   
 
struct Library *MathBase;
 
struct Library *MathBase;
Line 116: Line 82:
 
VOID main()
 
VOID main()
 
{
 
{
if (MathBase = OpenLibrary(&quot;mathffp.library&quot;, 0))
+
if (MathBase = OpenLibrary("mathffp.library", 0))
 
{
 
{
 
. . .
 
. . .
Line 123: Line 89:
 
}
 
}
 
else
 
else
printf(&quot;Can't open mathffp.library\n&quot;);
+
printf("Can't open mathffp.library\n");
  +
}
}</pre>
 
  +
</syntaxhighlight>
  +
 
The global variable '''MathBase''' is used internally for all future library references.
 
The global variable '''MathBase''' is used internally for all future library references.
   
 
=== FFP Basic Functions ===
 
=== FFP Basic Functions ===
   
  +
; SPAbs() FLOAT SPAbs( FLOAT parm );
Take absolute value of FFP variable.
 
  +
: Take absolute value of FFP variable.
   
  +
; SPAdd() FLOAT SPAdd( FLOAT leftParm, FLOAT rightParm);
Add two FFP variables.
 
  +
: Add two FFP variables.
   
  +
; SPCeil() FLOAT SPCeil( FLOAT parm );
Computer largest integer less than or equal to variable.
 
  +
: Computer largest integer less than or equal to variable.
   
  +
; SPCmp() LONG SPCmp( FLOAT leftParm, FLOAT rightParm)
Compare two FFP variables.
 
  +
: Compare two FFP variables.
   
  +
; SPDiv() FLOAT SPDiv( FLOAT leftParm, FLOAT rightParm);
Divide two FFP variables.
 
  +
: Divide two FFP variables.
   
  +
; SPFix() LONG SPFix( FLOAT parm );
Convert FFP variable to integer.
 
  +
: Convert FFP variable to integer.
   
  +
; SPFloor() FLOAT SPFloor( FLOAT parm );
Compute least integer greater than or equal to variable.
 
  +
: Compute least integer greater than or equal to variable.
   
  +
; SPFlt() FLOAT SPFlt( long integer );
Convert integer variable to FFP.
 
  +
: Convert integer variable to FFP.
   
  +
; SPMul() FLOAT SPMul( FLOAT leftParm, FLOAT rightParm);
Multiply two FFP variables.
 
  +
: Multiply two FFP variables.
   
  +
; SPNeg() FLOAT SPNeg( FLOAT parm );
Take two’s complement of FFP variable.
 
  +
: Take two's complement of FFP variable.
   
  +
; SPSub() FLOAT SPSub( FLOAT leftParm, FLOAT rightParm);
Subtract two FFP variables.
 
  +
: Subtract two FFP variables.
   
  +
; SPTst() LONG SPTst( FLOAT parm );
Test an FFP variable against zero.
 
  +
: Test an FFP variable against zero.
   
 
Be sure to include the proper data type definitions shown below.
 
Be sure to include the proper data type definitions shown below.
   
  +
<syntaxhighlight>
<pre>#include &lt;exec/types.h&gt;
 
#include &lt;libraries/mathffp.h&gt;
+
#include <exec/types.h>
  +
#include <libraries/mathffp.h>
   
#include &lt;clib/mathffp_protos.h&gt;
+
#include <clib/mathffp_protos.h>
   
 
struct Library *MathBase;
 
struct Library *MathBase;
Line 167: Line 148:
 
LONG i1;
 
LONG i1;
   
if (MathBase = OpenLibrary(&quot;mathffp.library&quot;, 0))
+
if (MathBase = OpenLibrary("mathffp.library", 0))
 
{
 
{
 
i1 = SPFix(f1); /* Call SPFix entry */
 
i1 = SPFix(f1); /* Call SPFix entry */
Line 187: Line 168:
 
}
 
}
 
else
 
else
printf(&quot;Can't open mathffp.library\n&quot;);
+
printf("Can't open mathffp.library\n");
  +
}
}</pre>
 
  +
</syntaxhighlight>
  +
 
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:
 
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:
   
  +
<pre>
<pre>MOVEA.L _MathBase,A6
 
  +
MOVEA.L _MathBase,A6
JSR _LVOSPFix(A6)</pre>
 
  +
JSR _LVOSPFix(A6)
'''FFP Basic Assembly Functions'''
 
  +
</pre>
   
  +
{| class="wikitable"
<table>
 
  +
|+ FFP 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>
 
  +
| _LVOSPAbs
</tr>
 
  +
| D0 = FFP argument
</thead>
 
  +
| D0 = FFP absolute value
<tbody>
 
  +
| N = 0<br/>
<tr class="odd">
 
  +
Z = 1 if result is zero<br/>
<td align="left">_LVOSPAbs</td>
 
  +
V = 0<br/>
<td align="left">D0 = FFP argument</td>
 
  +
C = undefined<br/>
<td align="left">D0 = FFP absolute value</td>
 
  +
X = undefined
<td align="left">N = 0</td>
 
  +
|-
</tr>
 
  +
| _LVOSPAdd
<tr class="even">
 
  +
| D1 = FFP argument 1<br/>
<td align="left"></td>
 
  +
D0 = FFP addition
<td align="left"></td>
 
  +
| D0 = FFP addition of arg1 + arg2
<td align="left"></td>
 
<td align="left">Z = 1 if result is zero</td>
+
| N = 1 if result is negative<br/>
  +
Z = 1 if result is zero<br/>
</tr>
 
  +
V = 1 if result overflowed<br/>
<tr class="odd">
 
  +
C = undefined<br/>
<td align="left"></td>
 
  +
Z = undefined
<td align="left"></td>
 
  +
|-
<td align="left"></td>
 
  +
| _LVOSPCeil
<td align="left">V = 0</td>
 
  +
| D0 = FFP argument
</tr>
 
  +
| D0 = least integer >= arg
<tr class="even">
 
  +
| N = 1 if result is negative<br/>
<td align="left"></td>
 
  +
Z = 1 if result is zero<br/>
<td align="left"></td>
 
  +
V = undefined<br/>
<td align="left"></td>
 
<td align="left">C = undefined</td>
+
C = undefined<br/>
  +
Z = undefined
</tr>
 
  +
|-
<tr class="odd">
 
  +
| _LVOSPCmp
<td align="left"></td>
 
  +
| D1 = FFP argument 1<br/>
<td align="left"></td>
 
  +
D0 = FFP argument 2<br/>
<td align="left"></td>
 
  +
| D0 = +1 if arg1 > arg2<br/>
<td align="left">X = undefined</td>
 
  +
D0 = -1 if arg1 < arg2<br/>
</tr>
 
  +
D0 = 0 if arg1 = arg2
<tr class="even">
 
  +
| N = 0<br/>
<td align="left">_LVOSPAdd</td>
 
  +
Z = 1 if result is zero<br/>
<td align="left">D1 = FFP argument 1</td>
 
  +
V = 0<br/>
<td align="left">D0 = FFP addition</td>
 
  +
C = undefined<br/>
<td align="left">N = 1 if result is negative</td>
 
  +
X = undefined<br/>
</tr>
 
  +
GT = arg2 > arg1<br/>
<tr class="odd">
 
  +
GE = arg2 >= arg1<br/>
<td align="left"></td>
 
  +
EQ = arg2 = arg1<br/>
<td align="left">D0 = FFP argument 2</td>
 
<td align="left">of arg1 + arg2</td>
+
NE = arg2 != arg1<br/>
  +
LT = arg2 < arg1<br/>
<td align="left">Z = 1 if result is zero</td>
 
  +
LE = arg2 <= arg1
</tr>
 
  +
|-
<tr class="even">
 
  +
| _LVOSPDiv
<td align="left"></td>
 
  +
| D1 = FFP argument 1<br/>
<td align="left"></td>
 
  +
D0 = FFP argument 2
<td align="left"></td>
 
  +
| D0 = FFP division of arg2/arg1
<td align="left">V = 1 if result overflowed</td>
 
  +
| N = 1 if result is negative<br/>
</tr>
 
  +
Z = 1 if result is zero<br/>
<tr class="odd">
 
  +
V = 1 if result overflowed<br/>
<td align="left"></td>
 
  +
C = undefined<br/>
<td align="left"></td>
 
  +
Z = undefined
<td align="left"></td>
 
  +
|-
<td align="left">C = undefined</td>
 
  +
| _LVOSPFix
</tr>
 
  +
| D0 = FFP argument
<tr class="even">
 
  +
| D0 = Integer (two's complement)
<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"></td>
 
  +
V = 1 if overflow occurred<br/>
<td align="left">Z = undefined</td>
 
  +
C = undefined<br/>
</tr>
 
  +
X = undefined
<tr class="odd">
 
  +
|-
<td align="left">_LVOSPCeil</td>
 
  +
| _LVOSPFloor
<td align="left">D0 = FFP argument</td>
 
  +
| D0 = FFP argument
<td align="left">D0 = least integer</td>
 
  +
| D0 = largest integer <= argument
<td align="left">N = 1 if result is negative</td>
 
  +
| N = 1 if result is negative
</tr>
 
  +
Z = 1 if result is zero<br/>
<tr class="even">
 
  +
V = undefined<br/>
<td align="left"></td>
 
  +
C = undefined<br/>
<td align="left"></td>
 
  +
Z = undefined
<td align="left"><math>\ge</math> argument</td>
 
  +
|-
<td align="left">Z = 1 if result is zero</td>
 
  +
| _LVOSPFlt
</tr>
 
  +
| D0 = Integer (two's complement)
<tr class="odd">
 
  +
| D0 = FFP result
<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"></td>
 
  +
V = 0<br/>
<td align="left">V = undefined</td>
 
  +
C = undefined<br/>
</tr>
 
  +
X = undefined
<tr class="even">
 
  +
|-
<td align="left"></td>
 
  +
| _LVOSPMul
<td align="left"></td>
 
  +
| D0 = FFP argument 1<br/>
<td align="left"></td>
 
  +
D1 = FFP argument 2
<td align="left">C = undefined</td>
 
  +
| D0 = FFP multiplication of arg1 * arg2
</tr>
 
  +
| N = 1 if result is negative<br/>
<tr class="odd">
 
  +
Z = 1 if result is zero<br/>
<td align="left"></td>
 
  +
V = 1 if result overflowed<br/>
<td align="left"></td>
 
  +
C = undefined<br/>
<td align="left"></td>
 
<td align="left">Z = undefined</td>
+
Z = undefined
  +
|-
</tr>
 
  +
| _LVOSPNeg
<tr class="even">
 
  +
| D0 = FFP argument
<td align="left">_LVOSPCmp</td>
 
  +
| D0 = FFP negated
<td align="left">D1 = FFP argument 1</td>
 
<td align="left">D0 = +1 if arg1 <math>></math> arg2</td>
+
| N = 1 if result is negative<br/>
  +
Z = 1 if result is zero<br/>
<td align="left">N = 0</td>
 
</tr>
+
V = 0<br/>
  +
C = undefined<br/>
<tr class="odd">
 
  +
X = undefined
<td align="left"></td>
 
  +
|-
<td align="left">D0 = FFP argument 2</td>
 
  +
| _LVOSPSub
<td align="left">D0 = -1 if arg1 <math><</math> arg2</td>
 
  +
| D1 = FFP argument 1<br/>
<td align="left">Z = 1 if result is zero</td>
 
  +
D0 = FFP argument 2
</tr>
 
  +
| D0 = FFP subtraction of arg2 - arg1
<tr class="even">
 
  +
| N = 1 if result is negative<br/>
<td align="left"></td>
 
  +
Z = 1 if result is zero<br/>
<td align="left"></td>
 
<td align="left">D0 = 0 if arg1 = arg2</td>
+
V = 1 if result overflowed<br/>
  +
C = undefined<br/>
<td align="left">V = 0</td>
 
  +
Z = undefined
</tr>
 
  +
|-
<tr class="odd">
 
  +
| _LVOSPTst
<td align="left"></td>
 
  +
| D1 = FFP argument<br/>
<td align="left"></td>
 
  +
''Note'': This routine trashes the argument in D1.
<td align="left"></td>
 
  +
| D0 = +1 if arg > 0.0<br/>
<td align="left">C = undefined</td>
 
  +
D0 = -1 if arg < 0.0<br/>
</tr>
 
  +
D0 = 0 if arg = 0.0
<tr class="even">
 
  +
| N = 1 if result is negative<br/>
<td align="left"></td>
 
  +
Z = 1 if result is zero<br/>
<td align="left"></td>
 
<td align="left"></td>
+
V = 0<br/>
<td align="left">X = undefined</td>
+
C = undefined<br/>
  +
X = undefined<br/>
</tr>
 
  +
EQ = arg = 0.0<br/>
<tr class="odd">
 
  +
NE = arg != 0.0<br/>
<td align="left"></td>
 
<td align="left"></td>
+
PL = arg >= 0.0<br/>
  +
MI = arg < 0.0
<td align="left"></td>
 
  +
|}
<td align="left">GT = arg2 <math>></math> arg1</td>
 
</tr>
 
<tr class="even">
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left">GE = arg2 <math>\ge</math> arg1</td>
 
</tr>
 
<tr class="odd">
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left">EQ = arg2 = arg1</td>
 
</tr>
 
<tr class="even">
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left">NE = arg2 <math>\not=</math> arg1</td>
 
</tr>
 
<tr class="odd">
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left">LT = arg2 <math><</math> arg1</td>
 
</tr>
 
<tr class="even">
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left">LE = arg2 <math>\le</math> arg1</td>
 
</tr>
 
<tr class="odd">
 
<td align="left">_LVOSPDiv</td>
 
<td align="left">D1 = FFP argument 1</td>
 
<td align="left">D0 = FFP division of</td>
 
<td align="left">N = 1 if result is negative</td>
 
</tr>
 
<tr class="even">
 
<td align="left"></td>
 
<td align="left">D0 = FFP argument 2</td>
 
<td align="left">arg2/arg1</td>
 
<td align="left">Z = 1 if result is zero</td>
 
</tr>
 
<tr class="odd">
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left">V = 1 if result overflowed</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">Z = undefined</td>
 
</tr>
 
<tr class="even">
 
<td align="left">_LVOSPFix</td>
 
<td align="left">D0 = FFP argument</td>
 
<td align="left">D0 = Integer</td>
 
<td align="left">N = 1 if result is negative</td>
 
</tr>
 
<tr class="odd">
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left">(two’s complement)</td>
 
<td align="left">Z = 1 if result is zero</td>
 
</tr>
 
<tr class="even">
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left">V = 1 if overflow occurred</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">_LVOSPFloor</td>
 
<td align="left">D0 = FFP argument</td>
 
<td align="left">D0 = largest integer</td>
 
<td align="left">N = 1 if result is negative</td>
 
</tr>
 
<tr class="even">
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left"><math>\le</math> argument</td>
 
<td align="left">Z = 1 if result is zero</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">Z = undefined</td>
 
</tr>
 
<tr class="even">
 
<td align="left">_LVOSPFlt</td>
 
<td align="left">D0 = Integer</td>
 
<td align="left">D0 = FFP result</td>
 
<td align="left">N = 1 if result is negative</td>
 
</tr>
 
<tr class="odd">
 
<td align="left"></td>
 
<td align="left">(two’s complement)</td>
 
<td align="left"></td>
 
<td align="left">Z = 1 if result is zero</td>
 
</tr>
 
<tr class="even">
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left"></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">_LVOSPMul</td>
 
<td align="left">D0 = FFP argument 1</td>
 
<td align="left">D0 = FFP multiplication</td>
 
<td align="left">N = 1 if result is negative</td>
 
</tr>
 
<tr class="even">
 
<td align="left"></td>
 
<td align="left">D1 = FFP argument 2</td>
 
<td align="left">of arg1<math>\times</math>arg2</td>
 
<td align="left">Z = 1 if result is zero</td>
 
</tr>
 
<tr class="odd">
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left">V = 1 if result overflowed</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">Z = undefined</td>
 
</tr>
 
<tr class="even">
 
<td align="left">_LVOSPNeg</td>
 
<td align="left">D0 = FFP argument</td>
 
<td align="left">D0 = FFP negated</td>
 
<td align="left">N = 1 if result is negative</td>
 
</tr>
 
<tr class="odd">
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left">Z = 1 if result is zero</td>
 
</tr>
 
<tr class="even">
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left"></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>
 
</tbody>
 
</table>
 
 
'''FFP 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">_LVOSPSub</td>
 
<td align="left">D1 = FFP argument 1</td>
 
<td align="left">D0 = FFP subtraction</td>
 
<td align="left">N = 1 if result is negative</td>
 
</tr>
 
<tr class="even">
 
<td align="left"></td>
 
<td align="left">D0 = FFP argument 2</td>
 
<td align="left">of arg2 - arg1</td>
 
<td align="left">Z = 1 if result is zero</td>
 
</tr>
 
<tr class="odd">
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left">V = 1 if result overflowed</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">Z = undefined</td>
 
</tr>
 
<tr class="even">
 
<td align="left">_LVOSPTst</td>
 
<td align="left">D1 = FFP argument</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"></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"></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">''Note'': This routine</td>
 
<td align="left"></td>
 
<td align="left">EQ = arg = 0.0</td>
 
</tr>
 
<tr class="even">
 
<td align="left"></td>
 
<td align="left">trashes the argument</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">in D1.</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>
 
</tbody>
 
</table>
 
   
 
== FFP Transcendental Mathematics Library ==
 
== FFP Transcendental Mathematics Library ==
Line 647: Line 319:
 
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 &quot;mathtrans.library&quot; as the argument.
 
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 &quot;mathtrans.library&quot; as the argument.
   
  +
<syntaxhighlight>
<pre>#include &lt;exec/types.h&gt;
 
#include &lt;libraries/mathffp.h&gt;
+
#include <exec/types.h>
  +
#include <libraries/mathffp.h>
   
#include &lt;clib/mathffp_protos.h&gt;
+
#include <clib/mathffp_protos.h>
#include &lt;clib/mathtrans_protos.h&gt;
+
#include <clib/mathtrans_protos.h>
   
 
struct Library *MathTransBase;
 
struct Library *MathTransBase;
Line 657: Line 330:
 
VOID main()
 
VOID main()
 
{
 
{
if (MathTransBase = OpenLibrary(&quot;mathtrans.library&quot;,0))
+
if (MathTransBase = OpenLibrary("mathtrans.library",0))
 
{
 
{
 
.
 
.
Line 665: Line 338:
 
}
 
}
 
else
 
else
printf(&quot;Can't open mathtrans.library\n&quot;);
+
printf("Can't open mathtrans.library\n");
  +
}
}</pre>
 
  +
</syntaxhighlight>
  +
 
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.
 
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 ===
 
=== FFP Transcendental Functions ===
   
  +
; SPAsin() FLOAT SPAsin( FLOAT parm );
Return arccosine of FFP variable.
 
  +
: Return arcsine of FFP variable.
   
  +
; SPAcos() FLOAT SPAcos( FLOAT parm );
Return arctangent of FFP variable.
 
  +
: Return arccosine of FFP variable.
   
  +
; SPAtan() FLOAT SPAtan( FLOAT parm );
Return arcsine of FFP variable.
 
  +
: 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.
 
  +
: 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.
 
  +
: 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.
 
  +
: 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.
 
  +
: 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.
 
  +
: Return hyperbolic sine of FFP variable.
   
  +
; SPCosh() FLOAT SPCosh( FLOAT parm );
Return hyperbolic cosine of FFP variable.
 
  +
: Return hyperbolic cosine of FFP variable.
   
  +
; SPTanh() FLOAT SPTanh( FLOAT parm );
Return hyperbolic tangent of FFP variable.
 
  +
: 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<math>\ldots</math>) raised to that power.
 
  +
: 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.
 
  +
: Return natural log (base ''e'') of FFP variable.
   
  +
; SPLog10() FLOAT SPLog10( FLOAT parm );
Return log (base 10) of FFP variable.
 
  +
: Return log (base 10) of FFP variable.
   
  +
; SPPow() FLOAT SPPow( FLOAT power, FLOAT arg );
Return FFP arg2 to FFP arg1.
 
  +
: Return FFP arg2 to FFP arg1.
   
  +
; SPSqrt() FLOAT SPSqrt( FLOAT parm );
Return square root of FFP variable.
 
  +
: Return square root of FFP variable.
   
  +
; SPTieee() FLOAT SPTieee( FLOAT parm );
Convert FFP variable to IEEE format
 
  +
: Convert FFP variable to IEEE format
   
  +
; SPFieee() FLOAT SPFieee( FLOAT parm );
Convert IEEE variable to FFP format.
 
  +
: Convert IEEE variable to FFP format.
   
 
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 &lt;exec/types.h&gt;
 
#include &lt;libraries/mathffp.h&gt;
+
#include <exec/types.h>
  +
#include <libraries/mathffp.h>
   
#include &lt;clib/mathffp_protos.h&gt;
+
#include <clib/mathffp_protos.h>
#include &lt;clib/mathtrans_protos.h&gt;
+
#include <clib/mathtrans_protos.h>
   
 
struct Library *MathTransBase;
 
struct Library *MathTransBase;
Line 720: Line 413:
 
FLOAT i1;
 
FLOAT i1;
   
if (MathTransBase = OpenLibrary(&quot;mathtrans.library&quot;,33))
+
if (MathTransBase = OpenLibrary("mathtrans.library",33))
 
{
 
{
 
f1 = SPAsin(f2); /* Call SPAsin entry */
 
f1 = SPAsin(f2); /* Call SPAsin entry */
Line 729: Line 422:
 
f1 = SPCos(f2); /* Call SPCos entry */
 
f1 = SPCos(f2); /* Call SPCos entry */
 
f1 = SPTan(f2); /* Call SPTan entry */
 
f1 = SPTan(f2); /* Call SPTan entry */
f1 = SPSincos(&amp;f3, f2); /* Call SPSincos entry */
+
f1 = SPSincos(&f3, f2); /* Call SPSincos entry */
   
 
f1 = SPSinh(f2); /* Call SPSinh entry */
 
f1 = SPSinh(f2); /* Call SPSinh entry */
Line 747: Line 440:
 
}
 
}
 
else
 
else
printf(&quot;Can't open mathtrans.library\n&quot;);
+
printf("Can't open mathtrans.library\n");
  +
}
}</pre>
 
  +
</syntaxhighlight>
  +
 
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:
 
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:
   
  +
<pre>
<pre>MOVEA.L _MathTransBase,A6
 
  +
MOVEA.L _MathTransBase,A6
JSR _LVOSPAsin(A6)</pre>
 
  +
JSR _LVOSPAsin(A6)
'''FFP Transcendental Assembly Functions'''
 
  +
</pre>
   
  +
{| class="wikitable"
<table>
 
  +
|+ FFP 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>
 
  +
| _LVOSPAsin
</tr>
 
  +
| D0 = FFP argument
</thead>
 
  +
| D0 = FFP arcsine radian
<tbody>
 
  +
| N = 0
<tr class="odd">
 
  +
Z = 1 if result is zero<br/>
<td align="left">_LVOSPAsin</td>
 
  +
V = 0<br/>
<td align="left">D0 = FFP argument</td>
 
  +
C = undefined<br/>
<td align="left">D0 = FFP arcsine</td>
 
  +
X = undefined
<td align="left">N = 0</td>
 
  +
|-
</tr>
 
  +
| _LVOSPAcos
<tr class="even">
 
  +
| D0 = FFP argument
<td align="left"></td>
 
  +
| D0 = FFP arccosine radian
<td align="left"></td>
 
  +
| N = 0<br/>
<td align="left">radian</td>
 
<td align="left">Z = 1 if result is zero</td>
+
Z = 1 if result is zero<br/>
  +
V = 1 if overflow occurred<br/>
</tr>
 
  +
C = undefined<br/>
<tr class="odd">
 
  +
X = undefined
<td align="left"></td>
 
  +
|-
<td align="left"></td>
 
  +
| _LVOSPAtan
<td align="left"></td>
 
  +
| D0 = FFP argument
<td align="left">V = 0</td>
 
  +
| D0 = FFP arctangent radian
</tr>
 
  +
| N = 0<br/>
<tr class="even">
 
  +
Z = 1 if result is zero<br/>
<td align="left"></td>
 
<td align="left"></td>
+
V = 0<br/>
  +
C = undefined<br/>
<td align="left"></td>
 
<td align="left">C = undefined</td>
+
X = undefined
  +
|-
</tr>
 
  +
| _LVOSPSin
<tr class="odd">
 
  +
| D0 = FFP argument in radians
<td align="left"></td>
 
  +
| D0 = FFP sine
<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">X = undefined</td>
 
  +
V = 1 if result is meaningless (that is, input magnitude too large)<br/>
</tr>
 
  +
C = undefined<br/>
<tr class="even">
 
  +
X = undefined
<td align="left">_LVOSPAcos</td>
 
  +
|-
<td align="left">D0 = FFP argument</td>
 
  +
| _LVOSPCos
<td align="left">D0 = FFP arccosine</td>
 
  +
| D0 = FFP argument in radians
<td align="left">N = 0</td>
 
  +
| D0 = FFP cosine
</tr>
 
  +
| N = 1 if result is negative<br/>
<tr class="odd">
 
  +
Z = 1 if result is zero<br/>
<td align="left"></td>
 
  +
V = 1 if result is meaningless (that is, input magnitude too large)<br/>
<td align="left"></td>
 
  +
C = undefined<br/>
<td align="left">radian</td>
 
  +
X = undefined
<td align="left">Z = 1 if result is zero</td>
 
  +
|-
</tr>
 
  +
| _LVOSPTan
<tr class="even">
 
  +
| D0 = FFP argument in radians
<td align="left"></td>
 
  +
| D0 = FFP tangent
<td align="left"></td>
 
  +
| N = 1 if result is negative<br/>
<td align="left"></td>
 
<td align="left">V = 1 if overflow occurred</td>
+
Z = 1 if result is zero<br/>
  +
V = 1 if result is meaningless (that is, input magnitude too large)<br/>
</tr>
 
  +
C = undefined<br/>
<tr class="odd">
 
  +
X = undefined
<td align="left"></td>
 
  +
|-
<td align="left"></td>
 
  +
| _LVOSPSincos
<td align="left"></td>
 
  +
| D0 = FFP argument in radians<br/>
<td align="left">C = undefined</td>
 
  +
D1 = Address to store cosine result
</tr>
 
  +
| D0 = FFP sine<br/>
<tr class="even">
 
  +
(D1) = FFP cosine
<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"></td>
 
  +
V = 1 if result is meaningless (that is, input magnitude too large)<br/>
<td align="left">X = undefined</td>
 
  +
C = undefined<br/>
</tr>
 
  +
X = undefined
<tr class="odd">
 
  +
|-
<td align="left">_LVOSPAtan</td>
 
  +
| _LVOSPSinh
<td align="left">D0 = FFP argument</td>
 
<td align="left">D0 = FFP arctangent</td>
+
| D0 = FFP argument in radians
  +
| D0 = FFP hyperbolic sine
<td align="left">N = 0</td>
 
  +
| N = 1 if result is negative<br/>
</tr>
 
  +
Z = 1 if result is zero<br/>
<tr class="even">
 
  +
V = 1 if overflow occurred<br/>
<td align="left"></td>
 
  +
C = undefined<br/>
<td align="left"></td>
 
  +
X = undefined
<td align="left">radian</td>
 
  +
|-
<td align="left">Z = 1 if result is zero</td>
 
  +
| _LVOSPCosh
</tr>
 
  +
| D0 = FFP argument in radians
<tr class="odd">
 
  +
| D0 = FFP hyperbolic cosine
<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"></td>
 
  +
V = 1 if overflow occurred<br/>
<td align="left">V = 0</td>
 
  +
C = undefined<br/>
</tr>
 
  +
X = undefined
<tr class="even">
 
  +
|-
<td align="left"></td>
 
  +
| _LVOSPTanh
<td align="left"></td>
 
  +
| D0 = FFP argument in radians
<td align="left"></td>
 
  +
| D0 = FFP hyperbolic tangent
<td align="left">C = undefined</td>
 
  +
| N = 1 if result is negative<br/>
</tr>
 
  +
Z = 1 if result is zero<br/>
<tr class="odd">
 
  +
V = 1 if overflow occurred<br/>
<td align="left"></td>
 
  +
C = undefined<br/>
<td align="left"></td>
 
  +
X = undefined
<td align="left"></td>
 
  +
|-
<td align="left">X = undefined</td>
 
  +
| _LVOSPExp
</tr>
 
  +
| D0 = FFP argument
<tr class="even">
 
  +
| D0 = FFP exponential
<td align="left">_LVOSPSin</td>
 
  +
| N = 0<br/>
<td align="left">D0 = FFP argument</td>
 
  +
Z = 1 if result is zero<br/>
<td align="left">D0 = FFP sine</td>
 
<td align="left">N = 1 if result is negative</td>
+
V = 1 if overflow occurred<br/>
  +
C = undefined<br/>
</tr>
 
  +
Z = undefined
<tr class="odd">
 
  +
|-
<td align="left"></td>
 
  +
| _LVOSPLog
<td align="left">in radians</td>
 
  +
| D0 = FFP argument
<td align="left"></td>
 
  +
| D0 = FFP natural logarithm
<td align="left">Z = 1 if result is zero</td>
 
  +
| N = 1 if result is negative<br/>
</tr>
 
  +
Z = 1 if result is zero<br/>
<tr class="even">
 
  +
V = 1 if argument negative or zero<br/>
<td align="left"></td>
 
  +
C = undefined<br/>
<td align="left"></td>
 
  +
Z = undefined
<td align="left"></td>
 
  +
|-
<td align="left">V = 1 if result is meaningless</td>
 
  +
| _LVOSPLog10
</tr>
 
  +
| D0 = FFP argument
<tr class="odd">
 
  +
| D0 = FFP logarithm (base 10)
<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"></td>
 
  +
V = 1 if argument negative or zero<br/>
<td align="left">(that is, input</td>
 
  +
C = undefined<br/>
</tr>
 
  +
Z = undefined
<tr class="even">
 
  +
|-
<td align="left"></td>
 
  +
| _LVOSPPow
<td align="left"></td>
 
  +
| D0 = FFP exponent value<br/>
<td align="left"></td>
 
  +
D1 = FFP argument value
<td align="left">magnitude too large)</td>
 
  +
| D0 = FFP result of arg taken to exp power
</tr>
 
  +
| N = 0<br/>
<tr class="odd">
 
  +
Z = 1 if result is zero<br/>
<td align="left"></td>
 
  +
V = 1 if result overflowed or arg < 0<br/>
<td align="left"></td>
 
  +
C = undefined<br/>
<td align="left"></td>
 
<td align="left">C = undefined</td>
+
Z = undefined
  +
|-
</tr>
 
  +
| _LVOSPSqrt
<tr class="even">
 
  +
| D0 = FFP argument
<td align="left"></td>
 
  +
| D0 = FFP square root
<td align="left"></td>
 
<td align="left"></td>
+
| N = 0<br/>
  +
Z = 1 if result is zero<br/>
<td align="left">X = undefined</td>
 
  +
V = 1 if argument was negative<br/>
</tr>
 
  +
C = undefined<br/>
<tr class="odd">
 
  +
Z = undefined
<td align="left">_LVOSPCos</td>
 
  +
|-
<td align="left">D0 = FFP argument</td>
 
  +
| _LVOSPTieee
<td align="left">D0 = FFP cosine</td>
 
  +
| D0 = FFP format argument
<td align="left">N = 1 if result is negative</td>
 
  +
| D0 = IEEE floating-point format
</tr>
 
  +
| N = 1 if result is negative<br/>
<tr class="even">
 
  +
Z = 1 if result is zero<br/>
<td align="left"></td>
 
  +
V = undefined<br/>
<td align="left">in radians</td>
 
  +
C = undefined<br/>
<td align="left"></td>
 
  +
Z = undefined
<td align="left">Z = 1 if result is zero</td>
 
  +
|-
</tr>
 
  +
| _LVOSPFieee
<tr class="odd">
 
  +
| D0 = IEEE floating-point format argument
<td align="left"></td>
 
  +
| D0 = FFP format
<td align="left"></td>
 
  +
| N = undefined<br/>
<td align="left"></td>
 
<td align="left">V = 1 if result is meaningless</td>
+
Z = 1 if result is zero<br/>
  +
V = 1 if result overflowed<br/>
</tr>
 
  +
C = undefined<br/>
<tr class="even">
 
  +
Z = undefined
<td align="left"></td>
 
  +
|}
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left">(that is, input</td>
 
</tr>
 
<tr class="odd">
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left">magnitude too large)</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">_LVOSPTan</td>
 
<td align="left">D0 = FFP argument</td>
 
<td align="left">D0 = FFP tangent</td>
 
<td align="left">N = 1 if result is negative</td>
 
</tr>
 
<tr class="odd">
 
<td align="left"></td>
 
<td align="left">in radians</td>
 
<td align="left"></td>
 
<td align="left">Z = 1 if result is zero</td>
 
</tr>
 
<tr class="even">
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left">V = 1 if result is meaningless</td>
 
</tr>
 
<tr class="odd">
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left">(that is, input</td>
 
</tr>
 
<tr class="even">
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left">magnitude too large)</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">_LVOSPSincos</td>
 
<td align="left">D0 = FFP argument</td>
 
<td align="left">D0 = FFP sine</td>
 
<td align="left">N = 1 if result is negative</td>
 
</tr>
 
<tr class="even">
 
<td align="left"></td>
 
<td align="left">in radians</td>
 
<td align="left">(D1) = FFP cosine</td>
 
<td align="left">Z = 1 if result is zero</td>
 
</tr>
 
<tr class="odd">
 
<td align="left"></td>
 
<td align="left">D1 = Address to store</td>
 
<td align="left"></td>
 
<td align="left">V = 1 if result is meaningless</td>
 
</tr>
 
<tr class="even">
 
<td align="left"></td>
 
<td align="left">cosine result</td>
 
<td align="left"></td>
 
<td align="left">(that is, input</td>
 
</tr>
 
<tr class="odd">
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left">magnitude too large)</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">_LVOSPSinh</td>
 
<td align="left">D0 = FFP argument</td>
 
<td align="left">D0 = FFP hyperbolic</td>
 
<td align="left">N = 1 if result is negative</td>
 
</tr>
 
<tr class="odd">
 
<td align="left"></td>
 
<td align="left">in radians</td>
 
<td align="left">sine</td>
 
<td align="left">Z = 1 if result is zero</td>
 
</tr>
 
<tr class="even">
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left">V = 1 if overflow occurred</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">_LVOSPCosh</td>
 
<td align="left">D0 = FFP argument</td>
 
<td align="left">D0 = FFP hyperbolic</td>
 
<td align="left">N = 1 if result is negative</td>
 
</tr>
 
<tr class="even">
 
<td align="left"></td>
 
<td align="left">in radians</td>
 
<td align="left">cosine</td>
 
<td align="left">Z = 1 if result is zero</td>
 
</tr>
 
<tr class="odd">
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left">V = 1 if overflow occurred</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>
 
 
'''FFP 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">_LVOSPTanh</td>
 
<td align="left">D0 = FFP argument</td>
 
<td align="left">D0 = FFP hyperbolic</td>
 
<td align="left">N = 1 if result is negative</td>
 
</tr>
 
<tr class="even">
 
<td align="left"></td>
 
<td align="left">in radians</td>
 
<td align="left">tangent</td>
 
<td align="left">Z = 1 if result is zero</td>
 
</tr>
 
<tr class="odd">
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left">V = 1 if overflow occurred</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">_LVOSPExp</td>
 
<td align="left">D0 = FFP argument</td>
 
<td align="left">D0 = FFP exponential</td>
 
<td align="left">N = 0</td>
 
</tr>
 
<tr class="odd">
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left">Z = 1 if result is zero</td>
 
</tr>
 
<tr class="even">
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left">V = 1 if overflow occurred</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">Z = undefined</td>
 
</tr>
 
<tr class="odd">
 
<td align="left">_LVOSPLog</td>
 
<td align="left">D0 = FFP argument</td>
 
<td align="left">D0 = FFP natural</td>
 
<td align="left">N = 1 if result is negative</td>
 
</tr>
 
<tr class="even">
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left">logarithm</td>
 
<td align="left">Z = 1 if result is zero</td>
 
</tr>
 
<tr class="odd">
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left">V = 1 if argument negative</td>
 
</tr>
 
<tr class="even">
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left">or zero</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">Z = undefined</td>
 
</tr>
 
<tr class="odd">
 
<td align="left">_LVOSPLog10</td>
 
<td align="left">D0 = FFP argument</td>
 
<td align="left">D0 = FFP logarithm</td>
 
<td align="left">N = 1 if result is negative</td>
 
</tr>
 
<tr class="even">
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left">(base 10)</td>
 
<td align="left">Z = 1 if result is zero</td>
 
</tr>
 
<tr class="odd">
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left">V = 1 if argument negative</td>
 
</tr>
 
<tr class="even">
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left">or zero</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">Z = undefined</td>
 
</tr>
 
<tr class="odd">
 
<td align="left">_LVOSPPow</td>
 
<td align="left">D0 = FFP exponent value</td>
 
<td align="left">D0 = FFP result of</td>
 
<td align="left">N = 0</td>
 
</tr>
 
<tr class="even">
 
<td align="left"></td>
 
<td align="left">D1 = FFP argument value</td>
 
<td align="left">arg taken to exp power</td>
 
<td align="left">Z = 1 if result is zero</td>
 
</tr>
 
<tr class="odd">
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left">V = 1 if result overflowed</td>
 
</tr>
 
<tr class="even">
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left">or arg <math><</math> 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">Z = undefined</td>
 
</tr>
 
<tr class="odd">
 
<td align="left">_LVOSPSqrt</td>
 
<td align="left">D0 = FFP argument</td>
 
<td align="left">D0 = FFP square root</td>
 
<td align="left">N = 0</td>
 
</tr>
 
<tr class="even">
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left">Z = 1 if result is zero</td>
 
</tr>
 
<tr class="odd">
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left">V = 1 if argument was negative</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">Z = undefined</td>
 
</tr>
 
</tbody>
 
</table>
 
   
 
== FFP Mathematics Conversion Library ==
 
== FFP Mathematics Conversion Library ==
Line 1,305: Line 621:
 
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.
 
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.
   
  +
<syntaxhighlight>
<pre>#include &lt;exec/types.h&gt;
 
#include &lt;libraries/mathffp.h&gt;
+
#include <exec/types.h>
  +
#include <libraries/mathffp.h>
   
#include &lt;clib/mathffp_protos.h&gt;
+
#include <clib/mathffp_protos.h>
   
 
struct Library *MathBase;
 
struct Library *MathBase;
Line 1,314: Line 631:
 
VOID main()
 
VOID main()
 
{
 
{
if (MathBase = OpenLibrary(&quot;mathffp.library&quot;, 33))
+
if (MathBase = OpenLibrary("mathffp.library", 33))
 
{
 
{
 
. . .
 
. . .
Line 1,321: Line 638:
 
}
 
}
 
else
 
else
printf(&quot;Can't open mathffp.library\n&quot;);
+
printf("Can't open mathffp.library\n");
  +
}
}</pre>
 
  +
</syntaxhighlight>
  +
 
=== Math Support Functions ===
 
=== Math Support Functions ===
   
  +
; afp() FLOAT afp( BYTE *string );
Convert ASCII string into FFP equivalent.
 
  +
: Convert ASCII string into FFP equivalent.
   
  +
; arnd() VOID arnd( LONG place, LONG exp, BYTE *string);
Round ASCII representation of FFP number.
 
  +
: Round ASCII representation of FFP number.
   
  +
; dbf() FLOAT dbf( ULONG exp, ULONG mant);
Convert FFP dual-binary number to FFP equivalent.
 
  +
: Convert FFP dual-binary number to FFP equivalent.
   
  +
; fpa() LONG fpa( FLOAT fnum, BYTE *string);
Convert FFP variable into ASCII equivalent.
 
  +
: 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.
 
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.
   
  +
<syntaxhighlight>
<pre>#include &lt;exec/types.h&gt;
 
#include &lt;libraries/mathffp.h&gt;
+
#include <exec/types.h>
  +
#include <libraries/mathffp.h>
   
#include &lt;clib/mathffp_protos.h&gt;
+
#include <clib/mathffp_protos.h>
#include &lt;clib/alib_protos.h&gt;
+
#include <clib/alib_protos.h>
   
 
struct Library *MathBase;
 
struct Library *MathBase;
   
UBYTE st1[80] = &quot;3.1415926535897&quot;;
+
UBYTE st1[80] = "3.1415926535897";
UBYTE st2[80] = &quot;2.718281828459045&quot;;
+
UBYTE st2[80] = "2.718281828459045";
 
UBYTE st3[80], st4[80];
 
UBYTE st3[80], st4[80];
   
Line 1,355: Line 679:
 
LONG place1, place2;
 
LONG place1, place2;
   
if (MathBase = OpenLibrary(&quot;mathffp.library&quot;, 33))
+
if (MathBase = OpenLibrary("mathffp.library", 33))
 
{
 
{
   
 
n1 = afp(st1); /* Call afp entry */
 
n1 = afp(st1); /* Call afp entry */
 
n2 = afp(st2); /* Call afp entry */
 
n2 = afp(st2); /* Call afp entry */
printf(&quot;\n\nASCII %s converts to floating point %f&quot;, st1, n1);
+
printf("\n\nASCII %s converts to floating point %f", st1, n1);
printf(&quot;\nASCII %s converts to floating point %f&quot;, st2, n2);
+
printf("\nASCII %s converts to floating point %f", st2, n2);
   
 
num1 = 3.1415926535897;
 
num1 = 3.1415926535897;
Line 1,368: Line 692:
 
exp1 = fpa(num1, st3); /* Call fpa entry */
 
exp1 = fpa(num1, st3); /* Call fpa entry */
 
exp2 = fpa(num2, st4); /* Call fpa entry */
 
exp2 = fpa(num2, st4); /* Call fpa entry */
printf(&quot;\n\nfloating point %f converts to ASCII %s&quot;, num1, st3);
+
printf("\n\nfloating point %f converts to ASCII %s", num1, st3);
printf(&quot;\nfloating point %f converts to ASCII %s&quot;, num2, st4);
+
printf("\nfloating point %f converts to ASCII %s", num2, st4);
   
 
place1 = -2;
 
place1 = -2;
Line 1,375: Line 699:
 
arnd(place1, exp1, st3); /* Call arnd entry */
 
arnd(place1, exp1, st3); /* Call arnd entry */
 
arnd(place2, exp2, st4); /* Call arnd entry */
 
arnd(place2, exp2, st4); /* Call arnd entry */
printf(&quot;\n\nASCII round of %f to %d places yields %s&quot;, num1, place1, st3);
+
printf("\n\nASCII round of %f to %d places yields %s", num1, place1, st3);
printf(&quot;\nASCII round of %f to %d places yields %s&quot;, num2, place2, st4);
+
printf("\nASCII round of %f to %d places yields %s", num2, place2, st4);
   
 
exp1 = -3; exp2 = 3; exp3 = -3; exp4 = 3;
 
exp1 = -3; exp2 = 3; exp3 = -3; exp4 = 3;
Line 1,385: Line 709:
 
n3 = dbf(exp3, mant3); /* Call dbf entry */
 
n3 = dbf(exp3, mant3); /* Call dbf entry */
 
n4 = dbf(exp4, mant4); /* Call dbf entry */
 
n4 = dbf(exp4, mant4); /* Call dbf entry */
printf(&quot;\n\ndbf of exp = %d and mant = %d yields FFP number of %f&quot;, exp1, mant1, n1);
+
printf("\n\ndbf of exp = %d and mant = %d yields FFP number of %f", exp1, mant1, n1);
printf(&quot;\ndbf of exp = %d and mant = %d yields FFP number of %f&quot;, exp2, mant2, n2);
+
printf("\ndbf of exp = %d and mant = %d yields FFP number of %f", exp2, mant2, n2);
printf(&quot;\ndbf of exp = %d and mant = %d yields FFP number of %f&quot;, exp3, mant3, n3);
+
printf("\ndbf of exp = %d and mant = %d yields FFP number of %f", exp3, mant3, n3);
printf(&quot;\ndbf of exp = %d and mant = %d yields FFP number of %f&quot;, exp4, mant4, n4);
+
printf("\ndbf of exp = %d and mant = %d yields FFP number of %f", exp4, mant4, n4);
   
 
CloseLibrary(MathBase);
 
CloseLibrary(MathBase);
 
}
 
}
 
else
 
else
printf(&quot;Can't open mathffp.library\n&quot;);
+
printf("Can't open mathffp.library\n");
  +
}
}</pre>
 
  +
</syntaxhighlight>
  +
 
== IEEE Single-Precision Data Format ==
 
== IEEE Single-Precision Data Format ==
   
 
The IEEE single-precision variables are defined as 32-bit entities with the following format:
 
The IEEE single-precision variables are defined as 32-bit entities with the following format:
   
  +
______________________________________________
<table>
 
  +
| |
<tbody>
 
  +
| SEEEEEEE MMMMMMMM MMMMMMMM MMMMMMMM |
<tr class="odd">
 
  +
| 31 23 15 7 |
<td align="left">SEEEEEEE</td>
 
  +
|______________________________________________|
<td align="left">MMMMMMMM</td>
 
<td align="left">MMMMMMMM</td>
 
<td align="left">EEEEEEE</td>
 
</tr>
 
<tr class="even">
 
<td align="left">31</td>
 
<td align="left">23</td>
 
<td align="left">15</td>
 
<td align="left">7</td>
 
</tr>
 
</tbody>
 
</table>
 
   
<sub>b</sub>oxHidden 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.
+
{{Note|title=Hidden Bit In The Mantissa|text=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.
+
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 ==
 
== IEEE Single-Precision Basic Math Library ==
Line 1,426: Line 741:
 
The library is opened by making calling OpenLibrary() with &quot;mathieeesingbas.library&quot; as the argument. Do not share the library base pointer between tasks - see note at beginning of chapter for details.
 
The library is opened by making calling OpenLibrary() with &quot;mathieeesingbas.library&quot; as the argument. Do not share the library base pointer between tasks - see note at beginning of chapter for details.
   
  +
<syntaxhighlight>
<pre>
 
#include &lt;exec/types.h&gt;
+
#include <exec/types.h>
#include &lt;libraries/mathieeesp.h&gt;
+
#include <libraries/mathieeesp.h>
   
#include &lt;clib/mathsingbas_protos.h&gt;
+
#include <clib/mathsingbas_protos.h>
   
 
struct Library *MathIeeeSingBasBase;
 
struct Library *MathIeeeSingBasBase;
Line 1,437: Line 752:
 
{
 
{
 
/* do not share base pointer between tasks. */
 
/* do not share base pointer between tasks. */
if (MathIeeeSingBasBase = OpenLibrary(&quot;mathieeesingbas.library&quot;, 37))
+
if (MathIeeeSingBasBase = OpenLibrary("mathieeesingbas.library", 37))
 
{
 
{
 
.
 
.
Line 1,445: Line 760:
 
}
 
}
 
else
 
else
printf(&quot;Can't open mathieeesingbas.library\n&quot;);
+
printf("Can't open mathieeesingbas.library\n");
  +
}
}</pre>
 
  +
</syntaxhighlight>
  +
 
The global variable MathIeeeSingBasBase is used internally for all future library references.
 
The global variable MathIeeeSingBasBase is used internally for all future library references.
   
Line 1,453: Line 770:
 
=== SP IEEE Basic Functions (V36 or greater) ===
 
=== SP IEEE Basic Functions (V36 or greater) ===
   
  +
; IEEESPAbs() FLOAT ( FLOAT parm );
Take absolute value of IEEE single-precision variable.
 
  +
: Take absolute value of IEEE single-precision variable.
   
  +
; IEEESPAdd() FLOAT IEEESPAdd( FLOAT leftParm, FLOAT rightParm);
Add two IEEE single-precision variables.
 
  +
: Add two IEEE single-precision variables.
   
  +
; IEEESPCeil() FLOAT IEEESPCeil( FLOAT parm );
Compute least integer greater than or equal to variable.
 
  +
: Compute least integer greater than or equal to variable.
   
  +
; IEEESPCmp() LONG IEEESPCmp( FLOAT leftParm, FLOAT rightParm );
Compare two IEEE single-precision variables.
 
  +
: Compare two IEEE single-precision variables.
   
  +
; IEEESPDiv() FLOAT IEEESPDiv( FLOAT dividend, FLOAT divisor );
Divide two IEEE single-precision variables.
 
  +
: Divide two IEEE single-precision variables.
   
  +
; IEEESPFix() LONG IEEESPFix( FLOAT parm );
Convert IEEE single-precision variable to integer.
 
  +
: Convert IEEE single-precision variable to integer.
   
  +
; IEEESPFloor() FLOAT IEEESPFloor( FLOAT parm );
Compute largest integer less than or equal to variable.
 
  +
: Compute largest integer less than or equal to variable.
   
  +
; IEEESPFlt() FLOAT IEEESPFlt( long integer );
Convert integer variable to IEEE single-precision.
 
  +
: Convert integer variable to IEEE single-precision.
   
  +
; IEEESPMul() FLOAT IEEESPMul( FLOAT leftParm, FLOAT rightParm );
Multiply two IEEE single-precision variables.
 
  +
: Multiply two IEEE single-precision variables.
   
  +
; IEEESPNeg() FLOAT IEEESPNeg( FLOAT parm );
Take two’s complement of IEEE single-precision variable.
 
  +
: Take two's complement of IEEE single-precision variable.
   
  +
; IEEESPSub() FLOAT IEEESPSub( FLOAT leftParm, FLOAT rightParm );
Subtract two IEEE single-precision variables.
 
  +
: Subtract two IEEE single-precision variables.
   
  +
; IEEESPTst() LONG IEEESPTst( FLOAT parm );
Test an IEEE single-precision variable against zero.
 
  +
: Test an IEEE single-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 &lt;exec/types.h&gt;
 
#include &lt;libraries/mathieeesp.h&gt;
+
#include <exec/types.h>
  +
#include <libraries/mathieeesp.h>
   
#include &lt;clib/mathsingbas_protos.h&gt;
+
#include <clib/mathsingbas_protos.h>
   
 
struct Library *MathIeeeSingBasBase;
 
struct Library *MathIeeeSingBasBase;
Line 1,491: Line 821:
 
LONG i1;
 
LONG i1;
   
if (MathIeeeSingBasBase = OpenLibrary(&quot;mathieeesingbas.library&quot;,37))
+
if (MathIeeeSingBasBase = OpenLibrary("mathieeesingbas.library",37))
 
{
 
{
 
i1 = IEEESPFix(f1); /* Call IEEESPFix entry */
 
i1 = IEEESPFix(f1); /* Call IEEESPFix entry */
Line 1,509: Line 839:
 
}
 
}
 
else
 
else
printf(&quot;Can't open mathieeesingbas.library\n&quot;);
+
printf("Can't open mathieeesingbas.library\n");
  +
}
}</pre>
 
  +
</syntaxhighlight>
  +
 
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:
 
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:
   
  +
<pre>
<pre>MOVEA.L _MathIeeeSingBasBase,A6
 
  +
MOVEA.L _MathIeeeSingBasBase,A6
JSR _LVOIEEESPFix(A6)</pre>
 
  +
JSR _LVOIEEESPFix(A6)
'''SP IEEE Basic Assembly Functions'''
 
  +
</pre>
 
<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">_LVOIEEESPFix</td>
 
<td align="left">D0 = IEEE double-precision</td>
 
<td align="left">D0 = Integer</td>
 
<td align="left">N = undefined</td>
 
</tr>
 
<tr class="even">
 
<td align="left"></td>
 
<td align="left">argument</td>
 
<td align="left">(two’s complement)</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">_LVOIEEESPFlt</td>
 
<td align="left">D0 = Integer argument</td>
 
<td align="left">D0 = IEEE</td>
 
<td align="left">N = undefined</td>
 
</tr>
 
<tr class="odd">
 
<td align="left"></td>
 
<td align="left">(two’s complement)</td>
 
<td align="left">single-precision</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">_LVOIEEESPCmp</td>
 
<td align="left">D0 = IEEE single-precision</td>
 
<td align="left">D0 = +1 if arg1 <math>></math> arg2</td>
 
<td align="left">N = 1 if result is negative</td>
 
</tr>
 
<tr class="even">
 
<td align="left"></td>
 
<td align="left">argument 1</td>
 
<td align="left">D0 = -1 if arg1 <math><</math> arg2</td>
 
<td align="left">Z = 1 if result is zero</td>
 
</tr>
 
<tr class="odd">
 
<td align="left"></td>
 
<td align="left">D1 = IEEE single-precision</td>
 
<td align="left">D0 = 0 if arg1 = arg2</td>
 
<td align="left">V = 0</td>
 
</tr>
 
<tr class="even">
 
<td align="left"></td>
 
<td align="left">argument 2</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"></td>
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left">GT = arg2 <math>></math> arg1</td>
 
</tr>
 
<tr class="odd">
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left">GE = arg2 <math>\ge</math> arg1</td>
 
</tr>
 
<tr class="even">
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left">EQ = arg2 = arg1</td>
 
</tr>
 
<tr class="odd">
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left">NE = arg2 <math>\not=</math> arg1</td>
 
</tr>
 
<tr class="even">
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left">LT = arg2 <math><</math> arg1</td>
 
</tr>
 
<tr class="odd">
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left">E= arg2 <math>\le</math> arg1</td>
 
</tr>
 
<tr class="even">
 
<td align="left">_LVOIEEESPTst</td>
 
<td align="left">D0 = IEEE single-precision</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">argument</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"></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">_LVOIEEESPAbs</td>
 
<td align="left">D0 = IEEE single-precision</td>
 
<td align="left">D0 = IEEE 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">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">_LVOIEEESPNeg</td>
 
<td align="left">D0 = IEEE single-precision</td>
 
<td align="left">D0 = IEEE single-precision</td>
 
<td align="left">N = undefined</td>
 
</tr>
 
<tr class="odd">
 
<td align="left"></td>
 
<td align="left">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">_LVOIEEESPAdd</td>
 
<td align="left">D0 = IEEE single-precision</td>
 
<td align="left">D0 = IEEE single-precision</td>
 
<td align="left">N = undefined</td>
 
</tr>
 
<tr class="even">
 
<td align="left"></td>
 
<td align="left">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">D1 = IEEE single-precision</td>
 
<td align="left"></td>
 
<td align="left">V = undefined</td>
 
</tr>
 
<tr class="even">
 
<td align="left"></td>
 
<td align="left">argument 2</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">_LVOIEEESPSub</td>
 
<td align="left">D0 = IEEE single-precision</td>
 
<td align="left">D0 = IEEE single-precision</td>
 
<td align="left">N = undefined</td>
 
</tr>
 
<tr class="odd">
 
<td align="left"></td>
 
<td align="left">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">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 2</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">_LVOIEEESPMul</td>
 
<td align="left">D0 = IEEE single-precision</td>
 
<td align="left">D0 = IEEE single-precision</td>
 
<td align="left">N = undefined</td>
 
</tr>
 
<tr class="even">
 
<td align="left"></td>
 
<td align="left">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">D1 = IEEE single-precision</td>
 
<td align="left"></td>
 
<td align="left">V = undefined</td>
 
</tr>
 
<tr class="even">
 
<td align="left"></td>
 
<td align="left">argument 2</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>
 
   
  +
{| class="wikitable"
'''SP IEEE Basic Assembly Functions (continued)'''
 
  +
|+ SP IEEE Basic Assembly Functions
 
  +
! Function
<table>
 
  +
! Input
<thead>
 
  +
! Output
<tr class="header">
 
  +
! Condition Codes
<th align="left">Function</th>
 
  +
|-
<th align="left">Input</th>
 
  +
| _LVOIEEESPFix
<th align="left">Output</th>
 
  +
| D0 = IEEE double-precision argument
<th align="left">Condition Codes</th>
 
  +
| D0 = Integer (two's complement)
</tr>
 
  +
| N = undefined<br/>
</thead>
 
  +
Z = undefined<br/>
<tbody>
 
  +
V = undefined<br/>
<tr class="odd">
 
  +
C = undefined<br/>
<td align="left">_LVOIEEESPDiv</td>
 
  +
X = undefined
<td align="left">D0 = IEEE single-precision</td>
 
  +
|-
<td align="left">D0 = IEEE single-precision</td>
 
  +
| _LVOIEEESPFlt
<td align="left">N = undefined</td>
 
  +
| D0 = Integer argument (two's complement)
</tr>
 
  +
| D0 = IEEE single-precision
<tr class="even">
 
  +
| N = undefined<br/>
<td align="left"></td>
 
  +
Z = undefined<br/>
<td align="left">argument 1</td>
 
  +
V = undefined<br/>
<td align="left">division of arg1/arg2</td>
 
<td align="left">Z = undefined</td>
+
C = undefined<br/>
  +
X = undefined
</tr>
 
  +
|-
<tr class="odd">
 
  +
| _LVOIEEESPCmp
<td align="left"></td>
 
<td align="left">D1 = IEEE single-precision</td>
+
| D0 = IEEE single-precision argument 1<br/>
  +
D1 = IEEE single-precision argument 2
<td align="left"></td>
 
  +
| D0 = +1 if arg1 > arg2<br/>
<td align="left">V = undefined</td>
 
  +
D0 = -1 if arg1 < arg2<br/>
</tr>
 
  +
D0 = 0 if arg1 = arg2
<tr class="even">
 
  +
| N = 1 if result is negative<br/>
<td align="left"></td>
 
  +
Z = 1 if result is zero<br/>
<td align="left">argument 2</td>
 
<td align="left"></td>
+
V = 0<br/>
<td align="left">C = undefined</td>
+
C = undefined<br/>
  +
X = undefined<br/>
</tr>
 
  +
GT = arg2 > arg1<br/>
<tr class="odd">
 
  +
GE = arg2 >= arg1<br/>
<td align="left"></td>
 
  +
EQ = arg2 = arg1<br/>
<td align="left"></td>
 
  +
NE = arg2 != arg1<br/>
<td align="left"></td>
 
  +
LT = arg2 < arg1<br/>
<td align="left">X = undefined</td>
 
  +
E= arg2 <= arg1
</tr>
 
  +
|-
<tr class="even">
 
  +
| _LVOIEEESPTst
<td align="left">_LVOIEEESPCeil</td>
 
<td align="left">D0 = IEEE single-precision</td>
+
| D0 = IEEE single-precision argument
<td align="left">D0 = least integer</td>
+
| D0 = +1 if arg > 0.0<br/>
  +
D0 = -1 if arg < 0.0<br/>
<td align="left">N = undefined</td>
 
  +
D0 = 0 if arg = 0.0
</tr>
 
  +
| N = 1 if result is negative<br/>
<tr class="odd">
 
  +
Z = 1 if result is zero<br/>
<td align="left"></td>
 
  +
V = 0<br/>
<td align="left">variable</td>
 
  +
C = undefined<br/>
<td align="left"><math>\ge</math> variable</td>
 
<td align="left">Z = undefined</td>
+
X = undefined<br/>
  +
EQ = arg = 0.0<br/>
</tr>
 
  +
NE = arg != 0.0<br/>
<tr class="even">
 
<td align="left"></td>
+
PL = arg >= 0.0<br/>
  +
MI = arg < 0.0
<td align="left"></td>
 
  +
|-
<td align="left"></td>
 
  +
| _LVOIEEESPAbs
<td align="left">V = undefined</td>
 
  +
| D0 = IEEE single-precision argument
</tr>
 
  +
| D0 = IEEE single-precision absolute value
<tr class="odd">
 
  +
| N = undefined<br/>
<td align="left"></td>
 
  +
Z = undefined<br/>
<td align="left"></td>
 
  +
V = undefined<br/>
<td align="left"></td>
 
<td align="left">C = undefined</td>
+
C = undefined<br/>
  +
X = undefined
</tr>
 
  +
|-
<tr class="even">
 
  +
| _LVOIEEESPNeg
<td align="left"></td>
 
  +
| D0 = IEEE single-precision argument
<td align="left"></td>
 
  +
| D0 = IEEE single-precision negated
<td align="left"></td>
 
<td align="left">X = undefined</td>
+
| N = undefined<br/>
  +
Z = undefined<br/>
</tr>
 
  +
V = undefined<br/>
<tr class="odd">
 
  +
C = undefined<br/>
<td align="left">_LVOIEEESPFloor</td>
 
  +
X = undefined
<td align="left">D0 = IEEE single-precision</td>
 
  +
|-
<td align="left">D0 = largest integer</td>
 
  +
| _LVOIEEESPAdd
<td align="left">N = undefined</td>
 
  +
| D0 = IEEE single-precision argument 1<br/>
</tr>
 
  +
D1 = IEEE single-precision argument 2
<tr class="even">
 
  +
| D0 = IEEE single-precision addition of arg1+arg2
<td align="left"></td>
 
  +
| N = undefined<br/>
<td align="left">variable</td>
 
  +
Z = undefined<br/>
<td align="left"><math>\le</math> argument</td>
 
<td align="left">Z = undefined</td>
+
V = undefined<br/>
  +
C = undefined<br/>
</tr>
 
  +
X = undefined
<tr class="odd">
 
  +
|-
<td align="left"></td>
 
  +
| _LVOIEEESPSub
<td align="left"></td>
 
  +
| D0 = IEEE single-precision argument 1<br/>
<td align="left"></td>
 
  +
D1 = IEEE single-precision argument 2
<td align="left">V = undefined</td>
 
  +
| D0 = IEEE single-precision subtraction of arg1-arg2
</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>
 
<td align="left">C = undefined</td>
+
X = undefined
  +
|-
</tr>
 
  +
| _LVOIEEESPMul
<tr class="odd">
 
  +
| D0 = IEEE single-precision argument 1<br/>
<td align="left"></td>
 
  +
D1 = IEEE single-precision argument 2
<td align="left"></td>
 
  +
| D0 = IEEE single-precision multiplication of arg1 * arg2
<td align="left"></td>
 
<td align="left">X = undefined</td>
+
| N = undefined<br/>
  +
Z = undefined<br/>
</tr>
 
  +
V = undefined<br/>
</tbody>
 
  +
C = undefined<br/>
</table>
 
  +
X = undefined
  +
|-
  +
| _LVOIEEESPDiv
  +
| D0 = IEEE single-precision argument 1<br/>
  +
D1 = IEEE single-precision argument 2
  +
| D0 = IEEE single-precision division of arg1/arg2
  +
| N = undefined<br/>
  +
Z = undefined<br/>
  +
V = undefined<br/>
  +
C = undefined<br/>
  +
X = undefined
  +
|-
  +
| _LVOIEEESPCeil
  +
| D0 = IEEE single-precision variable
  +
| D0 = least integer >= variable
  +
| N = undefined<br/>
  +
Z = undefined<br/>
  +
V = undefined<br/>
  +
C = undefined<br/>
  +
X = undefined
  +
|-
  +
| _LVOIEEESPFloor
  +
| D0 = IEEE single-precision variable
  +
| D0 = largest integer <= argument
  +
| N = undefined<br/>
  +
Z = undefined<br/>
  +
V = undefined<br/>
  +
C = undefined<br/>
  +
X = undefined
  +
|}
   
 
== IEEE Single-Precision Transcendental Math Library ==
 
== IEEE Single-Precision Transcendental Math Library ==
Line 1,969: Line 989:
 
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.
 
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 &quot;mathieeesingtrans.library&quot; as the argument. Do not share the library base pointer between tasks – see note at beginning of chapter.
+
This library resides on disk and is opened by calling OpenLibrary() with &quot;mathieeesingtrans.library&quot; as the argument. Do not share the library base pointer between tasks - see note at beginning of chapter.
   
  +
<syntaxhighlight>
<pre>#include &lt;exec/types.h&gt;
 
#include &lt;libraries/mathieeesp.h&gt;
+
#include <exec/types.h>
  +
#include <libraries/mathieeesp.h>
   
 
struct Library *MathIeeeSingTransBase;
 
struct Library *MathIeeeSingTransBase;
   
#include &lt;clib/mathsingtrans_protos.h&gt;
+
#include <clib/mathsingtrans_protos.h>
   
 
VOID main()
 
VOID main()
 
{
 
{
if (MathIeeeSingTransBase = OpenLibrary(&quot;mathieeesingtrans.library&quot;,37))
+
if (MathIeeeSingTransBase = OpenLibrary("mathieeesingtrans.library",37))
 
{
 
{
 
. . .
 
. . .
Line 1,986: Line 1,007:
 
CloseLibrary(MathIeeeSingTransBase);
 
CloseLibrary(MathIeeeSingTransBase);
 
}
 
}
else printf(&quot;Can't open mathieeesingtrans.library\n&quot;);
+
else printf("Can't open mathieeesingtrans.library\n");
  +
}
}</pre>
 
  +
</syntaxhighlight>
  +
 
The global variable MathIeeeSingTransBase is used internally for all future library references.
 
The global variable MathIeeeSingTransBase is used internally for all future library references.
   
Line 1,996: Line 1,019:
 
=== SP IEEE Transcendental Functions (V36 or greater) ===
 
=== SP IEEE Transcendental Functions (V36 or greater) ===
   
  +
; IEEESPAsin() FLOAT IEEESPAsin( FLOAT parm );
Return arcsine of IEEE single-precision variable.
 
  +
: Return arcsine of IEEE single-precision variable.
   
  +
; IEEESPAcos() FLOAT IEEESPAcos( FLOAT parm );
Return arccosine of IEEE single-precision variable.
 
  +
: Return arccosine of IEEE single-precision variable.
   
  +
; IEEESPAtan() FLOAT IEEESPAtan( FLOAT parm );
Return arctangent of IEEE single-precision variable.
 
  +
: 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.
 
  +
; 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.
 
  +
: 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.
 
  +
: 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.
 
  +
: 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.
 
  +
: Return hyperbolic sine of IEEE single-precision variable.
   
  +
; IEEESPCosh() FLOAT IEEESPCosh( FLOAT parm );
Return hyperbolic cosine of IEEE single-precision variable.
 
  +
: Return hyperbolic cosine of IEEE single-precision variable.
   
  +
; IEEESPTanh() FLOAT IEEESPTanh( FLOAT parm );
Return hyperbolic tangent of IEEE single-precision variable.
 
  +
: 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.
 
  +
: 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.
 
  +
: 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.
 
  +
: Return natural log (base ''e'' of IEEE single-precision variable.
   
  +
; IEEESPLog10() FLOAT IEEESPLog10( FLOAT parm );
Return log (base 10) of IEEE single-precision variable.
 
  +
: 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.
 
  +
: Return IEEE single-precision arg2 to IEEE single-precision arg1.
   
  +
; IEEESPSqrt() FLOAT IEEESPSqrt( FLOAT parm );
Return square root of IEEE single-precision variable.
 
  +
: 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.
 
  +
: 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.
 
Be sure to include the proper data type definitions as shown below.
   
  +
<syntaxhighlight>
<pre>#include &lt;exec/types.h&gt;
 
#include &lt;libraries/mathieeesp.h&gt;
+
#include <exec/types.h>
  +
#include <libraries/mathieeesp.h>
   
#include &lt;clib/mathsingtrans_protos.h&gt;
+
#include <clib/mathsingtrans_protos.h>
   
 
struct Library *MathIeeeSingTransBase;
 
struct Library *MathIeeeSingTransBase;
Line 2,043: Line 1,084:
 
FLOAT f1, f2, f3;
 
FLOAT f1, f2, f3;
   
if (MathIeeeSingTransBase = OpenLibrary(&quot;mathieeesingtrans.library&quot;,37))
+
if (MathIeeeSingTransBase = OpenLibrary("mathieeesingtrans.library",37))
 
{
 
{
 
f1 = IEEEDPAsin(f2); /* Call IEEESPAsin entry */
 
f1 = IEEEDPAsin(f2); /* Call IEEESPAsin entry */
Line 2,051: Line 1,092:
 
f1 = IEEEDPCos(f2); /* Call IEEESPCos entry */
 
f1 = IEEEDPCos(f2); /* Call IEEESPCos entry */
 
f1 = IEEEDPTan(f2); /* Call IEEESPTan entry */
 
f1 = IEEEDPTan(f2); /* Call IEEESPTan entry */
f1 = IEEEDPSincos(&amp;f3, f2); /* Call IEEESPSincos entry */
+
f1 = IEEEDPSincos(&f3, f2); /* Call IEEESPSincos entry */
 
f1 = IEEEDPSinh(f2); /* Call IEEESPSinh entry */
 
f1 = IEEEDPSinh(f2); /* Call IEEESPSinh entry */
 
f1 = IEEEDPCosh(f2); /* Call IEEESPCosh entry */
 
f1 = IEEEDPCosh(f2); /* Call IEEESPCosh entry */
Line 2,063: Line 1,104:
 
CloseLibrary(MathIeeeSingTransBase);
 
CloseLibrary(MathIeeeSingTransBase);
 
}
 
}
else printf(&quot;Can't open mathieeesingtrans.library\n&quot;);
+
else printf("Can't open mathieeesingtrans.library\n");
  +
}
}</pre>
 
  +
</syntaxhighlight>
  +
 
The section below describes the Amiga assembly interface to the IEEE single-precision transcendental math library. The access mechanism from assembly language is:
 
The section below describes the Amiga assembly interface to the IEEE single-precision transcendental math library. The access mechanism from assembly language is:
   
  +
<pre>
<pre>MOVEA.L _MathIeeeSingTransBase,A6
 
  +
MOVEA.L _MathIeeeSingTransBase,A6
JSR _LVOIEEESPAsin(A6)</pre>
 
  +
JSR _LVOIEEESPAsin(A6)
'''SP IEEE Transcendental Assembly Functions'''
 
  +
</pre>
 
<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">_LVOIEEESPAsin</td>
 
<td align="left">D0 = IEEE argument</td>
 
<td align="left">D0 = IEEE arcsine</td>
 
<td align="left">N = undefined</td>
 
</tr>
 
<tr class="even">
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left">radian</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">_LVOIEEESPAcos</td>
 
<td align="left">D0 = IEEE single-precision</td>
 
<td align="left">D0 = IEEE arccosine</td>
 
<td align="left">N = undefined</td>
 
</tr>
 
<tr class="odd">
 
<td align="left"></td>
 
<td align="left">argument</td>
 
<td align="left">radian</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">_LVOIEEESPAtan</td>
 
<td align="left">D0 = IEEE single-precision</td>
 
<td align="left">D0 = IEEE arctangent</td>
 
<td align="left">N = undefined</td>
 
</tr>
 
<tr class="even">
 
<td align="left"></td>
 
<td align="left">argument</td>
 
<td align="left">radian</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">_LVOIEEESPSin</td>
 
<td align="left">D0 = IEEE single-precision</td>
 
<td align="left">D0 = IEEE sine</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">_LVOIEEESPCos</td>
 
<td align="left">D0 = IEEE single-precision</td>
 
<td align="left">D0 = IEEE cosine</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"></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">_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)'''
 
   
  +
{| class="wikitable"
<table>
 
  +
|+ SP 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>
 
  +
| _LVOIEEESPAsin
</tr>
 
  +
| D0 = IEEE argument
</thead>
 
  +
| D0 = IEEE arcsine radian
<tbody>
 
  +
| N = undefined<br/>
<tr class="odd">
 
  +
Z = undefined<br/>
<td align="left">_LVOIEEESPExp</td>
 
  +
V = undefined<br/>
<td align="left">D0 = IEEE single-precision</td>
 
  +
C = undefined<br/>
<td align="left">D0 = IEEE exponential</td>
 
<td align="left">N = undefined</td>
+
X = undefined
  +
|-
</tr>
 
  +
| _LVOIEEESPAcos
<tr class="even">
 
  +
| D0 = IEEE single-precision argument
<td align="left"></td>
 
  +
| D0 = IEEE arccosine radian
<td align="left">argument</td>
 
  +
| N = undefined<br/>
<td align="left"></td>
 
<td align="left">Z = undefined</td>
+
Z = undefined<br/>
  +
V = undefined<br/>
</tr>
 
  +
C = undefined<br/>
<tr class="odd">
 
  +
X = undefined
<td align="left"></td>
 
  +
|-
<td align="left"></td>
 
  +
| _LVOIEEESPAtan
<td align="left"></td>
 
  +
| D0 = IEEE single-precision argument
<td align="left">V = undefined</td>
 
  +
| D0 = 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>
 
<td align="left">C = undefined</td>
+
X = undefined
  +
|-
</tr>
 
  +
| _LVOIEEESPSin
<tr class="odd">
 
  +
| D0 = IEEE single-precision argument in radians
<td align="left"></td>
 
  +
| D0 = IEEE sine
<td align="left"></td>
 
  +
| N = undefined<br/>
<td align="left"></td>
 
<td align="left">X = undefined</td>
+
Z = undefined<br/>
  +
V = undefined<br/>
</tr>
 
  +
C = undefined<br/>
<tr class="even">
 
  +
X = undefined
<td align="left">_LVOIEEESPLog</td>
 
  +
|-
<td align="left">D0 = IEEE single-precision</td>
 
  +
| _LVOIEEESPCos
<td align="left">D0 = IEEE natural</td>
 
  +
| D0 = IEEE single-precision argument in radians
<td align="left">N = undefined</td>
 
  +
| D0 = IEEE cosine
</tr>
 
  +
| N = undefined<br/>
<tr class="odd">
 
  +
Z = undefined<br/>
<td align="left"></td>
 
  +
V = undefined<br/>
<td align="left">argument</td>
 
  +
C = undefined<br/>
<td align="left">logarithm</td>
 
<td align="left">Z = undefined</td>
+
X = undefined
  +
|-
</tr>
 
  +
| _LVOIEEESPTan
<tr class="even">
 
  +
| D0 = IEEE single-precision argument in radians
<td align="left"></td>
 
  +
| D0 = IEEE tangent
<td align="left"></td>
 
  +
| N = undefined<br/>
<td align="left"></td>
 
<td align="left">V = undefined</td>
+
Z = undefined<br/>
  +
V = undefined<br/>
</tr>
 
  +
C = undefined<br/>
<tr class="odd">
 
  +
X = undefined
<td align="left"></td>
 
  +
|-
<td align="left"></td>
 
  +
| _LVOIEEESPSincos
<td align="left"></td>
 
  +
| A0 = Address to store cosine result<br/>
<td align="left">C = undefined</td>
 
  +
D0 = IEEE argument in radians
</tr>
 
  +
| D0 = 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>
 
<td align="left">X = undefined</td>
+
V = undefined<br/>
  +
C = undefined<br/>
</tr>
 
  +
X = undefined
<tr class="odd">
 
  +
|-
<td align="left">_LVOIEEESPLog10</td>
 
  +
| _LVOIEEESPSinh
<td align="left">D0 = IEEE single-precision</td>
 
  +
| D0 = IEEE single-precision argument in radians
<td align="left">D0 = IEEE logarithm</td>
 
  +
| D0 = 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">(base 10)</td>
 
  +
|-
<td align="left">Z = undefined</td>
 
  +
| _LVOIEEESPCosh
</tr>
 
  +
| D0 = IEEE single-precision argument in radians
<tr class="odd">
 
  +
| D0 = IEEE hyperbolic cosine
<td align="left"></td>
 
  +
| N = undefined<br/>
<td align="left"></td>
 
  +
Z = undefined<br/>
<td align="left"></td>
 
<td align="left">V = undefined</td>
+
V = undefined<br/>
  +
C = undefined<br/>
</tr>
 
  +
X = undefined
<tr class="even">
 
  +
|-
<td align="left"></td>
 
  +
| _LVOIEEESPTanh
<td align="left"></td>
 
  +
| D0 = IEEE single-precision argument in radians
<td align="left"></td>
 
  +
| D0 = 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>
 
  +
| _LVOIEEESPExp
</tr>
 
  +
| D0 = IEEE single-precision argument
<tr class="even">
 
  +
| D0 = IEEE exponential
<td align="left">_LVOIEEESPPow</td>
 
  +
| N = undefined<br/>
<td align="left">D0 = IEEE single-precision</td>
 
  +
Z = undefined<br/>
<td align="left">D0 = IEEE result of arg</td>
 
<td align="left">N = undefined</td>
+
V = undefined<br/>
  +
C = undefined<br/>
</tr>
 
  +
X = undefined
<tr class="odd">
 
  +
|-
<td align="left"></td>
 
  +
| _LVOIEEESPLog
<td align="left">exponent value</td>
 
  +
| D0 = IEEE single-precision argument
<td align="left">taken to exp power</td>
 
  +
| D0 = 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">D1 = IEEE single-precision</td>
 
  +
X = undefined
<td align="left"></td>
 
  +
|-
<td align="left">V = undefined</td>
 
  +
| _LVOIEEESPLog10
</tr>
 
  +
| D0 = IEEE single-precision argument
<tr class="odd">
 
  +
| D0 = IEEE logarithm (base 10)
<td align="left"></td>
 
  +
| N = undefined<br/>
<td align="left">argument value</td>
 
  +
Z = undefined<br/>
<td align="left"></td>
 
<td align="left">C = undefined</td>
+
V = undefined<br/>
  +
C = undefined<br/>
</tr>
 
  +
X = undefined
<tr class="even">
 
  +
|-
<td align="left"></td>
 
  +
| _LVOIEEESPPow
<td align="left"></td>
 
  +
| D0 = IEEE single-precision exponent value<br/>
<td align="left"></td>
 
  +
D1 = IEEE single-precision argument value
<td align="left">X = undefined</td>
 
  +
| D0 = IEEE result of arg taken to exp power
</tr>
 
  +
| N = undefined<br/>
<tr class="odd">
 
  +
Z = undefined<br/>
<td align="left">_LVOIEEESPSqrt</td>
 
  +
V = undefined<br/>
<td align="left">D0 = IEEE single-precision</td>
 
  +
C = undefined<br/>
<td align="left">D0 = IEEE square root</td>
 
<td align="left">N = undefined</td>
+
X = undefined
  +
|-
</tr>
 
  +
| _LVOIEEESPSqrt
<tr class="even">
 
  +
| D0 = IEEE single-precision argument
<td align="left"></td>
 
  +
| D0 = IEEE square root
<td align="left">argument</td>
 
  +
| N = undefined<br/>
<td align="left"></td>
 
<td align="left">Z = undefined</td>
+
Z = undefined<br/>
  +
V = undefined<br/>
</tr>
 
  +
C = undefined<br/>
<tr class="odd">
 
  +
X = undefined
<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 2,553: Line 1,265:
 
The IEEE double-precision variables are defined as 64-bit entities with the following format:
 
The IEEE double-precision variables are defined as 64-bit entities with the following format:
   
  +
______________________________________________
<table>
 
  +
| |
<tbody>
 
  +
| SEEEEEEE EEEEEIMM MMMMMMMM MMMMMMMM |
<tr class="odd">
 
  +
| 63 55 47 39 |
<td align="left">SEEEEEEE</td>
 
  +
|______________________________________________|
<td align="left">EEEEEIMM</td>
 
<td align="left">MMMMMMMM</td>
 
<td align="left">MMMMMMMM</td>
 
</tr>
 
<tr class="even">
 
<td align="left">63</td>
 
<td align="left">55</td>
 
<td align="left">47</td>
 
<td align="left">39</td>
 
</tr>
 
</tbody>
 
</table>
 
   
  +
______________________________________________
<table>
 
  +
| |
<tbody>
 
  +
| MMMMMMMM MMMMMMMM MMMMMMMM MMMMMMMM |
<tr class="odd">
 
  +
| 31 23 15 7 |
<td align="left">MMMMMMMM</td>
 
  +
|______________________________________________|
<td align="left">MMMMMMMM</td>
 
<td align="left">MMMMMMMM</td>
 
<td align="left">MMMMMMMM</td>
 
</tr>
 
<tr class="even">
 
<td align="left">31</td>
 
<td align="left">23</td>
 
<td align="left">15</td>
 
<td align="left">7</td>
 
</tr>
 
</tbody>
 
</table>
 
   
<sub>b</sub>oxHidden 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.
+
{{Note|title=Hidden Bit In The Mantissa|text=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.
+
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 ==
 
== 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 &quot;mathieeedoubbas.library&quot; as the argument. Do not share the library base pointer between tasks – see note at beginning of chapter for details.
+
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 &quot;mathieeedoubbas.library&quot; as the argument. Do not share the library base pointer between tasks - see note at beginning of chapter for details.
   
  +
<syntaxhighlight>
<pre>#include &lt;exec/types.h&gt;
 
#include &lt;libraries/mathieeedp.h&gt;
+
#include <exec/types.h>
  +
#include <libraries/mathieeedp.h>
   
#include &lt;clib/mathdoubbas_protos.h&gt;
+
#include <clib/mathdoubbas_protos.h>
   
 
struct Library *MathIeeeDoubBasBase;
 
struct Library *MathIeeeDoubBasBase;
Line 2,605: Line 1,296:
 
{
 
{
 
/* do not share base pointer between tasks. */
 
/* do not share base pointer between tasks. */
if (MathIeeeDoubBasBase = OpenLibrary(&quot;mathieeedoubbas.library&quot;, 34))
+
if (MathIeeeDoubBasBase = OpenLibrary("mathieeedoubbas.library", 34))
 
{
 
{
 
. . .
 
. . .
Line 2,611: Line 1,302:
 
CloseLibrary(MathIeeeDoubBasBase);
 
CloseLibrary(MathIeeeDoubBasBase);
 
}
 
}
else printf(&quot;Can't open mathieeedoubbas.library\n&quot;);
+
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 2,619: 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 &lt;exec/types.h&gt;
 
#include &lt;libraries/mathieeedp.h&gt;
+
#include <exec/types.h>
  +
#include <libraries/mathieeedp.h>
   
#include &lt;clib/mathieeedoubbas_protos.h&gt;
+
#include <clib/mathieeedoubbas_protos.h>
   
 
struct Library *MathIeeeDoubBasBase;
 
struct Library *MathIeeeDoubBasBase;
Line 2,657: Line 1,363:
 
LONG i1;
 
LONG i1;
   
if (MathIeeeDoubBasBase = OpenLibrary(&quot;mathieeedoubbas.library&quot;,34))
+
if (MathIeeeDoubBasBase = OpenLibrary("mathieeedoubbas.library",34))
 
{
 
{
   
Line 2,675: Line 1,381:
 
CloseLibrary(MathIeeeDoubBasBase);
 
CloseLibrary(MathIeeeDoubBasBase);
 
}
 
}
else printf(&quot;Can't open mathieeedoubbas.library\n&quot;);
+
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>
 
<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">_LVOIEEEDPFix</td>
 
<td align="left">D0/D1 = IEEE</td>
 
<td align="left">D0 = Integer</td>
 
<td align="left">N = undefined</td>
 
</tr>
 
<tr class="even">
 
<td align="left"></td>
 
<td align="left">double-precision</td>
 
<td align="left">(two’s complement)</td>
 
<td align="left">Z = undefined</td>
 
</tr>
 
<tr class="odd">
 
<td align="left"></td>
 
<td align="left">argument</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">_LVOIEEEDPFl</td>
 
<td align="left">D0 = Integer (two’s</td>
 
<td align="left">D0/D1 = IEEE</td>
 
<td align="left">N = undefined</td>
 
</tr>
 
<tr class="odd">
 
<td align="left"></td>
 
<td align="left">complement) argument</td>
 
<td align="left">double-precision</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">_LVOIEEEDPCmp</td>
 
<td align="left">D0/D1 = IEEE</td>
 
<td align="left">D0 = +1 if arg1 <math>></math> arg2</td>
 
<td align="left">N = 1 if result is negative</td>
 
</tr>
 
<tr class="even">
 
<td align="left"></td>
 
<td align="left">double-precision</td>
 
<td align="left">D0 = -1 if arg1 <math><</math> arg2</td>
 
<td align="left">Z = 1 if result is zero</td>
 
</tr>
 
<tr class="odd">
 
<td align="left"></td>
 
<td align="left">argument 1</td>
 
<td align="left">D0 = 0 if arg1 = arg2</td>
 
<td align="left">V = 0</td>
 
</tr>
 
<tr class="even">
 
<td align="left"></td>
 
<td align="left">D2/D3 = IEEE</td>
 
<td align="left"></td>
 
<td align="left">C = undefined</td>
 
</tr>
 
<tr class="odd">
 
<td align="left"></td>
 
<td align="left">double-precision</td>
 
<td align="left"></td>
 
<td align="left">X = undefined</td>
 
</tr>
 
<tr class="even">
 
<td align="left"></td>
 
<td align="left">argument 2</td>
 
<td align="left"></td>
 
<td align="left">GT = arg2 <math>></math> arg1</td>
 
</tr>
 
<tr class="odd">
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left">GE = arg2 <math>\ge</math> arg1</td>
 
</tr>
 
<tr class="even">
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left">EQ = arg2 = arg1</td>
 
</tr>
 
<tr class="odd">
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left">NE = arg2 <math>\not=</math> arg1</td>
 
</tr>
 
<tr class="even">
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left"></td>
 
<td align="left">LT = arg2 <math><</math> arg1</td>
 
</tr>
 
<tr class="odd">
 
<td align="left"></td>
 
<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)'''
 
   
  +
{| 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">_LVOIEEEDPDiv</td>
 
  +
V = undefined<br/>
<td align="left">D0/D1 = IEEE double-</td>
 
  +
C = undefined<br/>
<td align="left">D0/D1 = IEEE double-precision</td>
 
<td align="left">N = undefined</td>
+
X = undefined
  +
|-
</tr>
 
  +
| _LVOIEEEDPFl
<tr class="even">
 
  +
| D0 = Integer (two's complement) argument
<td align="left"></td>
 
  +
| D0/D1 = IEEE double-precision
<td align="left">precision argument 1</td>
 
  +
| N = undefined<br/>
<td align="left">division of arg1/arg2</td>
 
<td align="left">Z = undefined</td>
+
Z = undefined<br/>
  +
V = undefined<br/>
</tr>
 
  +
C = undefined<br/>
<tr class="odd">
 
  +
X = undefined
<td align="left"></td>
 
  +
|-
<td align="left"></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">D2/D3 = IEEE double-</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>
 
</tr>
+
V = 0<br/>
  +
C = undefined<br/>
<tr class="odd">
 
  +
X = undefined<br/>
<td align="left"></td>
 
  +
GT = arg2 > arg1<br/>
<td align="left">precision argument 2</td>
 
  +
GE = arg2 >= arg1<br/>
<td align="left"></td>
 
<td align="left">X = undefined</td>
+
EQ = arg2 = arg1<br/>
  +
NE = arg2 != arg1<br/>
</tr>
 
  +
LT = arg2 < arg1<br/>
<tr class="even">
 
  +
LE = arg2 <= arg1
<td align="left">_LVOIEEEDPCeil</td>
 
  +
|-
<td align="left">D0/D1 = IEEE double-</td>
 
  +
| _LVOIEEEDPTst
<td align="left">D0/D1 = least integer</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">precision argument</td>
 
  +
Z = 1 if result is zero<br/>
<td align="left"><math>\ge</math> argument</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>
 
<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>
 
<td align="left">C = undefined</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">_LVOIEEEDPFloor</td>
 
  +
V = undefined<br/>
<td align="left">D0/D1 = IEEE double-</td>
 
  +
C = undefined<br/>
<td align="left">D0/D1 = largest integer</td>
 
<td align="left">N = undefined</td>
+
X = undefined
  +
|-
</tr>
 
  +
| _LVOIEEEDPAdd
<tr class="even">
 
  +
| D0/D1 = IEEE double-precision argument 1<br/>
<td align="left"></td>
 
<td align="left">precision argument</td>
+
D2/D3 = IEEE double-precision argument 2
  +
| D0/D1 = IEEE double-precision addition of arg1+arg2
<td align="left"><math>\le</math> argument</td>
 
<td align="left">Z = undefined</td>
+
| 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"></td>
 
  +
|-
<td align="left"></td>
 
  +
| _LVOIEEEDPSub
<td align="left">V = undefined</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"></td>
 
  +
Z = undefined<br/>
<td align="left"></td>
 
<td align="left">C = undefined</td>
+
V = undefined<br/>
  +
C = undefined<br/>
</tr>
 
  +
X = undefined
<tr class="odd">
 
  +
|-
<td align="left"></td>
 
  +
| _LVOIEEEDPMul
<td align="left"></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/>
</tbody>
 
  +
Z = undefined<br/>
</table>
 
  +
V = undefined<br/>
  +
C = undefined<br/>
  +
X = undefined
  +
|-
  +
| _LVOIEEEDPDiv
  +
| D0/D1 = IEEE double-precision argument 1<br/>
  +
D2/D3 = IEEE double-precision argument 2
  +
| D0/D1 = IEEE double-precision division of arg1/arg2
  +
| N = undefined<br/>
  +
Z = undefined<br/>
  +
V = undefined<br/>
  +
C = undefined<br/>
  +
X = undefined
  +
|-
  +
| _LVOIEEEDPCeil
  +
| D0/D1 = IEEE double-precision argument
  +
| D0/D1 = least integer >= argument
  +
| N = undefined<br/>
  +
Z = undefined<br/>
  +
V = undefined<br/>
  +
C = undefined<br/>
  +
X = undefined
  +
|-
  +
| _LVOIEEEDPFloor
  +
| D0/D1 = IEEE double-precision argument
  +
| D0/D1 = largest integer <= argument
  +
| N = undefined<br/>
  +
Z = undefined<br/>
  +
V = undefined<br/>
  +
C = undefined<br/>
  +
X = undefined
  +
|}
   
 
== 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 &quot;mathieeedoubtrans.library&quot; as the argument. Do not share the library base pointer between tasks – see note at beginning of chapter for details.
+
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 &quot;mathieeedoubtrans.library&quot; as the argument. Do not share the library base pointer between tasks - see note at beginning of chapter for details.
   
  +
<syntaxhighlight>
<pre>#include &lt;exec/types.h&gt;
 
#include &lt;libraries/mathieeedp.h&gt;
+
#include <exec/types.h>
  +
#include <libraries/mathieeedp.h>
   
#include &lt;clib/mathdoubtrans_protos.h&gt;
+
#include <clib/mathdoubtrans_protos.h>
   
 
struct Library *MathIeeeDoubTransBase;
 
struct Library *MathIeeeDoubTransBase;
Line 3,144: Line 1,541:
 
VOID main()
 
VOID main()
 
{
 
{
if (MathIeeeDoubTransBase = OpenLibrary(&quot;mathieeedoubtrans.library&quot;,34))
+
if (MathIeeeDoubTransBase = OpenLibrary("mathieeedoubtrans.library",34))
 
{
 
{
 
. . .
 
. . .
Line 3,150: Line 1,547:
 
CloseLibrary(MathIeeeDoubTransBase);
 
CloseLibrary(MathIeeeDoubTransBase);
 
}
 
}
else printf(&quot;Can't open mathieeedoubtrans.library\n&quot;);
+
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 3,160: 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 &lt;exec/types.h&gt;
 
#include &lt;libraries/mathieeedp.h&gt;
+
#include <exec/types.h>
#include &lt;clib/mathdoubtrans_protos.h&gt;
+
#include <libraries/mathieeedp.h>
  +
#include <clib/mathdoubtrans_protos.h>
   
 
struct Library *MathIeeeDoubTransBase;
 
struct Library *MathIeeeDoubTransBase;
Line 3,207: Line 1,624:
 
FLOAT f1;
 
FLOAT f1;
   
if (MathIeeeDoubTransBase = OpenLibrary(&quot;mathieeedoubtrans.library&quot;,34))
+
if (MathIeeeDoubTransBase = OpenLibrary("mathieeedoubtrans.library",34))
 
{
 
{
 
d1 = IEEEDPAsin(d2); /* Call IEEEDPAsin entry */
 
d1 = IEEEDPAsin(d2); /* Call IEEEDPAsin entry */
Line 3,215: 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(&amp;d3, d2); /* Call IEEEDPSincos entry */
+
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 3,229: Line 1,646:
 
CloseLibrary(MathIeeeDoubTransBase);
 
CloseLibrary(MathIeeeDoubTransBase);
 
}
 
}
else printf(&quot;Can't open mathieeedoubtrans.library\n&quot;);
+
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>
 
<td align="left">N = undefined</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>
 
<td align="left">Z = undefined</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>
 
<td align="left">C = undefined</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>
 
<td align="left">X = undefined</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>
 
<td align="left">Z = undefined</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>
 
<td align="left">V = undefined</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>
 
<td align="left">X = undefined</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>
 
<td align="left">D0/D1 = IEEE arctangent</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>
 
<td align="left">V = undefined</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>
 
<td align="left">N = undefined</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>
 
<td align="left">C = undefined</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>
 
<td align="left">N = undefined</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>
 
<td align="left">Z = undefined</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>
 
<td align="left">C = undefined</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>
 
 
== Compile and Link Commands for SAS C 5.10 ==
 
 
<pre>lc -b1 -cfistq -ff -v -y &lt;filename&gt;.c
 
blink lib:c.o + &lt;filename&gt;.o TO &lt;filename&gt; LIB lib:lcmffp.lib + lib:lc.lib + lib:amiga.lib</pre>
 
<pre>lc -b1 -cfistq -fi -v -y &lt;filename&gt;.c
 
blink lib:c.o + &lt;filename&gt;.o TO &lt;filename&gt; LIB lib:lcmieee.lib + lib:lc.lib + lib:amiga.lib</pre>
 
 
== Function Reference ==
 
== Function Reference ==
   
 
Here's a brief summary of the functions covered in this chapter. Refer to the SDK for additional information.
 
Here's a brief summary of the functions covered in this chapter. Refer to the SDK for additional information.
   
  +
{| class="wikitable"
FFP Basic Functions
 
  +
|+ FFP Basic Functions
 
  +
! Function
<table>
 
  +
! Description
<tr class="header">
 
  +
|-
<th align="left">'''Function'''</th>
 
  +
| SPAbs()
<th align="left">'''Description'''</th>
 
  +
| Take absolute value of FFP variable
</tr>
 
  +
|-
<tr class="odd">
 
  +
| SPAdd()
<td align="left">SPAbs()</td>
 
  +
| Add two FFP variables
<td align="left">Take absolute value of FFP variable</td>
 
  +
|-
</tr>
 
  +
| SPCeil()
<tr class="even">
 
  +
| Compute least integer greater than or equal to variable.
<td align="left">SPAdd()</td>
 
  +
|-
<td align="left">Add two FFP variables</td>
 
  +
| SPCmp()
</tr>
 
  +
| Compare two FFP variables
<tr class="odd">
 
  +
|-
<td align="left">SPCeil()</td>
 
  +
| SPDiv()
<td align="left">Compute least integer greater than or equal to variable.</td>
 
  +
| Divide two FFP variables
</tr>
 
  +
|-
<tr class="even">
 
  +
| SPFix()
<td align="left">SPCmp()</td>
 
  +
| Convert FFP variable to integer
<td align="left">Compare two FFP variables</td>
 
  +
|-
</tr>
 
  +
| SPFloor()
<tr class="odd">
 
  +
| Computer largest integer less than or equal to variable.
<td align="left">SPDiv()</td>
 
  +
|-
<td align="left">Divide two FFP variables</td>
 
  +
| SPFlt()
</tr>
 
  +
| Convert integer variable to FFP
<tr class="even">
 
  +
|-
<td align="left">SPFix()</td>
 
  +
| SPMul()
<td align="left">Convert FFP variable to integer</td>
 
  +
| Multiply two FFP variables
</tr>
 
  +
|-
<tr class="odd">
 
  +
| SPNeg()
<td align="left">SPFloor()</td>
 
  +
| Take two’s complement of FFP variable
<td align="left">Computer largest integer less than or equal to variable.</td>
 
  +
|-
</tr>
 
  +
| SPSub()
<tr class="even">
 
  +
| Subtract two FFP variables
<td align="left">SPFlt()</td>
 
  +
|-
<td align="left">Convert integer variable to FFP</td>
 
  +
| SPTst()
</tr>
 
  +
| Test an FFP variable against zero
<tr class="odd">
 
  +
|}
<td align="left">SPMul()</td>
 
<td align="left">Multiply two FFP variables</td>
 
</tr>
 
<tr class="even">
 
<td align="left">SPNeg()</td>
 
<td align="left">Take two’s complement of FFP variable</td>
 
</tr>
 
<tr class="odd">
 
<td align="left">SPSub()</td>
 
<td align="left">Subtract two FFP variables</td>
 
</tr>
 
<tr class="even">
 
<td align="left">SPTst()</td>
 
<td align="left">Test an FFP variable against zero</td>
 
</tr>
 
</table>
 
 
FFP Transcendental Functions
 
 
<table>
 
<tr class="header">
 
<th align="left">'''Function'''</th>
 
<th align="left">'''Description'''</th>
 
</tr>
 
<tr class="odd">
 
<td align="left">SPAcos()</td>
 
<td align="left">Return arccosine of FFP variable.</td>
 
</tr>
 
<tr class="even">
 
<td align="left">SPAsin()</td>
 
<td align="left">Return arcsine of FFP variable.</td>
 
</tr>
 
<tr class="odd">
 
<td align="left">SPAtan()</td>
 
<td align="left">Return arctangent of FFP variable.</td>
 
</tr>
 
<tr class="even">
 
<td align="left">SPCos()</td>
 
<td align="left">Return cosine of FFP variable.</td>
 
</tr>
 
<tr class="odd">
 
<td align="left">SPCosh()</td>
 
<td align="left">Return hyperbolic cosine of FFP variable.</td>
 
</tr>
 
<tr class="even">
 
<td align="left">SPExp()</td>
 
<td align="left">Return ''e'' to the FFP variable power.</td>
 
</tr>
 
<tr class="odd">
 
<td align="left">SPFieee()</td>
 
<td align="left">Convert IEEE variable to FFP format.</td>
 
</tr>
 
<tr class="even">
 
<td align="left">SPLog()</td>
 
<td align="left">Return natural log (base ''e'') of FFP variable.</td>
 
</tr>
 
<tr class="odd">
 
<td align="left">SPLog10()</td>
 
<td align="left">Return log (base 10) of FFP variable.</td>
 
</tr>
 
<tr class="even">
 
<td align="left">SPPow()</td>
 
<td align="left">Return FFP arg2 to FFP arg1.</td>
 
</tr>
 
<tr class="odd">
 
<td align="left">SPSin()</td>
 
<td align="left">Return sine of FFP variable.</td>
 
</tr>
 
<tr class="even">
 
<td align="left">SPSincos()</td>
 
<td align="left">Return sine and cosine of FFP variable.</td>
 
</tr>
 
<tr class="odd">
 
<td align="left">SPSinh()</td>
 
<td align="left">Return hyperbolic sine of FFP variable.</td>
 
</tr>
 
<tr class="even">
 
<td align="left">SPSqrt()</td>
 
<td align="left">Return square root of FFP variable.</td>
 
</tr>
 
<tr class="odd">
 
<td align="left">SPTan()</td>
 
<td align="left">Return tangent of FFP variable.</td>
 
</tr>
 
<tr class="even">
 
<td align="left">SPTanh()</td>
 
<td align="left">Return hyperbolic tangent of FFP variable.</td>
 
</tr>
 
<tr class="odd">
 
<td align="left">SPTieee()</td>
 
<td align="left">Convert FFP variable to IEEE format</td>
 
</tr>
 
</table>
 
 
Math Support Functions
 
 
<table>
 
<tr class="header">
 
<th align="left">'''Function'''</th>
 
<th align="left">'''Description'''</th>
 
</tr>
 
<tr class="odd">
 
<td align="left">afp()</td>
 
<td align="left">Convert ASCII string into FFP equivalent.</td>
 
</tr>
 
<tr class="even">
 
<td align="left">fpa()</td>
 
<td align="left">Convert FFP variable into ASCII equivalent.</td>
 
</tr>
 
<tr class="odd">
 
<td align="left">arnd()</td>
 
<td align="left">Round ASCII representation of FFP number.</td>
 
</tr>
 
<tr class="even">
 
<td align="left">dbf()</td>
 
<td align="left">Convert FFP dual-binary number to FFP equivalent.</td>
 
</tr>
 
</table>
 
 
SP IEEE Basic Functions
 
 
<table>
 
<tr class="header">
 
<th align="left">'''Function'''</th>
 
<th align="left">'''Description'''</th>
 
</tr>
 
<tr class="odd">
 
<td align="left">IEEESPAbs()</td>
 
<td align="left">Take absolute value of IEEE single-precision variable</td>
 
</tr>
 
<tr class="even">
 
<td align="left">IEEESPAdd()</td>
 
<td align="left">Add two IEEE single-precision variables</td>
 
</tr>
 
<tr class="odd">
 
<td align="left">IEEESPCeil()</td>
 
<td align="left">Compute least integer greater than or equal to variable</td>
 
</tr>
 
<tr class="even">
 
<td align="left">IEEESPCmp()</td>
 
<td align="left">Compare two IEEE single-precision variables</td>
 
</tr>
 
<tr class="odd">
 
<td align="left">IEEESPDiv()</td>
 
<td align="left">Divide two IEEE single-precision variables</td>
 
</tr>
 
<tr class="even">
 
<td align="left">IEEESPFix()</td>
 
<td align="left">Convert IEEE single-precision variable to integer</td>
 
</tr>
 
<tr class="odd">
 
<td align="left">IEEESPFloor()</td>
 
<td align="left">Compute largest integer less than or equal to variable</td>
 
</tr>
 
<tr class="even">
 
<td align="left">IEEESPFlt()</td>
 
<td align="left">Convert integer variable to IEEE single-precision</td>
 
</tr>
 
<tr class="odd">
 
<td align="left">IEEESPMul()</td>
 
<td align="left">Multiply two IEEE single-precision variables</td>
 
</tr>
 
<tr class="even">
 
<td align="left">IEEESPNeg()</td>
 
<td align="left">Take two’s complement of IEEE single-precision variable</td>
 
</tr>
 
<tr class="odd">
 
<td align="left">IEEESPSub()</td>
 
<td align="left">Subtract two IEEE single-precision variables</td>
 
</tr>
 
<tr class="even">
 
<td align="left">IEEESPTst()</td>
 
<td align="left">Test an IEEE single-precision variable against zero</td>
 
</tr>
 
</table>
 
   
  +
{| class="wikitable"
SP IEEE Transcendental Functions
 
  +
|+ FFP Transcendental Functions
  +
! 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
  +
|}
   
  +
{| class="wikitable"
<table>
 
  +
|+ Math Support Functions
<tr class="header">
 
<th align="left">'''Function'''</th>
+
! Function
<th align="left">'''Description'''</th>
+
! Description
  +
|-
</tr>
 
  +
| afp()
<tr class="odd">
 
  +
| Convert ASCII string into FFP equivalent.
<td align="left">IEEESPACos()</td>
 
  +
|-
<td align="left">Return arccosine of IEEE single-precision variable.</td>
 
  +
| fpa()
</tr>
 
  +
| Convert FFP variable into ASCII equivalent.
<tr class="even">
 
  +
|-
<td align="left">IEEESPASin()</td>
 
  +
| arnd()
<td align="left">Return arcsine of IEEE single-precision variable.</td>
 
  +
| Round ASCII representation of FFP number.
</tr>
 
  +
|-
<tr class="odd">
 
  +
| dbf()
<td align="left">IEEESPAtan()</td>
 
  +
| Convert FFP dual-binary number to FFP equivalent.
<td align="left">Return arctangent of IEEE single-precision variable.</td>
 
  +
|}
</tr>
 
<tr class="even">
 
<td align="left">IEEESPCos()</td>
 
<td align="left">Return cosine of IEEE single-precision variable.</td>
 
</tr>
 
<tr class="odd">
 
<td align="left">IEEESPCosh()</td>
 
<td align="left">Return hyperbolic cosine of IEEE single-precision variable.</td>
 
</tr>
 
<tr class="even">
 
<td align="left">IEEESPExp()</td>
 
<td align="left">Return ''e'' to the IEEE variable power.</td>
 
</tr>
 
<tr class="odd">
 
<td align="left">IEEESPLog()</td>
 
<td align="left">Return natural log (base ''e'' of IEEE single-precision variable.</td>
 
</tr>
 
<tr class="even">
 
<td align="left">IEEESPLog10()</td>
 
<td align="left">Return log (base 10) of IEEE single-precision variable.</td>
 
</tr>
 
<tr class="odd">
 
<td align="left">IEEESPPow()</td>
 
<td align="left">Return power of IEEE single-precision variable.</td>
 
</tr>
 
<tr class="even">
 
<td align="left">IEEESPSin()</td>
 
<td align="left">Return sine of IEEE single-precision variable.</td>
 
</tr>
 
<tr class="odd">
 
<td align="left">IEEESPSincos()</td>
 
<td align="left">Return sine and cosine of IEEE single-precision variable.</td>
 
</tr>
 
<tr class="even">
 
<td align="left">IEEESPSinh()</td>
 
<td align="left">Return hyperbolic sine of IEEE single-precision variable.</td>
 
</tr>
 
<tr class="odd">
 
<td align="left">IEEESPSqrt()</td>
 
<td align="left">Return square root of IEEE single-precision variable.</td>
 
</tr>
 
<tr class="even">
 
<td align="left">IEEESPTan()</td>
 
<td align="left">Return tangent of IEEE single-precision variable.</td>
 
</tr>
 
<tr class="odd">
 
<td align="left">IEEESPTanh()</td>
 
<td align="left">Return hyperbolic tangent of IEEE single-precision variable.</td>
 
</tr>
 
</table>
 
   
  +
{| class="wikitable"
DP IEEE Basic Functions
 
  +
|+ SP IEEE Basic Functions
  +
! 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
  +
|}
   
  +
{| class="wikitable"
<table>
 
  +
|+ SP IEEE Transcendental Functions
<tr class="header">
 
<th align="left">'''Function'''</th>
+
! Function
<th align="left">'''Description'''</th>
+
! Description
  +
|-
</tr>
 
  +
| IEEESPACos()
<tr class="odd">
 
  +
| Return arccosine of IEEE single-precision variable.
<td align="left">IEEEDPAbs()</td>
 
  +
|-
<td align="left">Take absolute value of IEEE double-precision variable</td>
 
  +
| IEEESPASin()
</tr>
 
  +
| Return arcsine of IEEE single-precision variable.
<tr class="even">
 
  +
|-
<td align="left">IEEEDPAdd()</td>
 
  +
| IEEESPAtan()
<td align="left">Add two IEEE double-precision variables</td>
 
  +
| Return arctangent of IEEE single-precision variable.
</tr>
 
  +
|-
<tr class="odd">
 
  +
| IEEESPCos()
<td align="left">IEEEDPCeil()</td>
 
  +
| Return cosine of IEEE single-precision variable.
<td align="left">Compute least integer greater than or equal to variable</td>
 
  +
|-
</tr>
 
  +
| IEEESPCosh()
<tr class="even">
 
  +
| Return hyperbolic cosine of IEEE single-precision variable.
<td align="left">IEEEDPCmp()</td>
 
  +
|-
<td align="left">Compare two IEEE double-precision variables</td>
 
  +
| IEEESPExp()
</tr>
 
  +
| Return ''e'' to the IEEE variable power.
<tr class="odd">
 
  +
|-
<td align="left">IEEEDPDiv()</td>
 
  +
| IEEESPLog()
<td align="left">Divide two IEEE double-precision variables</td>
 
  +
| Return natural log (base ''e'' of IEEE single-precision variable.
</tr>
 
  +
|-
<tr class="even">
 
  +
| IEEESPLog10()
<td align="left">IEEEDPFix()</td>
 
<td align="left">Convert IEEE double-precision variable to integer</td>
+
| Return log (base 10) of IEEE single-precision variable.
  +
|-
</tr>
 
  +
| IEEESPPow()
<tr class="odd">
 
  +
| Return power of IEEE single-precision variable.
<td align="left">IEEEDPFloor()</td>
 
  +
|-
<td align="left">Compute largest integer less than or equal to variable</td>
 
  +
| IEEESPSin()
</tr>
 
  +
| Return sine of IEEE single-precision variable.
<tr class="even">
 
  +
|-
<td align="left">IEEEDPFlt()</td>
 
  +
| IEEESPSincos()
<td align="left">Convert integer variable to IEEE double-precision</td>
 
  +
| Return sine and cosine of IEEE single-precision variable.
</tr>
 
  +
|-
<tr class="odd">
 
  +
| IEEESPSinh()
<td align="left">IEEEDPMul()</td>
 
<td align="left">Multiply two IEEE double-precision variables</td>
+
| Return hyperbolic sine of IEEE single-precision variable.
  +
|-
</tr>
 
  +
| IEEESPSqrt()
<tr class="even">
 
  +
| Return square root of IEEE single-precision variable.
<td align="left">IEEEDPNeg()</td>
 
  +
|-
<td align="left">Take two’s complement of IEEE double-precision variable</td>
 
  +
| IEEESPTan()
</tr>
 
  +
| Return tangent of IEEE single-precision variable.
<tr class="odd">
 
  +
|-
<td align="left">IEEEDPSub()</td>
 
  +
| IEEESPTanh()
<td align="left">Subtract two IEEE single-precision variables</td>
 
  +
| Return hyperbolic tangent of IEEE single-precision variable.
</tr>
 
  +
|}
<tr class="even">
 
<td align="left">IEEEDPTst()</td>
 
<td align="left">Test an IEEE double-precision variable against zero</td>
 
</tr>
 
</table>
 
   
  +
{| class="wikitable"
DP IEEE Transcendental Functions
 
  +
|+ DP IEEE Basic Functions
  +
! 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
  +
|}
   
  +
{| class="wikitable"
<table>
 
  +
|+ DP IEEE Transcendental Functions
<tr class="header">
 
<th align="left">'''Function'''</th>
+
! Function
<th align="left">'''Description'''</th>
+
! Description
  +
|-
</tr>
 
  +
| IEEEDPACos()
<tr class="odd">
 
  +
| Return arccosine of IEEE double-precision variable.
<td align="left">IEEEDPACos()</td>
 
  +
|-
<td align="left">Return arccosine of IEEE double-precision variable.</td>
 
  +
| IEEEDPASin()
</tr>
 
  +
| Return arcsine of IEEE double-precision variable.
<tr class="even">
 
  +
|-
<td align="left">IEEEDPASin()</td>
 
  +
| IEEEDPAtan()
<td align="left">Return arcsine of IEEE double-precision variable.</td>
 
  +
| Return arctangent of IEEE double-precision variable.
</tr>
 
  +
|-
<tr class="odd">
 
  +
| IEEEDPCos()
<td align="left">IEEEDPAtan()</td>
 
<td align="left">Return arctangent of IEEE double-precision variable.</td>
+
| Return cosine of IEEE double-precision variable.
  +
|-
</tr>
 
  +
| IEEEDPCosh()
<tr class="even">
 
  +
| Return hyperbolic cosine of IEEE double-precision variable.
<td align="left">IEEEDPCos()</td>
 
  +
|-
<td align="left">Return cosine of IEEE double-precision variable.</td>
 
  +
| IEEEDPExp()
</tr>
 
  +
| Return ''e'' to the IEEE variable power.
<tr class="odd">
 
  +
|-
<td align="left">IEEEDPCosh()</td>
 
  +
| IEEEDPFieee()
<td align="left">Return hyperbolic cosine of IEEE double-precision variable.</td>
 
  +
| Convert IEEE single-precision number to IEEE double-precision number.
</tr>
 
  +
|-
<tr class="even">
 
  +
| IEEEDPLog()
<td align="left">IEEEDPExp()</td>
 
<td align="left">Return ''e'' to the IEEE variable power.</td>
+
| Return natural log (base ''e'' of IEEE double-precision variable.
  +
|-
</tr>
 
  +
| IEEEDPLog10()
<tr class="odd">
 
  +
| Return log (base 10) of IEEE double-precision variable.
<td align="left">IEEEDPFieee()</td>
 
  +
|-
<td align="left">Convert IEEE single-precision number to IEEE double-precision number.</td>
 
  +
| IEEEDPPow()
</tr>
 
  +
| Return power of IEEE double-precision variable.
<tr class="even">
 
  +
|-
<td align="left">IEEEDPLog()</td>
 
  +
| IEEEDPSin()
<td align="left">Return natural log (base ''e'' of IEEE double-precision variable.</td>
 
  +
| Return sine of IEEE double-precision variable.
</tr>
 
  +
|-
<tr class="odd">
 
  +
| IEEEDPSincos()
<td align="left">IEEEDPLog10()</td>
 
<td align="left">Return log (base 10) of IEEE double-precision variable.</td>
+
| Return sine and cosine of IEEE double-precision variable.
  +
|-
</tr>
 
  +
| IEEEDPSinh()
<tr class="even">
 
  +
| Return hyperbolic sine of IEEE double-precision variable.
<td align="left">IEEEDPPow()</td>
 
  +
|-
<td align="left">Return power of IEEE double-precision variable.</td>
 
  +
| IEEEDPSqrt()
</tr>
 
  +
| Return square root of IEEE double-precision variable.
<tr class="odd">
 
  +
|-
<td align="left">IEEEDPSin()</td>
 
  +
| IEEEDPTan()
<td align="left">Return sine of IEEE double-precision variable.</td>
 
  +
| Return tangent of IEEE double-precision variable.
</tr>
 
  +
|-
<tr class="even">
 
  +
| IEEEDPTanh()
<td align="left">IEEEDPSincos()</td>
 
<td align="left">Return sine and cosine of IEEE double-precision variable.</td>
+
| Return hyperbolic tangent of IEEE double-precision variable.
  +
|-
</tr>
 
  +
| IEEEDPTieee()
<tr class="odd">
 
  +
| Convert IEEE double-precision number to IEEE single-precision number.
<td align="left">IEEEDPSinh()</td>
 
  +
|}
<td align="left">Return hyperbolic sine of IEEE double-precision variable.</td>
 
</tr>
 
<tr class="even">
 
<td align="left">IEEEDPSqrt()</td>
 
<td align="left">Return square root of IEEE double-precision variable.</td>
 
</tr>
 
<tr class="odd">
 
<td align="left">IEEEDPTan()</td>
 
<td align="left">Return tangent of IEEE double-precision variable.</td>
 
</tr>
 
<tr class="even">
 
<td align="left">IEEEDPTanh()</td>
 
<td align="left">Return hyperbolic tangent of IEEE double-precision variable.</td>
 
</tr>
 
<tr class="odd">
 
<td align="left">IEEEDPTieee()</td>
 
<td align="left">Convert IEEE double-precision number to IEEE single-precision number.</td>
 
</tr>
 
</table>
 

Latest revision as of 10:53, 3 August 2023

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)
FFP Basic Assembly Functions
Function Input Output Condition Codes
_LVOSPAbs D0 = FFP argument D0 = FFP absolute value N = 0

Z = 1 if result is zero
V = 0
C = undefined
X = undefined

_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
V = 1 if result overflowed
C = undefined
Z = undefined

_LVOSPCeil D0 = FFP argument D0 = least integer >= arg N = 1 if result is negative

Z = 1 if result is zero
V = undefined
C = undefined
Z = undefined

_LVOSPCmp D1 = FFP argument 1

D0 = FFP argument 2

D0 = +1 if arg1 > arg2

D0 = -1 if arg1 < arg2
D0 = 0 if arg1 = arg2

N = 0

Z = 1 if result is zero
V = 0
C = undefined
X = undefined
GT = arg2 > arg1
GE = arg2 >= arg1
EQ = arg2 = arg1
NE = arg2 != arg1
LT = arg2 < arg1
LE = arg2 <= arg1

_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
V = 1 if result overflowed
C = undefined
Z = undefined

_LVOSPFix D0 = FFP argument D0 = Integer (two's complement) N = 1 if result is negative

Z = 1 if result is zero
V = 1 if overflow occurred
C = undefined
X = undefined

_LVOSPFloor D0 = FFP argument D0 = largest integer <= argument N = 1 if result is negative

Z = 1 if result is zero
V = undefined
C = undefined
Z = undefined

_LVOSPFlt D0 = Integer (two's complement) D0 = FFP result N = 1 if result is negative

Z = 1 if result is zero
V = 0
C = undefined
X = undefined

_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
V = 1 if result overflowed
C = undefined
Z = undefined

_LVOSPNeg D0 = FFP argument D0 = FFP negated N = 1 if result is negative

Z = 1 if result is zero
V = 0
C = undefined
X = undefined

_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
V = 1 if result overflowed
C = undefined
Z = undefined

_LVOSPTst D1 = FFP argument

Note: This routine trashes the argument in D1.

D0 = +1 if arg > 0.0

D0 = -1 if arg < 0.0
D0 = 0 if arg = 0.0

N = 1 if result is negative

Z = 1 if result is zero
V = 0
C = undefined
X = undefined
EQ = arg = 0.0
NE = arg != 0.0
PL = arg >= 0.0
MI = arg < 0.0

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)
FFP Transcendental Assembly Functions
Function Input Output Condition Codes
_LVOSPAsin D0 = FFP argument D0 = FFP arcsine radian N = 0

Z = 1 if result is zero
V = 0
C = undefined
X = undefined

_LVOSPAcos D0 = FFP argument D0 = FFP arccosine radian N = 0

Z = 1 if result is zero
V = 1 if overflow occurred
C = undefined
X = undefined

_LVOSPAtan D0 = FFP argument D0 = FFP arctangent radian N = 0

Z = 1 if result is zero
V = 0
C = undefined
X = undefined

_LVOSPSin D0 = FFP argument in radians D0 = FFP sine N = 1 if result is negative

Z = 1 if result is zero
V = 1 if result is meaningless (that is, input magnitude too large)
C = undefined
X = undefined

_LVOSPCos D0 = FFP argument in radians D0 = FFP cosine N = 1 if result is negative

Z = 1 if result is zero
V = 1 if result is meaningless (that is, input magnitude too large)
C = undefined
X = undefined

_LVOSPTan D0 = FFP argument in radians D0 = FFP tangent N = 1 if result is negative

Z = 1 if result is zero
V = 1 if result is meaningless (that is, input magnitude too large)
C = undefined
X = undefined

_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
V = 1 if result is meaningless (that is, input magnitude too large)
C = undefined
X = undefined

_LVOSPSinh D0 = FFP argument in radians D0 = FFP hyperbolic sine N = 1 if result is negative

Z = 1 if result is zero
V = 1 if overflow occurred
C = undefined
X = undefined

_LVOSPCosh D0 = FFP argument in radians D0 = FFP hyperbolic cosine N = 1 if result is negative

Z = 1 if result is zero
V = 1 if overflow occurred
C = undefined
X = undefined

_LVOSPTanh D0 = FFP argument in radians D0 = FFP hyperbolic tangent N = 1 if result is negative

Z = 1 if result is zero
V = 1 if overflow occurred
C = undefined
X = undefined

_LVOSPExp D0 = FFP argument D0 = FFP exponential N = 0

Z = 1 if result is zero
V = 1 if overflow occurred
C = undefined
Z = undefined

_LVOSPLog D0 = FFP argument D0 = FFP natural logarithm N = 1 if result is negative

Z = 1 if result is zero
V = 1 if argument negative or zero
C = undefined
Z = undefined

_LVOSPLog10 D0 = FFP argument D0 = FFP logarithm (base 10) N = 1 if result is negative

Z = 1 if result is zero
V = 1 if argument negative or zero
C = undefined
Z = undefined

_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
V = 1 if result overflowed or arg < 0
C = undefined
Z = undefined

_LVOSPSqrt D0 = FFP argument D0 = FFP square root N = 0

Z = 1 if result is zero
V = 1 if argument was negative
C = undefined
Z = undefined

_LVOSPTieee D0 = FFP format argument D0 = IEEE floating-point format N = 1 if result is negative

Z = 1 if result is zero
V = undefined
C = undefined
Z = undefined

_LVOSPFieee D0 = IEEE floating-point format argument D0 = FFP format N = undefined

Z = 1 if result is zero
V = 1 if result overflowed
C = undefined
Z = undefined

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)
SP IEEE Basic Assembly Functions
Function Input Output Condition Codes
_LVOIEEESPFix D0 = IEEE double-precision argument D0 = Integer (two's complement) N = undefined

Z = undefined
V = undefined
C = undefined
X = undefined

_LVOIEEESPFlt D0 = Integer argument (two's complement) D0 = IEEE single-precision N = undefined

Z = undefined
V = undefined
C = undefined
X = undefined

_LVOIEEESPCmp D0 = IEEE single-precision argument 1

D1 = IEEE single-precision argument 2

D0 = +1 if arg1 > arg2

D0 = -1 if arg1 < arg2
D0 = 0 if arg1 = arg2

N = 1 if result is negative

Z = 1 if result is zero
V = 0
C = undefined
X = undefined
GT = arg2 > arg1
GE = arg2 >= arg1
EQ = arg2 = arg1
NE = arg2 != arg1
LT = arg2 < arg1
E= arg2 <= arg1

_LVOIEEESPTst D0 = IEEE single-precision argument D0 = +1 if arg > 0.0

D0 = -1 if arg < 0.0
D0 = 0 if arg = 0.0

N = 1 if result is negative

Z = 1 if result is zero
V = 0
C = undefined
X = undefined
EQ = arg = 0.0
NE = arg != 0.0
PL = arg >= 0.0
MI = arg < 0.0

_LVOIEEESPAbs D0 = IEEE single-precision argument D0 = IEEE single-precision absolute value N = undefined

Z = undefined
V = undefined
C = undefined
X = undefined

_LVOIEEESPNeg D0 = IEEE single-precision argument D0 = IEEE single-precision negated N = undefined

Z = undefined
V = undefined
C = undefined
X = 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
V = undefined
C = undefined
X = 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
V = undefined
C = undefined
X = 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
V = undefined
C = undefined
X = 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
V = undefined
C = undefined
X = undefined

_LVOIEEESPCeil D0 = IEEE single-precision variable D0 = least integer >= variable N = undefined

Z = undefined
V = undefined
C = undefined
X = undefined

_LVOIEEESPFloor D0 = IEEE single-precision variable D0 = largest integer <= argument N = undefined

Z = undefined
V = undefined
C = undefined
X = 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)
SP IEEE Transcendental Assembly Functions
Function Input Output Condition Codes
_LVOIEEESPAsin D0 = IEEE argument D0 = IEEE arcsine radian N = undefined

Z = undefined
V = undefined
C = undefined
X = undefined

_LVOIEEESPAcos D0 = IEEE single-precision argument D0 = IEEE arccosine radian N = undefined

Z = undefined
V = undefined
C = undefined
X = undefined

_LVOIEEESPAtan D0 = IEEE single-precision argument D0 = IEEE arctangent radian N = undefined

Z = undefined
V = undefined
C = undefined
X = undefined

_LVOIEEESPSin D0 = IEEE single-precision argument in radians D0 = IEEE sine N = undefined

Z = undefined
V = undefined
C = undefined
X = undefined

_LVOIEEESPCos D0 = IEEE single-precision argument in radians D0 = IEEE cosine N = undefined

Z = undefined
V = undefined
C = undefined
X = undefined

_LVOIEEESPTan D0 = IEEE single-precision argument in radians D0 = IEEE tangent N = undefined

Z = undefined
V = undefined
C = undefined
X = undefined

_LVOIEEESPSincos A0 = Address to store cosine result

D0 = IEEE argument in radians

D0 = IEEE sine

(A0) = IEEE cosine

N = undefined

Z = undefined
V = undefined
C = undefined
X = undefined

_LVOIEEESPSinh D0 = IEEE single-precision argument in radians D0 = IEEE hyperbolic sine N = undefined

Z = undefined
V = undefined
C = undefined
X = undefined

_LVOIEEESPCosh D0 = IEEE single-precision argument in radians D0 = IEEE hyperbolic cosine N = undefined

Z = undefined
V = undefined
C = undefined
X = undefined

_LVOIEEESPTanh D0 = IEEE single-precision argument in radians D0 = IEEE hyperbolic tangent N = undefined

Z = undefined
V = undefined
C = undefined
X = undefined

_LVOIEEESPExp D0 = IEEE single-precision argument D0 = IEEE exponential N = undefined

Z = undefined
V = undefined
C = undefined
X = undefined

_LVOIEEESPLog D0 = IEEE single-precision argument D0 = IEEE natural logarithm N = undefined

Z = undefined
V = undefined
C = undefined
X = undefined

_LVOIEEESPLog10 D0 = IEEE single-precision argument D0 = IEEE logarithm (base 10) N = undefined

Z = undefined
V = undefined
C = undefined
X = 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
V = undefined
C = undefined
X = undefined

_LVOIEEESPSqrt D0 = IEEE single-precision argument D0 = IEEE square root N = undefined

Z = undefined
V = undefined
C = undefined
X = 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)
DP IEEE Basic Assembly Functions
Function Input Output Condition Codes
_LVOIEEEDPFix D0/D1 = IEEE double-precision argument D0 = Integer (two's complement) N = undefined

Z = undefined
V = undefined
C = undefined
X = undefined

_LVOIEEEDPFl D0 = Integer (two's complement) argument D0/D1 = IEEE double-precision N = undefined

Z = undefined
V = undefined
C = undefined
X = 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
D0 = 0 if arg1 = arg2

N = 1 if result is negative

Z = 1 if result is zero
V = 0
C = undefined
X = undefined
GT = arg2 > arg1
GE = arg2 >= arg1
EQ = arg2 = arg1
NE = arg2 != arg1
LT = arg2 < arg1
LE = arg2 <= arg1

_LVOIEEEDPTst D0/D1 = IEEE double-precision argument D0 = +1 if arg > 0.0

D0 = -1 if arg < 0.0
D0 = 0 if arg = 0.0

N = 1 if result is negative

Z = 1 if result is zero
V = 0
C = undefined
X = undefined
EQ = arg = 0.0
NE = arg != 0.0
PL = arg >= 0.0
MI = arg < 0.0

_LVOIEEEDPAbs D0/D1 = IEEE double-precision argument D0/D1 = IEEE double-precision absolute value N = undefined

Z = undefined
V = undefined
C = undefined
X = undefined

_LVOIEEEDPNeg D0/D1 = IEEE double-precision argument D0/D1 = IEEE double-precision negated N = undefined

Z = undefined
V = undefined
C = undefined
X = 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
V = undefined
C = undefined
X = 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
V = undefined
C = undefined
X = 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
V = undefined
C = undefined
X = 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
V = undefined
C = undefined
X = undefined

_LVOIEEEDPCeil D0/D1 = IEEE double-precision argument D0/D1 = least integer >= argument N = undefined

Z = undefined
V = undefined
C = undefined
X = undefined

_LVOIEEEDPFloor D0/D1 = IEEE double-precision argument D0/D1 = largest integer <= argument N = undefined

Z = undefined
V = undefined
C = undefined
X = 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)
DP IEEE Transcendental Assembly Functions
Function Input Output Condition Codes
_LVOIEEEDPAsin D0/D1 = IEEE argument D0/D1 = IEEE arcsine radian N = undefined

Z = undefined
V = undefined
C = undefined
X = undefined

_LVOIEEEDPAcos D0/D1 = IEEE argument D0/D1 = IEEE arccosine radian N = undefined

Z = undefined
V = undefined
C = undefined
X = undefined

_LVOIEEEDPAtan D0/D1 = IEEE argument D0/D1 = IEEE arctangent radian N = undefined

Z = undefined
V = undefined
C = undefined
X = undefined

_LVOIEEEDPSin D0/D1 = IEEE argument in radians D0/D1 = IEEE sine N = undefined

Z = undefined
V = undefined
C = undefined
X = undefined

_LVOIEEEDPCos D0/D1 = IEEE argument in radians D0/D1 = IEEE cosine N = undefined

Z = undefined
V = undefined
C = undefined
X = undefined

_LVOIEEEDPTan D0/D1 = IEEE argument in radians D0/D1 = IEEE tangent N = undefined

Z = undefined
V = undefined
C = undefined
X = 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
V = undefined
C = undefined
X = undefined

_LVOIEEEDPSin D0/D1 = IEEE argument in radians D0/D1 = IEEE hyperbolic sine N = undefined

Z = undefined
V = undefined
C = undefined
X = undefined

_LVOIEEEDPCosh D0/D1 = IEEE argument in radians D0/D1 = IEEE hyperbolic cosine N = undefined

Z = undefined
V = undefined
C = undefined
X = undefined

_LVOIEEEDPTanh D0/D1 = IEEE argument in radians D0/D1 = IEEE hyperbolic tangent N = undefined

Z = undefined
V = undefined
C = undefined
X = undefined

_LVOIEEEDPExp D0/D1 = IEEE argument D0/D1 = IEEE exponential N = undefined

Z = undefined
V = undefined
C = undefined
X = undefined

_LVOIEEEDPLog D0/D1 = IEEE argument D0/D1 = IEEE natural logarithm N = undefined

Z = undefined
V = undefined
C = undefined
X = undefined

_LVOIEEEDPLog10 D0/D1 = IEEE argument D0/D1 = IEEE logarithm (base 10) N = undefined

Z = undefined
V = undefined
C = undefined
X = undefined

_LVOIEEEDPPow D0/D1 = IEEE exponent

D2/D3 = IEEE argument

D0/D1 = IEEE result of arg taken to exp power N = undefined

Z = undefined
V = undefined
C = undefined
X = undefined

_LVOIEEEDPSqrt D0/D1 = IEEE argument D0/D1 = IEEE square root N = undefined

Z = undefined
V = undefined
C = undefined
X = undefined

_LVOIEEEDPTieee D0/D1 = IEEE format argument D0 = single-precision IEEE floating-point format N = undefined

Z = undefined
V = undefined
C = undefined
X = undefined

Function Reference

Here's a brief summary of the functions covered in this chapter. Refer to the SDK for additional information.

FFP Basic Functions
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
FFP Transcendental Functions
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
Math Support Functions
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.
SP IEEE Basic Functions
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
SP IEEE Transcendental Functions
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.
DP IEEE Basic Functions
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
DP IEEE Transcendental Functions
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.