Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. #include <math.h>
  2. #include <errno.h>
  3.  
  4. extern float  __QNANF;
  5.  
  6. float
  7. sqrtf (float x)
  8. {
  9.   if (x < 0.0F )
  10.     {
  11.       errno = EDOM;
  12.       return __QNANF;
  13.     }
  14.   else
  15.     {
  16.       float res;
  17.       asm ("fsqrt" : "=t" (res) : "0" (x));
  18.       return res;
  19.     }
  20. }
  21.  
  22. double
  23. sqrt (double x)
  24. {
  25.   if (x < 0.0F )
  26.     {
  27.       errno = EDOM;
  28.       return __QNANF;
  29.     }
  30.   else
  31.     {
  32.       double res;
  33.       asm ("fsqrt" : "=t" (res) : "0" (x));
  34.       return res;
  35.     }
  36. }
  37.  
  38.