Re: using doubles in the kernel

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

 



Lars Olsson wrote:
> 
> Dear all,
> Is there any reason why you should not use doubles and floats in the
> kernel? I remember that someome said that you should not use floating
> point types but I can't remember where. I need to use floating point
> number since I'm implementing a neural network (executing in kernel
> space because of performance reasons) and it is alot easier to implement
> this with floating point numbers.

I believe you are out of luck. As I understand it, the kernel
may not use the FPU because to do so would interfere with
user-space processes' use of the FPU. According to the
kernel-hacking HOWTO:

"
No floating point or MMX

     The FPU context is not saved; you would mess with some user 
     process' FPU. If you really want to do this, you would have
     to explicitely save/restore the full FPU state (and avoid
     context switches). It is generally a bad idea; use fixed point
     arithmetic first. 
"

Cheers,

-- Joe
--
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