session_encode problem
Posted: Thu Sep 11, 2008 12:39 am
Hello
I have a question based on the following code:
session_start();
$n = 50.9096
$_SESSION['number'] = $n;
$file = session_encode();
echo $file;
and the output is: number|d:50.9095999999999975216269376687705516815185546875;
Why is storing that amount of "invented" decimals??
But if i previously assign a format to the number:
session_start();
$n = number_format(50.9096, 4, ".", "");
$_SESSION['number'] = $n;
$file = session_encode();
echo $file;
the output is: number|d:50.9096;
I have the WampServer Version 2.0 on a Windows XP machine.
Thanks in advance.
I have a question based on the following code:
session_start();
$n = 50.9096
$_SESSION['number'] = $n;
$file = session_encode();
echo $file;
and the output is: number|d:50.9095999999999975216269376687705516815185546875;
Why is storing that amount of "invented" decimals??
But if i previously assign a format to the number:
session_start();
$n = number_format(50.9096, 4, ".", "");
$_SESSION['number'] = $n;
$file = session_encode();
echo $file;
the output is: number|d:50.9096;
I have the WampServer Version 2.0 on a Windows XP machine.
Thanks in advance.