aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorMatt Mayer <[email protected]>2023-01-30 20:28:53 +0700
committerGitHub <[email protected]>2023-01-30 14:28:53 +0100
commit1ebbead194a9583dbd0f21f136c9d2bf8f84a50f (patch)
tree94a75b885c01a6d16f0655a7fc74d3ffb969a609 /docs
parent0663048932bb1b625fbd5c6988d70bf6b1c0bf61 (diff)
downloadfaker-1ebbead194a9583dbd0f21f136c9d2bf8f84a50f.tar.xz
faker-1ebbead194a9583dbd0f21f136c9d2bf8f84a50f.zip
feat(number)!: default to high precision float (#1675)
Diffstat (limited to 'docs')
-rw-r--r--docs/guide/upgrading.md19
1 files changed, 14 insertions, 5 deletions
diff --git a/docs/guide/upgrading.md b/docs/guide/upgrading.md
index c30ee63b..673ab610 100644
--- a/docs/guide/upgrading.md
+++ b/docs/guide/upgrading.md
@@ -103,11 +103,20 @@ The `faker.address.*` methods will continue to work as an alias in v8 and v9, bu
The number-related methods previously found in `faker.datatype` have been moved to a new `faker.number` module.
For the old `faker.datatype.number` method you should replace with `faker.number.int` or `faker.number.float` depending on the precision required.
- faker.datatype.number() //35
- faker.datatype.int() //35
-
- faker.datatype.number({precision:0.01}) //35.21
- faker.datatype.float({precision:0.01}) //35.21
+By default, `faker.number.float` no longer defaults to a precision of 0.01
+
+```js
+// OLD
+faker.datatype.number({ max: 100 }); // 35
+faker.datatype.number({ max: 100, precision: 0.01 }); // 35.21
+faker.datatype.float({ max: 100 }); // 35.21
+faker.datatype.float({ max: 100, precision: 0.001 }); // 35.211
+
+// NEW
+faker.number.int({ max: 100 }); // 35
+faker.number.float({ max: 100 }); // 35.21092065742612
+faker.number.float({ max: 100, precision: 0.01 }); // 35.21
+```
| Old method | New method |
| ----------------------- | ------------------------------------------ |