original_string: private static function _nr3ToDecimal(string $str): float
      {
          /** @var $match string[] */
          if (!preg_match(self::NR3_REGEX, $str, $match)) {
              throw new \UnexpectedValueException(
                  "'$str' is not a valid NR3 form real.");
          }
          $m = $match[2];
          // if number started with minus sign
          $inv = $match[1] == "-";
          $e = intval($match[3]);
          // positive exponent
          if ($e > 0) {
              // pad with trailing zeroes
              $num = $m . str_repeat("0", $e);
          } else if ($e < 0) {
              // pad with leading zeroes
              if (strlen($m) < abs($e)) {
                  $m = str_repeat("0", abs($e) - strlen($m)) . $m;
              }
              // insert decimal point
              $num = substr($m, 0, $e) . "." . substr($m, $e);
          } else {
              $num = empty($m) ? "0" : $m;
          }
          // if number is negative
          if ($inv) {
              $num = "-$num";
          }
          return floatval($num);
      }
code: private static function _nr3ToDecimal(string $str): float
      {
          /** @var $match string[] */
          if (!preg_match(self::NR3_REGEX, $str, $match)) {
              throw new \UnexpectedValueException(
                  "'$str' is not a valid NR3 form real.");
          }
          $m = $match[2];
          // if number started with minus sign
          $inv = $match[1] == "-";
          $e = intval($match[3]);
          // positive exponent
          if ($e > 0) {
              // pad with trailing zeroes
              $num = $m . str_repeat("0", $e);
          } else if ($e < 0) {
              // pad with leading zeroes
              if (strlen($m) < abs($e)) {
                  $m = str_repeat("0", abs($e) - strlen($m)) . $m;
              }
              // insert decimal point
              $num = substr($m, 0, $e) . "." . substr($m, $e);
          } else {
              $num = empty($m) ? "0" : $m;
          }
          // if number is negative
          if ($inv) {
              $num = "-$num";
          }
          return floatval($num);
      }
code_tokens: private static function _nr3ToDecimal ( string $ str ) : float { /** @var $match string[] */ if ( ! preg_match ( self :: NR3_REGEX , $ str , $ match ) ) { throw new \ UnexpectedValueException ( "'$str' is not a valid NR3 form real." ) ; } $ m = $ match [ 2 ] ; // if number started with minus sign $ inv = $ match [ 1 ] == "-" ; $ e = intval ( $ match [ 3 ] ) ; // positive exponent if ( $ e > 0 ) { // pad with trailing zeroes $ num = $ m . str_repeat ( "0" , $ e ) ; } else if ( $ e < 0 ) { // pad with leading zeroes if ( strlen ( $ m ) < abs ( $ e ) ) { $ m = str_repeat ( "0" , abs ( $ e ) - strlen ( $ m ) ) . $ m ; } // insert decimal point $ num = substr ( $ m , 0 , $ e ) . "." . substr ( $ m , $ e ) ; } else { $ num = empty ( $ m ) ? "0" : $ m ; } // if number is negative if ( $ inv ) { $ num = "-$num" ; } return floatval ( $ num ) ; }
docstring: Convert NR3 form number to decimal.
  
  @param string $str
  @throws \UnexpectedValueException
  @return float
docstring_tokens: Convert NR3 form number to decimal .