typos and MisSpellings
MODIFY
README.md
README.md
[![dev dependency status][dev-deps-svg]][dev-deps-url]
[![License][license-image]][license-url]
-`Nat(value)` returns its argument if it represents a non-negative integer (i.e. a "natural number") that can be accurately represented in a Javascript `Number`, specifically (0, 1, 2... to 2 \*\* 53 - 1). Otherwise it throws a `RangeError` exception. This makes it easy to use on incoming arguments, or as an assertion on generated values.
+`Nat(value)` returns its argument if it represents a non-negative integer (i.e. a "natural number") that can be accurately represented in a JavaScript `Number`, specifically (0, 1, 2... to 2 \*\* 53 - 1). Otherwise it throws a `RangeError` exception. This makes it easy to use on incoming arguments, or as an assertion on generated values.
-Traditional Javascript has a single `Number` type, which is defined to contain a 64-bit IEEE-754 floating point value. This can safely represent a wide range of integers, but if they get too large, `Number` will lose precision: `2**53 + 1` will give you the same value as `2**53 + 2`. In situations where you care about accuracy rather than range, this would be a problem.
+Traditional JavaScript has a single `Number` type, which is defined to contain a 64-bit IEEE-754 floating point value. This can safely represent a wide range of integers, but if they get too large, `Number` will lose precision: `2**53 + 1` will give you the same value as `2**53 + 2`. In situations where you care about accuracy rather than range, this would be a problem.
You can think of `Nat()` as a type enforcement.
@@ -44,7 +44,7 @@ Array indexes can be wrapped with `Nat()`, to guard against the surprising strin
```
const a = [2,4,6]
function add(index, value) {
- a[Nat[index]] = value;
+ a[Nat(index)] = value;
}
add(3, 8); // works
add(2.5, 7); // throws rather than add a key named "2.5"
@@ -62,7 +62,7 @@ By excluding 2^53, we have the nice invariant that if
are all true, then `(a+b)` is an accurate sum of a and b.
-Future versions of `Nat` will use Javascript's upcoming (`BigInt` standard)[https://tc39.github.io/proposal-bigint/], to increase the range of accurately-representable integers to be effectively unbounded.
+Future versions of `Nat` will use JavaScript's upcoming (`BigInt` standard)[https://tc39.github.io/proposal-bigint/], to increase the range of accurately-representable integers to be effectively unbounded.
## History

typos and MisSpellings