private static function _decimalToNR3(string $str): string
    {
        // if number is in exponent form
        /** @var $match string[] */
        if (preg_match(self::PHP_EXPONENT_DNUM, $str, $match)) {
            $parts = explode(".", $match[1]);
            $m = ltrim($parts[0], "0");
            $e = intval($match[2]);
            // if mantissa had decimals
            if (count($parts) == 2) {
                $d = rtrim($parts[1], "0");
                $e -= strlen($d);
                $m .= $d;
            }
        } else {
            // explode from decimal
            $parts = explode(".", $str);
            $m = ltrim($parts[0], "0");
            // if number had decimals
            if (count($parts) == 2) {
                // exponent is negative number of the decimals
                $e = -strlen($parts[1]);
                // append decimals to the mantissa
                $m .= $parts[1];
            } else {
                $e = 0;
            }
            // shift trailing zeroes from the mantissa to the exponent
            while (substr($m, -1) === "0") {
                $e++;
                $m = substr($m, 0, -1);
            }
        }
        /* if exponent is zero, it must be prefixed with a "+" sign
         (X.690 07-2002, section 11.3.2.6) */
        if (0 == $e) {
            $es = "+";
        } else {
            $es = $e < 0 ? "-" : "";
        }
        return sprintf("%s.E%s%d", $m, $es, abs($e));
    }