What that means? It happens in my script, sometimes, and sometimes not, at the **acos**, **asin**,… functions.

And arguments are between -1 and 1, of course.

What that means? It happens in my script, sometimes, and sometimes not, at the **acos**, **asin**,… functions.

And arguments are between -1 and 1, of course.

are you 100% sure they are between -1 and 1? Otherwise, I don’t really see why it should give you that error.

Martin

Sometime in blender floats are not exactly -1.0 or 1.0

but -1.00000145524466 or 1.00000145524466.

Put “print argument” in the line before

and see the results when errors happen…

jm

use the *round* function might help you.

Martin

I wouldn’t really advice rounding, just clamp the value, something like this:

```
if t<-1.0:
angle_y = 1.570796327
elif t>1.0:
angle_y = -1.570796327
else:
angle_y = -asin(t)
```

or slightly different like this:

```
angle_y = -asin(max(min(t, 1.0), -1.0))
```

The matrix topic continued in the realtime forum, you can find some shorter functions there, in case you find it useful:

https://blenderartists.org/viewtopic.php?t=1184

Thank you for all, the problem is deeper in the code than I though…