b != 0.0 で割っても inf になることはある
参考:http://www.cqpub.co.jp/interface/column/freesoft/2003/200306/1.htm
#include
#include#include #include //#include #include int main(int argc, char *argv[]) { float a = 1.0f; float b = 0.000000000000000000000000000000000000001234567002324214214245023023400f; float c; c = a/b; if (b == 0.0f) { printf("b == 0.0f\n"); } else printf("b != 0.0f\n"); printf("%f\n", c); printf("%d\n", isfinite(c)); printf("%d\n", isfinite(1.0f)); return 0; }