From 4af83b1164c2a4af459c51c1a30d6bae44b863b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Bar=C3=A1=C5=A1ek?= Date: Thu, 23 Jan 2020 12:10:49 +0100 Subject: [PATCH] SmartNumber: Add support for small numbers. --- src/Entity/SmartNumber.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Entity/SmartNumber.php b/src/Entity/SmartNumber.php index 7abe938..caa65a7 100644 --- a/src/Entity/SmartNumber.php +++ b/src/Entity/SmartNumber.php @@ -255,6 +255,10 @@ private function setFractionHelper(string $float, float $tolerance = 1.e-8): arr return $this->fraction = ['0', '1']; } + if (preg_match('/^0+\.(?0{3,})(?\d+?)$/', $float, $floatParser)) { + return $this->fraction = [$floatParser['num'], '1' . str_repeat('0', \strlen($floatParser['zeros']) + 2)]; + } + $floatOriginal = $float; $float = preg_replace('/^-/', '', $float);