Compute power of 10 using ints instead of silly floats (bug #2390)
authorMark Spencer <markster@digium.com>
Tue, 7 Sep 2004 01:28:52 +0000 (01:28 +0000)
committerMark Spencer <markster@digium.com>
Tue, 7 Sep 2004 01:28:52 +0000 (01:28 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3734 65c4cc65-6c06-0410-ace0-fbb531ad65f3

say.c

diff --git a/say.c b/say.c
index e66aa22..7eed22c 100755 (executable)
--- a/say.c
+++ b/say.c
@@ -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)) {