Uploaded image for project: 'Apache Jena'
  1. Apache Jena
  2. JENA-1370

Exponent values

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: Jena 3.2.0
    • Fix Version/s: Jena 3.4.0
    • Component/s: Jena
    • Labels:
      None
    • Environment:

      Java 1.8, Ubuntu Linux (xenial)

      Description

      The equality between float values appears to be not working as I expected.
      Example code:

        @Test
        public void testDeltaSimple() throws Exception {
          Graph oldGraph = GraphFactory.createGraphMem();
          Graph newGraph = GraphFactory.createGraphMem();
      
          // oldGraph:
          // <http://example.com/subject> <http://example.com/property> -1.700000e+00 ;
          // newGraph: 
          // <http://example.com/subject> <http://example.com/property> -1.7E0 ;
          RDFDataMgr.read(oldGraph, "oldGraph.ttl");
          RDFDataMgr.read(newGraph, "newGraph.ttl");
      
      
          Delta delta = new Delta(oldGraph);
          delta.clear();
          GraphUtil.addInto(delta, newGraph);
          if (!delta.isIsomorphicWith(oldGraph)) {
            System.err.println("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
            RDFDataMgr.write(System.err, delta.getAdditions(), Lang.TURTLE);
            System.err.println("-------------------------------------------------------------------------------------");
            RDFDataMgr.write(System.err, delta.getDeletions(), Lang.TURTLE);
            fail("!!!!!!!!!!!!!!!!!!!!!! RDF not equal");
          }
        }
      

      Result:

      +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
      -------------------------------------------------------------------------------------
      <http://example.com/subject>
              <http://example.com/property>  -1.700000e+00 .
      
      java.lang.AssertionError: !!!!!!!!!!!!!!!!!!!!!! RDF not equal
      
      

      If I start with an empty graph for oldGraph, the new double value is properly added.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                andy Andy Seaborne
                Reporter:
                osmosisch Daan Reid
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: