summaryrefslogtreecommitdiff
path: root/src/sign.c
blob: 07c9d7ab97e27f8c8df1c80724e382b45300742f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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);
}