Warning: Attempt to read property "date" on null in /usr/local/www/websvn.planix.org/blame.php on line 247

Warning: Attempt to read property "msg" on null in /usr/local/www/websvn.planix.org/blame.php on line 247
WebSVN – planix.SVN – Blame – /os/branches/feature_fixcpp/sys/man/2/muldiv – Rev 34

Subversion Repositories planix.SVN

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
.TH MULDIV 2
2
.SH NAME
3
muldiv, umuldiv \- high-precision multiplication and division
4
.SH SYNOPSIS
5
.B #include <u.h>
6
.br
7
.B #include <libc.h>
8
.PP
9
.B
10
long muldiv(long a, long b, long c)
11
.PP
12
.B
13
ulong umuldiv(ulong a, ulong b, ulong c)
14
.SH DESCRIPTION
15
.I Muldiv
16
returns
17
.BR a*b/c ,
18
using a
19
.B vlong
20
to hold the intermediate result.
21
.I Umuldiv
22
is the equivalent for unsigned integers.
23
They can be used to scale integer values without worry about
24
overflowing the intermediate result.
25
.PP
26
On some architectures, these routines can generate a trap if the
27
final result does not fit in a
28
.B long
29
or
30
.BR ulong ;
31
on others they will silently truncate.