Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #155 from rossipedia/smalldec-fix

when sending decimals as UInt's, Math.round the value to prevent IEEE 754 floating point errors
  • Loading branch information...
commit cb3aebbe49d6a1c127ab21ff8db0b407a2de15dc 2 parents 223ef30 + 39a2b77
@patriksimek patriksimek authored
Showing with 2 additions and 1 deletion.
  1. +2 −1  src/data-type.coffee
View
3  src/data-type.coffee
@@ -224,7 +224,8 @@ TYPE =
if parameter.precision <= 9
buffer.writeUInt8 5
buffer.writeUInt8 sign
- buffer.writeUInt32LE value
+ # Round to preven IEEE 754 floating point errors
+ buffer.writeUInt32LE Math.round(value)
else if parameter.precision <= 19
buffer.writeUInt8 9
buffer.writeUInt8 sign
Please sign in to comment.
Something went wrong with that request. Please try again.