<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>gothedistance</author_name>
  <author_url>https://blog.hatena.ne.jp/gothedistance/</author_url>
  <blog_title>Life is Really Short, Have Your Life!!</blog_title>
  <blog_url>https://aroundthedistance.hatenadiary.jp/</blog_url>
  <categories>
    <anon>Python</anon>
  </categories>
  <description>まじかよ... dev.classmethod.jp decimalモジュールに記載がある通り、float型ではなくstr型にすることで回避できます。 ですので、実装時にはstr型にキャストしたほうが良いと思います。 &gt;&gt;&gt; from decimal import Decimal, ROUND_HALF_UP &gt;&gt;&gt; (Decimal(1750) * Decimal(0.43)).quantize(Decimal(&quot;0&quot;), rounding=ROUND_HALF_UP) Decimal(752) 四捨五入出来てない・・・ &gt;&gt;&gt; from decimal import Decimal, RO…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Faroundthedistance.hatenadiary.jp%2Fentry%2F2023%2F09%2F01%2F164553&quot; title=&quot;Pythonで小数点の計算をする時、strでキャストすべし... - Life is Really Short, Have Your Life!!&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>2023-09-01 16:45:53</published>
  <title>Pythonで小数点の計算をする時、strでキャストすべし...</title>
  <type>rich</type>
  <url>https://aroundthedistance.hatenadiary.jp/entry/2023/09/01/164553</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
