[libfann] 143/242: don't use as many decimals when saving training data

Christian Kastner chrisk-guest at moszumanska.debian.org
Sat Oct 4 21:10:34 UTC 2014


This is an automated email from the git hooks/post-receive script.

chrisk-guest pushed a commit to tag Version2_0_0
in repository libfann.

commit efc6d79325e08b69d76c44e4a1d2dac22eb64577
Author: Steffen Nissen <lukesky at diku.dk>
Date:   Thu Jun 24 23:13:03 2004 +0000

    don't use as many decimals when saving training data
---
 src/fann_io.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/fann_io.c b/src/fann_io.c
index 748f0d8..2aea67a 100644
--- a/src/fann_io.c
+++ b/src/fann_io.c
@@ -250,7 +250,12 @@ void fann_save_train_internal_fd(struct fann_train_data* data, FILE *file, char
 			if(save_as_fixed){
 				fprintf(file, "%d ", (int)(data->input[i][j]*multiplier));
 			}else{
-				fprintf(file, FANNPRINTF" ", data->input[i][j]);
+				if(((int)floor(data->input[i][j]+0.5)*1000000) ==
+					((int)floor(data->input[i][j]*1000000.0+0.5))){
+					fprintf(file, "%d ", (int)data->input[i][j]);
+				}else{
+					fprintf(file, "%f ", data->input[i][j]);
+				}
 			}
 #else
 			fprintf(file, FANNPRINTF" ", data->input[i][j]);
@@ -263,7 +268,12 @@ void fann_save_train_internal_fd(struct fann_train_data* data, FILE *file, char
 			if(save_as_fixed){
 				fprintf(file, "%d ", (int)(data->output[i][j]*multiplier));
 			}else{
-				fprintf(file, FANNPRINTF" ", data->output[i][j]);
+				if(((int)floor(data->output[i][j]+0.5)*1000000) ==
+					((int)floor(data->output[i][j]*1000000.0+0.5))){
+					fprintf(file, "%d ", (int)data->output[i][j]);
+				}else{
+					fprintf(file, "%f ", data->output[i][j]);
+				}
 			}
 #else
 			fprintf(file, FANNPRINTF" ", data->output[i][j]);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/libfann.git



More information about the debian-science-commits mailing list