mathh.inc 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. {
  2. This file is part of the Free Pascal run time library.
  3. Copyright (c) 1999-2000 by Florian Klaempfl,
  4. member of the Free Pascal development team
  5. See the file COPYING.FPC, included in this distribution,
  6. for details about the copyright.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10. **********************************************************************}
  11. { i386 FPU Controlword }
  12. {$if defined(cpui386) or defined(cpux86_64)}
  13. const
  14. Default8087CW : word = $1332;
  15. procedure Set8087CW(cw:word);
  16. function Get8087CW:word;
  17. procedure SetSSECSR(w : dword);
  18. function GetSSECSR : dword;
  19. {$endif}
  20. const
  21. {*
  22. -------------------------------------------------------------------------------
  23. Software IEC/IEEE floating-point exception flags.
  24. -------------------------------------------------------------------------------
  25. *}
  26. float_flag_invalid = 1;
  27. float_flag_denormal = 2;
  28. float_flag_divbyzero = 4;
  29. float_flag_overflow = 8;
  30. float_flag_underflow = 16;
  31. float_flag_inexact = 32;
  32. {*
  33. -------------------------------------------------------------------------------
  34. Software IEC/IEEE floating-point rounding mode.
  35. -------------------------------------------------------------------------------
  36. *}
  37. float_round_nearest_even = 0;
  38. float_round_down = 1;
  39. float_round_up = 2;
  40. float_round_to_zero = 3;
  41. threadvar
  42. softfloat_exception_mask : Byte;
  43. softfloat_exception_flags : Byte;
  44. softfloat_rounding_mode : Byte;
  45. procedure float_raise(i: shortint);
  46. {$ifdef cpui386}
  47. {$define INTERNMATH}
  48. {$endif}
  49. {$ifndef INTERNMATH}
  50. {$ifdef FPC_USE_LIBC}
  51. {$ifdef SYSTEMINLINE}
  52. {$define MATHINLINE}
  53. {$endif}
  54. {$endif}
  55. {$endif}
  56. function pi : ValReal;[internproc:fpc_in_pi_real];
  57. function abs(d : ValReal) : ValReal;[internproc:fpc_in_abs_real];
  58. function sqr(d : ValReal) : ValReal;[internproc:fpc_in_sqr_real];
  59. function sqrt(d : ValReal) : ValReal;[internproc:fpc_in_sqrt_real];
  60. function arctan(d : ValReal) : ValReal;[internproc:fpc_in_arctan_real];
  61. function ln(d : ValReal) : ValReal;[internproc:fpc_in_ln_real];
  62. function sin(d : ValReal) : ValReal;[internproc:fpc_in_sin_real];
  63. function cos(d : ValReal) : ValReal;[internproc:fpc_in_cos_real];
  64. function exp(d : ValReal) : ValReal;[internproc:fpc_in_exp_real];
  65. function round(d : ValReal) : int64;[internproc:fpc_in_round_real];
  66. function frac(d : ValReal) : ValReal;[internproc:fpc_in_frac_real];
  67. function int(d : ValReal) : ValReal;[internproc:fpc_in_int_real];
  68. function trunc(d : ValReal) : int64;[internproc:fpc_in_trunc_real];
  69. {$ifdef SUPPORT_EXTENDED}
  70. function FPower10(val: Extended; Power: Longint): Extended;
  71. {$endif SUPPORT_EXTENDED}
  72. type
  73. real48 = array[0..5] of byte;
  74. {$ifdef SUPPORT_DOUBLE}
  75. function Real2Double(r : real48) : double;
  76. operator := (b:real48) d:double;
  77. {$endif}
  78. {$ifdef SUPPORT_EXTENDED}
  79. operator := (b:real48) e:extended;
  80. {$endif SUPPORT_EXTENDED}