~ubuntu-branches/ubuntu/feisty/fpc/feisty

« back to all changes in this revision

Viewing changes to packages/extra/univint/fp.pas

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2007-01-27 20:08:50 UTC
  • mfrom: (1.2.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20070127200850-9mrptaqqjsx9nwa7
Tags: 2.0.4-5
* Fixed Build-Depends.
* Add myself to Uploaders in debian/control.
* Make sure that the sources are really patched before building them.
* Build unit 'libc' on powerpc too.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
{
 
2
     File:       fp.p
 
3
 
 
4
     Contains:   FPCE Floating-Point Definitions and Declarations.
 
5
 
 
6
     Version:    Technology: MathLib v2
 
7
                 Release:    Universal Interfaces 3.4.2
 
8
 
 
9
     Copyright:  � 1987-2002 by Apple Computer, Inc., all rights reserved.
 
10
 
 
11
     Bugs?:      For bug reports, consult the following page on
 
12
                 the World Wide Web:
 
13
 
 
14
                     http://www.freepascal.org/bugs.html
 
15
 
 
16
}
 
17
 
 
18
{
 
19
    Modified for use with Free Pascal
 
20
    Version 200
 
21
    Please report any bugs to <gpc@microbizz.nl>
 
22
}
 
23
 
 
24
{$mode macpas}
 
25
{$packenum 1}
 
26
{$macro on}
 
27
{$inline on}
 
28
{$CALLING MWPASCAL}
 
29
 
 
30
unit fp;
 
31
interface
 
32
{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
 
33
{$setc GAP_INTERFACES_VERSION := $0200}
 
34
 
 
35
{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
 
36
    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
 
37
{$endc}
 
38
 
 
39
{$ifc defined CPUPOWERPC and defined CPUI386}
 
40
        {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
 
41
{$endc}
 
42
{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
 
43
        {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
 
44
{$endc}
 
45
 
 
46
{$ifc not defined __ppc__ and defined CPUPOWERPC}
 
47
        {$setc __ppc__ := 1}
 
48
{$elsec}
 
49
        {$setc __ppc__ := 0}
 
50
{$endc}
 
51
{$ifc not defined __i386__ and defined CPUI386}
 
52
        {$setc __i386__ := 1}
 
53
{$elsec}
 
54
        {$setc __i386__ := 0}
 
55
{$endc}
 
56
 
 
57
{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
 
58
        {$error Conflicting definitions for __ppc__ and __i386__}
 
59
{$endc}
 
60
 
 
61
{$ifc defined __ppc__ and __ppc__}
 
62
        {$setc TARGET_CPU_PPC := TRUE}
 
63
        {$setc TARGET_CPU_X86 := FALSE}
 
64
{$elifc defined __i386__ and __i386__}
 
65
        {$setc TARGET_CPU_PPC := FALSE}
 
66
        {$setc TARGET_CPU_X86 := TRUE}
 
67
{$elsec}
 
68
        {$error Neither __ppc__ nor __i386__ is defined.}
 
69
{$endc}
 
70
{$setc TARGET_CPU_PPC_64 := FALSE}
 
71
 
 
72
{$ifc defined FPC_BIG_ENDIAN}
 
73
        {$setc TARGET_RT_BIG_ENDIAN := TRUE}
 
74
        {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
 
75
{$elifc defined FPC_LITTLE_ENDIAN}
 
76
        {$setc TARGET_RT_BIG_ENDIAN := FALSE}
 
77
        {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
 
78
{$elsec}
 
79
        {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
 
80
{$endc}
 
81
{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
 
82
{$setc CALL_NOT_IN_CARBON := FALSE}
 
83
{$setc OLDROUTINENAMES := FALSE}
 
84
{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
 
85
{$setc OPAQUE_UPP_TYPES := TRUE}
 
86
{$setc OTCARBONAPPLICATION := TRUE}
 
87
{$setc OTKERNEL := FALSE}
 
88
{$setc PM_USE_SESSION_APIS := TRUE}
 
89
{$setc TARGET_API_MAC_CARBON := TRUE}
 
90
{$setc TARGET_API_MAC_OS8 := FALSE}
 
91
{$setc TARGET_API_MAC_OSX := TRUE}
 
92
{$setc TARGET_CARBON := TRUE}
 
93
{$setc TARGET_CPU_68K := FALSE}
 
94
{$setc TARGET_CPU_MIPS := FALSE}
 
95
{$setc TARGET_CPU_SPARC := FALSE}
 
96
{$setc TARGET_OS_MAC := TRUE}
 
97
{$setc TARGET_OS_UNIX := FALSE}
 
98
{$setc TARGET_OS_WIN32 := FALSE}
 
99
{$setc TARGET_RT_MAC_68881 := FALSE}
 
100
{$setc TARGET_RT_MAC_CFM := FALSE}
 
101
{$setc TARGET_RT_MAC_MACHO := TRUE}
 
102
{$setc TYPED_FUNCTION_POINTERS := TRUE}
 
103
{$setc TYPE_BOOL := FALSE}
 
104
{$setc TYPE_EXTENDED := FALSE}
 
105
{$setc TYPE_LONGLONG := TRUE}
 
106
uses MacTypes,ConditionalMacros;
 
107
 
 
108
{*******************************************************************************
 
109
*                                                                               *
 
110
*    A collection of numerical functions designed to facilitate a wide          *
 
111
*    range of numerical programming as required by C9X.                         *
 
112
*                                                                               *
 
113
*    The <fp.h> declares many functions in support of numerical programming.    *
 
114
*    It provides a superset of <math.h> and <SANE.h> functions.  Some           *
 
115
*    functionality previously found in <SANE.h> and not in the FPCE <fp.h>      *
 
116
*    can be found in this <fp.h> under the heading "__NOEXTENSIONS__".          *
 
117
*                                                                               *
 
118
*    All of these functions are IEEE 754 aware and treat exceptions, NaNs,      *
 
119
*    positive and negative zero and infinity consistent with the floating-      *
 
120
*    point standard.                                                            *
 
121
*                                                                               *
 
122
*******************************************************************************}
 
123
 
 
124
 
 
125
{$ALIGN MAC68K}
 
126
 
 
127
{*******************************************************************************
 
128
*                                                                               *
 
129
*                            Efficient types                                    *
 
130
*                                                                               *
 
131
*    float_t         Most efficient type at least as wide as float              *
 
132
*    double_t        Most efficient type at least as wide as double             *
 
133
*                                                                               *
 
134
*      CPU            float_t(bits)                double_t(bits)               *
 
135
*    --------        -----------------            -----------------             *
 
136
*    PowerPC          float(32)                    double(64)                   *
 
137
*    68K              long double(80/96)           long double(80/96)           *
 
138
*    x86              double(64)                   double(64)                   *
 
139
*                                                                               *
 
140
*******************************************************************************}
 
141
{$ifc TARGET_CPU_PPC}
 
142
 
 
143
type
 
144
        float_t                                                         = Float32;
 
145
        double_t                                                        = Float64;
 
146
{$elsec}
 
147
  {$ifc TARGET_CPU_68K}
 
148
type
 
149
    float_t                             = extended;
 
150
    double_t                            = extended;
 
151
  {$elsec}
 
152
    {$ifc TARGET_CPU_X86}
 
153
 
 
154
type
 
155
        float_t                                                         = Float64;
 
156
        double_t                                                        = Float64;
 
157
    {$elsec}
 
158
      {$ifc TARGET_CPU_MIPS}
 
159
 
 
160
type
 
161
        float_t                                                         = Double;
 
162
        double_t                                                        = Double;
 
163
      {$elsec}
 
164
        {$ifc TARGET_CPU_ALPHA}
 
165
 
 
166
type
 
167
        float_t                                                         = Double;
 
168
        double_t                                                        = Double;
 
169
        {$elsec}
 
170
          {$ifc TARGET_CPU_SPARC}
 
171
 
 
172
type
 
173
        float_t                                                         = Double;
 
174
        double_t                                                        = Double;
 
175
          {$elsec}
 
176
{ Unsupported CPU }
 
177
          {$endc}
 
178
        {$endc}
 
179
      {$endc}
 
180
    {$endc}
 
181
  {$endc}
 
182
{$endc}
 
183
 
 
184
{*******************************************************************************
 
185
*                                                                               *
 
186
*                              Define some constants.                           *
 
187
*                                                                               *
 
188
*    HUGE_VAL            IEEE 754 value of infinity.                            *
 
189
*    INFINITY            IEEE 754 value of infinity.                            *
 
190
*    NAN                 A generic NaN (Not A Number).                          *
 
191
*    DECIMAL_DIG         Satisfies the constraint that the conversion from      *
 
192
*                        double to decimal and back is the identity function.   *
 
193
*                                                                               *
 
194
*******************************************************************************}
 
195
const
 
196
{$ifc TARGET_CPU_PPC}
 
197
    DECIMAL_DIG                         = 17; 
 
198
{$elsec}
 
199
    DECIMAL_DIG                         = 21;
 
200
{$endc}
 
201
{$ifc TARGET_OS_MAC}
 
202
{*******************************************************************************
 
203
*                                                                               *
 
204
*                            Trigonometric functions                            *
 
205
*                                                                               *
 
206
*   acos        result is in [0,pi].                                            *
 
207
*   asin        result is in [-pi/2,pi/2].                                      *
 
208
*   atan        result is in [-pi/2,pi/2].                                      *
 
209
*   atan2       Computes the arc tangent of y/x in [-pi,pi] using the sign of   *
 
210
*               both arguments to determine the quadrant of the computed value. *
 
211
*                                                                               *
 
212
*******************************************************************************}
 
213
{
 
214
 *  cos()
 
215
 *  
 
216
 *  Availability:
 
217
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 
218
 *    CarbonLib:        in CarbonLib 1.0 and later
 
219
 *    Mac OS X:         in version 10.0 and later
 
220
 }
 
221
function cos(x: double_t): double_t; external name '_cos';
 
222
 
 
223
{
 
224
 *  sin()
 
225
 *  
 
226
 *  Availability:
 
227
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 
228
 *    CarbonLib:        in CarbonLib 1.0 and later
 
229
 *    Mac OS X:         in version 10.0 and later
 
230
 }
 
231
function sin(x: double_t): double_t; external name '_sin';
 
232
 
 
233
{
 
234
 *  tan()
 
235
 *  
 
236
 *  Availability:
 
237
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 
238
 *    CarbonLib:        in CarbonLib 1.0 and later
 
239
 *    Mac OS X:         in version 10.0 and later
 
240
 }
 
241
function tan(x: double_t): double_t; external name '_tan';
 
242
 
 
243
{
 
244
 *  acos()
 
245
 *  
 
246
 *  Availability:
 
247
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 
248
 *    CarbonLib:        in CarbonLib 1.0 and later
 
249
 *    Mac OS X:         in version 10.0 and later
 
250
 }
 
251
function acos(x: double_t): double_t; external name '_acos';
 
252
 
 
253
{
 
254
 *  asin()
 
255
 *  
 
256
 *  Availability:
 
257
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 
258
 *    CarbonLib:        in CarbonLib 1.0 and later
 
259
 *    Mac OS X:         in version 10.0 and later
 
260
 }
 
261
function asin(x: double_t): double_t; external name '_asin';
 
262
 
 
263
{
 
264
 *  atan()
 
265
 *  
 
266
 *  Availability:
 
267
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 
268
 *    CarbonLib:        in CarbonLib 1.0 and later
 
269
 *    Mac OS X:         in version 10.0 and later
 
270
 }
 
271
function atan(x: double_t): double_t; external name '_atan';
 
272
 
 
273
{
 
274
 *  atan2()
 
275
 *  
 
276
 *  Availability:
 
277
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 
278
 *    CarbonLib:        in CarbonLib 1.0 and later
 
279
 *    Mac OS X:         in version 10.0 and later
 
280
 }
 
281
function atan2(y: double_t; x: double_t): double_t; external name '_atan2';
 
282
 
 
283
 
 
284
{*******************************************************************************
 
285
*                                                                               *
 
286
*                              Hyperbolic functions                             *
 
287
*                                                                               *
 
288
*******************************************************************************}
 
289
{
 
290
 *  cosh()
 
291
 *  
 
292
 *  Availability:
 
293
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 
294
 *    CarbonLib:        in CarbonLib 1.0 and later
 
295
 *    Mac OS X:         in version 10.0 and later
 
296
 }
 
297
function cosh(x: double_t): double_t; external name '_cosh';
 
298
 
 
299
{
 
300
 *  sinh()
 
301
 *  
 
302
 *  Availability:
 
303
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 
304
 *    CarbonLib:        in CarbonLib 1.0 and later
 
305
 *    Mac OS X:         in version 10.0 and later
 
306
 }
 
307
function sinh(x: double_t): double_t; external name '_sinh';
 
308
 
 
309
{
 
310
 *  tanh()
 
311
 *  
 
312
 *  Availability:
 
313
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 
314
 *    CarbonLib:        in CarbonLib 1.0 and later
 
315
 *    Mac OS X:         in version 10.0 and later
 
316
 }
 
317
function tanh(x: double_t): double_t; external name '_tanh';
 
318
 
 
319
{
 
320
 *  acosh()
 
321
 *  
 
322
 *  Availability:
 
323
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 
324
 *    CarbonLib:        in CarbonLib 1.0 and later
 
325
 *    Mac OS X:         in version 10.0 and later
 
326
 }
 
327
function acosh(x: double_t): double_t; external name '_acosh';
 
328
 
 
329
{
 
330
 *  asinh()
 
331
 *  
 
332
 *  Availability:
 
333
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 
334
 *    CarbonLib:        in CarbonLib 1.0 and later
 
335
 *    Mac OS X:         in version 10.0 and later
 
336
 }
 
337
function asinh(x: double_t): double_t; external name '_asinh';
 
338
 
 
339
{
 
340
 *  atanh()
 
341
 *  
 
342
 *  Availability:
 
343
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 
344
 *    CarbonLib:        in CarbonLib 1.0 and later
 
345
 *    Mac OS X:         in version 10.0 and later
 
346
 }
 
347
function atanh(x: double_t): double_t; external name '_atanh';
 
348
 
 
349
 
 
350
{*******************************************************************************
 
351
*                                                                               *
 
352
*                              Exponential functions                            *
 
353
*                                                                               *
 
354
*   expm1       expm1(x) = exp(x) - 1.  But, for small enough arguments,        *
 
355
*               expm1(x) is expected to be more accurate than exp(x) - 1.       *
 
356
*   frexp       Breaks a floating-point number into a normalized fraction       *
 
357
*               and an integral power of 2.  It stores the SInt16 in the       *
 
358
*               object pointed by *exponent.                                    *
 
359
*   ldexp       Multiplies a floating-point number by an SInt16 power of 2.    *
 
360
*   log1p       log1p = log(1 + x). But, for small enough arguments,            *
 
361
*               log1p is expected to be more accurate than log(1 + x).          *
 
362
*   logb        Extracts the exponent of its argument, as a signed integral     *
 
363
*               value. A subnormal argument is treated as though it were first  *
 
364
*               normalized. Thus:                                               *
 
365
*                                  1   <=   x * 2^(-logb(x))   <   2            *
 
366
*   modf        Returns fractional part of x as function result and returns     *
 
367
*               integral part of x via iptr. Note C9X uses double not double_t. *
 
368
*   scalb       Computes x * 2^n efficently.  This is not normally done by      *
 
369
*               computing 2^n explicitly.                                       *
 
370
*                                                                               *
 
371
*******************************************************************************}
 
372
{
 
373
 *  exp()
 
374
 *  
 
375
 *  Availability:
 
376
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 
377
 *    CarbonLib:        in CarbonLib 1.0 and later
 
378
 *    Mac OS X:         in version 10.0 and later
 
379
 }
 
380
function exp(x: double_t): double_t; external name '_exp';
 
381
 
 
382
{
 
383
 *  expm1()
 
384
 *  
 
385
 *  Availability:
 
386
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 
387
 *    CarbonLib:        in CarbonLib 1.0 and later
 
388
 *    Mac OS X:         in version 10.0 and later
 
389
 }
 
390
function expm1(x: double_t): double_t; external name '_expm1';
 
391
 
 
392
{
 
393
 *  exp2()
 
394
 *  
 
395
 *  Availability:
 
396
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 
397
 *    CarbonLib:        in CarbonLib 1.0 and later
 
398
 *    Mac OS X:         in version 10.0 and later
 
399
 }
 
400
function exp2(x: double_t): double_t; external name '_exp2';
 
401
 
 
402
{
 
403
 *  frexp()
 
404
 *  
 
405
 *  Availability:
 
406
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 
407
 *    CarbonLib:        in CarbonLib 1.0 and later
 
408
 *    Mac OS X:         in version 10.0 and later
 
409
 }
 
410
function frexp(x: double_t; var exponent: SInt32): double_t; external name '_frexp';
 
411
 
 
412
{
 
413
 *  ldexp()
 
414
 *  
 
415
 *  Availability:
 
416
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 
417
 *    CarbonLib:        in CarbonLib 1.0 and later
 
418
 *    Mac OS X:         in version 10.0 and later
 
419
 }
 
420
function ldexp(x: double_t; n: SInt32): double_t; external name '_ldexp';
 
421
 
 
422
{
 
423
 *  log()
 
424
 *  
 
425
 *  Availability:
 
426
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 
427
 *    CarbonLib:        in CarbonLib 1.0 and later
 
428
 *    Mac OS X:         in version 10.0 and later
 
429
 }
 
430
function log(x: double_t): double_t; external name '_log';
 
431
 
 
432
{
 
433
 *  log2()
 
434
 *  
 
435
 *  Availability:
 
436
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 
437
 *    CarbonLib:        in CarbonLib 1.0 and later
 
438
 *    Mac OS X:         in version 10.0 and later
 
439
 }
 
440
function log2(x: double_t): double_t; external name '_log2';
 
441
 
 
442
{
 
443
 *  log1p()
 
444
 *  
 
445
 *  Availability:
 
446
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 
447
 *    CarbonLib:        in CarbonLib 1.0 and later
 
448
 *    Mac OS X:         in version 10.0 and later
 
449
 }
 
450
function log1p(x: double_t): double_t; external name '_log1p';
 
451
 
 
452
{
 
453
 *  log10()
 
454
 *  
 
455
 *  Availability:
 
456
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 
457
 *    CarbonLib:        in CarbonLib 1.0 and later
 
458
 *    Mac OS X:         in version 10.0 and later
 
459
 }
 
460
function log10(x: double_t): double_t; external name '_log10';
 
461
 
 
462
{
 
463
 *  logb()
 
464
 *  
 
465
 *  Availability:
 
466
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 
467
 *    CarbonLib:        in CarbonLib 1.0 and later
 
468
 *    Mac OS X:         in version 10.0 and later
 
469
 }
 
470
function logb(x: double_t): double_t; external name '_logb';
 
471
 
 
472
{
 
473
 *  modf()
 
474
 *  
 
475
 *  Availability:
 
476
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 
477
 *    CarbonLib:        in CarbonLib 1.0 and later
 
478
 *    Mac OS X:         in version 10.0 and later
 
479
 }
 
480
function modf(x: double_t; var iptr: double_t): double_t; external name '_modf';
 
481
 
 
482
{
 
483
 *  modff()
 
484
 *  
 
485
 *  Availability:
 
486
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 
487
 *    CarbonLib:        in CarbonLib 1.0 and later
 
488
 *    Mac OS X:         in version 10.0 and later
 
489
 }
 
490
function modff(x: Single; var iptrf: Single): Single; external name '_modff';
 
491
 
 
492
 
 
493
{
 
494
    Note: For compatiblity scalb(x,n) has n of type
 
495
            int  on Mac OS X 
 
496
            long on Mac OS
 
497
}
 
498
 
 
499
type
 
500
        _scalb_n_type                                           = SInt32;
 
501
        {
 
502
         *  scalb()
 
503
         *  
 
504
         *  Availability:
 
505
         *    Non-Carbon CFM:   in MathLib 1.0 and later
 
506
         *    CarbonLib:        in CarbonLib 1.0 and later
 
507
         *    Mac OS X:         in version 10.0 and later
 
508
                }
 
509
function scalb(x: double_t; n: _scalb_n_type): double_t; external name '_scalb';
 
510
 
 
511
 
 
512
{*******************************************************************************
 
513
*                                                                               *
 
514
*                     Power and absolute value functions                        *
 
515
*                                                                               *
 
516
*   hypot       Computes the square root of the sum of the squares of its       *
 
517
*               arguments, without undue overflow or underflow.                 *
 
518
*   pow         Returns x raised to the power of y.  Result is more accurate    *
 
519
*               than using exp(log(x)*y).                                       *
 
520
*                                                                               *
 
521
*******************************************************************************}
 
522
{
 
523
 *  fabs()
 
524
 *  
 
525
 *  Availability:
 
526
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 
527
 *    CarbonLib:        in CarbonLib 1.0 and later
 
528
 *    Mac OS X:         in version 10.0 and later
 
529
 }
 
530
function fabs(x: double_t): double_t; external name '_fabs';
 
531
 
 
532
{
 
533
 *  hypot()
 
534
 *  
 
535
 *  Availability:
 
536
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 
537
 *    CarbonLib:        in CarbonLib 1.0 and later
 
538
 *    Mac OS X:         in version 10.0 and later
 
539
 }
 
540
function hypot(x: double_t; y: double_t): double_t; external name '_hypot';
 
541
 
 
542
{
 
543
 *  pow()
 
544
 *  
 
545
 *  Availability:
 
546
 *    Non-Carbon CFM:   in MathLib 2.0 and later
 
547
 *    CarbonLib:        in CarbonLib 1.0 and later
 
548
 *    Mac OS X:         in version 10.0 and later
 
549
 }
 
550
function pow(x: double_t; y: double_t): double_t; external name '_pow';
 
551
 
 
552
{
 
553
 *  sqrt()
 
554
 *  
 
555
 *  Availability:
 
556
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 
557
 *    CarbonLib:        in CarbonLib 1.0 and later
 
558
 *    Mac OS X:         in version 10.0 and later
 
559
 }
 
560
function sqrt(x: double_t): double_t; external name '_sqrt';
 
561
 
 
562
 
 
563
{*******************************************************************************
 
564
*                                                                               *
 
565
*                        Gamma and Error functions                              *
 
566
*                                                                               *
 
567
*   erf         The error function.                                             *
 
568
*   erfc        Complementary error function.                                   *
 
569
*   gamma       The gamma function.                                             *
 
570
*   lgamma      Computes the base-e logarithm of the absolute value of          *
 
571
*               gamma of its argument x, for x > 0.                             *
 
572
*                                                                               *
 
573
*******************************************************************************}
 
574
{
 
575
 *  erf()
 
576
 *  
 
577
 *  Availability:
 
578
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 
579
 *    CarbonLib:        in CarbonLib 1.0 and later
 
580
 *    Mac OS X:         in version 10.0 and later
 
581
 }
 
582
function erf(x: double_t): double_t; external name '_erf';
 
583
 
 
584
{
 
585
 *  erfc()
 
586
 *  
 
587
 *  Availability:
 
588
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 
589
 *    CarbonLib:        in CarbonLib 1.0 and later
 
590
 *    Mac OS X:         in version 10.0 and later
 
591
 }
 
592
function erfc(x: double_t): double_t; external name '_erfc';
 
593
 
 
594
{
 
595
 *  gamma()
 
596
 *  
 
597
 *  Availability:
 
598
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 
599
 *    CarbonLib:        in CarbonLib 1.0 and later
 
600
 *    Mac OS X:         in version 10.0 and later
 
601
 }
 
602
function gamma(x: double_t): double_t; external name '_gamma';
 
603
 
 
604
{
 
605
 *  lgamma()
 
606
 *  
 
607
 *  Availability:
 
608
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 
609
 *    CarbonLib:        in CarbonLib 1.0 and later
 
610
 *    Mac OS X:         in version 10.0 and later
 
611
 }
 
612
function lgamma(x: double_t): double_t; external name '_lgamma';
 
613
 
 
614
 
 
615
{*******************************************************************************
 
616
*                                                                               *
 
617
*                        Nearest SInt16 functions                              *
 
618
*                                                                               *
 
619
*   rint        Rounds its argument to an integral value in floating point      *
 
620
*               format, honoring the current rounding direction.                *
 
621
*                                                                               *
 
622
*   nearbyint   Differs from rint only in that it does not raise the inexact    *
 
623
*               exception. It is the nearbyint function recommended by the      *
 
624
*               IEEE floating-point standard 854.                               *
 
625
*                                                                               *
 
626
*   rinttol     Rounds its argument to the nearest long int using the current   *
 
627
*               rounding direction.  NOTE: if the rounded value is outside      *
 
628
*               the range of long int, then the result is undefined.            *
 
629
*                                                                               *
 
630
*   round       Rounds the argument to the nearest integral value in floating   *
 
631
*               point format similar to the Fortran "anint" function. That is:  *
 
632
*               add half to the magnitude and chop.                             *
 
633
*                                                                               *
 
634
*   roundtol    Similar to the Fortran function nint or to the Pascal round.    *
 
635
*               NOTE: if the rounded value is outside the range of long int,    *
 
636
*               then the result is undefined.                                   *
 
637
*                                                                               *
 
638
*   trunc       Computes the integral value, in floating format, nearest to     *
 
639
*               but no larger in magnitude than its argument.   NOTE: on 68K    *
 
640
*               compilers when using -elems881, trunc must return an int        *
 
641
*                                                                               *
 
642
*******************************************************************************}
 
643
{
 
644
 *  ceil()
 
645
 *  
 
646
 *  Availability:
 
647
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 
648
 *    CarbonLib:        in CarbonLib 1.0 and later
 
649
 *    Mac OS X:         in version 10.0 and later
 
650
 }
 
651
function ceil(x: double_t): double_t; external name '_ceil';
 
652
 
 
653
{
 
654
 *  floor()
 
655
 *  
 
656
 *  Availability:
 
657
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 
658
 *    CarbonLib:        in CarbonLib 1.0 and later
 
659
 *    Mac OS X:         in version 10.0 and later
 
660
 }
 
661
function floor(x: double_t): double_t; external name '_floor';
 
662
 
 
663
{
 
664
 *  rint()
 
665
 *  
 
666
 *  Availability:
 
667
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 
668
 *    CarbonLib:        in CarbonLib 1.0 and later
 
669
 *    Mac OS X:         in version 10.0 and later
 
670
 }
 
671
function rint(x: double_t): double_t; external name '_rint';
 
672
 
 
673
{
 
674
 *  nearbyint()
 
675
 *  
 
676
 *  Availability:
 
677
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 
678
 *    CarbonLib:        in CarbonLib 1.0 and later
 
679
 *    Mac OS X:         in version 10.0 and later
 
680
 }
 
681
function nearbyint(x: double_t): double_t; external name '_nearbyint';
 
682
 
 
683
{
 
684
 *  rinttol()
 
685
 *  
 
686
 *  Availability:
 
687
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 
688
 *    CarbonLib:        in CarbonLib 1.0 and later
 
689
 *    Mac OS X:         in version 10.0 and later
 
690
 }
 
691
function rinttol(x: double_t): SInt32; external name '_rinttol';
 
692
 
 
693
{
 
694
 *  round()
 
695
 *  
 
696
 *  Availability:
 
697
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 
698
 *    CarbonLib:        in CarbonLib 1.0 and later
 
699
 *    Mac OS X:         in version 10.0 and later
 
700
 }
 
701
function roundd(x: double_t): double_t; external name '_round';
 
702
 
 
703
{
 
704
 *  roundtol()
 
705
 *  
 
706
 *  Availability:
 
707
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 
708
 *    CarbonLib:        in CarbonLib 1.0 and later
 
709
 *    Mac OS X:         in version 10.0 and later
 
710
 }
 
711
function roundtol(round: double_t): SInt32; external name '_roundtol';
 
712
 
 
713
{
 
714
    Note: For compatiblity trunc(x) has a return type of
 
715
            int       for classic 68K with FPU enabled
 
716
            double_t  everywhere else
 
717
}
 
718
{$ifc TARGET_RT_MAC_68881}
 
719
 
 
720
type
 
721
        _trunc_return_type                                      = SInt32;
 
722
{$elsec}
 
723
 
 
724
type
 
725
        _trunc_return_type                                      = double_t;
 
726
{$endc}  {TARGET_RT_MAC_68881}
 
727
        {
 
728
         *  trunc()
 
729
         *  
 
730
         *  Availability:
 
731
         *    Non-Carbon CFM:   in MathLib 1.0 and later
 
732
         *    CarbonLib:        in CarbonLib 1.0 and later
 
733
         *    Mac OS X:         in version 10.0 and later
 
734
                }
 
735
function truncd(x: double_t): _trunc_return_type; external name '_trunc';
 
736
 
 
737
 
 
738
{*******************************************************************************
 
739
*                                                                               *
 
740
*                            Remainder functions                                *
 
741
*                                                                               *
 
742
*   remainder       IEEE 754 floating point standard for remainder.             *
 
743
*   remquo          SANE remainder.  It stores into 'quotient' the 7 low-order  *
 
744
*                   bits of the SInt16 quotient x/y, such that:                *
 
745
*                       -127 <= quotient <= 127.                                *
 
746
*                                                                               *
 
747
*******************************************************************************}
 
748
{
 
749
 *  fmod()
 
750
 *  
 
751
 *  Availability:
 
752
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 
753
 *    CarbonLib:        in CarbonLib 1.0 and later
 
754
 *    Mac OS X:         in version 10.0 and later
 
755
 }
 
756
function fmod(x: double_t; y: double_t): double_t; external name '_fmod';
 
757
 
 
758
{
 
759
 *  remainder()
 
760
 *  
 
761
 *  Availability:
 
762
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 
763
 *    CarbonLib:        in CarbonLib 1.0 and later
 
764
 *    Mac OS X:         in version 10.0 and later
 
765
 }
 
766
function remainder(x: double_t; y: double_t): double_t; external name '_remainder';
 
767
 
 
768
{
 
769
 *  remquo()
 
770
 *  
 
771
 *  Availability:
 
772
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 
773
 *    CarbonLib:        in CarbonLib 1.0 and later
 
774
 *    Mac OS X:         in version 10.0 and later
 
775
 }
 
776
function remquo(x: double_t; y: double_t; var quo: SInt32): double_t; external name '_remquo';
 
777
 
 
778
 
 
779
{*******************************************************************************
 
780
*                                                                               *
 
781
*                             Auxiliary functions                               *
 
782
*                                                                               *
 
783
*   copysign        Produces a value with the magnitude of its first argument   *
 
784
*                   and sign of its second argument.  NOTE: the order of the    *
 
785
*                   arguments matches the recommendation of the IEEE 754        *
 
786
*                   floating point standard,  which is opposite from the SANE   *
 
787
*                   copysign function.                                          *
 
788
*                                                                               *
 
789
*   nan             The call 'nan("n-char-sequence")' returns a quiet NaN       *
 
790
*                   with content indicated through tagp in the selected         *
 
791
*                   data type format.                                           *
 
792
*                                                                               *
 
793
*   nextafter       Computes the next representable value after 'x' in the      *
 
794
*                   direction of 'y'.  if x == y, then y is returned.           *
 
795
*                                                                               *
 
796
*******************************************************************************}
 
797
{
 
798
 *  copysign()
 
799
 *  
 
800
 *  Availability:
 
801
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 
802
 *    CarbonLib:        in CarbonLib 1.0 and later
 
803
 *    Mac OS X:         in version 10.0 and later
 
804
 }
 
805
function copysign(x: double_t; y: double_t): double_t; external name '_copysign';
 
806
 
 
807
{
 
808
 *  nan()
 
809
 *  
 
810
 *  Availability:
 
811
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 
812
 *    CarbonLib:        in CarbonLib 1.0 and later
 
813
 *    Mac OS X:         in version 10.0 and later
 
814
 }
 
815
function nan(tagp: ConstCStringPtr): Double; external name '_nan';
 
816
 
 
817
{
 
818
 *  nanf()
 
819
 *  
 
820
 *  Availability:
 
821
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 
822
 *    CarbonLib:        in CarbonLib 1.0 and later
 
823
 *    Mac OS X:         in version 10.0 and later
 
824
 }
 
825
function nanf(tagp: ConstCStringPtr): Single; external name '_nanf';
 
826
 
 
827
{
 
828
 *  nextafterd()
 
829
 *  
 
830
 *  Availability:
 
831
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 
832
 *    CarbonLib:        in CarbonLib 1.0 and later
 
833
 *    Mac OS X:         in version 10.0 and later
 
834
 }
 
835
function nextafterd(x: Double; y: Double): Double; external name '_nextafterd';
 
836
 
 
837
{
 
838
 *  nextafterf()
 
839
 *  
 
840
 *  Availability:
 
841
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 
842
 *    CarbonLib:        in CarbonLib 1.0 and later
 
843
 *    Mac OS X:         in version 10.0 and later
 
844
 }
 
845
function nextafterf(x: Single; y: Single): Single; external name '_nextafterf';
 
846
 
 
847
 
 
848
{
 
849
 *  __fpclassifyd()
 
850
 *  
 
851
 *  Availability:
 
852
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 
853
 *    CarbonLib:        in CarbonLib 1.0 and later
 
854
 *    Mac OS X:         in version 10.0 and later
 
855
 }
 
856
function __fpclassifyd(x: Double): SInt32; external name '___fpclassifyd';
 
857
 
 
858
{
 
859
 *  __fpclassifyf()
 
860
 *  
 
861
 *  Availability:
 
862
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 
863
 *    CarbonLib:        in CarbonLib 1.0 and later
 
864
 *    Mac OS X:         in version 10.0 and later
 
865
 }
 
866
function __fpclassifyf(x: Single): SInt32; external name '___fpclassifyf';
 
867
 
 
868
{
 
869
 *  __isnormald()
 
870
 *  
 
871
 *  Availability:
 
872
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 
873
 *    CarbonLib:        in CarbonLib 1.0 and later
 
874
 *    Mac OS X:         in version 10.0 and later
 
875
 }
 
876
function __isnormald(x: Double): SInt32; external name '___isnormald';
 
877
 
 
878
{
 
879
 *  __isnormalf()
 
880
 *  
 
881
 *  Availability:
 
882
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 
883
 *    CarbonLib:        in CarbonLib 1.0 and later
 
884
 *    Mac OS X:         in version 10.0 and later
 
885
 }
 
886
function __isnormalf(x: Single): SInt32; external name '___isnormalf';
 
887
 
 
888
{
 
889
 *  __isfinited()
 
890
 *  
 
891
 *  Availability:
 
892
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 
893
 *    CarbonLib:        in CarbonLib 1.0 and later
 
894
 *    Mac OS X:         in version 10.0 and later
 
895
 }
 
896
function __isfinited(x: Double): SInt32; external name '___isfinited';
 
897
 
 
898
{
 
899
 *  __isfinitef()
 
900
 *  
 
901
 *  Availability:
 
902
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 
903
 *    CarbonLib:        in CarbonLib 1.0 and later
 
904
 *    Mac OS X:         in version 10.0 and later
 
905
 }
 
906
function __isfinitef(x: Single): SInt32; external name '___isfinitef';
 
907
 
 
908
{
 
909
 *  __isnand()
 
910
 *  
 
911
 *  Availability:
 
912
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 
913
 *    CarbonLib:        in CarbonLib 1.0 and later
 
914
 *    Mac OS X:         in version 10.0 and later
 
915
 }
 
916
function __isnand(x: Double): SInt32; external name '___isnand';
 
917
 
 
918
{
 
919
 *  __isnanf()
 
920
 *  
 
921
 *  Availability:
 
922
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 
923
 *    CarbonLib:        in CarbonLib 1.0 and later
 
924
 *    Mac OS X:         in version 10.0 and later
 
925
 }
 
926
function __isnanf(x: Single): SInt32; external name '___isnanf';
 
927
 
 
928
{
 
929
 *  __signbitd()
 
930
 *  
 
931
 *  Availability:
 
932
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 
933
 *    CarbonLib:        in CarbonLib 1.0 and later
 
934
 *    Mac OS X:         in version 10.0 and later
 
935
 }
 
936
function __signbitd(x: Double): SInt32; external name '___signbitd';
 
937
 
 
938
{
 
939
 *  __signbitf()
 
940
 *  
 
941
 *  Availability:
 
942
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 
943
 *    CarbonLib:        in CarbonLib 1.0 and later
 
944
 *    Mac OS X:         in version 10.0 and later
 
945
 }
 
946
function __signbitf(x: Single): SInt32; external name '___signbitf';
 
947
 
 
948
{
 
949
 *  __inf()
 
950
 *  
 
951
 *  Availability:
 
952
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 
953
 *    CarbonLib:        in CarbonLib 1.0 and later
 
954
 *    Mac OS X:         in version 10.0 and later
 
955
 }
 
956
function __inf: double_t; external name '___inf';
 
957
 
 
958
 
 
959
{*******************************************************************************
 
960
*                                                                               *
 
961
*                              Inquiry macros                                   *
 
962
*                                                                               *
 
963
*   fpclassify      Returns one of the FP_� values.                             *
 
964
*   isnormal        Non-zero if and only if the argument x is normalized.       *
 
965
*   isfinite        Non-zero if and only if the argument x is finite.           *
 
966
*   isnan           Non-zero if and only if the argument x is a NaN.            *
 
967
*   signbit         Non-zero if and only if the sign of the argument x is       *
 
968
*                   negative.  This includes, NaNs, infinities and zeros.       *
 
969
*                                                                               *
 
970
*******************************************************************************}
 
971
 
 
972
const
 
973
        FP_SNAN                                         = 0;                                                    {       signaling NaN                          }
 
974
        FP_QNAN                                         = 1;                                                    {       quiet NaN                              }
 
975
        FP_INFINITE                                     = 2;                                                    {       + or - infinity                        }
 
976
        FP_ZERO                                         = 3;                                                    {       + or - zero                            }
 
977
        FP_NORMAL                                       = 4;                                                    {       all normal numbers                     }
 
978
        FP_SUBNORMAL                            = 5;                                                    {       denormal numbers                       }
 
979
 
 
980
 
 
981
        {       *******************************************************************************
 
982
        *                                                                               *
 
983
        *                      Max, Min and Positive Difference                         *
 
984
        *                                                                               *
 
985
        *   fdim        Determines the 'positive difference' between its arguments:     *
 
986
        *               ( x - y, if x > y ), ( +0, if x <= y ).  If one argument is     *
 
987
        *               NaN, then fdim returns that NaN.  if both arguments are NaNs,   *
 
988
        *               then fdim returns the first argument.                           *
 
989
        *                                                                               *
 
990
        *   fmax        Returns the maximum of the two arguments.  Corresponds to the   *
 
991
        *               max function in FORTRAN.  NaN arguments are treated as missing  *
 
992
        *               data.  If one argument is NaN and the other is a number, then   *
 
993
        *               the number is returned.  If both are NaNs then the first        *
 
994
        *               argument is returned.                                           *
 
995
        *                                                                               *
 
996
        *   fmin        Returns the minimum of the two arguments.  Corresponds to the   *
 
997
        *               min function in FORTRAN.  NaN arguments are treated as missing  *
 
998
        *               data.  If one argument is NaN and the other is a number, then   *
 
999
        *               the number is returned.  If both are NaNs then the first        *
 
1000
        *               argument is returned.                                           *
 
1001
        *                                                                               *
 
1002
        ******************************************************************************* }
 
1003
        {
 
1004
         *  fdim()
 
1005
         *  
 
1006
         *  Availability:
 
1007
         *    Non-Carbon CFM:   in MathLib 1.0 and later
 
1008
         *    CarbonLib:        in CarbonLib 1.0 and later
 
1009
         *    Mac OS X:         in version 10.0 and later
 
1010
                }
 
1011
function fdim(x: double_t; y: double_t): double_t; external name '_fdim';
 
1012
 
 
1013
{
 
1014
 *  fmax()
 
1015
 *  
 
1016
 *  Availability:
 
1017
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 
1018
 *    CarbonLib:        in CarbonLib 1.0 and later
 
1019
 *    Mac OS X:         in version 10.0 and later
 
1020
 }
 
1021
function fmax(x: double_t; y: double_t): double_t; external name '_fmax';
 
1022
 
 
1023
{
 
1024
 *  fmin()
 
1025
 *  
 
1026
 *  Availability:
 
1027
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 
1028
 *    CarbonLib:        in CarbonLib 1.0 and later
 
1029
 *    Mac OS X:         in version 10.0 and later
 
1030
 }
 
1031
function fmin(x: double_t; y: double_t): double_t; external name '_fmin';
 
1032
 
 
1033
 
 
1034
{******************************************************************************
 
1035
*                                Constants                                     *
 
1036
******************************************************************************}
 
1037
 
 
1038
{*******************************************************************************
 
1039
*                                                                               *
 
1040
*                              Non NCEG extensions                              *
 
1041
*                                                                               *
 
1042
*******************************************************************************}
 
1043
{$ifc undefined __NOEXTENSIONS__}
 
1044
{*******************************************************************************
 
1045
*                                                                               *
 
1046
*                              Financial functions                              *
 
1047
*                                                                               *
 
1048
*   compound        Computes the compound interest factor "(1 + rate)^periods"  *
 
1049
*                   more accurately than the straightforward computation with   *
 
1050
*                   the Power function.  This is SANE's compound function.      *
 
1051
*                                                                               *
 
1052
*   annuity         Computes the present value factor for an annuity            *
 
1053
*                   "(1 - (1 + rate)^(-periods)) /rate" more accurately than    *
 
1054
*                   the straightforward computation with the Power function.    *
 
1055
*                   This is SANE's annuity function.                            *
 
1056
*                                                                               *
 
1057
*******************************************************************************}
 
1058
{
 
1059
 *  compound()
 
1060
 *  
 
1061
 *  Availability:
 
1062
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 
1063
 *    CarbonLib:        in CarbonLib 1.0 and later
 
1064
 *    Mac OS X:         in version 10.0 and later
 
1065
 }
 
1066
function compound(rate: double_t; periods: double_t): double_t; external name '_compound';
 
1067
 
 
1068
{
 
1069
 *  annuity()
 
1070
 *  
 
1071
 *  Availability:
 
1072
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 
1073
 *    CarbonLib:        in CarbonLib 1.0 and later
 
1074
 *    Mac OS X:         in version 10.0 and later
 
1075
 }
 
1076
function annuity(rate: double_t; periods: double_t): double_t; external name '_annuity';
 
1077
 
 
1078
 
 
1079
{*******************************************************************************
 
1080
*                                                                               *
 
1081
*                              Random function                                  *
 
1082
*                                                                               *
 
1083
*   randomx         A pseudorandom number generator.  It uses the iteration:    *
 
1084
*                               (7^5*x)mod(2^31-1)                              *
 
1085
*                                                                               *
 
1086
*******************************************************************************}
 
1087
{
 
1088
 *  randomx()
 
1089
 *  
 
1090
 *  Availability:
 
1091
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 
1092
 *    CarbonLib:        in CarbonLib 1.0 and later
 
1093
 *    Mac OS X:         in version 10.0 and later
 
1094
 }
 
1095
function randomx(var x: double_t): double_t; external name '_randomx';
 
1096
 
 
1097
 
 
1098
{******************************************************************************
 
1099
*                              Relational operator                             *
 
1100
******************************************************************************}
 
1101
{      relational operator      }
 
1102
 
 
1103
type
 
1104
        relop                                                           = SInt16;
 
1105
 
 
1106
const
 
1107
        GREATERTHAN                                     = 0;
 
1108
        LESSTHAN                                        = 1;
 
1109
        EQUALTO                                         = 2;
 
1110
        UNORDERED                                       = 3;
 
1111
 
 
1112
        {
 
1113
         *  relation()
 
1114
         *  
 
1115
         *  Availability:
 
1116
         *    Non-Carbon CFM:   in MathLib 1.0 and later
 
1117
         *    CarbonLib:        in CarbonLib 1.0 and later
 
1118
         *    Mac OS X:         in version 10.0 and later
 
1119
                }
 
1120
function relation(x: double_t; y: double_t): relop; external name '_relation';
 
1121
 
 
1122
 
 
1123
{*******************************************************************************
 
1124
*                                                                               *
 
1125
*                         Binary to decimal conversions                         *
 
1126
*                                                                               *
 
1127
*   SIGDIGLEN   Significant decimal digits.                                     *
 
1128
*                                                                               *
 
1129
*   decimal     A record which provides an intermediate unpacked form for       *
 
1130
*               programmers who wish to do their own parsing of numeric input   *
 
1131
*               or formatting of numeric output.                                *
 
1132
*                                                                               *
 
1133
*   decform     Controls each conversion to a decimal string.  The style field  *
 
1134
*               is either FLOATDECIMAL or FIXEDDECIMAL. If FLOATDECIMAL, the    *
 
1135
*               value of the field digits is the number of significant digits.  *
 
1136
*               If FIXEDDECIMAL value of the field digits is the number of      *
 
1137
*               digits to the right of the decimal point.                       *
 
1138
*                                                                               *
 
1139
*   num2dec     Converts a double_t to a decimal record using a decform.        *
 
1140
*   dec2num     Converts a decimal record d to a double_t value.                *
 
1141
*   dec2str     Converts a decform and decimal to a string using a decform.     *
 
1142
*   str2dec     Converts a string to a decimal struct.                          *
 
1143
*   dec2d       Similar to dec2num except a double is returned (68k only).      *
 
1144
*   dec2f       Similar to dec2num except a float is returned.                  *
 
1145
*   dec2s       Similar to dec2num except a short is returned.                  *
 
1146
*   dec2l       Similar to dec2num except a long is returned.                   *
 
1147
*                                                                               *
 
1148
*******************************************************************************}
 
1149
const
 
1150
    SIGDIGLEN                   = 36;
 
1151
    DECSTROUTLEN                = 80;
 
1152
type
 
1153
    DecimalKindItem = (FLOATDECIMAL, FIXEDDECIMAL);
 
1154
    DecimalKind = DecimalKindItem;
 
1155
 
 
1156
    decimal = record
 
1157
        sgn:    0..1;           { sign 0 for +, 1 for -  }
 
1158
        exp:    SInt16;
 
1159
        sig:    Str36;
 
1160
    end;
 
1161
 
 
1162
    decform = record
 
1163
        style:  DecimalKind;
 
1164
        digits: SInt16;
 
1165
    end;
 
1166
 
 
1167
{
 
1168
 *  num2dec()
 
1169
 *  
 
1170
 *  Availability:
 
1171
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 
1172
 *    CarbonLib:        in CarbonLib 1.0 and later
 
1173
 *    Mac OS X:         in version 10.0 and later
 
1174
 }
 
1175
procedure num2dec(const (*var*) f: decform; x: double_t; var d: decimal); external name '_num2dec';
 
1176
 
 
1177
{
 
1178
 *  dec2num()
 
1179
 *  
 
1180
 *  Availability:
 
1181
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 
1182
 *    CarbonLib:        in CarbonLib 1.0 and later
 
1183
 *    Mac OS X:         in version 10.0 and later
 
1184
 }
 
1185
function dec2num(const (*var*) d: decimal): double_t; external name '_dec2num';
 
1186
 
 
1187
{
 
1188
 *  dec2str()
 
1189
 *  
 
1190
 *  Availability:
 
1191
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 
1192
 *    CarbonLib:        in CarbonLib 1.0 and later
 
1193
 *    Mac OS X:         in version 10.0 and later
 
1194
 }
 
1195
procedure dec2str(const (*var*) f: decform; const (*var*) d: decimal; s: CStringPtr); external name '_dec2str';
 
1196
 
 
1197
{
 
1198
 *  str2dec()
 
1199
 *  
 
1200
 *  Availability:
 
1201
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 
1202
 *    CarbonLib:        in CarbonLib 1.0 and later
 
1203
 *    Mac OS X:         in version 10.0 and later
 
1204
 }
 
1205
procedure str2dec(s: ConstCStringPtr; var ix: SInt16; var d: decimal; var vp: SInt16); external name '_str2dec';
 
1206
 
 
1207
{$ifc TARGET_CPU_68K}
 
1208
{$ifc CALL_NOT_IN_CARBON}
 
1209
{
 
1210
 *  dec2d()
 
1211
 *  
 
1212
 *  Availability:
 
1213
 *    Non-Carbon CFM:   not available
 
1214
 *    CarbonLib:        not available
 
1215
 *    Mac OS X:         not available
 
1216
 }
 
1217
function dec2d(const (*var*) d: decimal): Double; external name '_dec2d';
 
1218
 
 
1219
{$endc}  {CALL_NOT_IN_CARBON}
 
1220
{$endc}  {TARGET_CPU_68K}
 
1221
{
 
1222
 *  dec2f()
 
1223
 *  
 
1224
 *  Availability:
 
1225
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 
1226
 *    CarbonLib:        in CarbonLib 1.0 and later
 
1227
 *    Mac OS X:         in version 10.0 and later
 
1228
 }
 
1229
function dec2f(const (*var*) d: decimal): Single; external name '_dec2f';
 
1230
 
 
1231
{
 
1232
 *  dec2s()
 
1233
 *  
 
1234
 *  Availability:
 
1235
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 
1236
 *    CarbonLib:        in CarbonLib 1.0 and later
 
1237
 *    Mac OS X:         in version 10.0 and later
 
1238
 }
 
1239
function dec2s(const (*var*) d: decimal): SInt16; external name '_dec2s';
 
1240
 
 
1241
{
 
1242
 *  dec2l()
 
1243
 *  
 
1244
 *  Availability:
 
1245
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 
1246
 *    CarbonLib:        in CarbonLib 1.0 and later
 
1247
 *    Mac OS X:         in version 10.0 and later
 
1248
 }
 
1249
function dec2l(const (*var*) d: decimal): SInt32; external name '_dec2l';
 
1250
 
 
1251
 
 
1252
{*******************************************************************************
 
1253
*                                                                               *
 
1254
*                         68k-only Transfer Function Prototypes                 *
 
1255
*                                                                               *
 
1256
*******************************************************************************}
 
1257
{$ifc TARGET_CPU_68K}
 
1258
{$ifc CALL_NOT_IN_CARBON}
 
1259
{
 
1260
 *  x96tox80()
 
1261
 *  
 
1262
 *  Availability:
 
1263
 *    Non-Carbon CFM:   not available
 
1264
 *    CarbonLib:        not available
 
1265
 *    Mac OS X:         not available
 
1266
 }
 
1267
procedure x96tox80(const (*var*) x: extended96; var x80: extended80); external name '_x96tox80';
 
1268
 
 
1269
{
 
1270
 *  x80tox96()
 
1271
 *  
 
1272
 *  Availability:
 
1273
 *    Non-Carbon CFM:   not available
 
1274
 *    CarbonLib:        not available
 
1275
 *    Mac OS X:         not available
 
1276
 }
 
1277
procedure x80tox96(const (*var*) x80: extended80; var x: extended96); external name '_x80tox96';
 
1278
 
 
1279
{$endc}  {CALL_NOT_IN_CARBON}
 
1280
{$endc}  {TARGET_CPU_68K}
 
1281
{$endc}
 
1282
{*******************************************************************************
 
1283
*                                                                               *
 
1284
*                         PowerPC-only Function Prototypes                      *
 
1285
*                                                                               *
 
1286
*******************************************************************************}
 
1287
 
 
1288
{$ifc TARGET_CPU_PPC}
 
1289
 
 
1290
{
 
1291
 *  cosl()
 
1292
 *  
 
1293
 *  Availability:
 
1294
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 
1295
 *    CarbonLib:        in CarbonLib 1.0 and later
 
1296
 *    Mac OS X:         not available
 
1297
 }
 
1298
function cosl(x: LongDouble): LongDouble; external name '_cosl';
 
1299
 
 
1300
 
 
1301
{
 
1302
 *  sinl()
 
1303
 *  
 
1304
 *  Availability:
 
1305
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 
1306
 *    CarbonLib:        in CarbonLib 1.0 and later
 
1307
 *    Mac OS X:         not available
 
1308
 }
 
1309
function sinl(x: LongDouble): LongDouble; external name '_sinl';
 
1310
 
 
1311
 
 
1312
{
 
1313
 *  tanl()
 
1314
 *  
 
1315
 *  Availability:
 
1316
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 
1317
 *    CarbonLib:        in CarbonLib 1.0 and later
 
1318
 *    Mac OS X:         not available
 
1319
 }
 
1320
function tanl(x: LongDouble): LongDouble; external name '_tanl';
 
1321
 
 
1322
 
 
1323
{
 
1324
 *  acosl()
 
1325
 *  
 
1326
 *  Availability:
 
1327
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 
1328
 *    CarbonLib:        in CarbonLib 1.0 and later
 
1329
 *    Mac OS X:         not available
 
1330
 }
 
1331
function acosl(x: LongDouble): LongDouble; external name '_acosl';
 
1332
 
 
1333
 
 
1334
{
 
1335
 *  asinl()
 
1336
 *  
 
1337
 *  Availability:
 
1338
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 
1339
 *    CarbonLib:        in CarbonLib 1.0 and later
 
1340
 *    Mac OS X:         not available
 
1341
 }
 
1342
function asinl(x: LongDouble): LongDouble; external name '_asinl';
 
1343
 
 
1344
 
 
1345
{
 
1346
 *  atanl()
 
1347
 *  
 
1348
 *  Availability:
 
1349
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 
1350
 *    CarbonLib:        in CarbonLib 1.0 and later
 
1351
 *    Mac OS X:         not available
 
1352
 }
 
1353
function atanl(x: LongDouble): LongDouble; external name '_atanl';
 
1354
 
 
1355
 
 
1356
{
 
1357
 *  atan2l()
 
1358
 *  
 
1359
 *  Availability:
 
1360
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 
1361
 *    CarbonLib:        in CarbonLib 1.0 and later
 
1362
 *    Mac OS X:         not available
 
1363
 }
 
1364
function atan2l(y: LongDouble; x: LongDouble): LongDouble; external name '_atan2l';
 
1365
 
 
1366
 
 
1367
{
 
1368
 *  coshl()
 
1369
 *  
 
1370
 *  Availability:
 
1371
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 
1372
 *    CarbonLib:        in CarbonLib 1.0 and later
 
1373
 *    Mac OS X:         not available
 
1374
 }
 
1375
function coshl(x: LongDouble): LongDouble; external name '_coshl';
 
1376
 
 
1377
 
 
1378
{
 
1379
 *  sinhl()
 
1380
 *  
 
1381
 *  Availability:
 
1382
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 
1383
 *    CarbonLib:        in CarbonLib 1.0 and later
 
1384
 *    Mac OS X:         not available
 
1385
 }
 
1386
function sinhl(x: LongDouble): LongDouble; external name '_sinhl';
 
1387
 
 
1388
 
 
1389
{
 
1390
 *  tanhl()
 
1391
 *  
 
1392
 *  Availability:
 
1393
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 
1394
 *    CarbonLib:        in CarbonLib 1.0 and later
 
1395
 *    Mac OS X:         not available
 
1396
 }
 
1397
function tanhl(x: LongDouble): LongDouble; external name '_tanhl';
 
1398
 
 
1399
 
 
1400
{
 
1401
 *  acoshl()
 
1402
 *  
 
1403
 *  Availability:
 
1404
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 
1405
 *    CarbonLib:        in CarbonLib 1.0 and later
 
1406
 *    Mac OS X:         not available
 
1407
 }
 
1408
function acoshl(x: LongDouble): LongDouble; external name '_acoshl';
 
1409
 
 
1410
 
 
1411
{
 
1412
 *  asinhl()
 
1413
 *  
 
1414
 *  Availability:
 
1415
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 
1416
 *    CarbonLib:        in CarbonLib 1.0 and later
 
1417
 *    Mac OS X:         not available
 
1418
 }
 
1419
function asinhl(x: LongDouble): LongDouble; external name '_asinhl';
 
1420
 
 
1421
 
 
1422
{
 
1423
 *  atanhl()
 
1424
 *  
 
1425
 *  Availability:
 
1426
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 
1427
 *    CarbonLib:        in CarbonLib 1.0 and later
 
1428
 *    Mac OS X:         not available
 
1429
 }
 
1430
function atanhl(x: LongDouble): LongDouble; external name '_atanhl';
 
1431
 
 
1432
 
 
1433
{
 
1434
 *  expl()
 
1435
 *  
 
1436
 *  Availability:
 
1437
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 
1438
 *    CarbonLib:        in CarbonLib 1.0 and later
 
1439
 *    Mac OS X:         not available
 
1440
 }
 
1441
function expl(x: LongDouble): LongDouble; external name '_expl';
 
1442
 
 
1443
 
 
1444
{
 
1445
 *  expm1l()
 
1446
 *  
 
1447
 *  Availability:
 
1448
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 
1449
 *    CarbonLib:        in CarbonLib 1.0 and later
 
1450
 *    Mac OS X:         not available
 
1451
 }
 
1452
function expm1l(x: LongDouble): LongDouble; external name '_expm1l';
 
1453
 
 
1454
 
 
1455
{
 
1456
 *  exp2l()
 
1457
 *  
 
1458
 *  Availability:
 
1459
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 
1460
 *    CarbonLib:        in CarbonLib 1.0 and later
 
1461
 *    Mac OS X:         not available
 
1462
 }
 
1463
function exp2l(x: LongDouble): LongDouble; external name '_exp2l';
 
1464
 
 
1465
 
 
1466
{
 
1467
 *  frexpl()
 
1468
 *  
 
1469
 *  Availability:
 
1470
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 
1471
 *    CarbonLib:        in CarbonLib 1.0 and later
 
1472
 *    Mac OS X:         not available
 
1473
 }
 
1474
function frexpl(x: LongDouble; var exponent: SInt32): LongDouble; external name '_frexpl';
 
1475
 
 
1476
 
 
1477
{
 
1478
 *  ldexpl()
 
1479
 *  
 
1480
 *  Availability:
 
1481
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 
1482
 *    CarbonLib:        in CarbonLib 1.0 and later
 
1483
 *    Mac OS X:         not available
 
1484
 }
 
1485
function ldexpl(x: LongDouble; n: SInt32): LongDouble; external name '_ldexpl';
 
1486
 
 
1487
 
 
1488
{
 
1489
 *  logl()
 
1490
 *  
 
1491
 *  Availability:
 
1492
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 
1493
 *    CarbonLib:        in CarbonLib 1.0 and later
 
1494
 *    Mac OS X:         not available
 
1495
 }
 
1496
function logl(x: LongDouble): LongDouble; external name '_logl';
 
1497
 
 
1498
 
 
1499
{
 
1500
 *  log1pl()
 
1501
 *  
 
1502
 *  Availability:
 
1503
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 
1504
 *    CarbonLib:        in CarbonLib 1.0 and later
 
1505
 *    Mac OS X:         not available
 
1506
 }
 
1507
function log1pl(x: LongDouble): LongDouble; external name '_log1pl';
 
1508
 
 
1509
 
 
1510
{
 
1511
 *  log10l()
 
1512
 *  
 
1513
 *  Availability:
 
1514
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 
1515
 *    CarbonLib:        in CarbonLib 1.0 and later
 
1516
 *    Mac OS X:         not available
 
1517
 }
 
1518
function log10l(x: LongDouble): LongDouble; external name '_log10l';
 
1519
 
 
1520
 
 
1521
{
 
1522
 *  log2l()
 
1523
 *  
 
1524
 *  Availability:
 
1525
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 
1526
 *    CarbonLib:        in CarbonLib 1.0 and later
 
1527
 *    Mac OS X:         not available
 
1528
 }
 
1529
function log2l(x: LongDouble): LongDouble; external name '_log2l';
 
1530
 
 
1531
 
 
1532
{
 
1533
 *  logbl()
 
1534
 *  
 
1535
 *  Availability:
 
1536
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 
1537
 *    CarbonLib:        in CarbonLib 1.0 and later
 
1538
 *    Mac OS X:         not available
 
1539
 }
 
1540
function logbl(x: LongDouble): LongDouble; external name '_logbl';
 
1541
 
 
1542
 
 
1543
{
 
1544
 *  scalbl()
 
1545
 *  
 
1546
 *  Availability:
 
1547
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 
1548
 *    CarbonLib:        in CarbonLib 1.0 and later
 
1549
 *    Mac OS X:         not available
 
1550
 }
 
1551
function scalbl(x: LongDouble; n: SInt32): LongDouble; external name '_scalbl';
 
1552
 
 
1553
 
 
1554
{
 
1555
 *  fabsl()
 
1556
 *  
 
1557
 *  Availability:
 
1558
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 
1559
 *    CarbonLib:        in CarbonLib 1.0 and later
 
1560
 *    Mac OS X:         not available
 
1561
 }
 
1562
function fabsl(x: LongDouble): LongDouble; external name '_fabsl';
 
1563
 
 
1564
 
 
1565
{
 
1566
 *  hypotl()
 
1567
 *  
 
1568
 *  Availability:
 
1569
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 
1570
 *    CarbonLib:        in CarbonLib 1.0 and later
 
1571
 *    Mac OS X:         not available
 
1572
 }
 
1573
function hypotl(x: LongDouble; y: LongDouble): LongDouble; external name '_hypotl';
 
1574
 
 
1575
 
 
1576
{
 
1577
 *  powl()
 
1578
 *  
 
1579
 *  Availability:
 
1580
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 
1581
 *    CarbonLib:        in CarbonLib 1.0 and later
 
1582
 *    Mac OS X:         not available
 
1583
 }
 
1584
function powl(x: LongDouble; y: LongDouble): LongDouble; external name '_powl';
 
1585
 
 
1586
 
 
1587
{
 
1588
 *  sqrtl()
 
1589
 *  
 
1590
 *  Availability:
 
1591
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 
1592
 *    CarbonLib:        in CarbonLib 1.0 and later
 
1593
 *    Mac OS X:         not available
 
1594
 }
 
1595
function sqrtl(x: LongDouble): LongDouble; external name '_sqrtl';
 
1596
 
 
1597
 
 
1598
{
 
1599
 *  erfl()
 
1600
 *  
 
1601
 *  Availability:
 
1602
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 
1603
 *    CarbonLib:        in CarbonLib 1.0 and later
 
1604
 *    Mac OS X:         not available
 
1605
 }
 
1606
function erfl(x: LongDouble): LongDouble; external name '_erfl';
 
1607
 
 
1608
 
 
1609
{
 
1610
 *  erfcl()
 
1611
 *  
 
1612
 *  Availability:
 
1613
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 
1614
 *    CarbonLib:        in CarbonLib 1.0 and later
 
1615
 *    Mac OS X:         not available
 
1616
 }
 
1617
function erfcl(x: LongDouble): LongDouble; external name '_erfcl';
 
1618
 
 
1619
 
 
1620
{
 
1621
 *  gammal()
 
1622
 *  
 
1623
 *  Availability:
 
1624
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 
1625
 *    CarbonLib:        in CarbonLib 1.0 and later
 
1626
 *    Mac OS X:         not available
 
1627
 }
 
1628
function gammal(x: LongDouble): LongDouble; external name '_gammal';
 
1629
 
 
1630
 
 
1631
{
 
1632
 *  lgammal()
 
1633
 *  
 
1634
 *  Availability:
 
1635
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 
1636
 *    CarbonLib:        in CarbonLib 1.0 and later
 
1637
 *    Mac OS X:         not available
 
1638
 }
 
1639
function lgammal(x: LongDouble): LongDouble; external name '_lgammal';
 
1640
 
 
1641
 
 
1642
{
 
1643
 *  ceill()
 
1644
 *  
 
1645
 *  Availability:
 
1646
 *    Non-Carbon CFM:   in MathLib 2.0 and later or as macro/inline
 
1647
 *    CarbonLib:        in CarbonLib 1.0 and later
 
1648
 *    Mac OS X:         not available
 
1649
 }
 
1650
function ceill(x: LongDouble): LongDouble; external name '_ceill';
 
1651
 
 
1652
 
 
1653
{
 
1654
 *  floorl()
 
1655
 *  
 
1656
 *  Availability:
 
1657
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 
1658
 *    CarbonLib:        in CarbonLib 1.0 and later
 
1659
 *    Mac OS X:         not available
 
1660
 }
 
1661
function floorl(x: LongDouble): LongDouble; external name '_floorl';
 
1662
 
 
1663
 
 
1664
{
 
1665
 *  rintl()
 
1666
 *  
 
1667
 *  Availability:
 
1668
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 
1669
 *    CarbonLib:        in CarbonLib 1.0 and later
 
1670
 *    Mac OS X:         not available
 
1671
 }
 
1672
function rintl(x: LongDouble): LongDouble; external name '_rintl';
 
1673
 
 
1674
 
 
1675
{
 
1676
 *  nearbyintl()
 
1677
 *  
 
1678
 *  Availability:
 
1679
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 
1680
 *    CarbonLib:        in CarbonLib 1.0 and later
 
1681
 *    Mac OS X:         not available
 
1682
 }
 
1683
function nearbyintl(x: LongDouble): LongDouble; external name '_nearbyintl';
 
1684
 
 
1685
 
 
1686
{
 
1687
 *  rinttoll()
 
1688
 *  
 
1689
 *  Availability:
 
1690
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 
1691
 *    CarbonLib:        in CarbonLib 1.0 and later
 
1692
 *    Mac OS X:         not available
 
1693
 }
 
1694
function rinttoll(x: LongDouble): SInt32; external name '_rinttoll';
 
1695
 
 
1696
 
 
1697
{
 
1698
 *  roundl()
 
1699
 *  
 
1700
 *  Availability:
 
1701
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 
1702
 *    CarbonLib:        in CarbonLib 1.0 and later
 
1703
 *    Mac OS X:         not available
 
1704
 }
 
1705
function roundl(x: LongDouble): LongDouble; external name '_roundl';
 
1706
 
 
1707
 
 
1708
{
 
1709
 *  roundtoll()
 
1710
 *  
 
1711
 *  Availability:
 
1712
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 
1713
 *    CarbonLib:        in CarbonLib 1.0 and later
 
1714
 *    Mac OS X:         not available
 
1715
 }
 
1716
function roundtoll(x: LongDouble): SInt32; external name '_roundtoll';
 
1717
 
 
1718
 
 
1719
{
 
1720
 *  truncl()
 
1721
 *  
 
1722
 *  Availability:
 
1723
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 
1724
 *    CarbonLib:        in CarbonLib 1.0 and later
 
1725
 *    Mac OS X:         not available
 
1726
 }
 
1727
function truncl(x: LongDouble): LongDouble; external name '_truncl';
 
1728
 
 
1729
 
 
1730
{
 
1731
 *  remainderl()
 
1732
 *  
 
1733
 *  Availability:
 
1734
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 
1735
 *    CarbonLib:        in CarbonLib 1.0 and later
 
1736
 *    Mac OS X:         not available
 
1737
 }
 
1738
function remainderl(x: LongDouble; y: LongDouble): LongDouble; external name '_remainderl';
 
1739
 
 
1740
 
 
1741
{
 
1742
 *  remquol()
 
1743
 *  
 
1744
 *  Availability:
 
1745
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 
1746
 *    CarbonLib:        in CarbonLib 1.0 and later
 
1747
 *    Mac OS X:         not available
 
1748
 }
 
1749
function remquol(x: LongDouble; y: LongDouble; var quo: SInt32): LongDouble; external name '_remquol';
 
1750
 
 
1751
 
 
1752
{
 
1753
 *  copysignl()
 
1754
 *  
 
1755
 *  Availability:
 
1756
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 
1757
 *    CarbonLib:        in CarbonLib 1.0 and later
 
1758
 *    Mac OS X:         not available
 
1759
 }
 
1760
function copysignl(x: LongDouble; y: LongDouble): LongDouble; external name '_copysignl';
 
1761
 
 
1762
 
 
1763
{
 
1764
 *  fdiml()
 
1765
 *  
 
1766
 *  Availability:
 
1767
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 
1768
 *    CarbonLib:        in CarbonLib 1.0 and later
 
1769
 *    Mac OS X:         not available
 
1770
 }
 
1771
function fdiml(x: LongDouble; y: LongDouble): LongDouble; external name '_fdiml';
 
1772
 
 
1773
 
 
1774
{
 
1775
 *  fmaxl()
 
1776
 *  
 
1777
 *  Availability:
 
1778
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 
1779
 *    CarbonLib:        in CarbonLib 1.0 and later
 
1780
 *    Mac OS X:         not available
 
1781
 }
 
1782
function fmaxl(x: LongDouble; y: LongDouble): LongDouble; external name '_fmaxl';
 
1783
 
 
1784
 
 
1785
{
 
1786
 *  fminl()
 
1787
 *  
 
1788
 *  Availability:
 
1789
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 
1790
 *    CarbonLib:        in CarbonLib 1.0 and later
 
1791
 *    Mac OS X:         not available
 
1792
 }
 
1793
function fminl(x: LongDouble; y: LongDouble): LongDouble; external name '_fminl';
 
1794
 
 
1795
{$ifc undefined __NOEXTENSIONS__}
 
1796
{
 
1797
 *  relationl()
 
1798
 *  
 
1799
 *  Availability:
 
1800
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 
1801
 *    CarbonLib:        in CarbonLib 1.0 and later
 
1802
 *    Mac OS X:         not available
 
1803
 }
 
1804
function relationl(x: LongDouble; y: LongDouble): relop; external name '_relationl';
 
1805
 
 
1806
 
 
1807
{
 
1808
 *  num2decl()
 
1809
 *  
 
1810
 *  Availability:
 
1811
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 
1812
 *    CarbonLib:        in CarbonLib 1.0 and later
 
1813
 *    Mac OS X:         not available
 
1814
 }
 
1815
procedure num2decl(const (*var*) f: decform; x: LongDouble; var d: decimal); external name '_num2decl';
 
1816
 
 
1817
 
 
1818
{
 
1819
 *  dec2numl()
 
1820
 *  
 
1821
 *  Availability:
 
1822
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 
1823
 *    CarbonLib:        in CarbonLib 1.0 and later
 
1824
 *    Mac OS X:         not available
 
1825
 }
 
1826
function dec2numl(const (*var*) d: decimal): LongDouble; external name '_dec2numl';
 
1827
 
 
1828
{$endc}
 
1829
{$endc}  {TARGET_CPU_PPC}
 
1830
{$endc}  {TARGET_OS_MAC}
 
1831
 
 
1832
{$ifc undefined __NOEXTENSIONS__}
 
1833
{    
 
1834
        MathLib v2 has two new transfer functions: x80tod and dtox80.  They can 
 
1835
        be used to directly transform 68k 80-bit extended data types to double
 
1836
        and back for PowerPC based machines without using the functions
 
1837
        x80told or ldtox80.  Double rounding may occur. 
 
1838
    }
 
1839
{
 
1840
 *  x80tod()
 
1841
 *  
 
1842
 *  Availability:
 
1843
 *    Non-Carbon CFM:   in MathLib 2.0 and later
 
1844
 *    CarbonLib:        in CarbonLib 1.0 and later
 
1845
 *    Mac OS X:         in version 10.0 and later
 
1846
 }
 
1847
function x80tod(const (*var*) x80: extended80): Double; external name '_x80tod';
 
1848
 
 
1849
{
 
1850
 *  dtox80()
 
1851
 *  
 
1852
 *  Availability:
 
1853
 *    Non-Carbon CFM:   in MathLib 2.0 and later
 
1854
 *    CarbonLib:        in CarbonLib 1.0 and later
 
1855
 *    Mac OS X:         in version 10.0 and later
 
1856
 }
 
1857
procedure dtox80((*const*) var x: Double; var x80: extended80); external name '_dtox80';
 
1858
 
 
1859
{$ifc TARGET_CPU_PPC}
 
1860
{
 
1861
 *  x80told()
 
1862
 *  
 
1863
 *  Availability:
 
1864
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 
1865
 *    CarbonLib:        in CarbonLib 1.0 and later
 
1866
 *    Mac OS X:         not available
 
1867
 }
 
1868
procedure x80told(const (*var*) x80: extended80; var x: LongDouble); external name '_x80told';
 
1869
 
 
1870
 
 
1871
{
 
1872
 *  ldtox80()
 
1873
 *  
 
1874
 *  Availability:
 
1875
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 
1876
 *    CarbonLib:        in CarbonLib 1.0 and later
 
1877
 *    Mac OS X:         not available
 
1878
 }
 
1879
procedure ldtox80((*const*) var x: LongDouble; var x80: extended80); external name '_ldtox80';
 
1880
 
 
1881
{$endc} {TARGET_CPU_PPC}
 
1882
{$endc}
 
1883
 
 
1884
{$ALIGN MAC68K}
 
1885
 
 
1886
 
 
1887
end.