On dinsdag 29 mei 2018 11:03:56 CEST Mike Dewhirst wrote:

> Also, despite using decimal.Decimal under the covers it wants its money
> as strings.
> 
> Python 3.6.3
> 
>  >>> from money import money
>  >>> print(money.Money(23.45, 'AUD'))
> 
> AUD 23.449999999999999289457264239899814128875732421875
> 
>  >>> print(money.Money('23.45', 'AUD'))
> 
> AUD 23.45

No, that's decimal.Decimal and floats being an approximation:

>>> from decimal import Decimal 

>>> print('{:.48f}'.format(23.45)) 
>>> print('{:.55f}'.format(23.45)) 

So decimal.Decimal's constructor converts strings to decimal numbers with as 
much 
precision as given. It also applies to floats, except that floats have more 
precision then 
typed.
-- 
Melvyn Sopacua

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4704533.IngrlRvRmB%40fritzbook.
For more options, visit https://groups.google.com/d/optout.

Reply via email to