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
36 .Nd fixed-point math functions which apply integers to a Q number
40 .Fn Q_QADDI "QTYPE *a" "ITYPE b"
42 .Fn Q_QDIVI "QTYPE *a" "ITYPE b"
44 .Fn Q_QMULI "QTYPE *a" "ITYPE b"
46 .Fn Q_QSUBI "QTYPE *a" "ITYPE b"
48 .Fn Q_QFRACI "QTYPE *q" "ITYPE n" "ITYPE d"
50 .Fn Q_QCPYVALI "QTYPE *q" "ITYPE i"
58 functions add, divide, multiply or subtract
62 respectively, storing the result in
67 function computes the fraction
71 and stores the fixed-point result in
78 integer and fractional bits with the Q representation of integer value
81 All of those functions operate on
82 the following data types:
92 which are referred to generically as
100 For more details, see
110 functions return 0 on success, or an errno on failure.
112 is returned for divide-by-zero.
116 are returned for overflow and underflow respectively.
124 functions first appeared in
130 functions and this manual page were written by
131 .An Lawrence Stewart Aq Mt lstewart@FreeBSD.org
132 and sponsored by Netflix, Inc.