2026-01-25 17:26:52 +01:00
|
|
|
|
2026-01-28 17:03:16 +01:00
|
|
|
##### `m.room.power_levels` events accept values as floats
|
2026-01-25 17:26:52 +01:00
|
|
|
|
2026-02-08 00:43:03 +01:00
|
|
|
When the value is a float
|
|
|
|
|
* First, exponential notation is applied: `5.114698E4` becomes `51146.98`
|
|
|
|
|
* Second, the value is truncated at the decimal point: `51146.98` becomes `51146`.
|
|
|
|
|
|
|
|
|
|
Any float greater than or equal to `1e309` must result in the powerlevel event
|
|
|
|
|
being rejected.
|
2026-01-25 17:26:52 +01:00
|
|
|
|
|
|
|
|
For example, this is a valid `m.room.power_levels` event in this room version:
|
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
{
|
|
|
|
|
"content": {
|
|
|
|
|
"ban": 50,
|
|
|
|
|
"events": {
|
|
|
|
|
"m.room.power_levels": 100
|
|
|
|
|
},
|
|
|
|
|
"events_default": 0,
|
|
|
|
|
"state_default": 50,
|
|
|
|
|
"users": {
|
|
|
|
|
"@example:example.org": 100,
|
|
|
|
|
"@alice:localhost": 50,
|
|
|
|
|
"@bob:localhost": 50.57
|
|
|
|
|
},
|
|
|
|
|
"users_default": 0
|
|
|
|
|
},
|
|
|
|
|
"origin_server_ts": 1432735824653,
|
|
|
|
|
"room_id": "!jEsUZKDJdhlrceRyVU:example.org",
|
|
|
|
|
"sender": "@example:example.org",
|
|
|
|
|
"state_key": "",
|
|
|
|
|
"type": "m.room.power_levels"
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
In this example, both `@bob:localhost` and `@alice:localhost` have the same effective
|
2026-01-28 17:37:58 +01:00
|
|
|
power level of `50`, even though the values are technically different.
|
2026-01-28 18:05:35 +01:00
|
|
|
|
|
|
|
|
Note that, since this room version does not enforce that events comply with the requirements
|
|
|
|
|
of [Canonical JSON](/appendices#canonical-json), power levels can be formatted as floats.
|