Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
1.3 KiB

  1. page ,132
  2. title 87sqrt - square root - SQRT
  3. ;***
  4. ;87sqrt.asm - common square root support (80x87/emulator version)
  5. ;
  6. ; Copyright (c) 1984-2001, Microsoft Corporation. All rights reserved.
  7. ;
  8. ;Purpose:
  9. ; Common support for the sqrt function (80x87/emulator version)
  10. ;
  11. ;Revision History:
  12. ; 07-04-84 GFW initial version
  13. ; 10-26-87 BCM minor changes for new cmacros.inc
  14. ; 08-24-88 WAJ 386 version
  15. ;
  16. ;*******************************************************************************
  17. .xlist
  18. include cruntime.inc
  19. include mrt386.inc
  20. include elem87.inc
  21. .list
  22. CODESEG
  23. extrn _rtindfnpop:near
  24. extrn _rttosnpopde:near
  25. extrn _rtzeronpop:near
  26. extrn _tosnan1:near
  27. ;----------------------------------------------------------
  28. ;
  29. ; SQUARE ROOT FUNCTIONS
  30. ;
  31. ;----------------------------------------------------------
  32. lab fFSQRT
  33. or cl,cl ; test sign
  34. JSNZ sqrtindfnpop ; return indefinite if negative
  35. fsqrt ; calculate the square root of TOS
  36. ret
  37. lab _rtforsqrtinf
  38. or cl,cl ; test sign
  39. JSNZ sqrtindfnpop
  40. ret ; return infinity
  41. lab _rtforsqrtzero ; zero or denormal
  42. ftst
  43. fstsw ax
  44. fwait
  45. sahf
  46. JSNZ fFSQRT ; denormal operand
  47. ret ; return +0 or -0 (IEEE std)
  48. lab sqrtindfnpop
  49. jmp _rtindfnpop ; return indefinite
  50. end