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.

30 lines
437 B

  1. #include "mymath.h"
  2. #ifdef NEEDCEILF
  3. float ceilf( float x )
  4. {
  5. if( x < 0 ) {
  6. float nx = -x;
  7. int ix = (int) nx;
  8. return (float) -ix;
  9. } else {
  10. int ix = (int) x;
  11. if( x == (float) ix ) return x;
  12. return (float) (ix+1);
  13. }
  14. }
  15. float floorf( float x )
  16. {
  17. if( x < 0 ) {
  18. float nx = -x;
  19. int ix = (int) nx;
  20. if( nx == (float) ix ) return x;
  21. return (float) -(ix+1);
  22. } else {
  23. int ix = (int) x;
  24. return (float) ix;
  25. }
  26. }
  27. #endif