xref: /dragonfly/contrib/openbsd_libm/man/fmod.3 (revision 0db87cb7)
1.\"	$OpenBSD: fmod.3,v 1.12 2013/07/17 05:42:11 schwarze Exp $
2.\" Copyright (c) 1991 The Regents of the University of California.
3.\" All rights reserved.
4.\"
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
8.\" 1. Redistributions of source code must retain the above copyright
9.\"    notice, this list of conditions and the following disclaimer.
10.\" 2. Redistributions in binary form must reproduce the above copyright
11.\"    notice, this list of conditions and the following disclaimer in the
12.\"    documentation and/or other materials provided with the distribution.
13.\" 3. Neither the name of the University nor the names of its contributors
14.\"    may be used to endorse or promote products derived from this software
15.\"    without specific prior written permission.
16.\"
17.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27.\" SUCH DAMAGE.
28.\"
29.\"     from: @(#)fmod.3	5.1 (Berkeley) 5/2/91
30.\"
31.Dd $Mdocdate: July 17 2013 $
32.Dt FMOD 3
33.Os
34.Sh NAME
35.Nm fmod ,
36.Nm fmodf ,
37.Nm fmodl
38.Nd floating-point remainder functions
39.Sh SYNOPSIS
40.In math.h
41.Ft double
42.Fn fmod "double x" "double y"
43.Ft float
44.Fn fmodf "float x" "float y"
45.Ft long double
46.Fn fmodl "long double x" "long double y"
47.Sh DESCRIPTION
48The
49.Fn fmod
50function computes the floating-point remainder of
51.Fa x Ns / Fa y .
52The
53.Fn fmodf
54function is a single precision version of
55.Fn fmod .
56The
57.Fn fmodl
58function is an extended precision version of
59.Fn fmod .
60.Sh RETURN VALUES
61The
62.Fn fmod ,
63.Fn fmodf
64and
65.Fn fmodl
66functions return the value
67.Sm off
68.Fa x - Em i * Fa y ,
69.Sm on
70for some integer
71.Em i
72such that, if
73.Fa y
74is non-zero, the result has the same sign as
75.Fa x
76and magnitude less than the magnitude of
77.Fa y .
78If
79.Fa y
80is zero, whether a domain error occurs or the
81.Fn fmod
82function returns zero is implementation-defined.
83.Sh SEE ALSO
84.Xr remainder 3
85.Sh STANDARDS
86The
87.Fn fmod
88function conforms to
89.St -ansiC .
90.Sh HISTORY
91An
92.Fn fmod
93function first appeared in
94.At v5 .
95