0.30000000000000004
Brick\Money
0.30000000000000004 | Brick\Money | |
---|---|---|
245 | 15 | |
1,414 | 1,596 | |
- | 1.3% | |
2.0 | 6.4 | |
3 months ago | about 1 month ago | |
CSS | PHP | |
GNU General Public License v3.0 only | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
0.30000000000000004
-
What even is a JSON number?
https://0.30000000000000004.com/
Although it would be good to move in the direction of using a BigDecimal equivalent by default when ingesting unknown data.
- Floating Point Math
-
Working with Numpy floats and Forex financial instruments
There's no such thing as precision for floats. Floating-point calculations are always inaccurate: read this: https://0.30000000000000004.com/
- Just learned the difference between decimal and float
-
how do i make the decimals not fucked up
Edit: This specific example even has its own website: https://0.30000000000000004.com/
- why doest this loop ever terminate?
-
Decoding Why 0.6 + 0.3 = 0.8999999999999999 in JS and How to Solve?
In everyday math, we know adding 0.6 + 0.3 equals 0.9, right? But when we turn to computers it results in 0.8999999999999999. Surprisingly, this doesn’t just happen only in JavaScript; it’s the same in many programming languages like Python, Java, C too. Also, it’s not just about this specific calculation. There are many more decimal calculations showing similar not-quite-right answers.
- Lies My Calculator and Computer Told Me [pdf]
-
64-Bit Bank Balances ‘Ought to Be Enough for Anybody’?
Surprisingly common values like 0.1 don't have a precise representation in binary for most formats, including standard floating point number formats. See https://0.30000000000000004.com/ for more detail than you can shake a stick at.
Also if the local tax code states using 5 decimal places for intermediate values when you will introduce “errors” using formats that give greater precision as well as those that give less precision. Having work on mortgage and pension calculations I can state that the (very) small errors seen at individual steps because of this can balloon significantly through repeated calculations.
Furthmore, the name floating point gives away the other issue. Floating point numbers are accurate to a given number of significant figures not decimal places. For large numbers any decimal places you have in the result are at best an estimate, and as above any rounding errors at each stage can compound into a much larger error by the end of a calculation.
-
I don't get these people
You'll love this https://0.30000000000000004.com/
Brick\Money
-
Introducing Bag 1.0: Immutable Values Objects for PHP
For the last couple of years I’ve been using Value Objects in my projects to bring language-level strict types to what would typically be array data structures in my code. From method inputs to JSON API responses, value objects have almost entirely replaced arrays throughout. The ability to get runtime type checking and IDE auto-complete has eliminated many potential bugs, from key typos, to assigning an incorrectly typed value by accident: what type is an “amount” property in a credit card transaction API response? An integer of cents (or other minor units), a Money object such as brick/money or moneyphp/money? Or worst of all, a float?
-
PHP libraries and tools
brick/money: A money and currency library for PHP
-
Weekly help thread
1 - Floating point is not always great for money operations and can introduce odd rounding errors - https://www.php.net/manual/en/language.types.float.php - you might want to use something like this: https://github.com/brick/money
-
PHP is trolling me
He should have said to use Brick/Money https://github.com/brick/money which is based on Brick/Math but is specifically money related.
-
How to format prices?
If you don’t want to do the integer conversions yourself, I highly recommend looking at: https://github.com/brick/money
-
Which native PHP features do you regret not knowing about/adapting earlier?
brick/date-time is great! I personally prefer its interface and functionality over Carbon's. I also really like his money library
- Financial values in PHP
-
Best way to handle PHP float issue
Is the most popular, but https://github.com/brick/money is preferrable IMO. One of the reasons is that it handles not just money, but all arbitrary precision calculations independent of currecy via brick/math.
- Dealing with money
- Weekly "ask anything" thread
What are some alternatives?
glibc - Unofficial mirror of sourceware glibc repository. Updated daily.
laravel-money - Currency formatting and conversion package for Laravel
gcc
Money - PHP implementation of Fowler's Money pattern.
v8.dev - The source code of v8.dev, the official website of the V8 project.
Laravel - The Laravel Framework.
proposal-decimal - Built-in decimal datatype in JavaScript
laravel-currency-casting - Cast currency attributes stored as integer to floats automatically.
import-maps - How to control the behavior of JavaScript imports
laravel-currency - This provides Laravel with currency functions such as currency formatting and conversion using up-to-date exchange rates.
media
Brick\Math - Arbitrary-precision arithmetic library for PHP