# `BasisPoints`

A count of hundredths of a percent, a whole number of any sign, so 25 basis points is never read as 25%: shown `25 bp`.

[Money and banking](types.md#money-and-banking); ordered; since Jadpo 0.1.0.

## Make one

Build one from a whole number from -9007199254740991 to 9007199254740991, `BasisPoints(-25)`; a number outside them breaks `min` or `max`.

`text.parse(raw, as: BasisPoints)` reads one from its text; text that isn't one at all fails `malformed`, such as `25bp`, `25 bp` or `0.25%`.

## Text, JSON and storage

`text.from` writes its canonical text, the one form `text.parse` reads back. JSON sends it as a number.

| Text | JSON |
|---|---|
| `-25` | `-25` |
| `0` | `0` |
| `25` | `25` |
| `1500` | `1500` |

It is stored in one column named for the field, of type `bigint`. `25` is stored as `25`.

## Shown to people

`text.format(value, locale:)` shows it to people in their locale.

With `locale: Locale.en_gb`:

| Value | Shown |
|---|---|
| `-25` | `-25 bp` |
| `0` | `0 bp` |
| `25` | `25 bp` |
| `1500` | `1,500 bp` |

## Operations

It has the contract's own operations: `text.parse`, `text.from`, `text.format`, `json.read`, `json.write` and `==`. It is ordered, so `<` and sorting take it. [Every standard type meets one contract](../topics/every-standard-type-meets-one-contract.md) says how they work.
