> Jon Masters wrote: >> On 4/27/06, Ming Zhang <mingz@xxxxxxxxxxx> wrote: >> >>> kernel does not allow float point computation. google about why. >> >> However, if the original poster just wanted higher precision on 32-bit >> then there is limited support in-kernel for 64-bit arthimetic. >> Functions like do_div can help, if you're stuck. >> >> Jon. >> >> -- > > Related question - > > In-kernel code must do shift then int-multiply to get approximation of > floating point mult. > Is it possible use floating point math at compile-time (ie reduced by > gcc to constants) > to compute the shift and multiply terms ? > > In a sense, it could be done by macros which extract the mantissa & > exponent from a > floating point number ( except that this implies the availability of > that floating-point register) > > The use-case Im thinking of is the new Generic-Timekeeping-System code > now in 17-rcX-mmY > (X >=1) iirc. Computing the .shift, .mult values at compile-time in > macros that hide > the complexities would be nice. There are runtime helper-funcs that use > do_div(). > > -jimc I thought using floating point was possible, as long as you saved the floating point context. But this would probably be very architecture dependent. In any case, I know it is discouraged. -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/