aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-02-28 07:45:50 +0000
committerDavid Robillard <d@drobilla.net>2012-02-28 07:45:50 +0000
commit11a87df2845c4cd577786d2b4df83ab44421f546 (patch)
tree24af8188e1fccf262c876277d4c8edbee4e9f84f /src
parent1663e3e9940db8be898a1e00e5b6833cd8a22c3f (diff)
downloadserd-11a87df2845c4cd577786d2b4df83ab44421f546.tar.gz
serd-11a87df2845c4cd577786d2b4df83ab44421f546.tar.bz2
serd-11a87df2845c4cd577786d2b4df83ab44421f546.zip
Fix serialisation of decimals like 10.0, 20.0, etc.
git-svn-id: http://svn.drobilla.net/serd/trunk@325 490d8e77-9747-427b-9fa3-0b8f29cee8a0
Diffstat (limited to 'src')
-rw-r--r--src/node.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/node.c b/src/node.c
index 73976b44..4d8c620f 100644
--- a/src/node.c
+++ b/src/node.c
@@ -145,7 +145,7 @@ SerdNode
serd_node_new_decimal(double d, unsigned frac_digits)
{
const double abs_d = fabs(d);
- const unsigned int_digits = (unsigned)fmax(1.0, ceil(log10(abs_d)));
+ const unsigned int_digits = (unsigned)fmax(1.0, ceil(log10(abs_d + 1)));
char* buf = (char*)calloc(int_digits + frac_digits + 3, 1);
SerdNode node = { (const uint8_t*)buf, 0, 0, 0, SERD_LITERAL };
const double int_part = floor(abs_d);