Answer the question
In order to leave comments, you need to log in
Why do fractional numbers become long after serialization?
PHP, I save an array to a file with this function:
function object2file($value, $filename)
{
$str_value = serialize($value);
$f = fopen($filename, 'w');
fwrite($f, $str_value);
fclose($f);
}
If you look at the file, then the number 8812.29 is stored as:
8812.2900000000008731149137020111083984375
Is it possible to somehow avoid to reduce the file size?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question