Intop-Sign

Calculates sign of integer.

Summary
Intop-SignCalculates sign of integer.
CopyrightThis program is free software.
Files
C-kern/api/math/int/sign.hHeader file of Intop-Sign.
C-kern/math/int/sign.cImplementation file Intop-Sign impl.
Functions
test
unittest_math_int_signTests implementation of sign_int.
int_t
query
sign_intReturn the sign of an integer (signum function).
inline implementation
Macros
sign_intImplements int_t.sign_int as a generic function.

Copyright

This program is free software.  You can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.

Author

© 2011 Jörg Seebohn

Files

C-kern/api/math/int/sign.h

Header file of Intop-Sign.

C-kern/math/int/sign.c

Implementation file Intop-Sign impl.

Functions

Summary
test
unittest_math_int_signTests implementation of sign_int.

test

unittest_math_int_sign

int unittest_math_int_sign(void)

Tests implementation of sign_int.

int_t

Summary
query
sign_intReturn the sign of an integer (signum function).

query

sign_int

int sign_int(int i)

Return the sign of an integer (signum function).  This function is implemented as a generic function for all integer types.

Paramter

iThe argument whose sign is returned.

Returns

-1i is megative
0i is zero
+1i is positive

inline implementation

Summary
Macros
sign_intImplements int_t.sign_int as a generic function.

Macros

sign_int

Implements int_t.sign_int as a generic function.

Calculates sign of integer.
Implements Intop-Sign (only unittest_math_int_sign).
int unittest_math_int_sign(void)
Tests implementation of sign_int.
Implements int_t.sign_int as a generic function.
int sign_int(int i)
Return the sign of an integer (signum function).
Close