Hi, I am working on a module for load balancing. I have to make use of the type float. Can anyone please tell me if there is any nginx specific data type for float such as the one that exists for int (ngx_int_t). I would also like to know how to write the float value to the logs. The type %f prints only the integer portion of the float value. Thank you in advance. With Regards, Aparna.
on 2013-02-26 10:33
on 2013-02-26 11:09
On Feb 26, 2013, at 13:32 , Aparna Bhat wrote:
> I am working on a module for load balancing. I have to make use of the type
float. Can anyone please tell me if there is any nginx specific data type for
float such as the one that exists for int (ngx_int_t). I would also like to know
how to write the float value to the logs. The type %f prints only the integer
portion of the float value.
There is no special float integer type in nginx.
nginx %f format is for double, so you have to cast float to double in
ngx_sprintf().
To print fractional portion you should use "%.3f", the maximum supported
format is "%18.5f".
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.