URI: 
       tmuldiv.3 - plan9port - [fork] Plan 9 from user space
  HTML git clone git://src.adamsgaard.dk/plan9port
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
       tmuldiv.3 (640B)
       ---
            1 .TH MULDIV 3
            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.