Subversion Repositories Kolibri OS

Rev

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

  1. //#include <tgmath.h>
  2. #include <math.h>
  3. #include <stdlib.h>
  4. #include "test.h"
  5.  
  6. int main(void)
  7. {
  8.         long i;
  9. /*
  10.         i = lrint(123456789.1f) & 0x7fffffff;
  11.         if (i != 123456792)
  12.                 t_error("lrint(123456789.1f)&0x7fffffff want 123456792 got %ld\n", i);
  13.         i = lrint(123456789.1) & 0x7fffffff;
  14.         if (i != 123456789)
  15.                 t_error("lrint(123456789.1)&0x7fffffff want 123456789 got %ld\n", i);
  16. */
  17.         if (sqrt(2.0f) != 1.41421353816986083984375)
  18.                 t_error("sqrt(2.0f) want 1.41421353816986083984375 got %f\n", sqrt(2.0f));
  19.         if (sqrt(2.0) != 1.414213562373095145474621858738828450441360)
  20.                 t_error("sqrt(2.0) want 1.414213562373095145474621858738828450441360 got %d\n", sqrt(2.0));
  21.         if (sqrt(2) != 1.414213562373095145474621858738828450441360)
  22.                 t_error("sqrt(2) want 0x1.6a09e667f3bcdp+0 got %a\n", sqrt(2.0));
  23.  
  24.         if (sizeof pow(sqrt(8),0.5f) != sizeof(double))
  25.                 t_error("sizeof pow(sqrt(8),0.5f) want %d got %d\n", (int)sizeof(double), (int)sizeof pow(sqrt(8),0.5f));
  26.         if (sizeof pow(2.0,0.5) != sizeof(double))
  27.                 t_error("sizeof pow(2.0,0.5) want %d got %d\n", (int)sizeof(double), (int)sizeof pow(2.0,0.5));
  28.         if (sizeof pow(2.0f,0.5f) != sizeof(float))
  29.                 t_error("sizeof pow(2.0f,0.5f) want %d got %d\n", (int)sizeof(float), (int)sizeof pow(2.0f,0.5f));
  30. //      if (sizeof pow(2.0,0.5+0*I) != sizeof(double complex))
  31. //              t_error("sizeof pow(2.0,0.5+0*I) want %d got %d\n", (int)sizeof(double complex), (int)sizeof pow(2.0,0.5+0*I));
  32.  
  33.         if (pow(2.0,0.5) != 1.414213562373095145474621858738828450441360)
  34.                 t_error("pow(2.0,0.5) want 0x1.6a09e667f3bcdp+0 got %a\n", pow(2.0,0.5));
  35.         if (pow(2,0.5) != 1.414213562373095145474621858738828450441360)
  36.                 t_error("pow(2,0.5) want 0x1.6a09e667f3bcdp+0 got %a\n", pow(2,0.5));
  37.         if (pow(2,0.5f) != 1.414213562373095145474621858738828450441360)
  38.                 t_error("pow(2,0.5f) want 0x1.6a09e667f3bcdp+0 got %a\n", pow(2,0.5f));
  39.  
  40.         return t_status;
  41. }
  42.