[gnumeric] ODF handling of GAUSS



commit e5e3ff29f185f104afb69b1dc7c0a96ed92a6185
Author: Andreas J. Guelzow <aguelzow pyrshep ca>
Date:   Sun Aug 23 23:02:36 2009 -0600

    ODF handling of GAUSS
    
    2009-08-23  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* openoffice-read.c (odf_func_gauss_handler): new
    	(oo_func_map_in): map GAUSS to NORMDIST-0.5

 plugins/openoffice/ChangeLog         |    5 +++++
 plugins/openoffice/openoffice-read.c |   24 +++++++++++++++++++++---
 2 files changed, 26 insertions(+), 3 deletions(-)
---
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index f55da7f..a12e10a 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,5 +1,10 @@
 2009-08-23  Andreas J. Guelzow <aguelzow pyrshep ca>
 
+	* openoffice-read.c (odf_func_gauss_handler): new
+	(oo_func_map_in): map GAUSS to NORMDIST-0.5
+
+2009-08-23  Andreas J. Guelzow <aguelzow pyrshep ca>
+
 	* openoffice-read.c (odf_func_phi_handler): new
 	(oo_func_map_in): map PHI to NORMDIST
 
diff --git a/plugins/openoffice/openoffice-read.c b/plugins/openoffice/openoffice-read.c
index 90d09c4..172dba0 100644
--- a/plugins/openoffice/openoffice-read.c
+++ b/plugins/openoffice/openoffice-read.c
@@ -4340,6 +4340,25 @@ odf_func_phi_handler (GnmConventions const *convs, Workbook *scope, GnmExprList
 }
 
 static GnmExpr const *
+odf_func_gauss_handler (GnmConventions const *convs, Workbook *scope, GnmExprList *args)
+{
+	GnmFunc  *f = gnm_func_lookup_or_add_placeholder ("NORMDIST", scope, FALSE);
+	
+	args = g_slist_append ((GSList *) args,
+			       (gpointer) gnm_expr_new_constant (value_new_int (0)));
+	args = g_slist_append ((GSList *) args,
+			       (gpointer) gnm_expr_new_constant (value_new_int (1)));
+
+	args = g_slist_append ((GSList *) args,
+			       (gpointer) gnm_expr_new_funcall 
+			       (gnm_func_lookup_or_add_placeholder ("FALSE", scope, TRUE), NULL));
+	
+	return gnm_expr_new_binary (gnm_expr_new_funcall (f, args),
+				    GNM_EXPR_OP_SUB,
+				    gnm_expr_new_constant (value_new_float (0.5)));
+}
+
+static GnmExpr const *
 odf_func_floor_handler (GnmConventions const *convs, Workbook *scope, GnmExprList *args)
 {
 	guint argc = gnm_expr_list_length (args);
@@ -4566,6 +4585,7 @@ oo_func_map_in (GnmConventions const *convs, Workbook *scope,
 		{"FLOOR", odf_func_floor_handler},
 		{"ADDRESS", odf_func_address_handler},
 		{"PHI", odf_func_phi_handler},
+		{"GAUSS", odf_func_gauss_handler},
 		{NULL, NULL}
 	};
 	
@@ -4589,7 +4609,6 @@ oo_func_map_in (GnmConventions const *convs, Workbook *scope,
 		{ "COUNTIFS","ODF.COUNTIFS" },
 		{ "DAYS","ODF.DAYS" },
 		{ "DDE","ODF.DDE" },
-		{ "GAUSS","ODF.GAUSS" },
 		{ "IFNA","ODF.IFNA" },
 		{ "ISFORMULA","ODF.ISFORMULA" },
 		{ "MULTIPLE.OPERATIONS","ODF.MULTIPLE.OPERATIONS" },
@@ -4609,6 +4628,7 @@ oo_func_map_in (GnmConventions const *convs, Workbook *scope,
 		{ "CHISQDIST","ODF.CHISQDIST" },      /* see handler */
 		{ "FLOOR","ODF.FLOOR" },              /* see handler */
 		{ "FORMULA","GET.FORMULA" },
+		{ "GAUSS","NORMDIST" },              /* see handler */
 		{ "LEGACY.CHIDIST","CHIDIST" },
 		{ "LEGACY.CHIINV","CHIINV" },
 		{ "LEGACY.CHITEST","CHITEST" },
@@ -4756,7 +4776,6 @@ oo_func_map_in (GnmConventions const *convs, Workbook *scope,
 /* { "GAMMADIST","GAMMADIST" }, */
 /* { "GAMMAINV","GAMMAINV" }, */
 /* { "GAMMALN","GAMMALN" }, */
-/* { "GAUSS","GAUSS" }, */
 /* { "GCD","GCD" }, */
 /* { "GEOMEAN","GEOMEAN" }, */
 /* { "GESTEP","GESTEP" }, */
@@ -4884,7 +4903,6 @@ oo_func_map_in (GnmConventions const *convs, Workbook *scope,
 /* { "PERCENTRANK","PERCENTRANK" }, */
 /* { "PERMUT","PERMUT" }, */
 /* { "PERMUTATIONA","PERMUTATIONA" }, */
-/* { "PHI","PHI" }, */
 /* { "PI","PI" }, */
 /* { "PMT","PMT" }, */
 /* { "POISSON","POISSON" }, */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]