Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
osofem authored Jul 4, 2017
1 parent 79aeda7 commit 0796113
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ var ba = new BigArith(12345); //initialize ba to a BigArith object of value "123
```
The number must be between the `Number.MIN_SAFE_INTEGER` (-9007199254740991) and `Number.MAX_SAFE_INTEGER` (9007199254740991) limits else a `RangeError` will be thrown. <em>Please note that only integers are recommended for this method</em> because of the floating point precision _problem_ in JavaScript (which is one of the problems bigarith.js aim to solve).

Doing `var ba = new BigArith(0.45);` might still be considered _"safe"_ but some could be tempted to do `var ba = new BigArith(0.1 \* 0.2);`. As it is known `0.1 \* 0.2` will not give `0.02` in JavaScript but rather `0.020000000000000004`. Therefore, it is better to avoid initializing fractional numbers this way.
Doing `var ba = new BigArith(0.45);` might still be considered _"safe"_ but some could be tempted to do `var ba = new BigArith(0.1*0.2);`. As it is known `0.1*0.2` will not give `0.02` in JavaScript but rather `0.020000000000000004`. Therefore, it is better to avoid initializing fractional numbers this way.

> It is recommended fractional numbers are initialized with strings.
> See [here](#init_string).
Expand Down Expand Up @@ -200,4 +200,4 @@ See also:
26. [truncate()](https://osofem.github.io/bigarith.js/documentation/truuncate.html)
27. [negate()](https://osofem.github.io/bigarith.js/documentation/negate.html)

Full documentation is [here](https://github.com/osofem/bigarith.js/tree/master/documentation).
Full documentation is [here](https://github.com/osofem/bigarith.js/tree/master/documentation).

0 comments on commit 0796113

Please sign in to comment.