Skip to content

Commit 5078677

Browse files
committed
Update readme and fix phpcs
1 parent b18cb17 commit 5078677

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,11 +289,11 @@ public static void main(java.lang.String[])
289289
- **LOCAL STORAGE** is showing stacked items on a method.
290290

291291
## PHP problems
292-
- The PHP is cannot calculating big numbers because of PHP is different to the Java.
292+
- **Problem 1:** The PHP is cannot calculating big numbers because of PHP is different to the Java.
293293
But the PHPJava use `bcmath` functions and `gmp` functions to a certain extent to cover to calculate.
294294
The PHPJava return valued is mixed why therefore We recommend to cast to `string` on the PHPJava.
295295

296-
- The PHPJava cannot cover to Java's types completely because of PHP is different to the Java.
296+
- **Problem 2:** The PHPJava cannot cover to Java's types completely because of PHP is different to the Java.
297297
The Java and the PHPJava comparison table is below.
298298

299299
|Java |PHPJava |
@@ -308,6 +308,9 @@ public static void main(java.lang.String[])
308308
|float |\PHPJava\Kernel\Types\\_Float (including `__toString`), string, float |
309309
|double |\PHPJava\Kernel\Types\\_Char (including `__toString`), string, float |
310310

311+
- **Problem 3:** PHPJava cannot calculate big numbered double and float values because of `gmp_pow` cannot calculate negative exponents.
312+
So PHPJava use built-in functions which is `pow`.
313+
311314
## Run unit tests
312315

313316
- PHPUnit test is below.

src/Utilities/BinaryTool.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,7 @@ final public static function convertDoubleToIEEE754($doubleValue, $rounded = 8)
201201
$bits = $doubleValue;
202202
$s = ($bits >> 63) == 0 ? 1 : -1;
203203
$e = ($bits >> 52) & 0x7ff;
204-
$m = ($e == 0) ?
205-
(($bits & 0xfffffffffffff) << 1) : ($bits & 0xfffffffffffff) | 0x10000000000000;
204+
$m = ($e == 0) ? (($bits & 0xfffffffffffff) << 1) : ($bits & 0xfffffffffffff) | 0x10000000000000;
206205
return $s * $m * pow(2, $e - 1075);
207206
}
208207

0 commit comments

Comments
 (0)