Logo Search packages:      
Sourcecode: yajl version File versions  Download package

YAJL_API yajl_gen_status yajl_gen_double ( yajl_gen  hand,
double  number 
)

generate a floating point number. number may not be infinity or NaN, as these have no representation in JSON. In these cases the generator will return 'yajl_gen_invalid_number'

Definition at line 223 of file yajl_gen.c.

References yajl_gen_double(), yajl_gen_invalid_number, and yajl_gen_status_ok.

Referenced by yajl_gen_double().

{
    char i[32];
    ENSURE_VALID_STATE; ENSURE_NOT_KEY; 
    if (isnan(number) || isinf(number)) return yajl_gen_invalid_number;
    INSERT_SEP; INSERT_WHITESPACE;
    sprintf(i, "%.20g", number);
    g->print(g->ctx, i, (unsigned int)strlen(i));
    APPENDED_ATOM;
    FINAL_NEWLINE;
    return yajl_gen_status_ok;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index