Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
* a cvtts/s of a denorm ->0.0
@ 2000-09-29 18:24 Uncle George
  2000-10-01 21:35 ` Richard Henderson
  0 siblings, 1 reply; 3+ messages in thread
From: Uncle George @ 2000-09-29 18:24 UTC (permalink / raw)
  To: axp-list

[-- 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 );
}

	
		

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

end of thread, other threads:[~2000-10-03 10:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2000-09-29 18:24 a cvtts/s of a denorm ->0.0 Uncle George
2000-10-01 21:35 ` Richard Henderson
2000-10-03 10:22   ` Uncle George

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