From fb359a6d59193c94cbcfa1c0cf2b1149fccdd1e7 Mon Sep 17 00:00:00 2001 From: ArrayIterator <37867551+ArrayIterator@users.noreply.github.com> Date: Thu, 21 Mar 2024 01:31:28 +0700 Subject: [PATCH] Update DataNormalizer.php (exponent) --- src/Util/Filter/DataNormalizer.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Util/Filter/DataNormalizer.php b/src/Util/Filter/DataNormalizer.php index 8ab5b9a..21a639e 100644 --- a/src/Util/Filter/DataNormalizer.php +++ b/src/Util/Filter/DataNormalizer.php @@ -643,6 +643,12 @@ public static function number(mixed $number) : ?string 'Exponent is too large' ); } + // check additional exponent + $additionalExponent = 0; + if (!$isDecimalPoint && str_contains($mantissa, '.')) { + $additionalExponent = strlen(explode('.', $mantissa)[0]); + } + $exponent = $exponent + $additionalExponent; $mantissa = str_replace('.', '', $mantissa); if ($isDecimalPoint) { // - is decimal point, convert mantissa