C99 standard says:
A double argument representing an infinity is converted in one of the styles [-]inf or [-]infinity -- which style is implemented is implementation-defined. (p.278 section 7.19.6.1)
Unfortunately on Windows:
printf("%f\n", 1.0f/0.0f)
produces: 1.#INF00
This is a problem because some applications expect C standard compliant strings as input (also C#'s Double.Parse works for "Infinity" but not for "1.#INF00", curiously "infinity" is not ok either at least when I tried it with Mono).
My question is how do I force printf under Windows to output "inf" or "infinity" instead of 1.#INF00 ?
(I am compiling with MinGW gcc 4.8.2)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.