Commit Graph

37 Commits

Author SHA1 Message Date
Edward Tomasz Napierala
5a38af1fb8 Introduce <sys/qmath.h>, a fixed-point math library from Netflix.
This makes it possible to perform mathematical operations
on
fractional values without using floating point. It operates on Q
numbers, which are integer-sized, opaque structures initialized
to hold a chosen number of integer and fractional
bits.


For a general description of the Q number system, see the "Fixed Point
Representation & Fractional Math" whitepaper[1]; for the actual
API see the qmath(3) man page.

This is one of dependencies for the upcoming stats(3) framework[2]
that will be applied to the TCP stack in a later commit.

1. https://www.superkits.net/whitepapers/Fixed%20Point%20Representation%20&%20Fractional%20Math.pdf
2. https://reviews.freebsd.org/D20477

Reviewed by:	bcr (man pages, earlier version), sef (earlier version)
Discussed with:	cem, dteske, imp, lstewart
Sponsored By:	Klara Inc, Netflix
Obtained from:	Netflix
Differential Revision:	https://reviews.freebsd.org/D20116
2019-08-27 11:46:22 +00:00
Dimitry Andric
dfd6ede5f9 Remove the sentence in math(3) about some long double math functions not
being available.

Submitted by:	Steve Kargl
MFC after:	3 days
2017-12-07 20:38:37 +00:00
Warner Losh
fbbd9655e5 Renumber copyright clause 4
Renumber cluase 4 to 3, per what everybody else did when BSD granted
them permission to remove clause 3. My insistance on keeping the same
numbering for legal reasons is too pedantic, so give up on that point.

Submitted by:	Jan Schaumann <jschauma@stevens.edu>
Pull Request:	https://github.com/freebsd/freebsd/pull/96
2017-02-28 23:42:47 +00:00
David Schultz
715a43edd0 It's no longer accurate to say that math.h "constitute[s] the C math
library," since complex.h, tgmath.h, and fenv.h are also part of the
math library.  Replace the outdated sentence with some references to
the other parts.
2011-10-17 06:10:32 +00:00
Steve Kargl
dfe5233b59 Implement the long double version for the cube root function, cbrtl.
The algorithm uses Newton's iterations with a crude estimate of the
cube root to converge to a result.

Reviewed by:	bde
Approved by:	das
2011-03-12 16:50:39 +00:00
David Schultz
63687c8b08 Fix various nits in style and comments that were pointed out by bde.
Code changes verified with md5.
2010-12-07 02:19:15 +00:00
David Schultz
177668d11f Add log2() and log2f(). 2010-12-05 22:11:22 +00:00
Ulrich Spörlein
25c8b07fc2 mdoc: Garbage collect unused/unneeded macros 2010-05-27 13:56:27 +00:00
David Schultz
3be0479b4c Document the fact that we have nan(3) now, and make some minor clarifications
in other places.
2007-12-17 01:04:43 +00:00
Warner Losh
ee7093a640 Remove California Regent's clause 3, per letter 2007-01-09 01:02:06 +00:00
Ruslan Ermilov
110e1704d3 -mdoc sweep. 2005-11-17 13:00:00 +00:00
Bruce Evans
32948b81c4 The logb() functions are not just ieee754 "test" functions, but are
standard in C99 and POSIX.1-2001+.  They are also not deprecated, since
apart from being standard they can handle special args slightly better
than the ilogb() functions.

Move their documentation to ilogb.3.  Try to use consistent and improved
wording for both sets of functions.  All of ieee854, C99 and POSIX
have better wording and more details for special args.

Add history for the logb() functions and ilogbl().  Fix history for
ilogb().
2005-11-06 12:18:27 +00:00
Ruslan Ermilov
01293bdb90 Markup nit.
Approved by:	re (blanket)
2005-06-16 21:56:03 +00:00
David Schultz
90232fdf16 Document exp2() and exp2f(), and make other minor tweaks and updates. 2005-04-05 02:57:28 +00:00
David Schultz
3b9141ee91 Implement and document remquo() and remquof(). 2005-03-25 04:40:44 +00:00
David Schultz
15a53f77fd Add nexttoward to the list of implemented functions, and explicitly
list the four that are still missing.
2005-03-07 04:59:53 +00:00
David Schultz
29bf6af890 - Move the functions presently described in in ieee(3) to their own
manpages.  They are not very related, so separating them makes it
  easier to add meaningful cross-references and extend some of the
  descriptions.
- Move the part of math(3) that discusses IEEE 754 to the ieee(3)
  manpage.
2005-01-27 05:46:17 +00:00
David Schultz
52611c608e Many changes, including the following major ones:
- Rearrange the list of functions into categories.
- Remove the ulps column.  It was appropriate for only some
  of the functions in the list, and correct for even fewer
  of them.
