develooper Front page | perl.perl5.porters | Postings from June 2002

Re: [ID 20020504.002] 1 == 1 but 0 != 0

Thread Next
From:
Nicholas Clark
Date:
June 29, 2002 10:31
Subject:
Re: [ID 20020504.002] 1 == 1 but 0 != 0
Message ID:
20020629172209.GA322@Bagpuss.unfortu.net
On Sat, May 04, 2002 at 11:08:43PM -0500, Ben Winslow wrote:
> This turned out to be a problem with CONFIG_FPE_FASTFPE
> (CONFIG_FPE_NWFPE works fine.)  Thanks to everyone who provided insight
> into the problem.

On Mon, Jun 17, 2002 at 11:32:21AM -0700, Tony Lindgren wrote:
> * mallum <breakfast@10.am> [020614 07:13]:
> > I too have this exact same problem on a CATS machine running debian
> > unstable ( kernel 2.4.18-rmk6 ).
> > 
> > Is the only fix to link to debug-perl ?
> > 
> >   -- Matthew
> 
> Hi,
> 
> Well, I finally got around to verifying that this is caused by the Fast
> Floating Point Emulator. So the real solution is to use the Netwinder
> Floating Point Emulator. Symlinking perl to debug-perl seems to be a
> work around with the Fast Floating Point Emulator.
> 
> In any case, it's weird how the FastFPE works with debug-perl and not
> with perl...
> 
> Tony


I wasn't aware of anyone getting this down to a test case.
The problem seems to be saving a floating point register containing 0 to
memory, and then reloading it. The same binaries give:

nick@Bagpuss [test]$ ./is_zero 
1
nick@Bagpuss [test]$ ./is_one  
1
nick@Bagpuss [test]$ dmesg | grep -i Floating
NetWinder Floating Point Emulator V0.95 (c) 1998-1999 Rebel.com

nick@Bagpuss [test]$ ./is_zero 
0
nick@Bagpuss [test]$ ./is_one  
1
nick@Bagpuss [test]$ dmesg | grep -i Floating
Fast Floating Point Emulator V0.9 (c) Peter Teichmann.

If I take the lfmfd out from this then it all works as expected on FastFPE

	mvfd	f1, #0
	sfmfd	f1, 1, [sp]!
	lfmfd	f1, 1, [sp]!
	mvfd	f0, #0
	cmf	f0, f1

nick@Bagpuss [test]$ ./is_zero_noload 
1

Attached are source for is_zero and is_one

Nicholas Clark
-- 
Even better than the real thing:	http://nms-cgi.sourceforge.net/

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About