Blender 2.8 - Cycles - Math (Sign)
Your node tree almost worked, it just required a different approach at the end. Let me show you a working example here:



for clarity's sake I have added value nodes to give the inputs a caption. There is the Test Value, which is basically the number you input, and a Tolerance, which circumvents the problem that there is no real a == b node. So if the value you feed is inbetween +Tolerance and -Tolerance, the node tree outputs 0.

Besides that, the only change is the Multiply and Add node at the end of the tree. Why that? Let's walk through a few sample values:

TestValue = 5.333
GreatherThan will be +1
LessThan will be 0
-&gt; Multiply will be 0 too
-&gt; Add will do 1 + 0 = 1, which is what you want


Let's change TestValue to something negative:

TestValue = -2
GreatherThan will be 0
LessThan will be +1
-&gt; Multiply will be -1, as 1 * -1 = -1
-&gt; Add will do 0 + -1 = -1, which is what you want


And finally, something lower than Tolerance:

TestValue = 0.000001
GreatherThan will be 0
LessThan will be 0
-&gt; Multiply will be 0 too
-&gt; Add will do 0 + 0 = 0, which is what you want


To make this a bit more visible, I have added this node setup at the end of the tree:



The Add and `Multiply basically bring the -1 to +1 range to a 0 to 1 range. The Color Ramp has three slots, if the input value is 0, the output is red, if input is 0.5, output is green, and if input is 1, output is blue. See it in action here:



Here is the file for testing: