linux-mips
[Top] [All Lists]

Re: Float / Double issues

To: Tim Hockin <thockin@cobaltnet.com>
Subject: Re: Float / Double issues
From: Ralf Baechle <ralf@uni-koblenz.de>
Date: Wed, 14 Jul 1999 22:52:22 +0200
Cc: linux@cthulhu.engr.sgi.com
In-reply-to: <378AADF5.96152E0B@cobaltnet.com>; from Tim Hockin on Mon, Jul 12, 1999 at 08:09:41PM -0700
References: <378AADF5.96152E0B@cobaltnet.com>
Sender: owner-linux@cthulhu.engr.sgi.com
On Mon, Jul 12, 1999 at 08:09:41PM -0700, Tim Hockin wrote:

> 2) Floats and va_arg crash with an FPE
> 
> below are two snippets that show these, at least on our boxes.  If
> someone could confirm or deny their existence on any other platform?

The float / va_arg bug is a pilot error.  See ANSI C draft chapter 6.5.2.2,
paragraph 6 and7.  In short the problem is that float parameters will be
promoted to double.  You therefore have to to change the call of va_arg
in your float.c to va_arg(va, float).

Obvious, heh ;-)

Btw, SGI's compiler also doesn't attempt to get va_arg(..., float) right.

  Ralf

<Prev in Thread] Current Thread [Next in Thread>