diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2008-03-13 22:32:53 +0100 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2008-03-13 22:32:53 +0100 |
commit | e7c109b7f575d4c9e14ce1b523697a943320d7bd (patch) | |
tree | 5b62ab8fac2cd88e3313caa3c1b7adf87ff73c2d /data/rbot/plugins/math.rb | |
parent | 38212f89578111324c096d9bab55f2225a1d4d76 (diff) |
math plugin: allow floats as arguments to square and cubed roots
Diffstat (limited to 'data/rbot/plugins/math.rb')
-rw-r--r-- | data/rbot/plugins/math.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/data/rbot/plugins/math.rb b/data/rbot/plugins/math.rb index 945b2c78..f54733b3 100644 --- a/data/rbot/plugins/math.rb +++ b/data/rbot/plugins/math.rb @@ -85,8 +85,8 @@ class MathPlugin < Plugin expr.gsub!(/\bpercent/, "*0.01") expr.gsub!(/\% of\b/, "*0.01*") expr.gsub!(/\%/, "*0.01") - expr.gsub!(/\bsquare root of (\d+)/, '\1 ** 0.5 ') - expr.gsub!(/\bcubed? root of (\d+)/, '\1 **(1.0/3.0) ') + expr.gsub!(/\bsquare root of (\d+(\.\d+)?)/, '\1 ** 0.5 ') + expr.gsub!(/\bcubed? root of (\d+(\.\d+)?)/, '\1 **(1.0/3.0) ') expr.gsub!(/ of /, " * ") expr.gsub!(/(bit(-| )?)?xor(\'?e?d( with))?/, "^") expr.gsub!(/(bit(-| )?)?or(\'?e?d( with))?/, "|") |