---
name: "ggidev-le0_3"
section: "3"
platform: "linux"
package: "libggi2-dev"
version: "1:2.2.2-5"
release: "Debian 6.0 (Squeeze)"
platforms: ["linux"]
url: "https://new.carta.tech/ggidev-sign_3"
---

# ggidev-le0\_3(3)

triple-int properties

Part of [ggidev-sign\_3(3)](/ggidev-sign_3/3.md).

## NAME

**ggidev-sign\_3**, **ggidev-bits\_3**, **ggidev-eq0\_3**, **ggidev-gt0\_3**, **ggidev-ge0\_3**, **ggidev-lt0\_3**, **ggidev-le0\_3** - triple-int properties

## SYNOPSIS

```
#include <ggi/internal/triple-int.h>
int sign_3(unsigned x[3]);
int bits_3(unsigned x[3]);
int eq0_3(unsigned x[3]);
int gt0_3(unsigned x[3]);
int ge0_3(unsigned x[3]);
int lt0_3(unsigned x[3]);
int le0_3(unsigned x[3]);
```

## DESCRIPTION

**sign\_3** checks the sign of **x**.

**bits\_3** counts the number of significant bits of **x**. I.e. leading zeros in a positive value and leading ones in a negative value are not counted.

**eq0\_3**, **gt0\_3**, **ge0\_3**, **lt0\_3** and **le0\_3** tests the relation between **x** and zero. **eq0\_3** tests if **x** is equal to zero, **gt0\_3** if **x** is greater than zero, **ge0\_3** if **x** is greater than or equal to zero, **lt0\_3** if **x** is less than zero and last but not least **le0\_3** tests if **x** is less than or equal to zero.

## RETURN VALUE

**sign\_3** returns -1 for negative values, 0 for zero values and 1 for positive values.

**bits\_3** returns 0 for **x** equal to 0 or -1, 1 for **x** equal to 1 and -2, 2 for **x** equal to 2, 3, -3 and -4 etc.

**eq0\_3**, **gt0\_3**, **ge0\_3**, **lt0\_3** and **le0\_3** all returns non-zero if the relation is true, and zero otherwise.

## EXAMPLES

Some **triple-int** tests:

```
unsigned x[3];
assign_int_3(x, 5);
ASSERT(sign_3(x) == 1);
ASSERT(bits_3(x) == 3);
ASSERT(!eq0_3(x));
ASSERT(gt0_3(x));
ASSERT(ge0_3(x));
ASSERT(!lt0_3(x));
ASSERT(!le0_3(x));
```

## SEE ALSO

`ggidev-triple-int(7)`, `ggidev-assign_int_3(3)`
