### Godot Version

4.3.1

### Question

Hi everyone,

I have some code I’m using to compress some quaternions and send them over the network in packets. My issue is that when I uncompress them, I don’t get the correct value for W.

Here is my code:

```
func compress_quaternion(quat : Quaternion):
quat = quat.normalized()
var x : int = int(round((quat.x * 100)))
var y : int = int(round((quat.y * 100)))
var z : int = int(round((quat.z * 100)))
return Vector3i(x, y, z)
func uncompress_quaternion(x_enc, y_enc, z_enc):
var x : float = x_enc / 100.0
var y : float = y_enc / 100.0
var z : float = z_enc / 100.0
var w : float = sqrt(1.0 - (x * x + y * y + z * z))
return Quaternion(x,y,z,w)
```

For instance, when I have the quaternion (W = 0.738, x = 0.334, y = 0.334, z = -0.482), and I use uncompress_quaternion to get W back after compressing it, I get 1.00628 instead if 0.738.

Does anyone have any advice on why this won’t work correctly?

Thanks