These are chat archives for machinekit/machinekit

19th
Aug 2016
zhivko
@zhivko
Aug 19 2016 09:59
In hal component I would like to calculate sign of number - like sgn or signum, I found rtapi_copysign, but it takes 2 arguments.... and not sure how this work - I would expect something that takes only one arg... any hint?

maybe I could just write it like:

if (x > 0) return 1;
if (x < 0) return -1;
return 0;

but is there more appropriate way of doing it ?

Ah ok: copysign() takes the sign from one argument and the absolute value from the other
zhivko
@zhivko
Aug 19 2016 10:02
Thx!