aboutsummaryrefslogtreecommitdiff
path: root/matrix/generic
diff options
context:
space:
mode:
authorcloudygoose <[email protected]>2015-06-06 11:03:49 +0800
committercloudygoose <[email protected]>2015-06-06 11:03:49 +0800
commit31330d6c095b2b11b34f524169f56dc8d18355c3 (patch)
treec67e8d625fc5d31c048fca72e3dbeadafec0b9a2 /matrix/generic
parent3faaef779e384e6283761906552c6c6c4eafb3dd (diff)
parent0bb9cd4271f127c311fd9839855def8f9ea91dab (diff)
...
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'matrix/generic')
-rw-r--r--matrix/generic/elem_type.h3
-rw-r--r--matrix/generic/mmatrix.c2
2 files changed, 4 insertions, 1 deletions
diff --git a/matrix/generic/elem_type.h b/matrix/generic/elem_type.h
index 2a6ffa8..bffe940 100644
--- a/matrix/generic/elem_type.h
+++ b/matrix/generic/elem_type.h
@@ -2,18 +2,21 @@
#define MATRIX_ELEM float
#define MATRIX_ELEM_FMT "%f"
+#define MATRIX_ELEM_WRITE_FMT "%.8f"
#define MATRIX_ELEM_PTR(self) ((self)->data.f)
#elif defined(MATRIX_USE_DOUBLE)
#define MATRIX_ELEM double
#define MATRIX_ELEM_FMT "%lf"
+#define MATRIX_ELEM_WRITE_FMT "%.8lf"
#define MATRIX_ELEM_PTR(self) ((self)->data.d)
#elif defined(MATRIX_USE_INT)
#define MATRIX_ELEM long
#define MATRIX_ELEM_FMT "%ld"
+#define MATRIX_ELEM_WRITE_FMT "%ld"
#define MATRIX_ELEM_PTR(self) ((self)->data.i)
#endif
diff --git a/matrix/generic/mmatrix.c b/matrix/generic/mmatrix.c
index 75d1eb1..2045d65 100644
--- a/matrix/generic/mmatrix.c
+++ b/matrix/generic/mmatrix.c
@@ -86,7 +86,7 @@ int nerv_matrix_(save)(lua_State *L) {
{
MATRIX_ELEM *row = MATRIX_ROW_PTR(self, i);
for (j = 0; j < ncol; j++)
- if (fprintf(fp, MATRIX_ELEM_FMT " ", row[j]) < 0)
+ if (fprintf(fp, MATRIX_ELEM_WRITE_FMT " ", row[j]) < 0)
{
free(self);
return 0;