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

19 Jun, 2024 09:35 AM
18 Jun, 2024 10:50 AM
15 Jun, 2024 01:44 PM
08 Jun, 2024 09:05 AM
08 Jun, 2024 09:00 AM