Page MenuHomeFeedback Tracker

Lack of native signum or sgn(x) function
New, WishlistPublic

Description

Hello, since it's really handy and easy to implement, would it be possible to add the signum function?
One possible way to do it is:

if (x != 0) {
sgn = abs(x)/x;}
else {
sgn = 0;}

By making this an engine function you wouldn't "waste" much computational power while having a consistent and more readable command.

Details

Legacy ID
3206069159
Severity
None
Resolution
Open
Reproducibility
Always
Category
Scripting

Event Timeline

PYL set Category to Scripting.Feb 12 2016, 6:17 PM
PYL set Reproducibility to Always.
PYL set Severity to None.
PYL set Resolution to Open.
PYL set Legacy ID to 3206069159.May 8 2016, 1:43 PM
PYL added a subscriber: PYL.
PYL added a comment.Feb 16 2016, 2:48 PM

I think it's an interesting addition. This command is used a lot even in BIS' functions! It would make life easier, faster and more elegant ;)