[ create a new paste ] login | about

Link: http://codepad.org/KICl3xHw    [ raw code | output | fork ]

PHP, pasted on Jun 2:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<?php

$xml = simplexml_load_string("<xml><number>214748364800</number></xml>");

echo $xml->number . "\n"; // the proper number

$int = $xml->number / 1024 / 1024 / 1024; // initial cast to an int causes problems
echo $int . "\n"; 

$double = (double) $xml->number / 1024 / 1024 / 1024; // hard cast to a double fixes it
echo $double . "\n";

echo "214748364800" / 1024 / 1024 / 1024;
?>


Output:
1
2
3
4
214748364800
1.9999999990687
200
200


Create a new paste based on this one


Comments: