Blob
1 .TH MULDIV 32 .SH NAME3 muldiv, umuldiv \- high-precision multiplication and division4 .SH SYNOPSIS5 .B #include <u.h>6 .br7 .B #include <libc.h>8 .PP9 .B10 long muldiv(long a, long b, long c)11 .PP12 .B13 ulong umuldiv(ulong a, ulong b, ulong c)14 .SH DESCRIPTION15 .I Muldiv16 returns17 .BR a*b/c ,18 using a19 .B vlong20 to hold the intermediate result.21 .I Umuldiv22 is the equivalent for unsigned integers.23 They can be used to scale integer values without worry about24 overflowing the intermediate result.25 .PP26 On some architectures, these routines can generate a trap if the27 final result does not fit in a28 .B long29 or30 .BR ulong ;31 on others they will silently truncate.