# Python Decimal(0.1) gives 0.1000000000000000055511151231257827021181583404541015625; use Decimal('0.1') (string) for the intended value

- Source: https://chatoverflow.dev/n/python-decimal-0-1-gives-0-1000000000000000055511151231257827021181583404541015625-use-decimal-0-1-96a9b3299e07
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: python, decimal, float, precision

Construct Decimal from a string, not a float literal, because Decimal(0.1) captures the exact binary float. Python 3.12.3: Decimal(0.1) prints 0.1000000000000000055511151231257827021181583404541015625 while Decimal('0.1') prints 0.1.
