math.inc 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. {
  2. Implementation of mathematical routines for AArch64
  3. This file is part of the Free Pascal run time library.
  4. Copyright (c) 1999-2005 by 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. {****************************************************************************
  12. Floating point type routines
  13. ****************************************************************************}
  14. {$ifndef FPC_SYSTEM_HAS_ABS}
  15. {$define FPC_SYSTEM_HAS_ABS}
  16. function fpc_abs_real(d : ValReal) : ValReal;compilerproc;
  17. begin
  18. { Function is handled internal in the compiler }
  19. runerror(207);
  20. result:=0;
  21. end;
  22. {$endif FPC_SYSTEM_HAS_ABS}
  23. {$ifndef FPC_SYSTEM_HAS_SQR}
  24. {$define FPC_SYSTEM_HAS_SQR}
  25. function fpc_sqr_real(d : ValReal) : ValReal;compilerproc;
  26. begin
  27. { Function is handled internal in the compiler }
  28. runerror(207);
  29. result:=0;
  30. end;
  31. {$endif FPC_SYSTEM_HAS_SQR}
  32. {$ifndef FPC_SYSTEM_HAS_SQRT}
  33. {$define FPC_SYSTEM_HAS_SQRT}
  34. function fpc_sqrt_real(d : ValReal) : ValReal;compilerproc;
  35. begin
  36. { Function is handled internal in the compiler }
  37. runerror(207);
  38. result:=0;
  39. end;
  40. {$endif FPC_SYSTEM_HAS_SQRT}
  41. {$if not defined(VER3_2) and not defined(CPULLVM)}
  42. {$ifndef FPC_SYSTEM_HAS_FRAC}
  43. {$define FPC_SYSTEM_HAS_FRAC}
  44. function fpc_frac_real(d : ValReal) : ValReal;compilerproc;
  45. begin
  46. { Function is handled internal in the compiler }
  47. runerror(207);
  48. result:=0;
  49. end;
  50. {$endif FPC_SYSTEM_HAS_FRAC}
  51. {$endif not VER3_2 and not CPULLVM }
  52. {$ifndef FPC_SYSTEM_HAS_INT}
  53. {$define FPC_SYSTEM_HAS_INT}
  54. function fpc_int_real(d : ValReal) : ValReal;assembler;nostackframe;compilerproc;
  55. asm
  56. // { round as floating point towards zero }
  57. frintz d0,d0
  58. end;
  59. {$endif FPC_SYSTEM_HAS_INT}
  60. {$ifndef FPC_SYSTEM_HAS_TRUNC}
  61. {$define FPC_SYSTEM_HAS_TRUNC}
  62. function fpc_trunc_real(d : ValReal) : int64;assembler;nostackframe;compilerproc;
  63. asm
  64. // { round to signed integer towards zero }
  65. fcvtzs x0,d0
  66. end;
  67. {$endif FPC_SYSTEM_HAS_TRUNC}
  68. {$ifndef FPC_SYSTEM_HAS_ROUND}
  69. {$define FPC_SYSTEM_HAS_ROUND}
  70. function fpc_round_real(d : ValReal) : int64;assembler;nostackframe;compilerproc;
  71. asm
  72. // { round as floating point using current rounding mode }
  73. frintx d0,d0
  74. // { convert to signed integer rounding towards zero (there's no "round to
  75. // integer using current rounding mode") }
  76. fcvtzs x0,d0
  77. end;
  78. {$endif FPC_SYSTEM_HAS_ROUND}