All of lore.kernel.org
 help / color / mirror / Atom feed
From: Colin D Bennett <colin@gibibit.com>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: Re: Floating point usage
Date: Thu, 5 Jun 2008 10:12:38 -0700	[thread overview]
Message-ID: <20080605101238.68ecf34e@gibibit.com> (raw)
In-Reply-To: <484804D4.8020400@coresystems.de>

On Thu, 05 Jun 2008 17:23:00 +0200
Stefan Reinauer <stepan@coresystems.de> 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.

Colin



  reply	other threads:[~2008-06-05 17:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-04 16:47 Floating point usage Pavel Roskin
2008-06-05 15:12 ` Jan Kleinsorge
2008-06-05 15:23   ` Stefan Reinauer
2008-06-05 17:12     ` Colin D Bennett [this message]
2008-06-05 20:01   ` Vincent Pelletier
2008-06-05 20:53     ` Robert Millan
2008-06-05 21:22       ` Stefan Reinauer
2008-06-05 20:12 ` Vesa Jääskeläinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080605101238.68ecf34e@gibibit.com \
    --to=colin@gibibit.com \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.