# Best/easy way for invert a float

hello.

I have a function returning a value between -100.0 to 100.0, i going to use that value for “Make Rot”

but i want its if the value its 100 modified for be -100 and if its -100 -> 100

… invert
there are any BP for do that easy?

thanks.

You could just multiply it by -1. A negative * a negative = positive, and a positive * a negative = negative.

Absolute quit the minus soo any number is always positive.

1 Like

You can just multiply the returned value by -1

-1 x -100 = 100

-1 x 100 = -100

Would that work?

2 Likes

oh sh*t i need go back to the school or sleep more. :o

thanks all.

Isn’t 0 - X functionally the same as X * -1?

Sure that would work as well, multiplying by -1 and subtracting from 0 will only change the ± value, so either way should work just fine. Not sure which is the better, less resource-hungry, or “proper” way, but you can do almost anything in multiple ways, so long as it doesn’t affect performance it is just whichever you feel comfortable with.

I believe “0 - X” can be used in Math Expression nodes, while unary operations (in case the prefix notation -1) can not.