9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] libfmt/libutf and long double
@ 2003-12-30  3:10 suspect
  2003-12-30  3:30 ` David Presotto
  2003-12-31 16:17 ` Russ Cox
  0 siblings, 2 replies; 5+ messages in thread
From: suspect @ 2003-12-30  3:10 UTC (permalink / raw)
  To: 9fans

Hello,

I've run into a behavior with libfmt/libutf on UNIX system
that does not seem intuitive:

	long double ldv = 3.3;
	print("long double var = %llE\n", ldv);

gives:
	long double var = -6.257775E+92

Identical code under Plan 9 gives the expected output of:

	long double var = 3.300000E+00

Is there any particular reason why the behaviors should
differ in this manner ?

cheers,



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

* Re: [9fans] libfmt/libutf and long double
  2003-12-30  3:10 [9fans] libfmt/libutf and long double suspect
@ 2003-12-30  3:30 ` David Presotto
  2003-12-31 16:17 ` Russ Cox
  1 sibling, 0 replies; 5+ messages in thread
From: David Presotto @ 2003-12-30  3:30 UTC (permalink / raw)
  To: 9fans

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

Could it be that we don't know squat about long double?  At least in
our plan9 ape library, we just assume that the 'E' arg is a double
and don't look at the ll flags.  I don't know about the Unix libfmt.

Look at __efgfmt in fltfmt.c and see what the expected arg is.

[-- Attachment #2: Type: message/rfc822, Size: 2442 bytes --]

From: suspect@suspicious.org
To: 9fans@cse.psu.edu
Subject: [9fans] libfmt/libutf and long double
Date: Mon, 29 Dec 2003 22:10:41 -0500
Message-ID: <C01AD478-3A75-11D8-BD48-000A95C53D8A@suspicious.org>

Hello,

I've run into a behavior with libfmt/libutf on UNIX system
that does not seem intuitive:

	long double ldv = 3.3;
	print("long double var = %llE\n", ldv);

gives:
	long double var = -6.257775E+92

Identical code under Plan 9 gives the expected output of:

	long double var = 3.300000E+00

Is there any particular reason why the behaviors should
differ in this manner ?

cheers,

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

* Re: [9fans] libfmt/libutf and long double
  2003-12-30  3:10 [9fans] libfmt/libutf and long double suspect
  2003-12-30  3:30 ` David Presotto
@ 2003-12-31 16:17 ` Russ Cox
  2003-12-31 18:43   ` suspect
  1 sibling, 1 reply; 5+ messages in thread
From: Russ Cox @ 2003-12-31 16:17 UTC (permalink / raw)
  To: 9fans

> Hello,
>
> I've run into a behavior with libfmt/libutf on UNIX system
> that does not seem intuitive:
>
> 	long double ldv = 3.3;
> 	print("long double var = %llE\n", ldv);
>
> gives:
> 	long double var = -6.257775E+92
>
> Identical code under Plan 9 gives the expected output of:
>
> 	long double var = 3.300000E+00
>
> Is there any particular reason why the behaviors should
> differ in this manner ?

yes, plan 9 doesn't implement long double and your unix does.



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

* Re: [9fans] libfmt/libutf and long double
  2003-12-31 16:17 ` Russ Cox
@ 2003-12-31 18:43   ` suspect
  2003-12-31 19:11     ` David Presotto
  0 siblings, 1 reply; 5+ messages in thread
From: suspect @ 2003-12-31 18:43 UTC (permalink / raw)
  To: 9fans

Hello,

Actually, my curiosity was about why it worked on my
Plan 9 machine but gave the strange behavior when
using libfmt on a UNIX system.

 From http://www.cs.bell-labs.com/magic/man2html/2/fprintf:
	"... or an optional L specifying that a following e, E, f, g,
	or G conversion specifier applies to a long double argument."

The above made it make sense to me that it worked on
my Plan 9 machine. I'm therefore a bit confused by your
response. Thanks.


cheers,


On Dec 31, 2003, at 11:17 AM, Russ Cox wrote:
>
> yes, plan 9 doesn't implement long double and your unix does.
>




>> Hello,
>>
>> I've run into a behavior with libfmt/libutf on UNIX system
>> that does not seem intuitive:
>>
>> 	long double ldv = 3.3;
>> 	print("long double var = %llE\n", ldv);
>>
>> gives:
>> 	long double var = -6.257775E+92
>>
>> Identical code under Plan 9 gives the expected output of:
>>
>> 	long double var = 3.300000E+00
>>
>> Is there any particular reason why the behaviors should
>> differ in this manner ?



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

* Re: [9fans] libfmt/libutf and long double
  2003-12-31 18:43   ` suspect
@ 2003-12-31 19:11     ` David Presotto
  0 siblings, 0 replies; 5+ messages in thread
From: David Presotto @ 2003-12-31 19:11 UTC (permalink / raw)
  To: 9fans

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

On plan 9 double and long double are the same.  Therefore, the
fact that the libfmt library ignores the ll part of the %llE
doesn't break anything on plan 9 but does on Unix.

[-- Attachment #2: Type: message/rfc822, Size: 3274 bytes --]

From: suspect@suspicious.org
To: 9fans@cse.psu.edu
Subject: Re: [9fans] libfmt/libutf and long double
Date: Wed, 31 Dec 2003 13:43:31 -0500
Message-ID: <3B0EB7C6-3BC1-11D8-906F-000A95C53D8A@suspicious.org>

Hello,

Actually, my curiosity was about why it worked on my
Plan 9 machine but gave the strange behavior when
using libfmt on a UNIX system.

 From http://www.cs.bell-labs.com/magic/man2html/2/fprintf:
	"... or an optional L specifying that a following e, E, f, g,
	or G conversion specifier applies to a long double argument."

The above made it make sense to me that it worked on
my Plan 9 machine. I'm therefore a bit confused by your
response. Thanks.


cheers,


On Dec 31, 2003, at 11:17 AM, Russ Cox wrote:
>
> yes, plan 9 doesn't implement long double and your unix does.
>




>> Hello,
>>
>> I've run into a behavior with libfmt/libutf on UNIX system
>> that does not seem intuitive:
>>
>> 	long double ldv = 3.3;
>> 	print("long double var = %llE\n", ldv);
>>
>> gives:
>> 	long double var = -6.257775E+92
>>
>> Identical code under Plan 9 gives the expected output of:
>>
>> 	long double var = 3.300000E+00
>>
>> Is there any particular reason why the behaviors should
>> differ in this manner  ?

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

end of thread, other threads:[~2003-12-31 19:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-12-30  3:10 [9fans] libfmt/libutf and long double suspect
2003-12-30  3:30 ` David Presotto
2003-12-31 16:17 ` Russ Cox
2003-12-31 18:43   ` suspect
2003-12-31 19:11     ` David Presotto

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).