Strange behavior

Chuck Allison cda@freshsources.com
Sat Mar 2 13:18:00 GMT 2002


I have a simple Rational number class and have discovered  weird behavior
with Cygwin's g++. If you look at the very short main program in file
rtest2.cpp, you will see by the output that g++ get's the wrong answer for

r1 / r2 == Rational(2,3); // should be true

even though it prints as 2/3! Borland and Microsoft get it right. Any ideas?
All code atached.

Thanks.

-- Chuck Allison (The Harmonious CodeSmith)
-- Senior Editor, C/C++ Users Journal
-- cda@freshsources.com

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Rational2.h
URL: <http://cygwin.com/pipermail/cygwin/attachments/20020302/a76936a2/attachment.h>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Rational2.cpp
URL: <http://cygwin.com/pipermail/cygwin/attachments/20020302/a76936a2/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: rtest2.cpp
URL: <http://cygwin.com/pipermail/cygwin/attachments/20020302/a76936a2/attachment-0001.ksh>
-------------- next part --------------
--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


More information about the Cygwin mailing list