Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
From: Uncle George <gatgul@voicenet.com>
To: axp-list@redhat.com
Subject: a cvtts/s of a denorm ->0.0
Date: Fri, 29 Sep 2000 13:24:03 -0500	[thread overview]
Message-ID: <39D4DE43.4DF4DCF7@voicenet.com> (raw)

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

It seems that the conversion of a double/denorm value into a
float/denorm gets truncated into 0.0 . In the attached example, the
(correct) double result of the fmod , get chopped ( ie cvtts/s ) into
0.0 and stored in c.

I was expecting to see the float denorm of 0x1 back.
/gat


[-- Attachment #2: fmod.c --]
[-- Type: text/plain, Size: 796 bytes --]

main()
{
	extern double fmod( double a, double b );
	float a, b, c;
	union {
		float	f;
		int	i;
	} u;
	long	fpcr;

        asm( "excb; mf_fpcr %0" : "=f"(fpcr));
printf(" fpcr = %p\n", fpcr );
#if 1
        fpcr |= (1L << 47);     /* DNOD  Not avail in 21264(a) */
        fpcr &= ~(1L << 48 );   /* DNZ idenormal Operands to Zero */
        fpcr |= (1L << 49);     /* DNOD  Not avail in 21264(a) */
        fpcr &= ~(1L << 60 );   /* UNDZ underflow to zero OFF */
        fpcr |= (1L << 61);     /* UNFD underflow disable ON */
/*      fpcr |= (1L << 62);      UNFD */

        asm volatile ( "mt_fpcr %0 ; excb" : : "f"(fpcr));
#endif
        asm( "excb; mf_fpcr %0" : "=f"(fpcr));
printf(" fpcr = %p\n", fpcr );


	u.i = 1;
	a = u.f;

	u.i = 0xff800000;
	b = u.f;

	c = fmod( a, b );
}

	
		

             reply	other threads:[~2000-09-29 18:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-09-29 18:24 Uncle George [this message]
2000-10-01 21:35 ` a cvtts/s of a denorm ->0.0 Richard Henderson
2000-10-03 10:22   ` Uncle George
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox