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 972 B

12345678910111213141516171819202122232425262728
  1. /* Copyright (C) 2016 by Rainer Gerhards
  2. * Released under ASL 2.0 */
  3. #include "config.h"
  4. #include "json_object.h"
  5. #include "json_tokener.h"
  6. #include <stdio.h>
  7. int main(void)
  8. {
  9. json_object *json;
  10. json = json_object_new_double(1.0);
  11. printf("json = %s\n", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY));
  12. json_object_put(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.23);
  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(123456789.0);
  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.123);
  23. printf("json = %s\n", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY));
  24. json_object_put(json);
  25. return 0;
  26. }