[Top][All Lists]

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

Re: Floating point usage

From: Colin D Bennett
Subject: Re: Floating point usage
Date: Thu, 5 Jun 2008 10:12:38 -0700

On Thu, 05 Jun 2008 17:23:00 +0200
Stefan Reinauer <address@hidden> wrote:

> Jan Kleinsorge wrote:
> > Pavel Roskin wrote:
> >   
> >> Hello!
> >>
> >> I tried to compile the current grub on Fedora 9 for PowerPC, but it
> >> failed due to floating point usage in ls.  Sorry, I don't have the
> >> exact message handy.
> >>
> >> Anyway, there are several references to "float" and "double" in the
> >> code, and I think it's wrong.  GRUB should be able to work on
> >> systems with no floating point support and on systems where the
> >> floating point device needs to be activated.  Even Linux kernel
> >> avoids using floating point.
> >>
> >> If everyone is fine, I'll try to remove all floating point stuff
> >> from the code.
> >>
> >>     
> >  Hi Pavel,
> >
> > there is no need for hard-float support on the target machine. The
> > libgcc provides all the software-emulation routines. Given that
> > GRUB is linked against it. Which is likely as it is a necessity
> > when compiling with gcc. Maybe your compilation is simply broken
> > because of that one missing. Could you please post the error
> > message?
> Nonetheless, using Floating Point operations in bootloaders and
> firmware  is highly discouraged. If Floating Point is required for a
> bootloader (except, maybe, possibly, at all, for encryption) the
> bootloader is definitely broken, either in implementation or in
> design.
> Also keep in mind, most operating systems expect the FPU to be in
> power on state.
> Stefan

The bootloader is "broken" if it uses floating point arithmetic?  I
think that while GRUB should not REQUIRE an FPU, it could use software
floating point if there was a good reason to do so (and it would not
be broken as long is it was done portably). Though I only have minimal
knowledge of encryption algorithms, I don't think that floating point
math is often used.

I think that avoiding floating point math as Pavel Roskin suggested is
good, though I don't agree that Stefan's assertion that any use of
floating point math is necessarily "broken" -- it might be better to
say that we'd prefer not to pull in softfloat libraries (necessary
since many targets have no FPU); therefore it is desirable to avoid
floating point math.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]