<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>aa_debdeb</author_name>
  <author_url>https://blog.hatena.ne.jp/aa_debdeb/</author_url>
  <blog_title>技術的なメモ</blog_title>
  <blog_url>https://aa-debdeb.hatenablog.com/</blog_url>
  <categories>
    <anon>C++</anon>
  </categories>
  <description>小数点第一桁で四捨五入したい場合は，0.5を足してからint型に変換（切り下げ）すればいい．小数点第n桁以下で四捨五入したい場合は，10n - 1倍してから，0.5を足してint型に変換．その後，10n - 1で割り直す． #include &lt;cstdio&gt; int main(){ float f1 = 5.4; printf(&quot;%f\n&quot;, float(int(f1 + 0.5))); // 5.000000 float f2 = 3.8; printf(&quot;%f\n&quot;, float(int(f2 + 0.5))); // 4.000000 float f3 = 2.63; printf(&quot;%…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Faa-debdeb.hatenablog.com%2Fentry%2F2015%2F12%2F25%2F185042&quot; title=&quot;C++で四捨五入する - 技術的なメモ&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>2015-12-25 18:50:42</published>
  <title>C++で四捨五入する</title>
  <type>rich</type>
  <url>https://aa-debdeb.hatenablog.com/entry/2015/12/25/185042</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
