From: "NAKAMURA, Hiroshi" Date: 2003-12-24T10:30:28+09:00 Subject: Re: Ruby 1.8.1 preview4 Hi, Dennis, Last 2 point. > From: "Dennis Ranke" > Newsgroups: comp.lang.ruby > Sent: Wednesday, December 24, 2003 3:36 AM > > [1, 2, 31, 32; floating point] > > > >> 1) Failure: > >> test_SOAPDouble(SOAP::TestSOAP) [./soap/test_basetype.rb:257]: > >> <"-0"> expected but was > >> <"+0">. > > > > How does this dump? > > $ ruby -e 'a = -0.0; p (1 / a > 0.0)' > > > > expecting false.. > > irb(main):002:0> VERSION > => "1.8.1" > irb(main):001:0> a=-0.0 > => 0.0 > irb(main):002:0> 1 / a > 0.0 > => true > irb(main):003:0> 1 / a > => Infinity On your ruby, "-0.0" shoud be interpreted 0.0. Gotoken hacked and told me that if I expect "-0.0" to be interpreted as negative zero in ruby, "echo 'main(){double a = 0; a = -a; puts(1/a < 0 ? "n" : "p");}' | gcc -xc - && ./a.out" must dump "n". May be "p" on your system? I can use "-1.0 / (1.0 / 0.0)" instead of "-0.0" for soap4r test. How does this dump? $ ruby -e 'p(-1.0 / (1.0 / 0.0))' > >> 2) Failure: > >> test_SOAPFloat(SOAP::TestSOAP) > >> [./soap/test_basetype.rb:161:in `test_SOAPFloat' > >> ./soap/test_basetype.rb:160:in `each' > >> ./soap/test_basetype.rb:160:in `test_SOAPFloat']: > >> <1.4e-45> expected but was > >> <0.0>. > > > > Hmm... > > ok, my theory about single-precision floats was probably wrong: > irb(main):009:0> 1.0/2**256 > => 8.63616855509444e-78 > > So as long as SOAP doesn't convert between different float > representations, i have no idea where this error comes from. "float" in XML Schema Datatypes (and SOAP) is a single float. Ruby's is double. So I try to "narrow"? the given double float to single with d = given_double # e.g. 1.4e-45 f = (/\A\0*\z/ =~ [d].pack("f")) ? 0.0 : d sprintf("%.10g", f) # use this as a value of "float" Maybe I misunderstand something... $ ruby -e 'p([1.4e-45].pack("f"))' ? > > [3-9, 28-30; socket] > >> 3) Error: > >> test_charset(SOAP::TestStreamHandler): > >> SocketError: getaddrinfo: Temporary failure in name resolution > > > > $ ruby -rsocket -e 'p Socket.getaddrinfo("localhost", "http")' > > > > Same error? > > Yes, and "unknown host" with "ping localhost", so i added localhost to my > hosts file, which got rid of those errors... ;) :) Thanks. There shoudl be some architecture/settings where "localhost" is not defined. But I don't know portable way to test server/client. Regards, // NaHi