Skip to content

ROUND function behavior change in v5.1.7 #1837

Open
@shunjikonishi

Description

@shunjikonishi

Issue Summary

Recently I've updated my application env.
In that process, I've updated node-sqlite3 from v5.1.6 to v5.1.7
After that update, ROUND function behavior was changed.
This is minimum example.

const sqlite3 = require('sqlite3').verbose();
const db = new sqlite3.Database(':memory:');

db.serialize(() => {
    db.each("SELECT ROUND(1.15, 1) as rounded", (err, row) => {
        console.log(row);
    });
});
  • v5.1.6 -> { rounded: 1.2 }
  • v5.1.7 -> { rounded: 1.1 }

For my usecase, expected value is 1.2.
However v5.1.7 returns 1.1. (Floating point handling was changed?)

The other hand, I've verified sqlite3 binary behavior.

$ echo "SELECT ROUND(1.15, 1)" | sqlite3
1.1

It returns 1.1. (v3.44.2 and v3.49.2)

Is it expected value? v5.1.7 was fixed to return same value of sqlite3 binary?

Once I'm going to use [email protected].

However I'm bit confusing about this change.

Steps to Reproduce

  1. Store code in summary as js file
  2. Run it with both v5.1.6 and v5.1.7

Version

5.1.6 and 5.1.7

Node.js Version

v22.17.0

How did you install the library?

npm i [email protected]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions