-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Labels
c: docsImprovements or additions to documentationImprovements or additions to documentationm: numberSomething is referring to the number moduleSomething is referring to the number modulep: 1-normalNothing urgentNothing urgent
Milestone
Description
Pre-Checks
- Follow our Code of Conduct.
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Make sure this is a Faker issue and not related to a combination with another package.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
- I am willing to provide a PR.
Describe the bug
faker.number.float() is unable to return 1.
Minimal reproduction code
it('should be able to return 1', () => {
// @ts-expect-error: access private member field
const mersenne = faker._mersenne;
mersenne.next = () => 0.9999999999999999; // based on the definition of mersenne.next()
const actual = faker.number.float();
expect(actual).toBe(1); // 💥 fails
});
Additional Context
Originally part of:
Environment Info
System:
OS: Windows 10 10.0.22621
CPU: (16) x64 Intel(R) Core(TM) i7-7820X CPU @ 3.60GHz
Memory: 47.42 GB / 63.69 GB
Binaries:
Node: 18.17.1 - C:\Program Files\nodejs\node.EXE
npm: 9.7.2 - C:\Program Files\nodejs\npm.CMD
pnpm: 8.5.1 - C:\Program Files\nodejs\pnpm.CMD
Browsers:
Edge: Spartan (44.22621.2134.0), Chromium (116.0.1938.62)
Internet Explorer: 11.0.22621.1
Which module system do you use?
- CJS
- ESM
Used Package Manager
pnpm
Metadata
Metadata
Assignees
Labels
c: docsImprovements or additions to documentationImprovements or additions to documentationm: numberSomething is referring to the number moduleSomething is referring to the number modulep: 1-normalNothing urgentNothing urgent