Ens torna 1 si x >= 0 i -1 si x < 0.
1
x >= 0
-1
x < 0
x El nombre sobre el que aplicar l'operació.
x
function init() local x = {0, 4.1, 10.5, 0.8, -4.3} cls() for i=1,#x do print("signe de "..x[i].." = "..sgn(x[i]), 0, i-1) end end
Deleting the wiki page "sgn" cannot be undone. Continue?