Re: How to use floating point in *initializations*, then cast to int or long

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux