~ubuntu-branches/debian/lenny/fpc/lenny

« back to all changes in this revision

Viewing changes to fpcsrc/rtl/inc/cgenmath.inc

  • Committer: Bazaar Package Importer
  • Author(s): Mazen Neifer, Torsten Werner, Mazen Neifer
  • Date: 2008-05-17 17:12:11 UTC
  • mfrom: (3.1.9 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080517171211-9qi33xhd9evfa0kg
Tags: 2.2.0-dfsg1-9
[ Torsten Werner ]
* Add Mazen Neifer to Uploaders field.

[ Mazen Neifer ]
* Moved FPC sources into a version dependent directory from /usr/share/fpcsrc
  to /usr/share/fpcsrc/${FPCVERSION}. This allow installing more than on FPC
  release.
* Fixed far call issue in compiler preventing building huge binearies.
  (closes: #477743)
* Updated building dependencies, recomennded and suggested packages.
* Moved fppkg to fp-utils as it is just a helper tool and is not required by
  compiler.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
{
 
2
    This file is part of the Free Pascal run time library.
 
3
    Copyright (c) 1999-2001 by Several contributors
 
4
 
 
5
    Generic mathemtical routines in libc
 
6
 
 
7
    See the file COPYING.FPC, included in this distribution,
 
8
    for details about the copyright.
 
9
 
 
10
    This program is distributed in the hope that it will be useful,
 
11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
13
 
 
14
 **********************************************************************}
 
15
 
 
16
{ for 80x86, we can easily write the optimal inline code }
 
17
{$ifndef cpui386}
 
18
 
 
19
{$ifndef SOLARIS}
 
20
 
 
21
{$ifndef FPC_SYSTEM_HAS_INT}
 
22
{$define FPC_SYSTEM_HAS_INT}
 
23
 
 
24
{$ifdef SUPPORT_DOUBLE}
 
25
    function c_trunc(d: double): double; cdecl; external 'c' name 'trunc';
 
26
 
 
27
    function fpc_int_real(d: ValReal): ValReal;compilerproc; {$ifdef MATHINLINE}inline;{$endif}
 
28
    begin
 
29
      result := c_trunc(d);
 
30
    end;
 
31
 
 
32
 
 
33
{$else SUPPORT_DOUBLE}
 
34
 
 
35
    function c_truncf(d: double): double; cdecl; external 'c' name 'truncf';
 
36
 
 
37
    function fpc_int_real(d: ValReal): ValReal;compilerproc; {$ifdef MATHINLINE}inline;{$endif}
 
38
      begin
 
39
        { this will be correct since real = single in the case of }
 
40
        { the motorola version of the compiler...                 }
 
41
        int:=c_truncf(d);
 
42
      end;
 
43
{$endif SUPPORT_DOUBLE}
 
44
 
 
45
{$endif FPC_SYSTEM_HAS_INT}
 
46
{$endif SOLARIS}
 
47
 
 
48
{$ifndef SYSTEM_HAS_FREXP}
 
49
{$define SYSTEM_HAS_FREXP}
 
50
    function c_frexp(x: double; out e: longint): double; cdecl; external 'c' name 'frexp';
 
51
 
 
52
    function frexp(x:ValReal; out e:Integer ):ValReal; {$ifdef MATHINLINE}inline;{$endif}
 
53
    var
 
54
      l: longint;
 
55
    begin
 
56
      frexp := c_frexp(x,l);
 
57
      e := l;
 
58
    end;
 
59
{$endif not SYSTEM_HAS_FREXP}
 
60
 
 
61
 
 
62
{$ifndef SYSTEM_HAS_LDEXP}
 
63
{$define SYSTEM_HAS_LDEXP}
 
64
    function c_ldexp(x: double; n: longint): double; cdecl; external 'c' name 'ldexp';
 
65
 
 
66
    function ldexp( x: ValReal; N: Integer):ValReal;{$ifdef MATHINLINE}inline;{$endif}
 
67
    begin
 
68
      ldexp := c_ldexp(x,n);
 
69
    end;
 
70
{$endif not SYSTEM_HAS_LDEXP}
 
71
 
 
72
 
 
73
{$ifndef FPC_SYSTEM_HAS_SQRT}
 
74
{$define FPC_SYSTEM_HAS_SQRT}
 
75
 
 
76
    function c_sqrt(d: double): double; cdecl; external 'c' name 'sqrt';
 
77
 
 
78
    function fpc_sqrt_real(d:ValReal):ValReal;compilerproc; {$ifdef MATHINLINE}inline;{$endif}
 
79
    begin
 
80
      result := c_sqrt(d);
 
81
    end;
 
82
 
 
83
{$endif}
 
84
 
 
85
 
 
86
{$ifndef FPC_SYSTEM_HAS_EXP}
 
87
{$define FPC_SYSTEM_HAS_EXP}
 
88
    function c_exp(d: double): double; cdecl; external 'c' name 'exp';
 
89
 
 
90
    function fpc_Exp_real(d:ValReal):ValReal;compilerproc; {$ifdef MATHINLINE}inline;{$endif}
 
91
    begin
 
92
      result := c_exp(d);
 
93
    end;
 
94
{$endif}
 
95
 
 
96
 
 
97
{ Not supported everywhere (also not on Mac OS X 10.1, but that's deprecated. }
 
98
{ It is supported on linux, but at least for linux/i386 we should call        }
 
99
{ llroundl() instead (for extended support).                                  }
 
100
 
 
101
{$if defined(darwin) }
 
102
 
 
103
{$ifndef FPC_SYSTEM_HAS_ROUND}
 
104
{$define FPC_SYSTEM_HAS_ROUND}
 
105
 
 
106
    function c_llround(d: double): int64; cdecl; external 'c' name 'llround';
 
107
 
 
108
//    function round(d : Real) : int64; external name 'FPC_ROUND';
 
109
 
 
110
    function fpc_round_real(d : ValReal) : int64;[public, alias:'FPC_ROUND'];compilerproc;
 
111
    begin
 
112
      fpc_round_real := c_llround(d);
 
113
    end;
 
114
{$endif not FPC_SYSTEM_HAS_ROUND}
 
115
 
 
116
{$endif darwin}
 
117
 
 
118
 
 
119
{$ifndef FPC_SYSTEM_HAS_LN}
 
120
{$define FPC_SYSTEM_HAS_LN}
 
121
 
 
122
    function c_log(d: double): double; cdecl; external 'c' name 'log';
 
123
 
 
124
    function fpc_Ln_real(d:ValReal):ValReal;compilerproc;{$ifdef MATHINLINE}inline;{$endif}
 
125
    begin
 
126
      result := c_log(d);
 
127
    end;
 
128
{$endif}
 
129
 
 
130
 
 
131
{$ifndef FPC_SYSTEM_HAS_SIN}
 
132
{$define FPC_SYSTEM_HAS_SIN}
 
133
    function c_sin(d: double): double; cdecl; external 'c' name 'sin';
 
134
 
 
135
    function fpc_Sin_real(d:ValReal):ValReal;compilerproc; {$ifdef MATHINLINE}inline;{$endif}
 
136
    begin
 
137
      result := c_sin(d);
 
138
    end;
 
139
{$endif}
 
140
 
 
141
 
 
142
 
 
143
{$ifndef FPC_SYSTEM_HAS_COS}
 
144
{$define FPC_SYSTEM_HAS_COS}
 
145
    function c_cos(d: double): double; cdecl; external 'c' name 'cos';
 
146
 
 
147
    function fpc_Cos_real(d:ValReal):ValReal;compilerproc; {$ifdef MATHINLINE}inline;{$endif}
 
148
    begin
 
149
      result := c_cos(d);
 
150
    end;
 
151
{$endif}
 
152
 
 
153
 
 
154
 
 
155
{$ifndef FPC_SYSTEM_HAS_ARCTAN}
 
156
{$define FPC_SYSTEM_HAS_ARCTAN}
 
157
    function c_atan(d: double): double; cdecl; external 'c' name 'atan';
 
158
 
 
159
    function fpc_ArcTan_real(d:ValReal):ValReal;compilerproc; {$ifdef MATHINLINE}inline;{$endif}
 
160
    begin
 
161
      result := c_atan(d);
 
162
    end;
 
163
{$endif}
 
164
 
 
165
{$endif not i386}
 
166