*Issue with Mathieu Function Code@ 2013-08-31 18:11 Brian Gladman2013-09-09 17:50 ` Patrick Alken 0 siblings, 1 reply; 4+ messages in thread From: Brian Gladman @ 2013-08-31 18:11 UTC (permalink / raw) To: gsl-discuss [-- Attachment #1: Type: text/plain, Size: 1142 bytes --] The GSL special functions are each supposed to have two alternative functional interfaces, a pure one: double function(x, ...) and one allowing for full error returns: int function_e(x, ... gsl_sf_result * result) But the Mathieu function code doesn't follow this convention. It doesn't offer the former interface at all and uses the second convention for all its functions BUT without the '_e' name extension on its function declarations. This is quite error prone since it is easy to assume that *gsl_sf_result is simply a reference to a double when in fact it is a structure that is longer than this (a library user on Windows made exactly this mistake and wondered why his code was causing an illegal access exception). I am doubtful that this is an intentional feature of the Mathieu function code so I have created the attached patch to update the code to use the normal conventions of the GSL special functions. (this needs testing since I have only tried it on WIndows). If this is adopted, the documentation will need updating as well (unfortunately I am unable to do this). with my best regards, Brian Gladman [-- Attachment #2: mathieu.patch --] [-- Type: text/plain, Size: 14254 bytes --] Left file: C:\Users\brian\AppData\Local\Temp\qbzr\bzr-diff-kryjkr\1\specfunc\gsl_sf_mathieu.h Right file: C:\Users\brian\Documents\Visual Studio 2013\Projects\gsl\specfunc\gsl_sf_mathieu.h 70,71c70,73 < int gsl_sf_mathieu_a(int order, double qq, gsl_sf_result *result); < int gsl_sf_mathieu_b(int order, double qq, gsl_sf_result *result); --- > int gsl_sf_mathieu_a_e(int order, double qq, gsl_sf_result *result); > double gsl_sf_mathieu_a(int order, double qq); > int gsl_sf_mathieu_b_e(int order, double qq, gsl_sf_result *result); > double gsl_sf_mathieu_b(int order, double qq); 83,84c85,88 < int gsl_sf_mathieu_ce(int order, double qq, double zz, gsl_sf_result *result); < int gsl_sf_mathieu_se(int order, double qq, double zz, gsl_sf_result *result); --- > int gsl_sf_mathieu_ce_e(int order, double qq, double zz, gsl_sf_result *result); > double gsl_sf_mathieu_ce(int order, double qq, double zz); > int gsl_sf_mathieu_se_e(int order, double qq, double zz, gsl_sf_result *result); > double gsl_sf_mathieu_se(int order, double qq, double zz); 93c97 < int gsl_sf_mathieu_Mc(int kind, int order, double qq, double zz, --- > int gsl_sf_mathieu_Mc_e(int kind, int order, double qq, double zz, 95c99,100 < int gsl_sf_mathieu_Ms(int kind, int order, double qq, double zz, --- > double gsl_sf_mathieu_Mc(int kind, int order, double qq, double zz); > int gsl_sf_mathieu_Ms_e(int kind, int order, double qq, double zz, 96a102 > double gsl_sf_mathieu_Ms(int kind, int order, double qq, double zz); Left file: C:\Users\brian\AppData\Local\Temp\qbzr\bzr-diff-kryjkr\1\specfunc\mathieu_charv.c Right file: C:\Users\brian\Documents\Visual Studio 2013\Projects\gsl\specfunc\mathieu_charv.c 370c370 < int gsl_sf_mathieu_a(int order, double qq, gsl_sf_result *result) --- > int gsl_sf_mathieu_a_e(int order, double qq, gsl_sf_result *result) 398c398 < return gsl_sf_mathieu_a(order, -qq, result); --- > return gsl_sf_mathieu_a_e(order, -qq, result); 400c400 < return gsl_sf_mathieu_b(order, -qq, result); --- > return gsl_sf_mathieu_b_e(order, -qq, result); 496c496 < int gsl_sf_mathieu_b(int order, double qq, gsl_sf_result *result) --- > int gsl_sf_mathieu_b_e(int order, double qq, gsl_sf_result *result) 530c530 < return gsl_sf_mathieu_b(order, -qq, result); --- > return gsl_sf_mathieu_b_e(order, -qq, result); 532c532 < return gsl_sf_mathieu_a(order, -qq, result); --- > return gsl_sf_mathieu_a_e(order, -qq, result); 875a876,889 > > /*-*-*-*-*-*-*-*-*-* Functions w/ Natural Prototypes *-*-*-*-*-*-*-*-*-*-*/ > > #include "eval.h" > > GSL_FUN double gsl_sf_mathieu_a(int order, double qq) > { > EVAL_RESULT(gsl_sf_mathieu_a_e(order, qq, &result)); > } > > GSL_FUN double gsl_sf_mathieu_b(int order, double qq) > { > EVAL_RESULT(gsl_sf_mathieu_b_e(order, qq, &result)); > } Left file: C:\Users\brian\AppData\Local\Temp\qbzr\bzr-diff-kryjkr\1\specfunc\mathieu_angfunc.c Right file: C:\Users\brian\Documents\Visual Studio 2013\Projects\gsl\specfunc\mathieu_angfunc.c 30c30 < int gsl_sf_mathieu_ce(int order, double qq, double zz, gsl_sf_result *result) --- > int gsl_sf_mathieu_ce_e(int order, double qq, double zz, gsl_sf_result *result) 66c66 < status = gsl_sf_mathieu_a(order, qq, &aa); --- > status = gsl_sf_mathieu_a_e(order, qq, &aa); 112c112 < int gsl_sf_mathieu_se(int order, double qq, double zz, gsl_sf_result *result) --- > int gsl_sf_mathieu_se_e(int order, double qq, double zz, gsl_sf_result *result) 152c152 < status = gsl_sf_mathieu_b(order, qq, &aa); --- > status = gsl_sf_mathieu_b_e(order, qq, &aa); 350a351,364 > > /*-*-*-*-*-*-*-*-*-* Functions w/ Natural Prototypes *-*-*-*-*-*-*-*-*-*-*/ > > #include "eval.h" > > GSL_FUN double gsl_sf_mathieu_ce(int order, double qq, double zz) > { > EVAL_RESULT(gsl_sf_mathieu_ce_e(order, qq, zz, &result)); > } > > GSL_FUN double gsl_sf_mathieu_se(int order, double qq, double zz) > { > EVAL_RESULT(gsl_sf_mathieu_se_e(order, qq, zz, &result)); > } Left file: C:\Users\brian\AppData\Local\Temp\qbzr\bzr-diff-kryjkr\1\specfunc\mathieu_radfunc.c Right file: C:\Users\brian\Documents\Visual Studio 2013\Projects\gsl\specfunc\mathieu_radfunc.c 30c30 < int gsl_sf_mathieu_Mc(int kind, int order, double qq, double zz, --- > int gsl_sf_mathieu_Mc_e(int kind, int order, double qq, double zz, 62c62 < status = gsl_sf_mathieu_a(order, qq, &aa); --- > status = gsl_sf_mathieu_a_e(order, qq, &aa); 136c136 < int gsl_sf_mathieu_Ms(int kind, int order, double qq, double zz, --- > int gsl_sf_mathieu_Ms_e(int kind, int order, double qq, double zz, 176c176 < status = gsl_sf_mathieu_b(order, qq, &aa); --- > status = gsl_sf_mathieu_b_e(order, qq, &aa); 474a475,488 > > /*-*-*-*-*-*-*-*-*-* Functions w/ Natural Prototypes *-*-*-*-*-*-*-*-*-*-*/ > > #include "eval.h" > > GSL_FUN double gsl_sf_mathieu_Mc(int kind, int order, double qq, double zz) > { > EVAL_RESULT(gsl_sf_mathieu_Mc_e(kind, order, qq, zz, &result)); > } > > GSL_FUN double gsl_sf_mathieu_Ms(int kind, int order, double qq, double zz) > { > EVAL_RESULT(gsl_sf_mathieu_Ms_e(kind, order, qq, zz, &result)); > } Left file: C:\Users\brian\AppData\Local\Temp\qbzr\bzr-diff-cav0a0\1\specfunc\test_mathieu.c Right file: C:\Users\brian\Documents\Visual Studio 2013\Projects\gsl\specfunc\test_mathieu.c 37c37 < TEST_SF(s, gsl_sf_mathieu_ce, (0, 0.0, 0.0, &r), --- > TEST_SF(s, gsl_sf_mathieu_ce_e, (0, 0.0, 0.0, &r), 39c39 < TEST_SF(s, gsl_sf_mathieu_ce, (0, 0.0, M_PI_2, &r), --- > TEST_SF(s, gsl_sf_mathieu_ce_e, (0, 0.0, M_PI_2, &r), 41c41 < TEST_SF(s, gsl_sf_mathieu_ce, (0, 5.0, 0.0, &r), --- > TEST_SF(s, gsl_sf_mathieu_ce_e, (0, 5.0, 0.0, &r), 43c43 < TEST_SF(s, gsl_sf_mathieu_ce, (0, 5.0, M_PI_2, &r), --- > TEST_SF(s, gsl_sf_mathieu_ce_e, (0, 5.0, M_PI_2, &r), 45c45 < TEST_SF(s, gsl_sf_mathieu_ce, (0, 10.0, 0.0, &r), --- > TEST_SF(s, gsl_sf_mathieu_ce_e, (0, 10.0, 0.0, &r), 47c47 < TEST_SF(s, gsl_sf_mathieu_ce, (0, 10.0, M_PI_2, &r), --- > TEST_SF(s, gsl_sf_mathieu_ce_e, (0, 10.0, M_PI_2, &r), 49c49 < TEST_SF(s, gsl_sf_mathieu_ce, (0, 15.0, 0.0, &r), --- > TEST_SF(s, gsl_sf_mathieu_ce_e, (0, 15.0, 0.0, &r), 51c51 < TEST_SF(s, gsl_sf_mathieu_ce, (0, 15.0, M_PI_2, &r), --- > TEST_SF(s, gsl_sf_mathieu_ce_e, (0, 15.0, M_PI_2, &r), 53c53 < TEST_SF(s, gsl_sf_mathieu_ce, (0, 20.0, 0.0, &r), --- > TEST_SF(s, gsl_sf_mathieu_ce_e, (0, 20.0, 0.0, &r), 55c55 < TEST_SF(s, gsl_sf_mathieu_ce, (0, 20.0, M_PI_2, &r), --- > TEST_SF(s, gsl_sf_mathieu_ce_e, (0, 20.0, M_PI_2, &r), 57c57 < TEST_SF(s, gsl_sf_mathieu_ce, (0, 25.0, 0.0, &r), --- > TEST_SF(s, gsl_sf_mathieu_ce_e, (0, 25.0, 0.0, &r), 59c59 < TEST_SF(s, gsl_sf_mathieu_ce, (0, 25.0, M_PI_2, &r), --- > TEST_SF(s, gsl_sf_mathieu_ce_e, (0, 25.0, M_PI_2, &r), 61c61 < TEST_SF(s, gsl_sf_mathieu_ce, (1, 0.0, 0.0, &r), --- > TEST_SF(s, gsl_sf_mathieu_ce_e, (1, 0.0, 0.0, &r), 63c63 < TEST_SF(s, gsl_sf_mathieu_ce, (1, 5.0, 0.0, &r), --- > TEST_SF(s, gsl_sf_mathieu_ce_e, (1, 5.0, 0.0, &r), 65c65 < TEST_SF(s, gsl_sf_mathieu_ce, (1, 10.0, 0.0, &r), --- > TEST_SF(s, gsl_sf_mathieu_ce_e, (1, 10.0, 0.0, &r), 67c67 < TEST_SF(s, gsl_sf_mathieu_ce, (1, 15.0, 0.0, &r), --- > TEST_SF(s, gsl_sf_mathieu_ce_e, (1, 15.0, 0.0, &r), 69c69 < TEST_SF(s, gsl_sf_mathieu_ce, (1, 20.0, 0.0, &r), --- > TEST_SF(s, gsl_sf_mathieu_ce_e, (1, 20.0, 0.0, &r), 71c71 < TEST_SF(s, gsl_sf_mathieu_ce, (1, 25.0, 0.0, &r), --- > TEST_SF(s, gsl_sf_mathieu_ce_e, (1, 25.0, 0.0, &r), 73c73 < TEST_SF(s, gsl_sf_mathieu_se, (1, 0.0, M_PI_2, &r), --- > TEST_SF(s, gsl_sf_mathieu_se_e, (1, 0.0, M_PI_2, &r), 75c75 < TEST_SF(s, gsl_sf_mathieu_se, (1, 5.0, M_PI_2, &r), --- > TEST_SF(s, gsl_sf_mathieu_se_e, (1, 5.0, M_PI_2, &r), 77c77 < TEST_SF(s, gsl_sf_mathieu_se, (1, 10.0, M_PI_2, &r), --- > TEST_SF(s, gsl_sf_mathieu_se_e, (1, 10.0, M_PI_2, &r), 79c79 < TEST_SF(s, gsl_sf_mathieu_se, (1, 15.0, M_PI_2, &r), --- > TEST_SF(s, gsl_sf_mathieu_se_e, (1, 15.0, M_PI_2, &r), 81c81 < TEST_SF(s, gsl_sf_mathieu_se, (1, 20.0, M_PI_2, &r), --- > TEST_SF(s, gsl_sf_mathieu_se_e, (1, 20.0, M_PI_2, &r), 83c83 < TEST_SF(s, gsl_sf_mathieu_se, (1, 25.0, M_PI_2, &r), --- > TEST_SF(s, gsl_sf_mathieu_se_e, (1, 25.0, M_PI_2, &r), 85c85 < TEST_SF(s, gsl_sf_mathieu_ce, (2, 0.0, 0.0, &r), --- > TEST_SF(s, gsl_sf_mathieu_ce_e, (2, 0.0, 0.0, &r), 87c87 < TEST_SF(s, gsl_sf_mathieu_ce, (2, 0.0, M_PI_2, &r), --- > TEST_SF(s, gsl_sf_mathieu_ce_e, (2, 0.0, M_PI_2, &r), 89c89 < TEST_SF(s, gsl_sf_mathieu_ce, (2, 5.0, 0.0, &r), --- > TEST_SF(s, gsl_sf_mathieu_ce_e, (2, 5.0, 0.0, &r), 91c91 < TEST_SF(s, gsl_sf_mathieu_ce, (2, 5.0, M_PI_2, &r), --- > TEST_SF(s, gsl_sf_mathieu_ce_e, (2, 5.0, M_PI_2, &r), 93c93 < TEST_SF(s, gsl_sf_mathieu_ce, (2, 10.0, 0.0, &r), --- > TEST_SF(s, gsl_sf_mathieu_ce_e, (2, 10.0, 0.0, &r), 95c95 < TEST_SF(s, gsl_sf_mathieu_ce, (2, 10.0, M_PI_2, &r), --- > TEST_SF(s, gsl_sf_mathieu_ce_e, (2, 10.0, M_PI_2, &r), 97c97 < TEST_SF(s, gsl_sf_mathieu_ce, (2, 15.0, 0.0, &r), --- > TEST_SF(s, gsl_sf_mathieu_ce_e, (2, 15.0, 0.0, &r), 99c99 < TEST_SF(s, gsl_sf_mathieu_ce, (2, 15.0, M_PI_2, &r), --- > TEST_SF(s, gsl_sf_mathieu_ce_e, (2, 15.0, M_PI_2, &r), 101c101 < TEST_SF(s, gsl_sf_mathieu_ce, (2, 20.0, 0.0, &r), --- > TEST_SF(s, gsl_sf_mathieu_ce_e, (2, 20.0, 0.0, &r), 103c103 < TEST_SF(s, gsl_sf_mathieu_ce, (2, 20.0, M_PI_2, &r), --- > TEST_SF(s, gsl_sf_mathieu_ce_e, (2, 20.0, M_PI_2, &r), 105c105 < TEST_SF(s, gsl_sf_mathieu_ce, (2, 25.0, 0.0, &r), --- > TEST_SF(s, gsl_sf_mathieu_ce_e, (2, 25.0, 0.0, &r), 107c107 < TEST_SF(s, gsl_sf_mathieu_ce, (2, 25.0, M_PI_2, &r), --- > TEST_SF(s, gsl_sf_mathieu_ce_e, (2, 25.0, M_PI_2, &r), 109c109 < TEST_SF(s, gsl_sf_mathieu_ce, (5, 0.0, 0.0, &r), --- > TEST_SF(s, gsl_sf_mathieu_ce_e, (5, 0.0, 0.0, &r), 111c111 < TEST_SF(s, gsl_sf_mathieu_ce, (5, 5.0, 0.0, &r), --- > TEST_SF(s, gsl_sf_mathieu_ce_e, (5, 5.0, 0.0, &r), 113c113 < TEST_SF(s, gsl_sf_mathieu_ce, (5, 10.0, 0.0, &r), --- > TEST_SF(s, gsl_sf_mathieu_ce_e, (5, 10.0, 0.0, &r), 115c115 < TEST_SF(s, gsl_sf_mathieu_ce, (5, 15.0, 0.0, &r), --- > TEST_SF(s, gsl_sf_mathieu_ce_e, (5, 15.0, 0.0, &r), 117c117 < TEST_SF(s, gsl_sf_mathieu_ce, (5, 20.0, 0.0, &r), --- > TEST_SF(s, gsl_sf_mathieu_ce_e, (5, 20.0, 0.0, &r), 119c119 < TEST_SF(s, gsl_sf_mathieu_ce, (5, 25.0, 0.0, &r), --- > TEST_SF(s, gsl_sf_mathieu_ce_e, (5, 25.0, 0.0, &r), 121c121 < TEST_SF(s, gsl_sf_mathieu_se, (5, 0.0, M_PI_2, &r), --- > TEST_SF(s, gsl_sf_mathieu_se_e, (5, 0.0, M_PI_2, &r), 123c123 < TEST_SF(s, gsl_sf_mathieu_se, (5, 5.0, M_PI_2, &r), --- > TEST_SF(s, gsl_sf_mathieu_se_e, (5, 5.0, M_PI_2, &r), 125c125 < TEST_SF(s, gsl_sf_mathieu_se, (5, 10.0, M_PI_2, &r), --- > TEST_SF(s, gsl_sf_mathieu_se_e, (5, 10.0, M_PI_2, &r), 127c127 < TEST_SF(s, gsl_sf_mathieu_se, (5, 15.0, M_PI_2, &r), --- > TEST_SF(s, gsl_sf_mathieu_se_e, (5, 15.0, M_PI_2, &r), 129c129 < TEST_SF(s, gsl_sf_mathieu_se, (5, 20.0, M_PI_2, &r), --- > TEST_SF(s, gsl_sf_mathieu_se_e, (5, 20.0, M_PI_2, &r), 131c131 < TEST_SF(s, gsl_sf_mathieu_se, (5, 25.0, M_PI_2, &r), --- > TEST_SF(s, gsl_sf_mathieu_se_e, (5, 25.0, M_PI_2, &r), 133c133 < TEST_SF(s, gsl_sf_mathieu_ce, (10, 0.0, 0.0, &r), --- > TEST_SF(s, gsl_sf_mathieu_ce_e, (10, 0.0, 0.0, &r), 135c135 < TEST_SF(s, gsl_sf_mathieu_ce, (10, 0.0, M_PI_2, &r), --- > TEST_SF(s, gsl_sf_mathieu_ce_e, (10, 0.0, M_PI_2, &r), 137c137 < TEST_SF(s, gsl_sf_mathieu_ce, (10, 5.0, 0.0, &r), --- > TEST_SF(s, gsl_sf_mathieu_ce_e, (10, 5.0, 0.0, &r), 139c139 < TEST_SF(s, gsl_sf_mathieu_ce, (10, 5.0, M_PI_2, &r), --- > TEST_SF(s, gsl_sf_mathieu_ce_e, (10, 5.0, M_PI_2, &r), 141c141 < TEST_SF(s, gsl_sf_mathieu_ce, (10, 10.0, 0.0, &r), --- > TEST_SF(s, gsl_sf_mathieu_ce_e, (10, 10.0, 0.0, &r), 143c143 < TEST_SF(s, gsl_sf_mathieu_ce, (10, 10.0, M_PI_2, &r), --- > TEST_SF(s, gsl_sf_mathieu_ce_e, (10, 10.0, M_PI_2, &r), 145c145 < TEST_SF(s, gsl_sf_mathieu_ce, (10, 15.0, 0.0, &r), --- > TEST_SF(s, gsl_sf_mathieu_ce_e, (10, 15.0, 0.0, &r), 147c147 < TEST_SF(s, gsl_sf_mathieu_ce, (10, 15.0, M_PI_2, &r), --- > TEST_SF(s, gsl_sf_mathieu_ce_e, (10, 15.0, M_PI_2, &r), 149c149 < TEST_SF(s, gsl_sf_mathieu_ce, (10, 20.0, 0.0, &r), --- > TEST_SF(s, gsl_sf_mathieu_ce_e, (10, 20.0, 0.0, &r), 151c151 < TEST_SF(s, gsl_sf_mathieu_ce, (10, 20.0, M_PI_2, &r), --- > TEST_SF(s, gsl_sf_mathieu_ce_e, (10, 20.0, M_PI_2, &r), 153c153 < TEST_SF(s, gsl_sf_mathieu_ce, (10, 25.0, 0.0, &r), --- > TEST_SF(s, gsl_sf_mathieu_ce_e, (10, 25.0, 0.0, &r), 155c155 < TEST_SF(s, gsl_sf_mathieu_ce, (10, 25.0, M_PI_2, &r), --- > TEST_SF(s, gsl_sf_mathieu_ce_e, (10, 25.0, M_PI_2, &r), 157c157 < TEST_SF(s, gsl_sf_mathieu_ce, (15, 0.0, 0.0, &r), --- > TEST_SF(s, gsl_sf_mathieu_ce_e, (15, 0.0, 0.0, &r), 159c159 < TEST_SF(s, gsl_sf_mathieu_ce, (15, 5.0, 0.0, &r), --- > TEST_SF(s, gsl_sf_mathieu_ce_e, (15, 5.0, 0.0, &r), 161c161 < TEST_SF(s, gsl_sf_mathieu_ce, (15, 10.0, 0.0, &r), --- > TEST_SF(s, gsl_sf_mathieu_ce_e, (15, 10.0, 0.0, &r), 163c163 < TEST_SF(s, gsl_sf_mathieu_ce, (15, 15.0, 0.0, &r), --- > TEST_SF(s, gsl_sf_mathieu_ce_e, (15, 15.0, 0.0, &r), 165c165 < TEST_SF(s, gsl_sf_mathieu_ce, (15, 20.0, 0.0, &r), --- > TEST_SF(s, gsl_sf_mathieu_ce_e, (15, 20.0, 0.0, &r), 167c167 < TEST_SF(s, gsl_sf_mathieu_ce, (15, 25.0, 0.0, &r), --- > TEST_SF(s, gsl_sf_mathieu_ce_e, (15, 25.0, 0.0, &r), 169c169 < TEST_SF(s, gsl_sf_mathieu_se, (15, 0.0, M_PI_2, &r), --- > TEST_SF(s, gsl_sf_mathieu_se_e, (15, 0.0, M_PI_2, &r), 171c171 < TEST_SF(s, gsl_sf_mathieu_se, (15, 5.0, M_PI_2, &r), --- > TEST_SF(s, gsl_sf_mathieu_se_e, (15, 5.0, M_PI_2, &r), 173c173 < TEST_SF(s, gsl_sf_mathieu_se, (15, 10.0, M_PI_2, &r), --- > TEST_SF(s, gsl_sf_mathieu_se_e, (15, 10.0, M_PI_2, &r), 175c175 < TEST_SF(s, gsl_sf_mathieu_se, (15, 15.0, M_PI_2, &r), --- > TEST_SF(s, gsl_sf_mathieu_se_e, (15, 15.0, M_PI_2, &r), 177c177 < TEST_SF(s, gsl_sf_mathieu_se, (15, 20.0, M_PI_2, &r), --- > TEST_SF(s, gsl_sf_mathieu_se_e, (15, 20.0, M_PI_2, &r), 179c179 < TEST_SF(s, gsl_sf_mathieu_se, (15, 25.0, M_PI_2, &r), --- > TEST_SF(s, gsl_sf_mathieu_se_e, (15, 25.0, M_PI_2, &r), ^ permalink raw reply [flat|nested] 4+ messages in thread

*Re: Issue with Mathieu Function Code2013-08-31 18:11 Issue with Mathieu Function Code Brian Gladman@ 2013-09-09 17:50 ` Patrick Alken2013-09-09 19:04 ` Brian Gladman 0 siblings, 1 reply; 4+ messages in thread From: Patrick Alken @ 2013-09-09 17:50 UTC (permalink / raw) To: gsl-discuss This sounds like a good idea, but we need to maintain binary compatibility in future releases of GSL. It seems we could easily add functions with _e names, since they are already implemented. But we need to maintain the old interfaces as well, or at least mark them as deprecated, so that people can link their programs to the new library version without needing to recompile. This would be a good thing to add to a list of features for v2.0. I think Brian Gough had planned to break binary compatibility for v2.0 and do all these sorts of things that needed doing. Patrick On 08/31/2013 12:11 PM, Brian Gladman wrote: > The GSL special functions are each supposed to have two alternative > functional interfaces, a pure one: > > double function(x, ...) > > and one allowing for full error returns: > > int function_e(x, ... gsl_sf_result * result) > > But the Mathieu function code doesn't follow this convention. > > It doesn't offer the former interface at all and uses the second > convention for all its functions BUT without the '_e' name extension on > its function declarations. > > This is quite error prone since it is easy to assume that *gsl_sf_result > is simply a reference to a double when in fact it is a structure that is > longer than this (a library user on Windows made exactly this mistake > and wondered why his code was causing an illegal access exception). > > I am doubtful that this is an intentional feature of the Mathieu > function code so I have created the attached patch to update the code to > use the normal conventions of the GSL special functions. (this needs > testing since I have only tried it on WIndows). > > If this is adopted, the documentation will need updating as well > (unfortunately I am unable to do this). > > with my best regards, > > Brian Gladman > ^ permalink raw reply [flat|nested] 4+ messages in thread

*Re: Issue with Mathieu Function Code2013-09-09 17:50 ` Patrick Alken@ 2013-09-09 19:04 ` Brian Gladman2013-09-09 19:25 ` Brian Gladman 0 siblings, 1 reply; 4+ messages in thread From: Brian Gladman @ 2013-09-09 19:04 UTC (permalink / raw) To: gsl-discuss On 09/09/2013 18:50, Patrick Alken wrote: > This sounds like a good idea, but we need to maintain binary > compatibility in future releases of GSL. It seems we could easily add > functions with _e names, since they are already implemented. But we need > to maintain the old interfaces as well, or at least mark them as > deprecated, so that people can link their programs to the new library > version without needing to recompile. Ah, I hadn't realised that this was an issue. Is there a define somewhere (or could we add one) that would allow those users who are happy to recompile to update to a new interface? What I have in mind is to have --------------------------------- // the new function int function_e(...) { } #ifdef MAINTAIN_BINARY_COMPATIBILITY // keep the old function #define function function_e #else // add the new function double function(...) { EVAL_RESULT(function_e(order, qq, zz, &result)); } #endif This would also make it easy to move to v2.0. I would be happy to do the work involved although it would need checking on Linux. Brian ^ permalink raw reply [flat|nested] 4+ messages in thread

