From a87fdb9d4c17374fb235eb261e66d70425bc2b1b Mon Sep 17 00:00:00 2001 From: Hubert Bernaciak Date: Thu, 28 Jul 2022 16:01:31 +0200 Subject: [PATCH] Fixed mantissa (floating point) extraction This fix extends the handling of exponential notation for numbers like below, which throws an exception "strValue must be a number" before: 100000e-8 1.33E+33 11111111e-7 --- src/Decimal.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Decimal.php b/src/Decimal.php index 2a374ae..f9b54f9 100644 --- a/src/Decimal.php +++ b/src/Decimal.php @@ -18,7 +18,7 @@ class Decimal { const DEFAULT_SCALE = 16; const CLASSIC_DECIMAL_NUMBER_REGEXP = '/^([+\-]?)0*(([1-9][0-9]*|[0-9])(\.[0-9]+)?)$/'; - const EXP_NOTATION_NUMBER_REGEXP = '/^ (?P [+\-]?) 0*(?P [0-9](?P \.[0-9]+)?) [eE] (?P [+\-]?)(?P \d+)$/x'; + const EXP_NOTATION_NUMBER_REGEXP = '/^ (?P [+\-]?) 0*(?P [0-9]+(?P \.[0-9]+)?) [eE] (?P [+\-]?)(?P \d+)$/x'; const EXP_NUM_GROUPS_NUMBER_REGEXP = '/^ (?P \d*) (?: \. (?P \d+) ) E (?P[\+\-]) (?P\d+) $/x'; /**