shithub: opus

Download patch

ref: b5f739455d5a5fa343723477297e60bd918ac3d8
parent: 724385e242544a9c3613d54d3db8b856288c37db
author: Ralph Giles <[email protected]>
date: Fri Dec 21 07:06:24 EST 2012

Add float literal suffixes to mlp_data.c.

Fixes an MSVC double truncation warning.

--- a/src/mlp_data.c
+++ b/src/mlp_data.c
@@ -8,63 +8,63 @@
 static const float weights[271] = {
 
 /* hidden layer */
-1.55597, -0.0739792, -0.0646761, -0.099531, -0.0794943, 
-0.0180174, -0.0391354, 0.0508224, -0.0160169, -0.0773263, 
--0.0300002, -0.0865361, 0.124477, -0.28648, -0.0860702, 
--0.518949, -0.0873341, -0.235393, -0.907833, -0.383573, 
-0.535388, -0.57944, 0.98116, 0.8482, 1.12426, 
--3.23721, -0.647072, -0.0265139, 0.0711052, -0.00125666, 
--0.0396181, -0.44282, -0.510495, -0.201865, 0.0134336, 
--0.167205, -0.155406, 0.00041678, -0.00468705, -0.0233224, 
-0.264279, -0.301375, 0.00234895, 0.0144741, -0.137535, 
-0.200323, 0.0192027, 3.19818, 2.03495, 0.705517, 
--4.6025, -0.11485, -0.792716, 0.150714, 0.10608, 
-0.240633, 0.0690698, 0.0695297, 0.124819, 0.0501433, 
-0.0460952, 0.147639, 0.10327, 0.158007, 0.113714, 
-0.0276191, 0.0680749, -0.130012, 0.0796126, 0.133067, 
-0.51495, 0.747578, -0.128742, 5.98112, -1.16698, 
--0.276492, -1.73549, -3.90234, 2.01489, -0.040118, 
--0.113002, -0.146751, -0.113569, 0.0534873, 0.0989832, 
-0.0872875, 0.049266, 0.0367557, -0.00889148, -0.0648461, 
--0.00190352, 0.0143773, 0.0259364, -0.0592133, -0.0672924, 
-0.1399, -0.0987886, -0.347402, 0.101326, -0.0680876, 
-0.469186, 0.246922, 10.4017, 3.44846, -0.662725, 
--0.0328208, -0.0561274, -0.0167744, 0.00044282, -0.0457645, 
--0.0408314, -0.013113, -0.0373873, -0.0474122, -0.0273745, 
--0.0308505, 0.000582959, -0.0421135, 0.464859, 0.196842, 
-0.320538, 0.0435528, -0.200168, 0.266475, -0.0853727, 
-1.20397, 0.711542, -1.04397, -1.47759, 1.26768, 
-0.446958, 0.266477, -0.30802, 0.28431, -0.118541, 
-0.00836345, 0.0689026, -0.0137996, -0.0395417, 0.26982, 
--0.206255, 0.16066, 0.114757, 0.359587, -0.106503, 
--0.0948534, 0.175358, -0.122966, -0.0056675, 0.483848, 
--0.134916, -0.427567, -0.140172, -1.0866, -2.73921, 
-0.549843, 0.17685, 0.0010675, -0.00137386, 0.0884424, 
--0.0698736, -0.00174136, 0.0718775, -0.0396849, 0.0448056, 
-0.0577853, -0.0372353, 0.134599, 0.0260656, 0.140322, 
-0.22704, -0.020568, -0.0142424, -0.21723, -0.997704, 
--0.884573, -0.163495, 2.33617, 0.224142, 0.19635, 
--0.957387, 0.144678, 1.47035, -0.00700498, -0.0472309, 
--0.0137848, -0.0189145, 0.00856479, 0.0316965, 0.00613373, 
-0.00209807, 0.00270964, -0.0490206, 0.0105712, -0.0465045, 
--0.0381532, -0.0985268, -0.108297, 0.0146409, -0.0040718, 
--0.0698572, -0.380568, -0.230479, 3.98917, 0.457652, 
--1.02355, -7.4435, -0.475314, 1.61743, 0.0254017, 
--0.00791293, 0.047217, 0.0220995, -0.0304311, 0.0052168, 
--0.0404054, -0.0230293, 0.00169229, -0.0138178, 0.0043137, 
--0.0598088, -0.133601, 0.0555138, -0.177358, -0.159856, 
--0.137281, 0.108051, -0.305973, 0.393775, 0.0747287, 
-0.783993, -0.875086, 1.06862, 0.340519, -0.352681, 
--0.0830912, -0.100017, 0.0729085, -0.00829403, 0.027489, 
--0.0779597, 0.082286, -0.164181, -0.41519, 0.00282335, 
--0.29573, 0.125571, 0.726935, 0.392137, 0.491348, 
-0.0723196, -0.0259758, -0.0636332, -0.452384, -0.000225974, 
--2.34001, 2.45211, -0.544628, 5.62944, -3.44507, 
+1.55597f, -0.0739792f, -0.0646761f, -0.099531f, -0.0794943f,
+0.0180174f, -0.0391354f, 0.0508224f, -0.0160169f, -0.0773263f,
+-0.0300002f, -0.0865361f, 0.124477f, -0.28648f, -0.0860702f,
+-0.518949f, -0.0873341f, -0.235393f, -0.907833f, -0.383573f,
+0.535388f, -0.57944f, 0.98116f, 0.8482f, 1.12426f,
+-3.23721f, -0.647072f, -0.0265139f, 0.0711052f, -0.00125666f,
+-0.0396181f, -0.44282f, -0.510495f, -0.201865f, 0.0134336f,
+-0.167205f, -0.155406f, 0.00041678f, -0.00468705f, -0.0233224f,
+0.264279f, -0.301375f, 0.00234895f, 0.0144741f, -0.137535f,
+0.200323f, 0.0192027f, 3.19818f, 2.03495f, 0.705517f,
+-4.6025f, -0.11485f, -0.792716f, 0.150714f, 0.10608f,
+0.240633f, 0.0690698f, 0.0695297f, 0.124819f, 0.0501433f,
+0.0460952f, 0.147639f, 0.10327f, 0.158007f, 0.113714f,
+0.0276191f, 0.0680749f, -0.130012f, 0.0796126f, 0.133067f,
+0.51495f, 0.747578f, -0.128742f, 5.98112f, -1.16698f,
+-0.276492f, -1.73549f, -3.90234f, 2.01489f, -0.040118f,
+-0.113002f, -0.146751f, -0.113569f, 0.0534873f, 0.0989832f,
+0.0872875f, 0.049266f, 0.0367557f, -0.00889148f, -0.0648461f,
+-0.00190352f, 0.0143773f, 0.0259364f, -0.0592133f, -0.0672924f,
+0.1399f, -0.0987886f, -0.347402f, 0.101326f, -0.0680876f,
+0.469186f, 0.246922f, 10.4017f, 3.44846f, -0.662725f,
+-0.0328208f, -0.0561274f, -0.0167744f, 0.00044282f, -0.0457645f,
+-0.0408314f, -0.013113f, -0.0373873f, -0.0474122f, -0.0273745f,
+-0.0308505f, 0.000582959f, -0.0421135f, 0.464859f, 0.196842f,
+0.320538f, 0.0435528f, -0.200168f, 0.266475f, -0.0853727f,
+1.20397f, 0.711542f, -1.04397f, -1.47759f, 1.26768f,
+0.446958f, 0.266477f, -0.30802f, 0.28431f, -0.118541f,
+0.00836345f, 0.0689026f, -0.0137996f, -0.0395417f, 0.26982f,
+-0.206255f, 0.16066f, 0.114757f, 0.359587f, -0.106503f,
+-0.0948534f, 0.175358f, -0.122966f, -0.0056675f, 0.483848f,
+-0.134916f, -0.427567f, -0.140172f, -1.0866f, -2.73921f,
+0.549843f, 0.17685f, 0.0010675f, -0.00137386f, 0.0884424f,
+-0.0698736f, -0.00174136f, 0.0718775f, -0.0396849f, 0.0448056f,
+0.0577853f, -0.0372353f, 0.134599f, 0.0260656f, 0.140322f,
+0.22704f, -0.020568f, -0.0142424f, -0.21723f, -0.997704f,
+-0.884573f, -0.163495f, 2.33617f, 0.224142f, 0.19635f,
+-0.957387f, 0.144678f, 1.47035f, -0.00700498f, -0.0472309f,
+-0.0137848f, -0.0189145f, 0.00856479f, 0.0316965f, 0.00613373f,
+0.00209807f, 0.00270964f, -0.0490206f, 0.0105712f, -0.0465045f,
+-0.0381532f, -0.0985268f, -0.108297f, 0.0146409f, -0.0040718f,
+-0.0698572f, -0.380568f, -0.230479f, 3.98917f, 0.457652f,
+-1.02355f, -7.4435f, -0.475314f, 1.61743f, 0.0254017f,
+-0.00791293f, 0.047217f, 0.0220995f, -0.0304311f, 0.0052168f,
+-0.0404054f, -0.0230293f, 0.00169229f, -0.0138178f, 0.0043137f,
+-0.0598088f, -0.133601f, 0.0555138f, -0.177358f, -0.159856f,
+-0.137281f, 0.108051f, -0.305973f, 0.393775f, 0.0747287f,
+0.783993f, -0.875086f, 1.06862f, 0.340519f, -0.352681f,
+-0.0830912f, -0.100017f, 0.0729085f, -0.00829403f, 0.027489f,
+-0.0779597f, 0.082286f, -0.164181f, -0.41519f, 0.00282335f,
+-0.29573f, 0.125571f, 0.726935f, 0.392137f, 0.491348f,
+0.0723196f, -0.0259758f, -0.0636332f, -0.452384f, -0.000225974f,
+-2.34001f, 2.45211f, -0.544628f, 5.62944f, -3.44507f,
 
 /* output layer */
--3.13835, 0.994751, 0.444901, 1.59518, 1.23665, 
-3.37012, -1.34606, 1.99131, 1.33476, 1.3885, 
-1.12559, };
+-3.13835f, 0.994751f, 0.444901f, 1.59518f, 1.23665f,
+3.37012f, -1.34606f, 1.99131f, 1.33476f, 1.3885f,
+1.12559f, };
 
 static const int topo[3] = {25, 10, 1};
 
--- a/src/mlp_train.c
+++ b/src/mlp_train.c
@@ -475,7 +475,7 @@
 	printf ("\n/* hidden layer */\n");
 	for (i=0;i<(topo[0]+1)*topo[1];i++)
 	{
-		printf ("%g, ", net->weights[0][i]);
+		printf ("%gf, ", net->weights[0][i]);
 		if (i%5==4)
 			printf("\n");
 	}