2 .\" Copyright (c) 2018 Netflix, Inc.
3 .\" All rights reserved.
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\" notice, this list of conditions, and the following disclaimer,
10 .\" without modification, immediately at the beginning of the file.
11 .\" 2. The name of the author may not be used to endorse or promote products
12 .\" derived from this software without specific prior written permission.
14 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
18 .\" ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
43 .Nd fixed-point math comparison and logic functions
47 .Fn Q_SIGNED "NTYPE n"
51 .Fn Q_PRECEQ "QTYPE a" "QTYPE b"
53 .Fn Q_QLTQ "QTYPE a" "QTYPE b"
55 .Fn Q_QLEQ "QTYPE a" "QTYPE b"
57 .Fn Q_QGTQ "QTYPE a" "QTYPE b"
59 .Fn Q_QGEQ "QTYPE a" "QTYPE b"
61 .Fn Q_QEQ "QTYPE a" "QTYPE b"
63 .Fn Q_QNEQ "QTYPE a" "QTYPE b"
65 .Fn Q_OFLOW "QTYPE q" "ITYPE iv"
67 .Fn Q_RELPREC "QTYPE a" "QTYPE b"
72 if the numeric data type passed in as
85 .Pq requires types which use the MSB as the sign bit ,
97 fractional bits is the same,
109 functions compare two Q numbers, returning
113 is less than, less than or equal to, greater than, greater than or equal to,
114 equal to, or not equal to
119 The integral and fractional values are used to perform the comparison, without
120 explicit concern for the underlying number of integer versus fractional bits.
129 without truncation, or false otherwise.
132 returns the relative precision of
138 notation, this function returns the difference between the
144 For example, a return value of +4 means that
146 has an additional 4 bits of fractional precision compared to
149 All of those functions operate on
150 the following data types:
160 which are referred to generically as
168 is used to refer to any numeric type and is therefore a superset of
173 For more details, see
188 functions return expressions that evaluate to boolean
194 returns the relative precision difference as a signed integer.
202 functions first appeared in
208 functions and this manual page were written by
209 .An Lawrence Stewart Aq Mt lstewart@FreeBSD.org
210 and sponsored by Netflix, Inc.