{"published":"2013-11-12 16:05:30","author_url":"https://blog.hatena.ne.jp/ayaketan/","categories":["Ruby"],"url":"https://ayaketan.hatenablog.com/entry/2013/11/12/160530","blog_url":"https://ayaketan.hatenablog.com/","provider_url":"https://hatena.blog","version":"1.0","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fayaketan.hatenablog.com%2Fentry%2F2013%2F11%2F12%2F160530\" title=\"\u5c0f\u6570\u7b2c2\u4f4d\u4ee5\u4e0b\u306e\u5207\u308a\u6368\u3066 - ayaketan\u306e\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u52c9\u5f37\u65e5\u8a18\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","image_url":null,"provider_name":"Hatena Blog","height":"190","blog_title":"ayaketan\u306e\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u52c9\u5f37\u65e5\u8a18","type":"rich","author_name":"ayaketan","description":"\u9054\u6210\u7387\u3092\u5c0f\u6570\u7b2c1\u4f4d\u307e\u3067\u8868\u793a\u3057\u305f\u304b\u3063\u305f\u3002\u5f53\u521d\u4e0b\u8a18\u306e\u3088\u3046\u306b\u8a18\u8f09\u3057\u3066\u3044\u305f\u304c\u3001\u56db\u6368\u4e94\u5165\u304c\u884c\u308f\u308c\u308b\u305f\u3081\u3001\u9054\u6210\u7387\u304c99.99\uff05\u306e\u5834\u5408\u3001100.0\uff05\u3068\u306a\u3063\u3066\u3057\u307e\u3046\u3002 sprintf(\"%.1f\", numerator.to_f/denominator*100) \u8abf\u3079\u305f\u3068\u3053\u308d\u3001BigDecimal\u3068\u3044\u3046\u53ef\u5909\u9577\u6d6e\u52d5\u5c0f\u6570\u70b9\u8a08\u7b97\u6a5f\u80fd\u30e9\u30a4\u30d6\u30e9\u30ea\u304c\u3042\u308b\u305d\u3046\u3067\u3059\u3002 \u4e0b\u8a18\u306e\u3088\u3046\u306b\u8a18\u8f09\u3059\u308b\u3068\u3001\u5c0f\u6570\u7b2c2\u4f4d\u4ee5\u4e0b\u306e\u5207\u308a\u6368\u3066\u304c\u884c\u3048\u307e\u3059\u3002 sprintf(\"%.1f\", BigDecimal(\"#{numerator.to_f/denominator*100}\").floor(1)) \u53c2\u8003\uff1a BRAIN: Ruby on Rails \u2026","width":"100%","title":"\u5c0f\u6570\u7b2c2\u4f4d\u4ee5\u4e0b\u306e\u5207\u308a\u6368\u3066"}