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
38 .Nd fixed-point math functions which apply integers to a Q number
42 .Fn Q_QADDI "QTYPE *a" "ITYPE b"
44 .Fn Q_QDIVI "QTYPE *a" "ITYPE b"
46 .Fn Q_QMULI "QTYPE *a" "ITYPE b"
48 .Fn Q_QSUBI "QTYPE *a" "ITYPE b"
50 .Fn Q_QFRACI "QTYPE *q" "ITYPE n" "ITYPE d"
52 .Fn Q_QCPYVALI "QTYPE *q" "ITYPE i"
60 functions add, divide, multiply or subtract
64 respectively, storing the result in
69 function computes the fraction
73 and stores the fixed-point result in
80 integer and fractional bits with the Q representation of integer value
83 All of those functions operate on
84 the following data types:
94 which are referred to generically as
102 For more details, see
112 functions return 0 on success, or an errno on failure.
114 is returned for divide-by-zero.
118 are returned for overflow and underflow respectively.
126 functions first appeared in
132 functions and this manual page were written by
133 .An Lawrence Stewart Aq Mt lstewart@FreeBSD.org
134 and sponsored by Netflix, Inc.