[omniORB] What the difference betwen long & double

Bruce Visscher bvisscher@mindspring.com
Wed, 08 Jul 1998 23:26:13 -0400


Boris Khanales wrote:
> 
> > In Message <98Jul7.121037edt.11651-1@gateway.imagine-sw.com> ,
> >    boris@imagine-sw.com (Boris Khanales) wrote:
> >
> > =>I have kind of complex data structure:
> > =>
> > =>
> > =>
> > =>
> > =>foo.idl
> > =>
> > =>struct Foo
> > =>{
> > =>sequence<any> data;
> > =>};
> > =>
> > =>interface Hoo
> > =>{
> > =>long method( in Foo f );
> > =>}
> > =>
> > =>
> > =>The client does something like this:
> > =>
> > =>Foo f;
> > =>f.data.length(1);
> > =>
> > =>Foo f2;
> > =>f2.data.length(1);
> > =>
> > =>// Attn !!!
> > =>if I do this:
> > =>f2.data[0] <<= 1L; Everithing OK
> > =>
> > =>BUT
> > =>f2.data[0] <<= 1.1; It does not work!!!

Could you define "does not work"?  Compiler error?

> > =>
> > =>f.data[0] <<= f2;
> > =>
> > =>
> > =>
> > =>Any ideas?
> > =>HELPPP!?!?!
> > =>
> >
> >    Try "f2.data[0] <<= CORBA::Double(1.1);". It needs either a
> > CORBA::Double or a CORBA::Float, both of which are defined as classes
> > in OmniORB.

Actually, this is true only on the VMS platform which uses a proxy to
convert between IEEE and native.  But I agree with your solution.

> > It may be getting confused over which conversion to make,
> > so making it explicit could fix the problem.
> >
> >                                       Gary Duzan
> >                                       GTE Laboratories
> >
> >
> >
> Does not work. I tried sensless thingth like
>  <<= *(new double( tmpDouble))
>  and CORBA::Double
>  same result.
> 
>  What is realy surprise me that I have a case
>  when I do this
> 
>  Any a1 <<= 1L;
>  Any a2 <<= 1.1;
> 
>  f2.data[0] = a2; // exception
> 
>  f2.data[0]  <<= a2; // Sends message, but on recieve side
>         f2.data[0]   has _tc_any type
> 
> 
> Any difference between long &  double?

CORBA::Float and CORBA::Double are proxy classes on VMS.  I don't see
why that should matter, though.

> I've notice float & double are the special case.
> There is a macro HAS_DOUBLE, but ...

Since you were asking about VMS before I take it you're running this on
VMS?  All I can say is that I ran all the Any and typecode tests and had
no problems.  I tried lots of different floating point combinations
too.  I'll try and see if I can reproduce this.

Bruce