Skip to content

Commit 9a149fc

Browse files
authored
Mention integer precission differences, closes #295
1 parent 8bc4cd6 commit 9a149fc

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

README.md

+11
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,17 @@ $v8->executeString('PHP.foo.__call("bar", ["function"]);');
322322
Mapping Rules
323323
=============
324324

325+
PHP and JavaScript data types don't match exactly. This is of course both languages have
326+
data types to handle numbers. Yet PHP differentiates between integers and floating point
327+
numbers contrary JavaScript only has a type `Number`, which is a IEEE 754 floating point
328+
number. In many cases this doesn't matter at all, when both languages can represent the
329+
same number well. However there are edge cases.
330+
331+
On 64-bit systems PHP allows integers to have 64 significant bits, JavaScripts number type
332+
(i.e. IEEE 754) however has 52 bit mantissa only. Hence some precission will be lost. This
333+
starts to matter if you pass around integer values with more then 15 accurate decimal digits.
334+
335+
325336
Native Arrays
326337
-------------
327338

0 commit comments

Comments
 (0)