<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>toburau</author_name>
  <author_url>https://blog.hatena.ne.jp/toburau/</author_url>
  <blog_title>ゲームが作れるようになるまでがんばる日記</blog_title>
  <blog_url>https://toburau.hatenablog.jp/</blog_url>
  <categories>
    <anon>雑記</anon>
  </categories>
  <description>ゲームプログラマになる前に覚えておきたい技術で次のような気になる文章が。 float変数に1を1億回足した答えは1677万だ。 floatの演算で計算誤差が出ることは知っていたけど、そこまで精度が無いとは。 ということで実際に試してみた。 #include &lt;iostream&gt; using namespace std; int main() { float sum = 0.0f; for(int i=0; i&lt;100000000; ++i) { sum += 1.0f; } cout.setf(ios::fixed); cout &lt;&lt; sum; } 実行結果 16777216.000000 お…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Ftoburau.hatenablog.jp%2Fentry%2F20120114%2F1326558361&quot; title=&quot;floatの精度 - ゲームが作れるようになるまでがんばる日記&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2012-01-14 01:26:01</published>
  <title>floatの精度</title>
  <type>rich</type>
  <url>https://toburau.hatenablog.jp/entry/20120114/1326558361</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
