Qpid
  1. Qpid
  2. QPID-2766

string to double conversion results in questionable precision

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 0.6
    • Fix Version/s: 0.7
    • Component/s: Java Client
    • Labels:
      None

      Description

      The following test:

      public void testString2Double_1() {
      try

      { Message message = senderSession.createMessage(); message.setStringProperty("pi", "3.14159"); assertEquals(3.14159, message.getDoubleProperty("pi"),0); }

      catch (JMSException e)

      { fail(e); }

      }

      Fails with:

      junit.framework.AssertionFailedError: expected:<3.14159> but
      was:<3.141590118408203>

      This appears to be because the client ends up doing the equivalent of
      Double.valueOf(Float.valueOf(value)) when doing string to double conversion
      rather than the more direct Double.valueOf(value).

        Activity

          People

          • Assignee:
            Rajith Attapattu
            Reporter:
            Rajith Attapattu
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development