[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

a CVTST/s of +INF doesn't work :-{



it seems that the comparison of a (float) 0 with a (float) +INF  does not work
with linux-2.2.13.
the cvtst/s instruction ( which in itself it very strangely assembled - which
appears, when hand disassembled to be a CVTxS form of instruction rather than the
expected CVTxT ) does not convert the (float) +inf to a (double) +inf.
the the (float)inf becomes a (double) 0.
Attached is a simple program that exhibits the problem.
gat

BTW There seems to be some sorta madness with respect to the CVT instructs, that
defies my logic. Do I need to become also cerebrally damaged to understand this
:-/
ie a cvtst/s != the assembler version != whats in memory != what I understand.

int compare ( float, float );

main() {
	union
	{
		float	f;
		int	i;
		double	d;
		long	l;
	} ll, rr, dd;

	float l, r;
	int i;
	double d;
	ll.i = 0;
	rr.i = 0x7f800000;
	d = rr.f;
	dd.d = d;
	

	printf("l = %g, r = %g, d = (%lx, %g)\n", ll.f, rr.f, dd.l, dd.d );
	i = compare( ll.f,rr.f );
	printf("i = %d\n", i);

}

compare( float l, float r )
{
	if ( l < r )
		return 1;
	else
	if ( l > r )
		return -1;
	else
		return 0;
}

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index] []