You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

test_float.c 1.0 kB

12345678910111213141516171819202122232425262728293031
  1. /* Copyright (C) 2016 by Rainer Gerhards
  2. * Released under ASL 2.0 */
  3. #ifdef NDEBUG
  4. #undef NDEBUG
  5. #endif
  6. #include "config.h"
  7. #include "json_object.h"
  8. #include "json_tokener.h"
  9. #include <stdio.h>
  10. int main(void)
  11. {
  12. json_object *json;
  13. json = json_object_new_double(1.0);
  14. printf("json = %s\n", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY));
  15. json_object_put(json);
  16. json = json_object_new_double(-1.0);
  17. printf("json = %s\n", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY));
  18. json_object_put(json);
  19. json = json_object_new_double(1.23);
  20. printf("json = %s\n", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY));
  21. json_object_put(json);
  22. json = json_object_new_double(123456789.0);
  23. printf("json = %s\n", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY));
  24. json_object_put(json);
  25. json = json_object_new_double(123456789.123);
  26. printf("json = %s\n", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY));
  27. json_object_put(json);
  28. return 0;
  29. }