Skip to content

Commit 4fb3ce2

Browse files
thomasjtaylorafs
authored andcommitted
fix: NodeValue.makeNodeFloat(String) datatype XSDfloat
test: TestNodeValue.float4 makeNodeFloat(String) is Float
1 parent ab3daca commit 4fb3ce2

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ public static NodeValue makeNodeFloat(float f)
319319

320320
public static NodeValue makeNodeFloat(String lexicalForm)
321321
{
322-
NodeValue nv = makeNode(lexicalForm, null, XSDdouble.getURI()) ;
322+
NodeValue nv = makeNode(lexicalForm, null, XSDfloat.getURI()) ;
323323
return nv ;
324324
}
325325

jena-arq/src/test/java/org/apache/jena/sparql/expr/TestNodeValue.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,14 @@ public void testFloat3() {
104104
assertTrue("Not same float: " + v1 + " & " + v2, v1.getFloat() == v2.getFloat());
105105
assertTrue("Not same float as double: " + v1 + " & " + v2, v1.getDouble() == v2.getDouble());
106106
}
107+
108+
@Test
109+
public void testFloat4() {
110+
NodeValue v1 = NodeValue.makeNodeFloat("5.7");
111+
NodeValue v2 = NodeValue.makeFloat(5.7f);
112+
assertTrue("Not same float: " + v1 + " & " + v2, v1.getFloat() == v2.getFloat());
113+
assertTrue("Not same float as double: " + v1 + " & " + v2, v1.getDouble() == v2.getDouble());
114+
}
107115

108116
@Test
109117
public void testDouble1() {

0 commit comments

Comments
 (0)