CPP 1.3 NO IDEA Avatar
  1. OMG Issue

CPP13 — Fixed and truncation/rounding?

  • Key: CPP13-58
  • Legacy Issue Number: 4533
  • Status: open  
  • Source: Triodia Technologies Pty Ltd ( Michi Henning)
  • Summary:

    Suppose we have:

    typedef fixed<4,3> FT;

    interface I

    { FT op(); }

    ;

    Suppose the server does:

    FT
    I_impl::
    op() throw(CORBA::SystemException)

    { double d = 1.0/3.0; return CORBA::Fixed(d); }

    There are lots more digits in the return value than what is expected by the
    client. What should be returned to the client. The rounded value? The
    truncated value?

    Similarly, what if we have:

    double d = 10000000;
    return CORBA::Fixed(d);

    Do we return 9.999 to the client (which is the best we can do in this case)?

    Of course, it is the responsibility of the programmer to make sure that
    nonsense such as the second case doesn't happen. But the spec has to say
    what happens if it does happen

    Also, the first case will be very common – what should happen in this case?

  • Reported: CPP 1.1 — Thu, 23 Aug 2001 04:00 GMT
  • Updated: Fri, 6 Mar 2015 20:58 GMT