From 1d1fa4cb5b8395974f9ae2ebe4e2015c69c11fbd Mon Sep 17 00:00:00 2001 From: Kierre Date: Sat, 7 Feb 2026 18:43:03 -0500 Subject: [PATCH] move transformations into one section --- content/rooms/fragments/v1-floaty-power-levels.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/content/rooms/fragments/v1-floaty-power-levels.md b/content/rooms/fragments/v1-floaty-power-levels.md index abd4f50a..50421159 100644 --- a/content/rooms/fragments/v1-floaty-power-levels.md +++ b/content/rooms/fragments/v1-floaty-power-levels.md @@ -1,8 +1,12 @@ ##### `m.room.power_levels` events accept values as floats -When the value is a float, anything after the decimal point is removed, -making e.g. `5.17`, `5.42`, and `5` functionally identical. +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. For example, this is a valid `m.room.power_levels` event in this room version: @@ -33,8 +37,5 @@ For example, this is a valid `m.room.power_levels` event in this room version: In this example, both `@bob:localhost` and `@alice:localhost` have the same effective power level of `50`, even though the values are technically different. -When a float written in exponential notation is unpacked, the decimal portion is removed -afterward; for example, `5.114698E4` becomes `51146.98`, which is then truncated to `51146`. - 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.