9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] IEEE floats
@ 2014-02-27 11:51 Steve Simon
  2014-02-27 12:09 ` erik quanstrom
  0 siblings, 1 reply; 4+ messages in thread
From: Steve Simon @ 2014-02-27 11:51 UTC (permalink / raw)
  To: 9fans

Porting stuff from the net (under ape) which wants to use IEEE floats.
i.e. ieee754_float32_t, powf(), fabsf() and log10f().

I could map these to plan9 floats and call the double version
of the transient functions, but is there a better solution?

-Steve



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [9fans] IEEE floats
  2014-02-27 11:51 [9fans] IEEE floats Steve Simon
@ 2014-02-27 12:09 ` erik quanstrom
  2014-02-27 12:29   ` Charles Forsyth
  0 siblings, 1 reply; 4+ messages in thread
From: erik quanstrom @ 2014-02-27 12:09 UTC (permalink / raw)
  To: 9fans

On Thu Feb 27 06:54:22 EST 2014, steve@quintile.net wrote:
> Porting stuff from the net (under ape) which wants to use IEEE floats.
> i.e. ieee754_float32_t, powf(), fabsf() and log10f().
> 
> I could map these to plan9 floats and call the double version
> of the transient functions, but is there a better solution?

plan 9 uses ieee floating point on machines that support it
(all current arches) so ieee754_float32_t ≡ float.
substituting the double version should work.

did they abolish the rule that float is promoted to double
on function call?  or is this the equivalent of char fu(char) vs
int fu(int).

- erik



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [9fans] IEEE floats
  2014-02-27 12:09 ` erik quanstrom
@ 2014-02-27 12:29   ` Charles Forsyth
  2014-02-27 12:45     ` erik quanstrom
  0 siblings, 1 reply; 4+ messages in thread
From: Charles Forsyth @ 2014-02-27 12:29 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

[-- Attachment #1: Type: text/plain, Size: 624 bytes --]

On 27 February 2014 12:09, erik quanstrom <quanstro@quanstro.net> wrote:

> did they abolish the rule that float is promoted to double
> on function call?  or is this the equivalent of char fu(char) vs
> int fu(int).
>

if you use the original declaration syntax of 40 years ago,
float must be promoted to double because the caller won't know the type,
but the ANSI declarator syntax that everyone ought to be using allows
the distinction between float and double to be maintained, and it is.
compare

void
g(float a)
{
g(a);    /* a is float */
}

void
h(a)
float a;
{
h(a);    /* a is double */
}

[-- Attachment #2: Type: text/html, Size: 1690 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [9fans] IEEE floats
  2014-02-27 12:29   ` Charles Forsyth
@ 2014-02-27 12:45     ` erik quanstrom
  0 siblings, 0 replies; 4+ messages in thread
From: erik quanstrom @ 2014-02-27 12:45 UTC (permalink / raw)
  To: 9fans

> if you use the original declaration syntax of 40 years ago,
> float must be promoted to double because the caller won't know the type,
> but the ANSI declarator syntax that everyone ought to be using allows
> the distinction between float and double to be maintained, and it is.
> compare
>
> void
> g(float a)
> {
> g(a);    /* a is float */
> }
>
> void
> h(a)
> float a;
> {
> h(a);    /* a is double */
> }

thanks!

- erik



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-02-27 12:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-27 11:51 [9fans] IEEE floats Steve Simon
2014-02-27 12:09 ` erik quanstrom
2014-02-27 12:29   ` Charles Forsyth
2014-02-27 12:45     ` erik quanstrom

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).