test_strtod.cxx 846 B

1234567891011121314151617181920212223242526272829303132333435
  1. /**
  2. * PANDA 3D SOFTWARE
  3. * Copyright (c) Carnegie Mellon University. All rights reserved.
  4. *
  5. * All use of this software is subject to the terms of the revised BSD
  6. * license. You should have received a copy of this license along
  7. * with this source code in a file named "LICENSE."
  8. *
  9. * @file test_strtod.cxx
  10. * @author drose
  11. * @date 2009-06-14
  12. */
  13. #include "pstrtod.h"
  14. #ifndef _WIN32
  15. #include <locale.h>
  16. #endif
  17. int
  18. main(int argc, char *argv[]) {
  19. #ifndef _WIN32
  20. setlocale(LC_ALL, "");
  21. #endif
  22. for (int i = 1; i < argc; ++i) {
  23. char *endptr = nullptr;
  24. double result = pstrtod(argv[i], &endptr);
  25. std::cerr << "pstrtod - " << argv[i] << " : " << result << " : " << endptr << "\n";
  26. result = strtod(argv[i], &endptr);
  27. std::cerr << "strtod - " << argv[i] << " : " << result << " : " << endptr << "\n";
  28. }
  29. return 0;
  30. }