{"id":2418,"date":"2013-05-01T18:59:30","date_gmt":"2013-05-01T09:59:30","guid":{"rendered":"http:\/\/peta.okechan.net\/blog\/?p=2418"},"modified":"2016-05-27T16:13:20","modified_gmt":"2016-05-27T07:13:20","slug":"%e6%b5%ae%e5%8b%95%e5%b0%8f%e6%95%b0%e7%82%b9%e6%95%b0%ef%bc%8832bit-float%ef%bc%89%e3%81%ae%e6%95%b4%e6%95%b0%e6%bc%94%e7%ae%97%e3%81%ae%e7%b2%be%e5%ba%a6","status":"publish","type":"post","link":"https:\/\/peta.okechan.net\/blog\/archives\/2418","title":{"rendered":"\u6d6e\u52d5\u5c0f\u6570\u70b9\u6570\uff0832bit float\uff09\u306e\u6574\u6570\u6f14\u7b97\u306e\u7cbe\u5ea6"},"content":{"rendered":"<h3>\u3044\u304d\u306a\u308a\u4f59\u8ac7<\/h3>\n<p>\u73fe\u5728\u4f5c\u6210\u4e2d\u306e\u30a2\u30ec\u3067\u3001GPU Acceleration\u306b\u306b\u624b\u3092\u51fa\u3059\u306e\u306f\u3082\u3046\u5c11\u3057\u8db3\u5834\u3092\u56fa\u3081\u3066\u304b\u3089\u3068\u601d\u3063\u3066\u305f\u3051\u3069\u3001CPU\u3092\u4f7f\u3046\u30b3\u30fc\u30c9\u3092GPU\u3092\u4f7f\u3046\u30b3\u30fc\u30c9\u306b\u5909\u66f4\u3059\u308b\u306e\u306f\u624b\u9593\u3068\u3044\u3046\u304b\u3001\u8a2d\u8a08\u30ec\u30d9\u30eb\u304b\u3089\u5225\u7269\u306b\u306a\u308b\u304b\u3082\u3057\u308c\u306a\u3044\u3057\u3001\u3069\u3046\u305b\u6700\u7d42\u7684\u306b\u306fGPU\u4f7f\u3046\u3060\u308d\u3046\u3057\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u81ea\u5206\u306e\u4e2d\u3067GPU\u306e\u6c4e\u7528\u8a08\u7b97\u5229\u7528\u3092\u89e3\u7981\u3057\u305f\u3002<br \/>\n\u305f\u3060\u3001OpenGL\u3092\u4f7f\u3063\u305fGPGPU\u306e\u307f\u3067CUDA\u306f\u307e\u3060\u7981\u6b62\u3068\u3044\u3046\u3053\u3068\u306b\u3057\u3066\u308b\u3002<br \/>\n\u73fe\u5728\u4f5c\u6210\u4e2d\u306e\u30a2\u30ec\u3001\u3082\u3057\u304f\u306f\u305d\u306e\u6d3e\u751f\u7269\u3092\u914d\u5e03\u3059\u308b\u53ef\u80fd\u6027\u304c\u306a\u3044\u3068\u306f\u8a00\u3048\u306a\u3044\u306e\u3067\u3002<\/p>\n<p>\u73fe\u5728\u3001\u8907\u96d1\u306a\u5f62\u306e\u5927\u304d\u306a\u9762\u5149\u6e90\u304c\u3042\u3063\u3066\u3082\u7d50\u69cb\u6b63\u78ba\u3067\u9ad8\u901f\u306a\u76f4\u63a5\u7167\u660e\u306e\u8a08\u7b97\u3092GPU\u3092\u4f7f\u3063\u3066\u884c\u3046\u30b3\u30fc\u30c9\u3092\u5b9f\u88c5\u3057\u3066\u308b\u6700\u4e2d\u3002<br \/>\n\u4f8b\u306e\u7bb1\u306e\u30b7\u30fc\u30f3\u306e\u5929\u4e95\u5168\u90e8\u304c\u5149\u6e90\u3067\u3042\u308b\u3088\u3046\u306a\u30b7\u30fc\u30f3\u3067\u30821\u79d2\u672a\u6e80\u3067\u63cf\u753b\u53ef\u80fd\u306a\u3082\u306e\u304c\u3059\u3067\u306b\u51fa\u6765\u3066\u3044\u308b\u3002<br \/>\n\u524d\u56de\u306eCPU\u306e\u30b3\u30fc\u30c9\u3067\u3082\u304b\u306a\u308a\u65e9\u304b\u3063\u305f\u3051\u3069\u3001\u3042\u308c\u306f\u5b9f\u8cea2\u500b\u306e\u534a\u7403\u70b9\u5149\u6e90\u3067\u8fd1\u4f3c\u3057\u305f\u3060\u3051\uff08\u3055\u3089\u306b\u8a00\u3046\u3068\u30e9\u30a4\u30c6\u30a3\u30f3\u30b0\u306e\u8a08\u7b97\u304c\u3084\u306f\u308a\u9593\u9055\u3063\u3066\u305f\uff09\u3067\u3042\u3063\u3066\u3001\u5149\u6e90\u304c\u8907\u96d1\u306a\u5f62\u3067\u3042\u308b\u5834\u5408\u3001\u8fd1\u4f3c\u306e\u7cbe\u5ea6\u3092\u4e0a\u3052\u308b\u306b\u306f\u534a\u7403\u70b9\u5149\u6e90\u306e\u6570\u3092\u5897\u3084\u3055\u306a\u3051\u308c\u3070\u306a\u3089\u305a\u3001\u4f8b\u3048\u3070\u6570\u767e\u3068\u304b\u6570\u5343\u3068\u304b\u306b\u5897\u3084\u3059\u3068\u304b\u306a\u308a\u9045\u304f\u306a\u308b\u3068\u601d\u308f\u308c\u308b\u3002<br \/>\nGPU\u3092\u4f7f\u3046\u30b3\u30fc\u30c9\u306e\u65b9\u306f\u3001\u305d\u306e\u6570\u5343\u3068\u304b\u306e\u534a\u7403\u70b9\u5149\u6e90\u3092\u73fe\u306b\u6570\u79d2\u3067\u51e6\u7406\u53ef\u80fd\u3068\u306a\u3063\u3066\u3044\u308b\u3002<br \/>\n\u305f\u3060\u5f71\u306b\u3064\u3044\u3066\u306f\u307e\u3060\u5b9f\u88c5\u3057\u3066\u304a\u3089\u305a\u3001\u9762\u5149\u6e90\u3092\u6271\u3046\u3068\u3044\u3046\u3053\u3068\u3067\u534a\u5f71\u3001\u3044\u308f\u3086\u308b\u30bd\u30d5\u30c8\u30b7\u30e3\u30c9\u30a6\u3092\u8868\u73fe\u51fa\u6765\u306a\u304d\u3083\u3044\u3051\u306a\u3044\u3093\u3060\u3051\u3069\u3001\u4eca\u306e\u3068\u3053\u308d\u305d\u306e\u5b9f\u88c5\u65b9\u6cd5\u30923\u30d1\u30bf\u30fc\u30f3\u3050\u3089\u3044\u8003\u3048\u3066\u3066\u3069\u308c\u304c\u30d9\u30b9\u30c8\u304b\u60a9\u3093\u3067\u308b\u3068\u3053\u308d\u3002<br \/>\n\u51fa\u6765\u305f\u3089\u3053\u3053\u306b\u8aac\u660e\u3092\u66f8\u304f\u4e88\u5b9a\u3002<br \/>\n\uff08\u524d\u56de\u3001\u300c\u30d9\u30a4\u30ab\u30fc\u306f\u30ec\u30f3\u30c0\u30e9\u3068\u9055\u3063\u3066\u534a\u5f71\u9818\u57df\u306e\u5168\u4f53\u304b\u3089\u898b\u305f\u6bd4\u7387\u306f\u305d\u3046\u591a\u304f\u306f\u306a\u3089\u306a\u3044\u3060\u308d\u3046\u300d\u3068\u66f8\u3044\u305f\u3051\u3069\u3001\u8907\u6570\u306e\u5149\u6e90\u304c\u96e2\u308c\u305f\u3068\u3053\u308d\u306b\u3042\u3063\u305f\u308a\u3001\u30c7\u30ab\u30a4\u9762\u5149\u6e90\u304c\u3042\u308b\u3068\u307b\u3068\u3093\u3069\u534a\u5f71\u306b\u306a\u308a\u307e\u3059\u306d\u3002\uff09<\/p>\n<h3>\u672c\u984c<\/h3>\n<p>\u305d\u306e\u30bd\u30d5\u30c8\u30b7\u30e3\u30c9\u30a6\u306e\u5b9f\u88c5\u65b9\u6cd5\u3092\u8003\u3048\u3066\u308b\u4e2d\u3067\u3075\u3068\u7591\u554f\u306b\u601d\u3063\u305f\u70b9\u304c\u3042\u3063\u305f\u306e\u3067\u3001\u305d\u308c\u306b\u3064\u3044\u3066\u4eca\u56de\u306f\u66f8\u304f\u3002<br \/>\n\u5185\u5bb9\u306f\u30bf\u30a4\u30c8\u30eb\u306e\u901a\u308a\u3002<\/p>\n<p>\u6d6e\u52d5\u5c0f\u6570\u70b9\u6570\u3092\u4f8b\u3048\u30700.1\u305a\u3064\u30a4\u30f3\u30af\u30ea\u30e1\u30f3\u30c8\u3059\u308b\u3068\u3059\u3050\u8aa4\u5dee\u304c\u8868\u9762\u5316\u3059\u308b\u306e\u306f\u3088\u304f\u77e5\u3089\u308c\u3066\u308b\u304c\u3001\u6574\u6570\u3068\u3057\u3066\u6271\u3046\u3068\u3001\u5177\u4f53\u7684\u306b\u306f1.0\u305a\u3064\u30a4\u30f3\u30af\u30ea\u30e1\u30f3\u30c8\u3059\u308b\u3068\u3069\u3046\u306a\u308b\u304b\u8abf\u3079\u3066\u307f\u305f\u3002<\/p>\n<pre class=\"brush: cpp; title: ; notranslate\" title=\"\">        float f = 0.0f;\r\n        for (long i = 0; i &lt; 123456789; i++) {\r\n            f += 1.0f;\r\n        }\r\n        printf(&quot;f = %f\\n&quot;, f);<\/pre>\n<p>\u3053\u3093\u306a\u30b3\u30fc\u30c9\u3092C\u3067\u66f8\u3044\u3066\u307f\u305f\u3093\u3060\u3051\u3069\u3001\u51fa\u529b\u306f\u306a\u3093\u3068 16777216.000000\uff08\u7d041\u51042\u5343\u4e07\u56de\u306e\u30eb\u30fc\u30d7\u306a\u306e\u306b\u7d041\u53437\u767e\u4e07\u5f31\uff09 \u3068\u306a\u308b\u3002<br \/>\n\u3057\u304b\u3057\u3053\u308c\u306f0.1\u305a\u3064\u30a4\u30f3\u30af\u30ea\u30e1\u30f3\u30c8\u3057\u305f\u5834\u5408\u306e\u3088\u3046\u306b\u8aa4\u5dee\u304c\u84c4\u7a4d\u3057\u305f\u7d50\u679c\u3067\u306f\u306a\u304f\u300116777216\u4ee5\u4e0b\u307e\u3067\u306a\u3089\u8aa4\u5dee\u306a\u304f\u30a4\u30f3\u30af\u30ea\u30e1\u30f3\u30c8\u51fa\u6765\u308b\u3002<\/p>\n<p>\u306a\u3093\u3067\u3053\u3093\u306a\u73fe\u8c61\u304c\u8d77\u304d\u308b\u304b\u3060\u3051\u3069\u3001\u4e00\u8a00\u3067\u3044\u3046\u3068\u60c5\u5831\u843d\u3061\u304c\u767a\u751f\u3057\u3066\u308b\u305b\u3044\u3002<br \/>\n\u5177\u4f53\u7684\u306a\u6a5f\u5e8f\u306f\u6b21\u306e\u3088\u3046\u306a\u611f\u3058\u3002<\/p>\n<p>float\uff08IEEE 754 32bit\uff09\u306f\u4eee\u6570\u90e823bit\u3002\u30b1\u30c1\u8868\u73fe\u3092\u5229\u7528\u3057\u3066\u308b\u306e\u3067\u6709\u52b9\u6841\u6570\u306f2\u9032\u6570\u306723 + 1\u3002<br \/>\n\u3053\u308c\u3092\u4e00\u5fdc2 ^ (23 + 1)\u3068\u3057\u3066\u307f\u308b\u306810\u9032\u6570\u306716777216\u3068\u306a\u308b\u3002<br \/>\n\u3053\u3053\u3067\u300c\u4eee\u6570\u90e8\u304c16777216\u307e\u3067\u3057\u304b\u8868\u73fe\u51fa\u6765\u306a\u3044\u306e\u304c\u539f\u56e0\u300d\u3068\u3059\u308b\u306e\u306f\u5fae\u5999\u306b\u9593\u9055\u3063\u3066\u304a\u308a\u3001\u6d6e\u52d5\u5c0f\u6570\u70b9\u306e\u4ed5\u7d44\u307f\u306b\u3064\u3044\u3066\u8aa4\u89e3\u3092\u62db\u304d\u3084\u3059\u3044\u3068\u601d\u3046\u3002<br \/>\n\u6b63\u898f\u5316\u3055\u308c\u308b\u3053\u3068\u306b\u3088\u308a\u300116777216.0f\u3068\u3044\u3046\u5927\u304d\u306a\u6570\u5b57\u304c\u305d\u306e\u307e\u307e\u4eee\u6570\u90e8\u306b16777216\u3068\u3044\u3046\u5024\u3092\u6301\u3064\u3053\u3068\u306f\u7121\u3044\u304b\u3089\u3067\u3042\u308b\u3002<br \/>\n\uff08\u975e\u6b63\u898f\u5316\u6570\u306f\u3056\u3063\u304f\u308a\u8a00\u3046\u3068\u30bc\u30ed\u4ed8\u8fd1\u306e\u5fae\u5c0f\u306a\u5024\u3092\u8868\u73fe\u3059\u308b\u305f\u3081\u306e\u3082\u306e\u3067\u4eca\u56de\u306e\u8a71\u3068\u306f\u95a2\u4fc2\u306a\u3044\u3002\uff09<\/p>\n<p>\u3067\u3001float\u3092\u52a0\u7b97\u3059\u308b\u5834\u5408\u3001\u307e\u305a\u7d76\u5bfe\u5024\u304c\u5c0f\u3055\u3044\u307b\u3046\u306e\u6307\u6570\u90e8\u304c\u5927\u304d\u3044\u307b\u3046\u306e\u6307\u6570\u90e8\u306b\u5408\u308f\u305b\u3089\u308c\u308b\u3002<br \/>\n\u3055\u3089\u306b\u5927\u304d\u3044\u65b9\u306e\u6307\u6570\u90e8\u306b\u5408\u308f\u305b\u305f\u5206\u3060\u3051\u5c0f\u3055\u3044\u65b9\u306e\u4eee\u6570\u90e8\u304c\u53f3\u30b7\u30d5\u30c8\u3055\u308c\u308b\u3002<br \/>\n\u305d\u308c\u304b\u3089\u52a0\u7b97\u304c\u884c\u308f\u308c\u308b\u3002<\/p>\n<p>1.0f\u306816777216.0f\u306e\u4f8b\u3067\u3044\u3046\u3068\u3001\u305d\u308c\u305e\u308c\u30d3\u30c3\u30c8\u5217\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u306b\u306a\u308b\u3002<br \/>\n\u5de6\u304b\u3089\u7b26\u53f7\u90e81\u30d3\u30c3\u30c8\u3001\u6307\u6570\u90e88\u30d3\u30c3\u30c8\u3001\u4eee\u6570\u90e823\u30d3\u30c3\u30c8\u3002\u5404\u90e8\u5206\u306e\u9593\u306b\u7a7a\u767d\u3092\u5165\u308c\u305f\u3002<br \/>\n\u5206\u304b\u308a\u3084\u3059\u3055\u306e\u305f\u3081\u3001\u30b1\u30c1\u8868\u73fe\u3067\u7701\u7565\u3055\u308c\u305f1\u30d3\u30c3\u30c8\uff08\u6b63\u898f\u5316\u3067\u5e38\u306b1\u306b\u306a\u308b\uff09\u3092\u62ec\u5f27\u3067\u4eee\u6570\u90e8\u306b\u4ed8\u3051\u8db3\u3057\u305f\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">       1.0f = 0 01111111 (1)00000000000000000000000\r\n16777216.0f = 0 10010111 (1)00000000000000000000000<\/pre>\n<p>\u3061\u3087\u3063\u3068\u8aac\u660e\u3092\u7aef\u6298\u308b\u3051\u3069\u3001\u305d\u308c\u305e\u308c\u6307\u6570\u90e8\u306f2\u306e\u3079\u304d\u4e57\u3092\u8868\u3057\u3066\u304a\u308a\u30011.0f\u306e\u5834\u5408\u30670\u4e57\u76f8\u5f53\uff08\u6570\u5024\u306b\u3059\u308b\u3068 2 ^ 0 = 1\uff09\u300116777216.0f\u306e\u5834\u5408\u306724\u4e57\u76f8\u5f53\uff08\u6570\u5024\u306b\u3059\u308b\u3068 2 ^ 24 = 16777216\uff09\u3068\u306a\u308b\u3002<\/p>\n<p>\u3053\u308c\u3089\u304c\u52a0\u7b97\u3055\u308c\u308b\u5834\u5408\u30011.0f\u306e\u6307\u6570\u90e8\u306f24 &#8211; 0 = 24\u5897\u3084\u3055\u308c\u308b\u3002<br \/>\n\u305d\u308c\u306b\u5408\u308f\u305b\u30661.0f\u306e\u4eee\u6570\u90e8\u304c24\u56de\u53f3\u30b7\u30d5\u30c8\u3055\u308c\u308b\u3002<\/p>\n<p>\u30b1\u30c1\u8868\u73fe\u3067\u7701\u7565\u3055\u308c\u305f1\u30d3\u30c3\u30c8\u304c24\u56de\u53f3\u306b\u79fb\u52d5\u3057\u3066\u3044\u304f\u30a4\u30e1\u30fc\u30b8\u3060\u304c\u3001\u4eee\u6570\u90e8\u306f23bit\u3057\u304b\u306a\u3044\u306e\u306724\u56de\u3082\u79fb\u52d5\u3059\u308b\u3068\u53f3\u304b\u3089\u6f0f\u308c\u3066\u3057\u307e\u3046\u3002<br \/>\n\u8a00\u3044\u63db\u3048\u308b\u3068\u4eee\u6570\u90e8\u306e\u60c5\u5831\u304c\u7121\u304f\u306a\u3063\u3066\u3057\u307e\u3044\u30011.0f\u304c0.0f\u7684\u306a\u72b6\u614b\u306b\u306a\u3063\u3066\u3057\u307e\u3046\u3002<\/p>\n<p>\u306a\u306e\u3067\u300116777216.0f\u306b\u4f55\u56de1.0f\u3092\u8db3\u3057\u3066\u3082\u4f55\u3082\u8db3\u3057\u3066\u306a\u3044\u72b6\u614b\u3068\u540c\u3058\u306b\u306a\u308b\u3002<br \/>\n\u3053\u308c\u306f\u6307\u6570\u90e8\u306e\u5dee\u304c24\u4ee5\u4e0a\u3042\u308b\u5834\u5408\u306b\u8d77\u3053\u308b\u306e\u3067\u3001\u6307\u6570\u90e8\u306e\u5dee\u304c24\u672a\u6e80\u306e\u5834\u5408\u3001\u4f8b\u3048\u307016777216.0f + 2.0f\u306f\u60c5\u5831\u843d\u3061\u3082\u8aa4\u5dee\u3082\u767a\u751f\u305b\u305a\u6b63\u78ba\u306b\u8a08\u7b97\u3055\u308c\u308b\u3002<\/p>\n<p>\u307e\u305f\u4ee5\u4e0a\u306e\u4e8b\u304b\u3089\u3001-16777216.0f\u301c16777216.0f\u307e\u3067\u306f1.0f\u523b\u307f\u3067\u5168\u3066\u306e\u6574\u6570\u3092\u8aa4\u5dee\u306a\u3057\u3067\u8868\u73fe\u51fa\u6765\u308b\u4e8b\u3082\u89e3\u308b\u3002<br \/>\n\uff08\u00b116777216.0f\u301c\u00b116777216.0f*2\u307e\u3067\u306f2.0f\u523b\u307f\u3001\u00b116777216.0f*2\u301c\u00b116777216.0f*4\u307e\u3067\u306f4.0f\u523b\u307f\u3001\u4ee5\u964d\u6307\u6570\u90e8\u304c\u8a31\u3059\u9650\u308a\u7d9a\u304f\u3002\u3068\u306a\u308b\u3053\u3068\u3082\u89e3\u308b\u3002\uff09<\/p>\n<p>\u500b\u4eba\u7684\u306b\u4eca\u8003\u3048\u3066\u308b\u7528\u9014\u3067\u306f16777216.0f\u307e\u3067\u306e\u6574\u6570\u3092\u8aa4\u5dee\u306a\u3057\u3067\u8868\u73fe\u51fa\u6765\u308b\u306a\u3089\u5168\u7136\u554f\u984c\u306a\u3044\u3051\u3069\u3001\u4e00\u5343\u4e03\u767e\u4e07\u5f31\u306a\u3093\u3066\u306e\u306f\u6700\u8fd1\u306e\u30b3\u30f3\u30d4\u30e5\u30fc\u30bf\u306b\u3068\u3063\u3066\u306f\u5927\u304d\u304f\u306a\u3044\u5024\u3060\u3057\u3001int\u3084unsigned int\u306e\u7bc4\u56f2\u3068\u6bd4\u3079\u3066\u3082\u304b\u306a\u308a\u5c0f\u3055\u3044\u306e\u3067\u3001\u4f55\u3089\u304b\u306e\u4e8b\u60c5\u304c\u7121\u3044\u9650\u308a\u306ffloat\u3092\u6574\u6570\u7684\u306b\u4f7f\u3046\u306e\u306f\u3084\u3081\u3068\u3044\u305f\u65b9\u304c\u3044\u3044\u3060\u308d\u3046\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<h3>\u3044\u304d\u306a\u308a\u4f59\u8ac7<\/h3>\n<p>\u73fe\u5728\u4f5c\u6210\u4e2d\u306e\u30a2\u30ec\u3067\u3001GPU Acceleration\u306b\u306b\u624b\u3092\u51fa\u3059\u306e\u306f\u3082\u3046\u5c11\u3057\u8db3\u5834\u3092\u56fa\u3081\u3066\u304b\u3089\u3068\u601d\u3063\u3066\u305f\u3051\u3069\u3001CPU\u3092\u4f7f\u3046\u30b3\u30fc\u30c9\u3092GPU\u3092\u4f7f\u3046\u30b3\u30fc\u30c9\u306b\u5909\u66f4\u3059\u308b\u306e\u306f\u624b\u9593\u3068\u3044\u3046\u304b\u3001\u8a2d\u8a08\u30ec\u30d9\u30eb\u304b\u3089\u5225\u7269\u306b\u306a\u308b\u304b\u3082\u3057\u308c\u306a\u3044\u3057\u3001\u3069\u3046\u305b\u6700\u7d42\u7684\u306b\u306fGPU\u4f7f\u3046\u3060\u308d\u3046\u3057\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u81ea\u5206\u306e\u4e2d\u3067GPU\u306e\u6c4e\u7528\u8a08\u7b97\u5229\u7528\u3092\u89e3\u7981\u3057\u305f\u3002<br \/>\n\u305f\u3060\u3001OpenGL\u3092\u4f7f\u3063\u305fGPGPU\u306e\u307f\u3067CUDA\u306f\u307e\u3060\u7981\u6b62\u3068\u3044\u3046\u3053\u3068\u306b\u3057\u3066\u308b\u3002<br \/>\n\u73fe\u5728\u4f5c\u6210\u4e2d\u306e\u30a2\u30ec\u3001\u3082\u3057\u304f\u306f\u305d\u306e\u6d3e\u751f\u7269\u3092\u914d\u5e03\u3059\u308b\u53ef\u80fd\u6027\u304c\u306a\u3044\u3068\u306f\u8a00\u3048\u306a\u3044\u306e\u3067\u3002<\/p>\n<p>\u73fe\u5728\u3001\u8907\u96d1\u306a\u5f62\u306e\u5927\u304d\u306a\u9762\u5149\u6e90\u304c\u3042\u3063\u3066\u3082\u7d50\u69cb\u6b63\u78ba\u3067\u9ad8\u901f\u306a\u76f4\u63a5\u7167\u660e\u306e\u8a08\u7b97\u3092GPU\u3092\u4f7f\u3063\u3066\u884c\u3046\u30b3\u30fc\u30c9\u3092\u5b9f\u88c5\u3057\u3066\u308b\u6700\u4e2d\u3002<br \/>\n\u4f8b\u306e\u7bb1\u306e\u30b7\u30fc\u30f3\u306e\u5929\u4e95\u5168\u90e8\u304c\u5149\u6e90\u3067\u3042\u308b\u3088\u3046\u306a\u30b7\u30fc\u30f3\u3067\u30821\u79d2\u672a\u6e80\u3067\u63cf\u753b\u53ef\u80fd\u306a\u3082\u306e\u304c\u3059\u3067\u306b\u51fa\u6765\u3066\u3044\u308b\u3002<br \/>\n\u524d\u56de\u306eCPU\u306e\u30b3\u30fc\u30c9\u3067\u3082\u304b\u306a\u308a\u65e9\u304b\u3063\u305f\u3051\u3069\u3001\u3042\u308c\u306f\u5b9f\u8cea2\u500b\u306e\u534a\u7403\u70b9\u5149\u6e90\u3067\u8fd1\u4f3c\u3057\u305f\u3060\u3051\uff08\u3055\u3089\u306b\u8a00\u3046\u3068\u30e9\u30a4\u30c6\u30a3\u30f3\u30b0\u306e\u8a08\u7b97\u304c\u3084\u306f\u308a\u9593\u9055\u3063\u3066\u305f\uff09\u3067\u3042\u3063\u3066\u3001\u5149\u6e90\u304c\u8907\u96d1\u306a\u5f62\u3067\u3042\u308b\u5834\u5408\u3001\u8fd1\u4f3c\u306e\u7cbe\u5ea6\u3092\u4e0a\u3052\u308b\u306b\u306f\u534a\u7403\u70b9\u5149\u6e90\u306e\u6570\u3092\u5897\u3084\u3055\u306a\u3051\u308c\u3070\u306a\u3089\u305a\u3001\u4f8b\u3048\u3070\u6570\u767e\u3068\u304b\u6570\u5343\u3068\u304b\u306b\u5897\u3084\u3059\u3068\u304b\u306a\u308a\u9045\u304f\u306a\u308b\u3068\u601d\u308f\u308c\u308b\u3002<br \/>\nGPU\u3092\u4f7f\u3046\u30b3\u30fc\u30c9\u306e\u65b9\u306f\u3001\u305d\u306e\u6570\u5343\u3068\u304b\u306e\u534a\u7403\u70b9\u5149\u6e90\u3092\u73fe\u306b\u6570\u79d2\u3067\u51e6\u7406\u53ef\u80fd\u3068\u306a\u3063\u3066\u3044\u308b\u3002<br \/>\n\u305f\u3060\u5f71\u306b\u3064\u3044\u3066\u306f\u307e\u3060\u5b9f\u88c5\u3057\u3066\u304a\u3089\u305a\u3001\u9762\u5149\u6e90\u3092\u6271\u3046\u3068\u3044\u3046\u3053\u3068\u3067\u534a\u5f71\u3001\u3044\u308f\u3086\u308b\u30bd\u30d5\u30c8\u30b7\u30e3\u30c9\u30a6\u3092\u8868\u73fe\u51fa\u6765\u306a\u304d\u3083\u3044\u3051\u306a\u3044\u3093\u3060\u3051\u3069\u3001\u4eca\u306e\u3068\u3053\u308d\u305d\u306e\u5b9f\u88c5\u65b9\u6cd5\u30923\u30d1\u30bf\u30fc\u30f3\u3050\u3089\u3044\u8003\u3048\u3066\u3066\u3069\u308c\u304c\u30d9\u30b9\u30c8\u304b\u60a9\u3093\u3067\u308b\u3068\u3053\u308d\u3002<br \/>\n\u51fa\u6765\u305f\u3089\u3053\u3053\u306b\u8aac\u660e\u3092\u66f8\u304f\u4e88\u5b9a\u3002<br \/>\n\uff08\u524d\u56de\u3001\u300c\u30d9\u30a4\u30ab\u30fc\u306f\u30ec\u30f3\u30c0\u30e9\u3068\u9055\u3063\u3066\u534a\u5f71\u9818\u57df\u306e\u5168\u4f53\u304b\u3089\u898b\u305f\u6bd4\u7387\u306f\u305d\u3046\u591a\u304f\u306f\u306a\u3089\u306a\u3044\u3060\u308d\u3046\u300d\u3068\u66f8\u3044\u305f\u3051\u3069\u3001\u8907\u6570\u306e\u5149\u6e90\u304c\u96e2\u308c\u305f\u3068\u3053\u308d\u306b\u3042\u3063\u305f\u308a\u3001\u30c7\u30ab\u30a4\u9762\u5149\u6e90\u304c\u3042\u308b\u3068\u307b\u3068\u3093\u3069\u534a\u5f71\u306b\u306a\u308a\u307e\u3059\u306d\u3002\uff09<\/p>\n<h3>\u672c\u984c<\/h3>\n<p>\u305d\u306e\u30bd\u30d5\u30c8\u30b7\u30e3\u30c9\u30a6\u306e\u5b9f\u88c5\u65b9\u6cd5\u3092\u8003\u3048\u3066\u308b\u4e2d\u3067\u3075\u3068\u7591\u554f\u306b\u601d\u3063\u305f\u70b9\u304c\u3042\u3063\u305f\u306e\u3067\u3001\u305d\u308c\u306b\u3064\u3044\u3066\u4eca\u56de\u306f\u66f8\u304f\u3002<br \/>\n\u5185\u5bb9\u306f\u30bf\u30a4\u30c8\u30eb\u306e\u901a\u308a\u3002<\/p>\n<p>\u6d6e\u52d5\u5c0f\u6570\u70b9\u6570\u3092\u4f8b\u3048\u30700.1\u305a\u3064\u30a4\u30f3\u30af\u30ea\u30e1\u30f3\u30c8\u3059\u308b\u3068\u3059\u3050\u8aa4\u5dee\u304c\u8868\u9762\u5316\u3059\u308b\u306e\u306f\u3088\u304f\u77e5\u3089\u308c\u3066\u308b\u304c\u3001\u6574\u6570\u3068\u3057\u3066\u6271\u3046\u3068\u3001\u5177\u4f53\u7684\u306b\u306f1.0\u305a\u3064\u30a4\u30f3\u30af\u30ea\u30e1\u30f3\u30c8\u3059\u308b\u3068\u3069\u3046\u306a\u308b\u304b\u8abf\u3079\u3066\u307f\u305f\u3002<\/p>\n<pre class=\"brush: cpp; title: ; notranslate\" title=\"\">        float f = 0.0f;\r\n        for (long i = 0; i &lt; 123456789; i++) {\r\n            f += 1.0f;\r\n        }\r\n        printf(&quot;f = %f\\n&quot;, f);<\/pre>\n<p>\u3053\u3093\u306a\u30b3\u30fc\u30c9\u3092C\u3067\u66f8\u3044\u3066\u307f\u305f\u3093\u3060\u3051\u3069\u3001\u51fa\u529b\u306f\u306a\u3093\u3068 16777216.000000\uff08\u7d041\u51042\u5343\u4e07\u56de\u306e\u30eb\u30fc\u30d7\u306a\u306e\u306b\u7d041\u53437\u767e\u4e07\u5f31\uff09 \u3068\u306a\u308b\u3002<br \/>\n\u3057\u304b\u3057\u3053\u308c\u306f0.1\u305a\u3064\u30a4\u30f3\u30af\u30ea\u30e1\u30f3\u30c8\u3057\u305f\u5834\u5408\u306e\u3088\u3046\u306b\u8aa4\u5dee\u304c\u84c4\u7a4d\u3057\u305f\u7d50\u679c\u3067\u306f\u306a\u304f\u300116777216\u4ee5\u4e0b\u307e\u3067\u306a\u3089\u8aa4\u5dee\u306a\u304f\u30a4\u30f3\u30af\u30ea\u30e1\u30f3\u30c8\u51fa\u6765\u308b\u3002<\/p>\n<p>\u306a\u3093\u3067\u3053\u3093\u306a\u73fe\u8c61\u304c\u8d77\u304d\u308b\u304b\u3060\u3051\u3069\u3001\u4e00\u8a00\u3067\u3044\u3046\u3068\u60c5\u5831\u843d\u3061\u304c\u767a\u751f\u3057\u3066\u308b\u305b\u3044\u3002<br \/>\n\u5177\u4f53\u7684\u306a\u6a5f\u5e8f\u306f\u6b21\u306e\u3088\u3046\u306a\u611f\u3058\u3002<\/p>\n<p>float\uff08IEEE 754 32bit\uff09\u306f\u4eee\u6570\u90e823bit\u3002\u30b1\u30c1\u8868\u73fe\u3092\u5229\u7528\u3057\u3066\u308b\u306e\u3067\u6709\u52b9\u6841\u6570\u306f2\u9032\u6570\u306723 + 1\u3002<br \/>\n\u3053\u308c\u3092\u4e00\u5fdc2 ^ (23 + 1)\u3068\u3057\u3066\u307f\u308b\u306810\u9032\u6570\u306716777216\u3068\u306a\u308b\u3002<br \/>\n\u3053\u3053\u3067\u300c\u4eee\u6570\u90e8\u304c16777216\u307e\u3067\u3057\u304b\u8868\u73fe\u51fa\u6765\u306a\u3044\u306e\u304c\u539f\u56e0\u300d\u3068\u3059\u308b\u306e\u306f\u5fae\u5999\u306b\u9593\u9055\u3063\u3066\u304a\u308a\u3001\u6d6e\u52d5\u5c0f\u6570\u70b9\u306e\u4ed5\u7d44\u307f\u306b\u3064\u3044\u3066\u8aa4\u89e3\u3092\u62db\u304d\u3084\u3059\u3044\u3068\u601d\u3046\u3002<br \/>\n\u6b63\u898f\u5316\u3055\u308c\u308b\u3053\u3068\u306b\u3088\u308a\u300116777216.0f\u3068\u3044\u3046\u5927\u304d\u306a\u6570\u5b57\u304c\u305d\u306e\u307e\u307e\u4eee\u6570\u90e8\u306b16777216\u3068\u3044\u3046\u5024\u3092\u6301\u3064\u3053\u3068\u306f\u7121\u3044\u304b\u3089\u3067\u3042\u308b\u3002<br \/>\n\uff08\u975e\u6b63\u898f\u5316\u6570\u306f\u3056\u3063\u304f\u308a\u8a00\u3046\u3068\u30bc\u30ed\u4ed8\u8fd1\u306e\u5fae\u5c0f\u306a\u5024\u3092\u8868\u73fe\u3059\u308b\u305f\u3081\u306e\u3082\u306e\u3067\u4eca\u56de\u306e\u8a71\u3068\u306f\u95a2\u4fc2\u306a\u3044\u3002\uff09<\/p>\n<p>\u3067\u3001float\u3092\u52a0\u7b97\u3059\u308b\u5834\u5408\u3001\u307e\u305a\u7d76\u5bfe\u5024\u304c\u5c0f\u3055\u3044\u307b\u3046\u306e\u6307\u6570\u90e8\u304c\u5927\u304d\u3044\u307b\u3046\u306e\u6307\u6570\u90e8\u306b\u5408\u308f\u305b\u3089\u308c\u308b\u3002<br \/>\n\u3055\u3089\u306b\u5927\u304d\u3044\u65b9\u306e\u6307\u6570\u90e8\u306b\u5408\u308f\u305b\u305f\u5206\u3060\u3051\u5c0f\u3055\u3044\u65b9\u306e\u4eee\u6570\u90e8\u304c\u53f3\u30b7\u30d5\u30c8\u3055\u308c\u308b\u3002<br \/>\n\u305d\u308c\u304b\u3089\u52a0\u7b97\u304c\u884c\u308f\u308c\u308b\u3002<\/p>\n<p>1.0f\u306816777216.0f\u306e\u4f8b\u3067\u3044\u3046\u3068\u3001\u305d\u308c\u305e\u308c\u30d3\u30c3\u30c8\u5217\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u306b\u306a\u308b\u3002<br \/>\n\u5de6\u304b\u3089\u7b26\u53f7\u90e81\u30d3\u30c3\u30c8\u3001\u6307\u6570\u90e88\u30d3\u30c3\u30c8\u3001\u4eee\u6570\u90e823\u30d3\u30c3\u30c8\u3002\u5404\u90e8\u5206\u306e\u9593\u306b\u7a7a\u767d\u3092\u5165\u308c\u305f\u3002<br \/>\n\u5206\u304b\u308a\u3084\u3059\u3055\u306e\u305f\u3081\u3001\u30b1\u30c1\u8868\u73fe\u3067\u7701\u7565\u3055\u308c\u305f1\u30d3\u30c3\u30c8\uff08\u6b63\u898f\u5316\u3067\u5e38\u306b1\u306b\u306a\u308b\uff09\u3092\u62ec\u5f27\u3067\u4eee\u6570\u90e8\u306b\u4ed8\u3051\u8db3\u3057\u305f\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">       1.0f = 0 01111111 (1)00000000000000000000000\r\n16777216.0f = 0 10010111 (1)00000000000000000000000<\/pre>\n<p>\u3061\u3087\u3063\u3068\u8aac\u660e\u3092\u7aef\u6298\u308b\u3051\u3069\u3001\u305d\u308c\u305e\u308c\u6307\u6570\u90e8\u306f2\u306e\u3079\u304d\u4e57\u3092\u8868\u3057\u3066\u304a\u308a\u30011.0f\u306e\u5834\u5408\u30670\u4e57\u76f8\u5f53\uff08\u6570\u5024\u306b\u3059\u308b\u3068 2 ^ 0 = 1\uff09\u300116777216.0f\u306e\u5834\u5408\u306724\u4e57\u76f8\u5f53\uff08\u6570\u5024\u306b\u3059\u308b\u3068 2 ^ 24 = 16777216\uff09\u3068\u306a\u308b\u3002<\/p>\n<p>\u3053\u308c\u3089\u304c\u52a0\u7b97\u3055\u308c\u308b\u5834\u5408\u30011.0f\u306e\u6307\u6570\u90e8\u306f24 &#8211; 0 = 24\u5897\u3084\u3055\u308c\u308b\u3002<br \/>\n\u305d\u308c\u306b\u5408\u308f\u305b\u30661.0f\u306e\u4eee\u6570\u90e8\u304c24\u56de\u53f3\u30b7\u30d5\u30c8\u3055\u308c\u308b\u3002<\/p>\n<p>\u30b1\u30c1\u8868\u73fe\u3067\u7701\u7565\u3055\u308c\u305f1\u30d3\u30c3\u30c8\u304c24\u56de\u53f3\u306b\u79fb\u52d5\u3057\u3066\u3044\u304f\u30a4\u30e1\u30fc\u30b8\u3060\u304c\u3001\u4eee\u6570\u90e8\u306f23bit\u3057\u304b\u306a\u3044\u306e\u306724\u56de\u3082\u79fb\u52d5\u3059\u308b\u3068\u53f3\u304b\u3089\u6f0f\u308c\u3066\u3057\u307e\u3046\u3002<br \/>\n\u8a00\u3044\u63db\u3048\u308b\u3068\u4eee\u6570\u90e8\u306e\u60c5\u5831\u304c\u7121\u304f\u306a\u3063\u3066\u3057\u307e\u3044\u30011.0f\u304c0.0f\u7684\u306a\u72b6\u614b\u306b\u306a\u3063\u3066\u3057\u307e\u3046\u3002<\/p>\n<p>\u306a\u306e\u3067\u300116777216.0f\u306b\u4f55\u56de1.0f\u3092\u8db3\u3057\u3066\u3082\u4f55\u3082\u8db3\u3057\u3066\u306a\u3044\u72b6\u614b\u3068\u540c\u3058\u306b\u306a\u308b\u3002<br \/>\n\u3053\u308c\u306f\u6307\u6570\u90e8\u306e\u5dee\u304c24\u4ee5\u4e0a\u3042\u308b\u5834\u5408\u306b\u8d77\u3053\u308b\u306e\u3067\u3001\u6307\u6570\u90e8\u306e\u5dee\u304c24\u672a\u6e80\u306e\u5834\u5408\u3001\u4f8b\u3048\u307016777216.0f + 2.0f\u306f\u60c5\u5831\u843d\u3061\u3082\u8aa4\u5dee\u3082\u767a\u751f\u305b\u305a\u6b63\u78ba\u306b\u8a08\u7b97\u3055\u308c\u308b\u3002<\/p>\n<p>\u307e\u305f\u4ee5\u4e0a\u306e\u4e8b\u304b\u3089\u3001-16777216.0f\u301c16777216.0f\u307e\u3067\u306f1.0f\u523b\u307f\u3067\u5168\u3066\u306e\u6574\u6570\u3092\u8aa4\u5dee\u306a\u3057\u3067\u8868\u73fe\u51fa\u6765\u308b\u4e8b\u3082\u89e3\u308b\u3002<br \/>\n\uff08\u00b116777216.0f\u301c\u00b116777216.0f*2\u307e\u3067\u306f2.0f\u523b\u307f\u3001\u00b116777216.0f*2\u301c\u00b116777216.0f*4\u307e\u3067\u306f4.0f\u523b\u307f\u3001\u4ee5\u964d\u6307\u6570\u90e8\u304c\u8a31\u3059\u9650\u308a\u7d9a\u304f\u3002\u3068\u306a\u308b\u3053\u3068\u3082\u89e3\u308b\u3002\uff09<\/p>\n<p>\u500b\u4eba\u7684\u306b\u4eca\u8003\u3048\u3066\u308b\u7528\u9014\u3067\u306f16777216.0f\u307e\u3067\u306e\u6574\u6570\u3092\u8aa4\u5dee\u306a\u3057\u3067\u8868\u73fe\u51fa\u6765\u308b\u306a\u3089\u5168\u7136\u554f\u984c\u306a\u3044\u3051\u3069\u3001\u4e00\u5343\u4e03\u767e\u4e07\u5f31\u306a\u3093\u3066\u306e\u306f\u6700\u8fd1\u306e\u30b3\u30f3\u30d4\u30e5\u30fc\u30bf\u306b\u3068\u3063\u3066\u306f\u5927\u304d\u304f\u306a\u3044\u5024\u3060\u3057\u3001int\u3084unsigned int\u306e\u7bc4\u56f2\u3068\u6bd4\u3079\u3066\u3082\u304b\u306a\u308a\u5c0f\u3055\u3044\u306e\u3067\u3001\u4f55\u3089\u304b\u306e\u4e8b\u60c5\u304c\u7121\u3044\u9650\u308a\u306ffloat\u3092\u6574\u6570\u7684\u306b\u4f7f\u3046\u306e\u306f\u3084\u3081\u3068\u3044\u305f\u65b9\u304c\u3044\u3044\u3060\u308d\u3046\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[32],"tags":[],"class_list":["post-2418","post","type-post","status-publish","format-standard","hentry","category-tech"],"_links":{"self":[{"href":"https:\/\/peta.okechan.net\/blog\/wp-json\/wp\/v2\/posts\/2418","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/peta.okechan.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/peta.okechan.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/peta.okechan.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/peta.okechan.net\/blog\/wp-json\/wp\/v2\/comments?post=2418"}],"version-history":[{"count":0,"href":"https:\/\/peta.okechan.net\/blog\/wp-json\/wp\/v2\/posts\/2418\/revisions"}],"wp:attachment":[{"href":"https:\/\/peta.okechan.net\/blog\/wp-json\/wp\/v2\/media?parent=2418"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/peta.okechan.net\/blog\/wp-json\/wp\/v2\/categories?post=2418"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/peta.okechan.net\/blog\/wp-json\/wp\/v2\/tags?post=2418"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}