{"id":350,"date":"2015-12-06T22:52:40","date_gmt":"2015-12-06T13:52:40","guid":{"rendered":"http:\/\/alprovs.dip.jp\/wordpress\/?p=350"},"modified":"2021-08-19T08:01:58","modified_gmt":"2021-08-18T23:01:58","slug":"c%e8%a8%80%e8%aa%9e%e3%81%a7%e3%81%aenan-inf","status":"publish","type":"post","link":"https:\/\/www.alprovs.com\/wordpress\/?p=350","title":{"rendered":"C\u8a00\u8a9e\u3067\u306enan inf"},"content":{"rendered":"<p>\u30d7\u30ed\u30b0\u30e9\u30e0\u3067\u30aa\u30fc\u30d0\u30fc\u30d5\u30ed\u30fc\u3059\u308b\u3088\u3046\u306a\u5927\u304d\u306a\u5024\u3092\u6271\u3063\u305f\u969b\u306bnan\uff08\u975e\u6570\uff09\u3084inf\uff08\u7121\u9650\uff09\u304c\u51fa\u73fe\u3057\u305f\u3002\u3053\u306enan\u3084inf\u304c\u51fa\u73fe\u3059\u308b\u6cd5\u5247\u304c\u3088\u304f\u308f\u304b\u3089\u306a\u3044\u306e\u3067\uff08\u30de\u30cb\u30e5\u30a2\u30eb\u7b49\u3092\u898b\u308c\u3070\u66f8\u3044\u3066\u3042\u308b\u306e\u3060\u308d\u3046\u304c\u2026\uff09\u81ea\u5206\u304c\u6240\u6301\u3057\u3066\u3044\u308b\u74b0\u5883\u3067\u691c\u8a3c\u3092\u884c\u3063\u305f\u3002\u30bd\u30fc\u30b9\u306f\u6b21\u306e\u3068\u304a\u308a<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#include \r\n#include \r\n\r\nint main(void)\r\n{\r\n  printf(\"1\/0  = %f\\n\", 1.\/0.);\r\n  printf(\"exp(710) = %e\\n\", exp(710.));\r\n  printf(\"log(0) = %f\\n\\n\", log(0.));\r\n  \/\/inf\u306e\u6709\u9650\u5024\u3068\u306e\u52a0\u6e1b\u4e57\u9664\r\n  printf(\"1 + inf = %f\\n\", 1.+exp(710.));\r\n  printf(\"1 - inf = %f\\n\", 1.-exp(710.));\r\n  printf(\"1 * inf = %f\\n\", 1.*exp(710.));\r\n  printf(\"1 \/ inf = %f\\n\\n\", 1.\/exp(710.));\r\n  \/\/inf\u540c\u58eb\u306e\u52a0\u6e1b\u4e57\u9664\r\n  printf(\"inf + inf = %f\\n\", exp(710.)+exp(710.));\r\n  printf(\"inf - inf = %f\\n\", exp(710.)-exp(710.));\r\n  printf(\"inf * inf = %f\\n\", exp(710.)*exp(710.));\r\n  printf(\"inf \/ inf = %f\\n\\n\", exp(710.)\/exp(710.));\r\n  \/\/nan\u3068\u6709\u9650\u5024\u306e\u52a0\u6e1b\u4e57\u9664\r\n  printf(\"1 + nan = %f\\n\", 1.+(exp(710.)\/exp(710.)));\r\n  printf(\"1 - nan = %f\\n\", 1.-(exp(710.)\/exp(710.)));\r\n  printf(\"1 * nan = %f\\n\", 1.*(exp(710.)\/exp(710.)));\r\n  printf(\"1 \/ nan = %f\\n\\n\", 1.\/(exp(710.)\/exp(710.)));\r\n  return 0;\r\n}<\/pre>\n<p>\u6700\u521d\u306e3\u3064\u306e\u5f0f\u304c\u30d1\u30c3\u3068\u601d\u3044\u3064\u3044\u305fnan,inf\u306b\u306a\u308b\u3068\u601d\u308f\u308c\u308b\u3082\u306e\u3067\u3001<br \/>\n1\/0 = nan, exp(710) = inf, log(0) = -inf\u306b\u306a\u308b\u3068\u4e88\u60f3\u3059\u308b\u3002<br \/>\n\u6307\u6570\u95a2\u6570\u306e710\u3068\u3044\u3046\u5024\u306fdouble\u578b\u306e\u4e0a\u96501.797693e+308\u304b\u3089<br \/>\nexp(x) = 1.797693e+308 -&gt; x = log(1.797693)+308*log(10) = 709.78<br \/>\n\u3088\u308a\u4e0a\u9650\u3092\u8d8a\u3048\u308b\u5024\u3092\u9078\u629e\u3057\u305f\u3002<\/p>\n<ul>\n<li>\u7d50\u679c1<br \/>\n\u30b3\u30f3\u30d1\u30a4\u30e9\uff1agcc(version 4.4.7)<br \/>\n\u5b9f\u884c\u7d50\u679c<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">1\/0  = inf\r\nexp(710) = inf\r\nlog(0) = -inf\r\n\r\n1 + inf = inf\r\n1 - inf = -inf\r\n1 * inf = inf\r\n1 \/ inf = 0.000000\r\n\r\ninf + inf = inf\r\ninf - inf = -nan\r\ninf * inf = inf\r\ninf \/ inf = -nan\r\n\r\n1 + nan = -nan\r\n1 - nan = -nan\r\n1 * nan = -nan\r\n1 \/ nan = -nan<\/pre>\n<\/li>\n<li>\u7d50\u679c2<br \/>\n\u30b3\u30f3\u30d1\u30a4\u30e9\uff1aMicrosoft(R) 32-bit C\/C++ Optimizing Compiler Version 15.00.21022.08(Visual Studio 2008)<br \/>\n\u3053\u306e\u30b3\u30f3\u30d1\u30a4\u30e9\u3067\u306f1\/0\u306f<br \/>\n\u300cerror C2124: \u9664\u7b97\u3001\u5270\u4f59\u6f14\u7b97\u304c 0 \u3067\u884c\u308f\u308c\u3066\u3044\u307e\u3059\u3002\u300d<br \/>\n\u3068\u30a8\u30e9\u30fc\u3067\u5f3e\u304b\u308c\u3066\u3057\u307e\u3063\u305f\u70ba\u3001\u5909\u6570\u306b0\u3092\u683c\u7d0d\u3057\u3066\u5b9f\u884c\u3057\u305f\u3002<br \/>\n\u5b9f\u884c\u7d50\u679c<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">1\/0  = 1.#INF00\r\nexp(710) = 1.#INF00\r\nlog(0) = -1.#INF00\r\n\r\n1 + inf = 1.#INF00\r\n1 - inf = -1.#INF00\r\n1 * inf = 1.#INF00\r\n1 \/ inf = 0.000000\r\n\r\ninf + inf = 1.#INF00\r\ninf - inf = -1.#IND00\r\ninf * inf = 1.#INF00\r\ninf \/ inf = -1.#IND00\r\n\r\n1 + nan = -1.#IND00\r\n1 - nan = -1.#IND00\r\n1 * nan = -1.#IND00\r\n1 \/ nan = -1.#IND00<\/pre>\n<p>\u7d50\u679c\u306e\u8868\u73fe\u306f\u9055\u3046\u304c1.#INF00\u306finf\u3001-1.#IND00\u306fnan\u3092\u8868\u3057\u3066\u3044\u308b<\/li>\n<\/ul>\n<p>\u4eca\u56de2\u3064\u306e\u74b0\u5883\u3067\u30c6\u30b9\u30c8\u3092\u884c\u3063\u305f\u304c\u3001\u4e21\u65b9\u5171\u306b\u540c\u3058\u7d50\u679c\u3068\u306a\u3063\u305f\u3002\u3061\u306a\u307f\u306b\u5909\u6570\u304cinf\u304bnan\u304b\u3092\u5224\u5b9a\u3059\u308b\u306b\u306f&#8221;==&#8221;\u3067\u306a\u304f&#8221;isinf()&#8221;\u3068&#8221;isnan()&#8221;\u3068\u3044\u3046\u30de\u30af\u30ed\u3092\u4f7f\u7528\u3059\u308b\u3002\uff08\u8a73\u7d30\u306f\u4ed6\u306e\u30b5\u30a4\u30c8\u3092\u53c2\u8003\u306b\u3057\u3066\u304f\u3060\u3055\u3044\uff09<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u30d7\u30ed\u30b0\u30e9\u30e0\u3067\u30aa\u30fc\u30d0\u30fc\u30d5\u30ed\u30fc\u3059\u308b\u3088\u3046\u306a\u5927\u304d\u306a\u5024\u3092\u6271\u3063\u305f\u969b\u306bnan\uff08\u975e\u6570\uff09\u3084inf\uff08\u7121\u9650\uff09\u304c\u51fa\u73fe\u3057\u305f\u3002\u3053\u306enan\u3084inf\u304c\u51fa\u73fe\u3059\u308b\u6cd5\u5247\u304c\u3088\u304f\u308f\u304b\u3089\u306a\u3044\u306e\u3067\uff08\u30de\u30cb\u30e5\u30a2\u30eb\u7b49\u3092\u898b\u308c\u3070\u66f8\u3044\u3066\u3042\u308b\u306e\u3060\u308d\u3046\u304c\u2026\uff09\u81ea\u5206\u304c\u6240\u6301\u3057\u3066\u3044\u308b\u74b0\u5883\u3067 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,6,7],"tags":[],"class_list":["post-350","post","type-post","status-publish","format-standard","hentry","category-c","category-6","category-7"],"_links":{"self":[{"href":"https:\/\/www.alprovs.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/350","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.alprovs.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.alprovs.com\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.alprovs.com\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.alprovs.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=350"}],"version-history":[{"count":11,"href":"https:\/\/www.alprovs.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/350\/revisions"}],"predecessor-version":[{"id":764,"href":"https:\/\/www.alprovs.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/350\/revisions\/764"}],"wp:attachment":[{"href":"https:\/\/www.alprovs.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=350"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.alprovs.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=350"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.alprovs.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=350"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}