ufloatx80.pp 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. {
  2. This file is part of the Free Pascal run time library.
  3. Copyright (c) 2007 by the FPC development time
  4. Implements overloaded operators and misc. functions to
  5. provide a floatx80 type
  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. {$inline on}
  13. unit ufloatx80;
  14. interface
  15. uses
  16. sfpux80;
  17. type
  18. floatx80 = sfpux80.floatx80;
  19. operator+ (const f1,f2 : floatx80) result : floatx80;inline;
  20. operator* (const f1,f2 : floatx80) result : floatx80;inline;
  21. operator- (const f1,f2 : floatx80) result : floatx80;inline;
  22. operator/ (const f1,f2 : floatx80) result : floatx80;inline;
  23. operator :=(const source : double) dest : floatx80;inline;
  24. operator :=(const source : floatx80) dest : double;inline;
  25. procedure DumpFloatx80(const f : floatx80);
  26. implementation
  27. procedure DumpFloatx80(const f : floatx80);
  28. type
  29. ta = packed array[0..SizeOf(floatx80)-1] of byte;
  30. var
  31. i : longint;
  32. begin
  33. for i:=SizeOf(floatx80)-1 downto 0 do
  34. begin
  35. write(hexstr(ta(f)[i],2));
  36. if i<15 then
  37. write(' ');
  38. end;
  39. end;
  40. operator+ (const f1,f2 : floatx80) result : floatx80;inline;
  41. begin
  42. result:=floatx80_add(f1,f2);
  43. end;
  44. operator* (const f1,f2 : floatx80) result : floatx80;inline;
  45. begin
  46. result:=floatx80_mul(f1,f2);
  47. end;
  48. operator- (const f1,f2 : floatx80) result : floatx80;inline;
  49. begin
  50. result:=floatx80_sub(f1,f2);
  51. end;
  52. operator/ (const f1,f2 : floatx80) result : floatx80;inline;
  53. begin
  54. result:=floatx80_div(f1,f2);
  55. end;
  56. operator :=(const source : double) dest : floatx80;inline;
  57. begin
  58. dest:=float64_to_floatx80(float64(source));
  59. end;
  60. operator :=(const source : floatx80) dest : double;inline;
  61. begin
  62. dest:=double(floatx80_to_float64(source));
  63. end;
  64. end.