Sgn Machine
Jump to navigation
Jump to search
Sgn machine is designed by PSTF.
Description
The function of the Sgn machine is to receive a real number. If it is positive, it outputs 1; if it is negative, it outputs -1; if it is 0, it outputs 0 infinitely.
Challenge Area
The Second Coming
import math
open x: Float;
x = Float(input());
x = sgn(x);
if x != 0:
print(x)
else:
while true:
print(x)
endwhile
endif
Python
import math
x = float(input());
x = sgn(x);
if x != 0:
print(x)
else:
while True:
print(x)