May 21, 2019 Re: Is using floating point type for money/currency a good idea? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Boqsc | On 20/05/2019 11:10 PM, Boqsc wrote:
> https://dlang.org/spec/float.html
>
> I'm frozen in learning basics of D lang since I want to create a simple game and I really would like a clean and simple code, however to me floating points are magic.
>
> https://wiki.dlang.org/Review_Queue
> Since std.decimal is still work in progress and apparently its development is stuck for a while, should I just somehow use floating point to store currency or wait until Decimal package will be finally included into std Phobos of D lang?
While other posters have explained the best practice for currency in the real world, for games even AAA uses floats. Don't fret it, it doesn't matter. You won't loose actual money if its off by a few cents here or there.
|
August 20, 2020 Re: Is using floating point type for money/currency a good idea? | ||||
---|---|---|---|---|
| ||||
Posted in reply to H. S. Teoh | Me and my financial adviser think not. Unfortunately, this is not the best way.. |
Copyright © 1999-2021 by the D Language Foundation