Skip to content

Array parser drops decimal section of double precision values #131

Closed
@makkeu

Description

@makkeu

Currently, parseIntegerArray function is used for both integer and float value parsing.
This isn't working for actual decimal numbers, since parseInt is used:

var parseIntegerArray = function(val) {
  if(!val) return null;
  var p = arrayParser.create(val, function(entry){
    if(entry != null)
      entry = parseInt(entry, 10);

    return entry;
  });

  return p.parse();
};

This is related to the pull request #96.

One possible fix could be checking, if the string contains "." and using parseFloat instead:

      if(entry.indexOf(".") > -1) {
        entry = parseFloat(entry);
      } else {
        entry = parseInt(entry, 10);
      }

Tho, more elegant way would be to write separate parseFloatArray function for types 1021, 1022 and 1231.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions