mathh.inc 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. {
  2. $Id$
  3. This file is part of the Free Pascal run time library.
  4. Copyright (c) 1999-2000 by Florian Klaempfl,
  5. member of the Free Pascal development team
  6. See the file COPYING.FPC, included in this distribution,
  7. for details about the copyright.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. **********************************************************************}
  12. { i386 FPU Controlword }
  13. {$ifdef cpui386}
  14. const
  15. Default8087CW : word = $1332;
  16. procedure Set8087CW(cw:word);
  17. function Get8087CW:word;
  18. {$endif cpui386}
  19. {$ifdef cpux86_64}
  20. const
  21. Default8087CW : word = $1332;
  22. procedure Set8087CW(cw:word);
  23. function Get8087CW:word;
  24. {$endif cpux86_64}
  25. { declarations of the math routines }
  26. function abs(d : extended) : extended;
  27. function arctan(d : extended) : extended;
  28. function cos(d : extended) : extended;
  29. function exp(d : extended) : extended;
  30. function frac(d : extended) : extended;
  31. function int(d : extended) : extended;
  32. function ln(d : extended) : extended;
  33. function pi : extended;
  34. function round(d : extended) : int64;
  35. function sin(d : extended) : extended;
  36. function sqr(d : extended) : extended;
  37. function sqrt(d : extended) : extended;
  38. function trunc(d : extended) : int64;
  39. function power(bas,expo : extended) : extended;
  40. function power(bas,expo : int64) : int64;
  41. {$ifdef FPC_CURRENCY_IS_INT64}
  42. function trunc(c : currency) : int64;
  43. function trunc(c : comp) : int64;
  44. function round(c : currency) : int64;
  45. function round(c : comp) : int64;
  46. {$endif FPC_CURRENCY_IS_INT64}
  47. type
  48. real48 = array[0..5] of byte;
  49. {$ifdef SUPPORT_DOUBLE}
  50. function Real2Double(r : real48) : double;
  51. operator := (b:real48) d:double;
  52. {$endif}
  53. {$ifdef SUPPORT_EXTENDED}
  54. operator := (b:real48) e:extended;
  55. {$endif SUPPORT_EXTENDED}
  56. {
  57. $Log$
  58. Revision 1.15 2004-02-08 15:33:50 florian
  59. * linking problems fixed
  60. + abi tag added
  61. Revision 1.14 2004/01/02 17:19:04 jonas
  62. * if currency = int64, FPC_CURRENCY_IS_INT64 is defined
  63. + round and trunc for currency and comp if FPC_CURRENCY_IS_INT64 is
  64. defined
  65. * if currency = orddef, prefer currency -> int64/qword conversion over
  66. currency -> float conversions
  67. * optimized currency/currency if currency = orddef
  68. * TODO: write FPC_DIV_CURRENCY and FPC_MUL_CURRENCY routines to prevent
  69. precision loss if currency=int64 and bestreal = double
  70. Revision 1.13 2003/01/21 19:36:36 mazen
  71. - fpc_int64_to_double removed as not supported by most cpu targets
  72. Revision 1.12 2003/01/20 22:21:36 mazen
  73. * many stuff related to RTL fixed
  74. Revision 1.11 2003/01/15 00:40:18 peter
  75. * power returns int64
  76. Revision 1.10 2003/01/03 20:34:02 peter
  77. * i386 fpu controlword functions added
  78. Revision 1.9 2002/10/06 21:26:18 peter
  79. * round returns int64
  80. Revision 1.8 2002/09/07 15:07:45 peter
  81. * old logs removed and tabs fixed
  82. Revision 1.7 2002/07/26 22:46:06 florian
  83. * interface of system unit for Linux/PowerPC compiles
  84. }