Stream: helpdesk (published)

Topic: 2 decimals numbers


view this post on Zulip brett knoss (Jun 14 2021 at 19:35):

I'm working on an accounting program, and would like to know how to create two decimal numbers, instead of arbitrary point decimals.

view this post on Zulip Kwaku Oskin (Jun 14 2021 at 19:45):

There is a package https://github.com/JuliaMath/FixedPointDecimals.jl

But you can just make all calculations in cents (i.e. multiply internally by 100 and store everything in Int)

view this post on Zulip brett knoss (Jun 14 2021 at 19:53):

I was using integers, but then I couldn't do negative numbers. Can I do negative numbers with FixedPointDecimals.jl ?

view this post on Zulip Kwaku Oskin (Jun 14 2021 at 20:19):

How come that you cannot use negative integers?

view this post on Zulip Kwaku Oskin (Jun 14 2021 at 20:20):

What does that mean?

view this post on Zulip brett knoss (Jun 14 2021 at 21:08):

I thought I couldn't but it turns out I made a mistake, and I can create negative integers, so nevermind that.


Last updated: Nov 06 2024 at 04:40 UTC