- Add some new paragraphs, and remove some old ones about
  NaNs that may do more harm than good.
- Document precisions other than double-precision.
2005-01-23 22:05:33 +00:00
David Schultz
d5580d091a Add fma() and fmaf(), which implement a fused multiply-add operation. 2005-01-22 09:53:18 +00:00
Ruslan Ermilov
24a0682c64 Sort sections. 2005-01-20 09:17:07 +00:00
Ruslan Ermilov
5391441c05 Use the \*(If string provided by mdoc(7), to represent infinity. 2005-01-16 16:49:10 +00:00
David Schultz
2aac156d2e Document [l]lrint[f]() and [l]lround[f](). 2005-01-11 23:12:17 +00:00
Ruslan Ermilov
2d82ac3110 Scheduled mdoc(7) sweep. 2005-01-11 20:50:51 +00:00
Ruslan Ermilov
4e05ab77a8 Sanitize the markup, as prompted. 2005-01-11 20:16:03 +00:00
David Schultz
dbc8f2b5ce More updates for math(3):
- Make some minor rearrangements in the introduction.
- Mention the problem with argument reduction on i386.
- Add recently-implemented functions to the table.
- Un-document the error bounds that only apply to the old 4BSD math
  library, and fill in the correct values where I know them.  No
  attempt has been made to document bounds lower than 1 ulp, although
  smaller bounds are usually achievable in round-to-nearest mode.
2004-10-11 20:13:52 +00:00
David Schultz
f7748f6e01 Uncomment some functions that we now support. 2004-06-20 10:39:09 +00:00
David Schultz
2a6bf1fadb Memory's free, but all the world ain't a VAX anymore. Bring math.3
kicking and screaming into the 1980's.  This change converts most of
the markup from man(7) to mdoc(7) format, and I believe it removes or
updates everything that was flat out wrong.  However, much work is
still needed to sanitize the markup, improve coverage, and reduce
overlap with other manpages.  Some of the sections would better belong
in a philosophy_of_w_kahan.3 manpage, but they are informative and
remain at least as reminders of topics to cover.

Reviewed by:	doc@, trhodes@
2004-06-19 03:25:28 +00:00
Dima Dorfman
7ebcc426ef Remove whitespace at EOL. 2001-07-15 07:53:42 +00:00
Sheldon Hearn
4e86fcacf6 Remove more single-space hard sentence breaks. 2000-03-02 14:54:02 +00:00
Peter Wemm
7f3dea244c $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
Jonathan Lemon
4f36d4ac99 Document the fpgetprec/fpsetprec functions in their man page.
Add cross-references to the elusive fpsetmask() function to various other
man pages.
Reviewed by:	bde
1998-02-04 22:30:20 +00:00
Daniel O'Callaghan
fb9d219add PR: 5489
Submitted by:	Steve G. Kargl <kargl@troutmask.apl.washington.edu>
Repair corrupted text.
1998-01-15 23:28:18 +00:00
Peter Wemm
7e546392b5 Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
Jordan K. Hubbard
1130b656e5 Make the long-awaited change from $Id$ to $FreeBSD$
This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore.  This update would have been
insane otherwise.
1997-01-14 07:20:47 +00:00
Mike Pritchard
4bd9ba3c2f Fixed some minor formatting problems to silence manck some more.
Corrected some bogus cross references to man pages that we don't/won't
have and either deleted them, or found a more appropriate man page
that we do have.  Various other minor changes to silence manck.

Manck is currently down to about 200 lines of errors, down from
the 500 - 600+ when I started all this.
1996-02-12 01:20:38 +00:00
Jordan K. Hubbard
7a15a32a17 Additions from Thomas Graichen to mention each functions' floating point
counterpart.
Submitted by:	Thomas Graichen <graichen@sirius.physik.fu-berlin.de>
1995-03-01 05:06:48 +00:00
Jordan K. Hubbard
3a8617a83f J.T. Conklin's latest version of the Sun math library.
-- Begin comments from J.T. Conklin:
The most significant improvement is the addition of "float" versions
of the math functions that take float arguments, return floats, and do
all operations in floating point.  This doesn't help (performance)
much on the i386, but they are still nice to have.

The float versions were orginally done by Cygnus' Ian Taylor when
fdlibm was integrated into the libm we support for embedded systems.
I gave Ian a copy of my libm as a starting point since I had already
fixed a lot of bugs & problems in Sun's original code.  After he was
done, I cleaned it up a bit and integrated the changes back into my
libm.
-- End comments

Reviewed by:	jkh
Submitted by:	jtc
1994-08-19 09:40:01 +00:00