<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>ayaketan</author_name>
  <author_url>https://blog.hatena.ne.jp/ayaketan/</author_url>
  <blog_title>ayaketanのプログラミング勉強日記</blog_title>
  <blog_url>https://ayaketan.hatenablog.com/</blog_url>
  <categories>
    <anon>Ruby</anon>
  </categories>
  <description>達成率を小数第1位まで表示したかった。当初下記のように記載していたが、四捨五入が行われるため、達成率が99.99％の場合、100.0％となってしまう。 sprintf(&quot;%.1f&quot;, numerator.to_f/denominator*100) 調べたところ、BigDecimalという可変長浮動小数点計算機能ライブラリがあるそうです。 下記のように記載すると、小数第2位以下の切り捨てが行えます。 sprintf(&quot;%.1f&quot;, BigDecimal(&quot;#{numerator.to_f/denominator*100}&quot;).floor(1)) 参考： BRAIN: Ruby on Rails …</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fayaketan.hatenablog.com%2Fentry%2F2013%2F11%2F12%2F160530&quot; title=&quot;小数第2位以下の切り捨て - ayaketanのプログラミング勉強日記&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>2013-11-12 16:05:30</published>
  <title>小数第2位以下の切り捨て</title>
  <type>rich</type>
  <url>https://ayaketan.hatenablog.com/entry/2013/11/12/160530</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
