# data-malformed

The data of an event holds a **number beyond the range of a 64-bit floating-point number** or with **more than 1000 digits**.

- **Route:** `write-events`
- **Description:** `number at <pointer> is beyond the range of a 64-bit floating-point number` for a number too large in magnitude, and `number at <pointer> has more than 1000 digits` for one with more digits than that, written out in full, each with the JSON pointer of the number within the data
- **Details:** **`event`**, the place of the event in its list, counting from 0, and **`pointer`**, the JSON pointer of the number within the data of the event, such as `/price`.

## Why It Happens

EventSourcingDB keeps the **value of every number** in the data of an event **exactly**, including integers and decimals that a 64-bit floating-point number cannot hold. It refuses two kinds of numbers: one whose magnitude lies **beyond the range of a 64-bit floating-point number**, which ends at about `1.8e308`, such as `1e400`, and one that has **more than 1000 digits** when it is written out in full, without an exponent, such as `1e-2000`. Such a number is usually a mistake, for example the result of a calculation that went wrong.

If the data holds several such numbers, the error names the first of them, with the keys of every object sorted. The details name the number by its place, not by its value.

## How to Fix It

Keep the numbers in the data within the range of a 64-bit floating-point number and within 1000 digits. If a value needs more, send it as a string. Sending the same request again fails the same way, since the error depends on the request alone.

## Example

For a write whose first event holds `1e400` as its `price`, EventSourcingDB answers with this error, as a line of the stream, and then ends the stream with its `end` item:

```json
{
  "type": "error",
  "data": {
    "code": "https://docs.eventsourcingdb.io/errors/data-malformed",
    "description": "number at /price is beyond the range of a 64-bit floating-point number",
    "details": {
      "event": 0,
      "pointer": "/price"
    }
  }
}
```