*2013-09-09 19:04 ` Brian GladmanRe: Issue with Mathieu Function Code@ 2013-09-09 19:25 ` Brian Gladman0 siblings, 0 replies; 4+ messages in thread From: Brian Gladman @ 2013-09-09 19:25 UTC (permalink / raw) To: gsl-discuss On 09/09/2013 20:04, Brian Gladman wrote: > On 09/09/2013 18:50, Patrick Alken wrote: >> This sounds like a good idea, but we need to maintain binary >> compatibility in future releases of GSL. It seems we could easily add >> functions with _e names, since they are already implemented. But we need >> to maintain the old interfaces as well, or at least mark them as >> deprecated, so that people can link their programs to the new library >> version without needing to recompile. > > Ah, I hadn't realised that this was an issue. > > Is there a define somewhere (or could we add one) that would allow > those users who are happy to recompile to update to a new interface? > > What I have in mind is to have > > --------------------------------- > // the new function > int function_e(...) > { > } > > #ifdef MAINTAIN_BINARY_COMPATIBILITY > > // keep the old function > #define function function_e > > #else > > // add the new function > double function(...) > { > EVAL_RESULT(function_e(order, qq, zz, &result)); > } > > #endif > > This would also make it easy to move to v2.0. Answering my own question, I could simply use GSL_MAJOR_VERSION Brian ^ permalink raw reply [flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-09-09 19:25 UTC | newest]Thread overview:4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2013-08-31 18:11 Issue with Mathieu Function Code Brian Gladman 2013-09-09 17:50 ` Patrick Alken 2013-09-09 19:04 ` Brian Gladman 2013-09-09 19:25 ` Brian Gladman

This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).