damus

nostr ios client
git clone git://jb55.com/damus
Log | Files | Refs | README | LICENSE

pprintfp.h (855B)


      1 #ifndef PPRINTFP_H
      2 #define PPRINTFP_H
      3 
      4 #ifdef __cplusplus
      5 extern "C" {
      6 #endif
      7 
      8 #define PDIAGNOSTIC_IGNORE_UNUSED_FUNCTION
      9 #include "pdiagnostic_push.h"
     10 
     11 #ifndef PORTABLE_USE_GRISU3
     12 #define PORTABLE_USE_GRISU3 1
     13 #endif
     14 
     15 
     16 #if PORTABLE_USE_GRISU3
     17 #include "grisu3_print.h"
     18 #endif
     19 
     20 #ifdef grisu3_print_double_is_defined
     21 /* Currently there is not special support for floats. */
     22 #define print_float(n, p) grisu3_print_double((float)(n), (p))
     23 #define print_double(n, p) grisu3_print_double((double)(n), (p))
     24 #else
     25 #include <stdio.h>
     26 #define print_float(n, p) sprintf(p, "%.9g", (float)(n))
     27 #define print_double(n, p) sprintf(p, "%.17g", (double)(n))
     28 #endif
     29 
     30 #define print_hex_float(n, p) sprintf(p, "%a", (float)(n))
     31 #define print_hex_double(n, p) sprintf(p, "%a", (double)(n))
     32 
     33 #include "pdiagnostic_pop.h"
     34 
     35 #ifdef __cplusplus
     36 }
     37 #endif
     38 
     39 #endif /* PPRINTFP_H */