{"id":80833,"date":"2024-03-20T23:13:15","date_gmt":"2024-03-20T14:13:15","guid":{"rendered":"https:\/\/www.silicloud.com\/ja\/blog\/python%e3%81%aedecimal%e9%96%a2%e6%95%b0%e3%81%ae%e5%88%a9%e7%94%a8%e6%96%b9%e6%b3%95\/"},"modified":"2025-08-12T13:41:14","modified_gmt":"2025-08-12T04:41:14","slug":"python%e3%81%aedecimal%e9%96%a2%e6%95%b0%e3%81%ae%e5%88%a9%e7%94%a8%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/ja\/blog\/python%e3%81%aedecimal%e9%96%a2%e6%95%b0%e3%81%ae%e5%88%a9%e7%94%a8%e6%96%b9%e6%b3%95\/","title":{"rendered":"Python\u306edecimal\u95a2\u6570\u306e\u5229\u7528\u65b9\u6cd5"},"content":{"rendered":"<p>Python\u3067\u306f\u3001decimal\u95a2\u6570\u306fDecimal\u30af\u30e9\u30b9\u306e\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u3067\u3059\u3002Decimal\u30af\u30e9\u30b9\u306f\u3001\u6d6e\u52d5\u5c0f\u6570\u70b9\u6570\u306e\u8a08\u7b97\u3067\u767a\u751f\u3059\u308b\u7cbe\u5ea6\u640d\u5931\u306e\u554f\u984c\u3092\u56de\u907f\u3059\u308b\u305f\u3081\u306b\u3001\u9ad8\u7cbe\u5ea6\u6f14\u7b97\u306b\u4f7f\u7528\u3055\u308c\u308b\u30c7\u30fc\u30bf\u578b\u3067\u3059\u3002<\/p>\n<p>decimal \u95a2\u6570\u306e\u4e00\u822c\u7684\u306a\u4f7f\u3044\u65b9\u306f\u3001\u6b21\u306e\u3068\u304a\u308a\u3067\u3059\u3002<\/p>\n<ol>\n<li>Decimal\u30e2\u30b8\u30e5\u30fc\u30eb\u304b\u3089Decimal\u3092\u30a4\u30f3\u30dd\u30fc\u30c8<\/li>\n<li>decimal_number = Decimal(&#8216;10.5&#8217;)<\/li>\n<\/ol>\n<p>Decimal\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u4f5c\u6210\u3059\u308b\u306b\u306f\u3001\u5fc5\u8981\u306b\u5fdc\u3058\u3066decimal\u95a2\u6570\u306b\u3055\u307e\u3056\u307e\u306a\u5f15\u6570\u3092\u6e21\u305b\u307e\u3059\uff1a<\/p>\n<ol>\n<li>\u6574\u6570\u3092Decimal\u578b\u306b\u5909\u63db\uff1adecimal_number = Decimal(10)<\/li>\n<li>\u6587\u5b57\u5217: decimal_number = Decimal(&#8216;10.5&#8217;)<\/li>\n<li>\u30bf\u30d7\u30eb decimal_number \u306f Decimal ((0, (3, 1, 4), -2)) \u306b\u306a\u308a\u307e\u3059\u3002\u30bf\u30d7\u30eb\u3067\u306f\u3001\u6700\u521d\u306e\u8981\u7d20\u306f\u7b26\u53f7\u4ed8\u304d\u6570\u5b57\uff080 \u306f\u6b63\u6570\u3092\u8868\u3057\u30011 \u306f\u8ca0\u6570\u3092\u8868\u3059\uff09\u30012 \u756a\u76ee\u306e\u8981\u7d20\u306f\u6574\u6570\u90e8\u5206\u306e\u30bf\u30d7\u30eb\u30013 \u756a\u76ee\u306e\u8981\u7d20\u306f\u6307\u6570\uff08-2 \u306f 10 \u306e 2 \u4e57\u5206\u306e 1 \u3092\u8868\u3059\uff09\u3067\u3059\u3002<\/li>\n<\/ol>\n<p>\u5341\u9032\u6570\u5024\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306f\u3001\u5e83\u7bc4\u306a\u6570\u5b66\u6f14\u7b97\u3092\u5b9f\u884c\u3067\u304d\u308b\u3060\u3051\u3067\u306a\u304f\u3001\u9ad8\u3044\u7cbe\u5ea6\u3082\u7dad\u6301\u3067\u304d\u307e\u3059\u3002\u305f\u3068\u3048\u3070\u3001<\/p>\n<pre class=\"post-pre\"><code>from decimal import Decimal\r\n\r\nx = Decimal('0.1') + Decimal('0.1') + Decimal('0.1')\r\nprint(x)  # \u8f93\u51fa\uff1a0.3\r\n<\/code><\/pre>\n<p>\u306a\u304a\u3001Decimal\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3067\u8a08\u7b97\u3092\u884c\u3063\u305f\u5834\u5408\u306e\u7d50\u679c\u3082Decimal\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306b\u306a\u308b\u305f\u3081\u3001\u5fc5\u8981\u306b\u5fdc\u3058\u3066str() \u3084 float() \u306a\u3069\u306e\u95a2\u6570\u3067\u6587\u5b57\u5217\u3084\u6d6e\u52d5\u5c0f\u6570\u70b9\u6570\u306b\u5909\u63db\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Python\u3067\u306f\u3001decimal\u95a2\u6570\u306fDecimal\u30af\u30e9\u30b9\u306e\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u3067\u3059\u3002Decimal\u30af\u30e9\u30b9\u306f\u3001\u6d6e\u52d5\u5c0f\u6570\u70b9\u6570\u306e\u8a08\u7b97\u3067\u767a\u751f\u3059\u308b\u7cbe\u5ea6\u640d\u5931\u306e\u554f\u984c\u3092\u56de\u907f\u3059\u308b\u305f\u3081\u306b\u3001\u9ad8\u7cbe\u5ea6\u6f14\u7b97\u306b\u4f7f\u7528\u3055\u308c\u308b\u30c7\u30fc\u30bf\u578b\u3067\u3059\u3002 decimal \u95a2 [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[31,26],"class_list":["post-80833","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-python","tag-26"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Python\u306edecimal\u95a2\u6570\u306e\u5229\u7528\u65b9\u6cd5 - Blog - Silicon Cloud<\/title>\n<meta name=\"description\" content=\"Python\u306edecimal\u95a2\u6570\u306e\u5229\u7528\u65b9\u6cd5\u3092\u5206\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac\u3002\u5b9f\u8df5\u7684\u306a\u4f8b\u3068\u30b3\u30fc\u30c9\u3001\u6ce8\u610f\u70b9\u3092\u542b\u3081\u3066\u521d\u5fc3\u8005\u306b\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u8aac\u660e\u3057\u307e\u3059\u3002\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.silicloud.com\/ja\/blog\/python\u306edecimal\u95a2\u6570\u306e\u5229\u7528\u65b9\u6cd5\/\" \/>\n<meta property=\"og:locale\" content=\"ja_JP\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python\u306edecimal\u95a2\u6570\u306e\u5229\u7528\u65b9\u6cd5\" \/>\n<meta property=\"og:description\" content=\"Python\u306edecimal\u95a2\u6570\u306e\u5229\u7528\u65b9\u6cd5\u3092\u5206\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac\u3002\u5b9f\u8df5\u7684\u306a\u4f8b\u3068\u30b3\u30fc\u30c9\u3001\u6ce8\u610f\u70b9\u3092\u542b\u3081\u3066\u521d\u5fc3\u8005\u306b\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u8aac\u660e\u3057\u307e\u3059\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/ja\/blog\/python\u306edecimal\u95a2\u6570\u306e\u5229\u7528\u65b9\u6cd5\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2024-03-20T14:13:15+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-08-12T04:41:14+00:00\" \/>\n<meta name=\"author\" content=\"\u685c, \u6625\u6a39\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u57f7\u7b46\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u685c, \u6625\u6a39\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u63a8\u5b9a\u8aad\u307f\u53d6\u308a\u6642\u9593\" \/>\n\t<meta name=\"twitter:data2\" content=\"2\u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/python%e3%81%aedecimal%e9%96%a2%e6%95%b0%e3%81%ae%e5%88%a9%e7%94%a8%e6%96%b9%e6%b3%95\/\",\"url\":\"https:\/\/www.silicloud.com\/ja\/blog\/python%e3%81%aedecimal%e9%96%a2%e6%95%b0%e3%81%ae%e5%88%a9%e7%94%a8%e6%96%b9%e6%b3%95\/\",\"name\":\"Python\u306edecimal\u95a2\u6570\u306e\u5229\u7528\u65b9\u6cd5 - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#website\"},\"datePublished\":\"2024-03-20T14:13:15+00:00\",\"dateModified\":\"2025-08-12T04:41:14+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/ff22288af1a5455571aff7586b0fb341\"},\"description\":\"Python\u306edecimal\u95a2\u6570\u306e\u5229\u7528\u65b9\u6cd5\u3092\u5206\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac\u3002\u5b9f\u8df5\u7684\u306a\u4f8b\u3068\u30b3\u30fc\u30c9\u3001\u6ce8\u610f\u70b9\u3092\u542b\u3081\u3066\u521d\u5fc3\u8005\u306b\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u8aac\u660e\u3057\u307e\u3059\u3002\",\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/python%e3%81%aedecimal%e9%96%a2%e6%95%b0%e3%81%ae%e5%88%a9%e7%94%a8%e6%96%b9%e6%b3%95\/#breadcrumb\"},\"inLanguage\":\"ja\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/ja\/blog\/python%e3%81%aedecimal%e9%96%a2%e6%95%b0%e3%81%ae%e5%88%a9%e7%94%a8%e6%96%b9%e6%b3%95\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/python%e3%81%aedecimal%e9%96%a2%e6%95%b0%e3%81%ae%e5%88%a9%e7%94%a8%e6%96%b9%e6%b3%95\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.silicloud.com\/ja\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Python\u306edecimal\u95a2\u6570\u306e\u5229\u7528\u65b9\u6cd5\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/ja\/blog\/\",\"name\":\"Blog - Silicon Cloud\",\"description\":\"\",\"inLanguage\":\"ja\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/ff22288af1a5455571aff7586b0fb341\",\"name\":\"\u685c, \u6625\u6a39\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/cee48863f3d4fd7fef222498f3e71b82312aee42b7257a2dbde56394ca4e19de?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/cee48863f3d4fd7fef222498f3e71b82312aee42b7257a2dbde56394ca4e19de?s=96&d=mm&r=g\",\"caption\":\"\u685c, \u6625\u6a39\"},\"url\":\"https:\/\/www.silicloud.com\/ja\/blog\/author\/sakuraharuki\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/python%e3%81%aedecimal%e9%96%a2%e6%95%b0%e3%81%ae%e5%88%a9%e7%94%a8%e6%96%b9%e6%b3%95\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Python\u306edecimal\u95a2\u6570\u306e\u5229\u7528\u65b9\u6cd5 - Blog - Silicon Cloud","description":"Python\u306edecimal\u95a2\u6570\u306e\u5229\u7528\u65b9\u6cd5\u3092\u5206\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac\u3002\u5b9f\u8df5\u7684\u306a\u4f8b\u3068\u30b3\u30fc\u30c9\u3001\u6ce8\u610f\u70b9\u3092\u542b\u3081\u3066\u521d\u5fc3\u8005\u306b\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u8aac\u660e\u3057\u307e\u3059\u3002","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.silicloud.com\/ja\/blog\/python\u306edecimal\u95a2\u6570\u306e\u5229\u7528\u65b9\u6cd5\/","og_locale":"ja_JP","og_type":"article","og_title":"Python\u306edecimal\u95a2\u6570\u306e\u5229\u7528\u65b9\u6cd5","og_description":"Python\u306edecimal\u95a2\u6570\u306e\u5229\u7528\u65b9\u6cd5\u3092\u5206\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac\u3002\u5b9f\u8df5\u7684\u306a\u4f8b\u3068\u30b3\u30fc\u30c9\u3001\u6ce8\u610f\u70b9\u3092\u542b\u3081\u3066\u521d\u5fc3\u8005\u306b\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u8aac\u660e\u3057\u307e\u3059\u3002","og_url":"https:\/\/www.silicloud.com\/ja\/blog\/python\u306edecimal\u95a2\u6570\u306e\u5229\u7528\u65b9\u6cd5\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2024-03-20T14:13:15+00:00","article_modified_time":"2025-08-12T04:41:14+00:00","author":"\u685c, \u6625\u6a39","twitter_card":"summary_large_image","twitter_misc":{"\u57f7\u7b46\u8005":"\u685c, \u6625\u6a39","\u63a8\u5b9a\u8aad\u307f\u53d6\u308a\u6642\u9593":"2\u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/ja\/blog\/python%e3%81%aedecimal%e9%96%a2%e6%95%b0%e3%81%ae%e5%88%a9%e7%94%a8%e6%96%b9%e6%b3%95\/","url":"https:\/\/www.silicloud.com\/ja\/blog\/python%e3%81%aedecimal%e9%96%a2%e6%95%b0%e3%81%ae%e5%88%a9%e7%94%a8%e6%96%b9%e6%b3%95\/","name":"Python\u306edecimal\u95a2\u6570\u306e\u5229\u7528\u65b9\u6cd5 - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/ja\/blog\/#website"},"datePublished":"2024-03-20T14:13:15+00:00","dateModified":"2025-08-12T04:41:14+00:00","author":{"@id":"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/ff22288af1a5455571aff7586b0fb341"},"description":"Python\u306edecimal\u95a2\u6570\u306e\u5229\u7528\u65b9\u6cd5\u3092\u5206\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac\u3002\u5b9f\u8df5\u7684\u306a\u4f8b\u3068\u30b3\u30fc\u30c9\u3001\u6ce8\u610f\u70b9\u3092\u542b\u3081\u3066\u521d\u5fc3\u8005\u306b\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u8aac\u660e\u3057\u307e\u3059\u3002","breadcrumb":{"@id":"https:\/\/www.silicloud.com\/ja\/blog\/python%e3%81%aedecimal%e9%96%a2%e6%95%b0%e3%81%ae%e5%88%a9%e7%94%a8%e6%96%b9%e6%b3%95\/#breadcrumb"},"inLanguage":"ja","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/ja\/blog\/python%e3%81%aedecimal%e9%96%a2%e6%95%b0%e3%81%ae%e5%88%a9%e7%94%a8%e6%96%b9%e6%b3%95\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/ja\/blog\/python%e3%81%aedecimal%e9%96%a2%e6%95%b0%e3%81%ae%e5%88%a9%e7%94%a8%e6%96%b9%e6%b3%95\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.silicloud.com\/ja\/blog\/"},{"@type":"ListItem","position":2,"name":"Python\u306edecimal\u95a2\u6570\u306e\u5229\u7528\u65b9\u6cd5"}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/ja\/blog\/#website","url":"https:\/\/www.silicloud.com\/ja\/blog\/","name":"Blog - Silicon Cloud","description":"","inLanguage":"ja"},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/ff22288af1a5455571aff7586b0fb341","name":"\u685c, \u6625\u6a39","image":{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/cee48863f3d4fd7fef222498f3e71b82312aee42b7257a2dbde56394ca4e19de?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/cee48863f3d4fd7fef222498f3e71b82312aee42b7257a2dbde56394ca4e19de?s=96&d=mm&r=g","caption":"\u685c, \u6625\u6a39"},"url":"https:\/\/www.silicloud.com\/ja\/blog\/author\/sakuraharuki\/"},{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/www.silicloud.com\/ja\/blog\/python%e3%81%aedecimal%e9%96%a2%e6%95%b0%e3%81%ae%e5%88%a9%e7%94%a8%e6%96%b9%e6%b3%95\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/posts\/80833","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/comments?post=80833"}],"version-history":[{"count":2,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/posts\/80833\/revisions"}],"predecessor-version":[{"id":148850,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/posts\/80833\/revisions\/148850"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/media?parent=80833"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/categories?post=80833"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/tags?post=80833"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}