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.

37 lines
879 B

  1. /* _Stod/_Stof/_Stold functions for Microsoft */
  2. #include <stdlib.h>
  3. #include "wctype.h"
  4. #ifndef _LIMITS
  5. #include <yvals.h>
  6. #endif
  7. _STD_BEGIN
  8. _CRTIMP2 double _Stod(const char *s, char **endptr, long pten)
  9. { /* convert string to double */
  10. double x = strtod(s, endptr);
  11. for (; 0 < pten; --pten)
  12. x *= 10.0;
  13. for (; pten < 0; ++pten)
  14. x /= 10.0;
  15. return (x);
  16. }
  17. _CRTIMP2 float _Stof(const char *s, char **endptr, long pten)
  18. { /* convert string to float */
  19. return ((float)_Stod(s, endptr, pten));
  20. }
  21. _CRTIMP2 long double _Stold(const char *s, char **endptr, long pten)
  22. { /* convert string to long double */
  23. return ((long double)_Stod(s, endptr, pten));
  24. }
  25. _STD_END
  26. /*
  27. * Copyright (c) 1995 by P.J. Plauger. ALL RIGHTS RESERVED.
  28. * Consult your license regarding permissions and restrictions.
  29. */
  30. /*
  31. 951207 pjp: added new file
  32. */