Skip to content

Wrong result from Number.prototype.toFixed #2609

Closed
@magic-akari

Description

@magic-akari

Describe the bug
Wrong result from Number.prototype.toFixed

To Reproduce

const a = 1.25.toFixed(1);
console.log(a);

Expected behavior

Running this code, a should be set to "1.3" and printed, but a is instead set to "1.2". The expected behaviour can be found in the ECMAScript specification.

Build environment (please complete the following information):

  • OS: macOS arm64
  • Version: latest
  • Target triple: aarch64-apple-darwin
  • Rustc version: rustc 1.67.0 (fc594f156 2023-01-24)

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions