Skip to content

Conversation

mak626
Copy link

@mak626 mak626 commented Feb 10, 2025

Fixes #1593

Example:-
Decimal(0.01) created a value Decimal("0.01000000000000000020816681711721685132943093776702880859375")

Additional:
The Decimal field now accepts string, int & float. Previously, it was just string & int

… values

Example:-
Decimal(0.01) -> Decimal("0.01000000000000000020816681711721685132943093776702880859375")

Additional:
Decimal field now accepts string, int & float. Previously it was just string & int
@mak626 mak626 changed the title fix Decimal scalar inaccurate conversion of float -> decimal conversions [FIX] Decimal scalar inaccurate conversion of float to decimal Feb 10, 2025
def parse_value(value):
try:
return _Decimal(value)
return _Decimal(str(value))
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using the same implementation as done at Strawberry

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inaccurate Float-to-Decimal Conversion in parse_value of Decimal Scalar
1 participant