diff options
author | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-09-07 01:28:52 +0000 |
---|---|---|
committer | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-09-07 01:28:52 +0000 |
commit | 8ddfefeda3e8ad8b8c5ce265ba8de5a920ff530a (patch) | |
tree | f7b100236fea8426668ef80987442ea25959e0c5 /say.c | |
parent | 6f3a8589019b30cfbef735d7f8a319b467ee18f1 (diff) |
Compute power of 10 using ints instead of silly floats (bug #2390)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@3734 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'say.c')
-rwxr-xr-x | say.c | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -1194,6 +1194,14 @@ static int ast_say_number_full_nl(struct ast_channel *chan, int num, char *ints, return res; } +static int exp10_int(int power) +{ + int x, res= 1; + for (x=0;x<power;x++) + res *= 10; + return res; +} + typedef struct { char *separator_dziesiatek; char *cyfry[10]; @@ -1776,7 +1784,7 @@ static int ast_say_number_full_cz(struct ast_channel *chan, int num, char *ints, while ( (length % 3 ) != 1 ) { length--; } - left = num / (exp10(length-1)); + left = num / (exp10_int(length-1)); if ( left == 2 ) { switch (length-1) { case 9: options = "w"; /* 1,000,000,000 gender female */ @@ -1796,7 +1804,7 @@ static int ast_say_number_full_cz(struct ast_channel *chan, int num, char *ints, } else { /* left == 1 */ snprintf(fn, sizeof(fn), "digits/1_E%d",length-1); } - num -= left * (exp10(length-1)); + num -= left * (exp10_int(length-1)); } if (!res) { if(!ast_streamfile(chan, fn, language)) { |