diff options
Diffstat (limited to 'src/sign.c')
-rw-r--r-- | src/sign.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/sign.c b/src/sign.c new file mode 100644 index 0000000..07c9d7a --- /dev/null +++ b/src/sign.c @@ -0,0 +1,16 @@ +#include <stdio.h> +#include <glib.h> + +/* is there a standard C function to do this? */ + +gint +sign (gint n) +{ + if (n < 0) { + return (-1); + } else if (n > 0) { + return (+1); + } + + return (0); +} |