- UID
- 81263
- 帖子
- 53
- 精华
- 2
- 积分
- 167
|
3# kungfu529
利用 sgn(x)
sgn(1+sgn(x)):x>=0 为1,其余为0
sgn(sgn(x)-0.5): x>0,1,else -1
再套一个sgn,即sgn(1+sgn(sgn(x)-0.5))即可
sgn(1+sgn(a-b)),a>=b为真,其余为假
sgn(1+sgn(sgn(a-b)-0.5)):a>b 真,其余假
c=sgn(1+sgn(a-b))*a+sgn(1+sgn(sgn(b-a)-0.5))*b |
|