Sign Node

john's Avatar

john

08 Apr, 2023 08:14 AM

Attached is a very simple but occasionally useful node: sign.

Sign returns the sign of a number: -1 if the number is negative, +1 if the number is positive, or 0 if the number is 0 (or -0).

This comes in handy every now and then. It's not terribly hard to compute from scratch, but you do have to beware of those negative zeros which sometimes appear. So it's easier to copy paste this node than to reinvent that wheel each time. Most languages have this function. Now we do too.

Sign will be included in the upcoming 3.2 rev of my library - coming soon!

John

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Already uploaded files

  • sign_demo_screenshot.png 364 KB
  • sign_demo.ndbx.zip 9.15 KB

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

23 May, 2023 02:09 PM
12 May, 2023 10:17 PM
07 May, 2023 11:53 PM
07 May, 2023 04:43 PM
17 Apr, 2023 11:34 AM

 

15 Apr, 2023 01:31 AM
15 Apr, 2023 01:23 AM
14 Apr, 2023 02:54 AM
11 Apr, 2023 03:53 PM
08 Apr, 2023 09:59 PM
08 Apr, 2023 08:14 AM