bernhard Posted Sunday at 12:28 PM Share Posted Sunday at 12:28 PM Usage: echo rockmoney() ->parse("1,4") ->minus(0.4) ->format(); // 1,00€ Why? The short answer is, because 0.1 + 0.2 is not 0.3 in computer world: Download & Docs: baumrock.com/RockMoney Link to comment Share on other sites More sharing options...
wbmnfktr Posted Sunday at 06:33 PM Share Posted Sunday at 06:33 PM You don't save money values in cents (or whatever the smallest unit is)? Link to comment Share on other sites More sharing options...
bernhard Posted Sunday at 07:49 PM Author Share Posted Sunday at 07:49 PM What is your question? Are you asking about the inner workings of the module? The db storage? How the money library works? 1 Link to comment Share on other sites More sharing options...
wbmnfktr Posted 20 hours ago Share Posted 20 hours ago On 10/20/2024 at 9:49 PM, bernhard said: What is your question? Are you asking about the inner workings of the module? The db storage? How the money library works? No, nothing of that. I was just a bit surprised you don't save currency values in cents (for Euro and Dollar and similar for other currencies) and had the need for this. As a drop-in solution, for already existing projects with tons of products/items, this seems perfect. Link to comment Share on other sites More sharing options...
bernhard Posted 8 hours ago Author Share Posted 8 hours ago Well, you get all kind of weird rounding issues if you do that. Of course you could round() all results, but that is tedious and I'm not sure if that's 100% bulletproof: Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now