]> git.donarmstrong.com Git - infobot.git/blobdiff - src/Modules/Math.pl
* support more dictionaries [dpkg specific]
[infobot.git] / src / Modules / Math.pl
index c5a1f6bbfc8a8c0793ed754e0d2bdd02fcdb1805..b91f8fe64ff7d1f5bc8623b271cf5cfd8183dc2b 100644 (file)
@@ -2,7 +2,9 @@
 # infobot copyright (C) kevin lenzo 1997-98
 #
 
-if (&IsParam("useStrict")) { use strict; }
+use strict;
+
+use vars qw($message);
 
 my %digits = (
        "first",   "1",
@@ -76,7 +78,7 @@ sub perlMath {
     }
 
     for ($locMsg) {
-       s/\bpi\b/3.1415/g;
+       s/\bpi\b/3.14159265/g;
        s/ to the / ** /g;
        s/\btimes\b/\*/g;
        s/\bdiv(ided by)? /\/ /g;
@@ -104,6 +106,7 @@ sub perlMath {
        && ($locMsg !~ /^\s*[( )]+\s*$/)
        && ($locMsg =~ /\d+/)
     ) {
+       $locMsg =~ s/([0-9]+\.[0-9]+(\.[0-9]+)+)/"$1"/g;
        $locMsg = eval($locMsg);
 
        if (defined $locMsg and $locMsg =~ /^[-+\de\.]+$/) {
@@ -115,7 +118,7 @@ sub perlMath {
            }
        } else {
            if (defined $locMsg) {
-               &DEBUG("math: locMsg => '$locMsg'... FIXME");
+               &FIXME("math: locMsg => '$locMsg'...");
            } else {
                &status("math: could not really compute.");
                $locMsg = "";