<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Rounding on 每日拍拍</title>
    <link>https://dailypypy.org/tags/rounding/</link>
    <description>Recent content in Rounding on 每日拍拍</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>zh-tw</language>
    <copyright>© 2026 每日拍拍</copyright>
    <lastBuildDate>Sun, 18 Oct 2026 12:37:00 +0800</lastBuildDate><atom:link href="https://dailypypy.org/tags/rounding/index.xml" rel="self" type="application/rss+xml" />
    <follow_challenge>
      <feedId>155076163427069952</feedId>
      <userId>154825760438254592</userId>
    </follow_challenge>
    
    
    <item>
      <title>Python Decimal 實戰：精度、捨入規則與金額計算契約</title>
      <link>https://dailypypy.org/learn/python-decimal-rounding-contracts/</link>
      <pubDate>Sun, 18 Oct 2026 12:37:00 +0800</pubDate>
      
      <guid>https://dailypypy.org/learn/python-decimal-rounding-contracts/</guid>
      <description>&lt;!---
1440x768
prompt: masterpiece, best quality, highres, clean anime illustration, japanese anime style, soft shading, flat color design, 1girl, black hair, green eyes, white off-shoulder shirt, black short skirt, eye-level side profile medium shot with face turned toward viewer, sitting upright on a rounded stool with hands resting gently on knees, bright relaxed laugh, looking at viewer, pastel powder blue and pale lemon background, two subtle smooth translucent spheres balanced symmetrically without symbols or markings, neat composition, detailed eyes, cute and smart vibe, minimal background, polished illustration, no text
negative prompt: worst quality, bad eye, bad hand, extra limbs, manga, multiple views, monochrome, text, signature
dedup note: Focused arithmetic-policy follow-up to ../python-json/, whose Decimal coverage concerns parse_float and one output quantize example. This post instead covers significant-digit contexts, explicit negative/tie rounding, exponent versus increment, Inexact/Rounded, bounded fixed-point admission, rounding placement and executable contracts. It does not rebuild JSON encoders, JSONL conversion, pandas cleaning or NumPy arrays. Strict 194-post source inventory checked before drafting; planned python-venv-comparison was already published and left unchanged.
source check: Python 3.14 decimal reference and floating-point tutorial reviewed on 2026-10-18. All monetary policies below are fictional application contracts, not universal currency rules.
verification: Python 3.14.3 / pytest 9.1.1; nine Python blocks parsed, seven standalone examples executed, 23 pytest cases passed, and additional tie/direction/input/context/representation assertions passed. Final source comparison max character 5-gram Jaccard 0.04288 against python-warnings-deprecation-ci (shared testing boilerplate; distinct domain), 0.04065 against python-json. Related links and privacy checks passed. Cover DAILYPYPY_00139_.png from prompt 0f2cf215-31c4-4924-8eee-60f4f24d8a63 verified PNG 1440x768 and visually inspected: no text, face or material anatomy artifacts.
publication note: Randomized date retained; past publishDate permits the morning release with buildFuture=false.
---&gt;

&lt;h2 class=&#34;relative group&#34;&gt;一. 前言：換成 Decimal，為什麼還差一分？ 
    &lt;div id=&#34;一-前言換成-decimal為什麼還差一分&#34; class=&#34;anchor&#34;&gt;&lt;/div&gt;
    
    &lt;span
        class=&#34;absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100&#34;&gt;
        &lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34;
            style=&#34;text-decoration-line: none !important;&#34; href=&#34;#%e4%b8%80-%e5%89%8d%e8%a8%80%e6%8f%9b%e6%88%90-decimal%e7%82%ba%e4%bb%80%e9%ba%bc%e9%82%84%e5%b7%ae%e4%b8%80%e5%88%86&#34; aria-label=&#34;定位點&#34;&gt;#&lt;/a&gt;
    &lt;/span&gt;        
    
&lt;/h2&gt;
&lt;p&gt;嗨，我是拍拍君！今天來處理一個很容易吵起來的 bug。&lt;/p&gt;</description>
      <media:content xmlns:media="http://search.yahoo.com/mrss/" url="https://dailypypy.org/learn/python-decimal-rounding-contracts/featured.png" />
    </item>
    
  </channel>
</rss>
