Skip to content
Advertisement

Tag: floating-accuracy

PHP Printf As Float Precision

I am attempting to use PHP’s printf function to print out a user’s storage capacity. The full formula looks something like this: Given that $size == (10 * 1024 * 1024), this should print out 10.00 GB But it doesn’t. It prints 10.04 GB. Furthermore, results in 10.04 What?! In giving it an integer to convert to a float, it

Advertisement