diff options
-rw-r--r-- | src/reader.c | 5 | ||||
-rw-r--r-- | tests/test-num.out | 3 | ||||
-rw-r--r-- | tests/test-num.ttl | 4 |
3 files changed, 11 insertions, 1 deletions
diff --git a/src/reader.c b/src/reader.c index 79b61385..a342a4d2 100644 --- a/src/reader.c +++ b/src/reader.c @@ -869,6 +869,11 @@ read_number(SerdReader reader, Node* dest) if (c == 'e' || c == 'E') { // double push_byte(reader, str, eat_byte(reader, c)); + switch ((c = peek_byte(reader))) { + case '+': case '-': + push_byte(reader, str, eat_byte(reader, c)); + default: break; + } read_0_9(reader, str, true); datatype = push_string(reader, XSD_DOUBLE, strlen(XSD_DOUBLE) + 1); } else if (has_decimal) { diff --git a/tests/test-num.out b/tests/test-num.out index 447f11df..2502580b 100644 --- a/tests/test-num.out +++ b/tests/test-num.out @@ -4,3 +4,6 @@ <http://example.org/eg#thing> <http://example.org/eg#num> ".4"^^<http://www.w3.org/2001/XMLSchema#decimal> . <http://example.org/eg#thing> <http://example.org/eg#num> "+.5"^^<http://www.w3.org/2001/XMLSchema#decimal> . <http://example.org/eg#thing> <http://example.org/eg#num> "-.6"^^<http://www.w3.org/2001/XMLSchema#decimal> . +<http://example.org/eg#thing> <http://example.org/eg#num> "1.58490e-05"^^<http://www.w3.org/2001/XMLSchema#double> . +<http://example.org/eg#thing> <http://example.org/eg#num> "1.58490e+05"^^<http://www.w3.org/2001/XMLSchema#double> . +<http://example.org/eg#thing> <http://example.org/eg#num> "1.58490e05"^^<http://www.w3.org/2001/XMLSchema#double> . diff --git a/tests/test-num.ttl b/tests/test-num.ttl index 086ca5ab..54a425ac 100644 --- a/tests/test-num.ttl +++ b/tests/test-num.ttl @@ -6,4 +6,6 @@ eg:thing eg:num -0.3 . eg:thing eg:num .4 . eg:thing eg:num +.5 . eg:thing eg:num -.6 . - +eg:thing eg:num 1.58490e-05 . +eg:thing eg:num 1.58490e+05 . +eg:thing eg:num 1.58490e05 . |