瀏覽代碼

fix floating point change for decimals

horgh 16 年之前
父節點
當前提交
8326c38ac8
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      calc.tcl

+ 1 - 1
calc.tcl

@@ -18,7 +18,7 @@ proc safe_calc {nick uhost hand chan str} {
 	}
 	}
 
 
 	# make all values floating point
 	# make all values floating point
-	set str [regsub -all -- {(\d+)} $str {[expr {\1*1.0}]}]
+	set str [regsub -all -- {((?:\d+)?\.?\d+)} $str {[expr {\1*1.0}]}]
 	set str [subst $str]
 	set str [subst $str]
 
 
 	if {[catch {expr $str} out]} {
 	if {[catch {expr $str} out]} {