| Main index | Section 3 | Options |
#include <sys/qmath.h>
Q_LTZ() returns true if the numeric value passed in as n is negative (requires types which use the MSB as the sign bit), or false otherwise.
Q_PRECEQ() returns true if the number of a and b fractional bits is the same, false otherwise.
The Q_QLTQ(), Q_QLEQ(), Q_QGTQ(), Q_QGEQ(), Q_QEQ() and Q_QNEQ() functions compare two Q numbers, returning true if a is less than, less than or equal to, greater than, greater than or equal to, equal to, or not equal to b respectively, or false otherwise. The integral and fractional values are used to perform the comparison, without explicit concern for the underlying number of integer versus fractional bits.
Q_OFLOW() returns true if integer value iv cannot be stored in q without truncation, or false otherwise.
Q_RELPREC() returns the relative precision of a versus b. In terms of Qm.n notation, this function returns the difference between the n values of a and b. For example, a return value of +4 means that a has an additional 4 bits of fractional precision compared to b.
All of those functions operate on the following data types: s8q_t, u8q_t, s16q_t, u16q_t, s32q_t, u32q_t, s64q_t, and u64q_t, which are referred to generically as QTYPE. The ITYPE refers to the stdint(7) integer types. NTYPE is used to refer to any numeric type and is therefore a superset of QTYPE and ITYPE.
For more details, see qmath(3).
Q_RELPREC() returns the relative precision difference as a signed integer.
| Q_SIGNED (3) | July 8, 2018 |
| Main index | Section 3 | Options |
Please direct any comments about this manual page service to Ben Bullock. Privacy policy.
| “ | Our grievance is not just against Unix itself, but against the cult of Unix zealots who defend and nurture it. They take the heat, disease, and pestilence as givens, and, as ancient shamans did, display their wounds, some self-inflicted, as proof of their power and wizardry. We aim, through bluntness and humor, to show them that they pray to a tin god, and that science, not religion, is the path to useful and friendly technology. | ” |
| — The Unix Haters' handbook | ||