version 1.173, 2007/06/26 01:40:47
|
version 1.176, 2007/08/10 22:04:10
|
Line 569 sub implicit_multiplication {
|
Line 569 sub implicit_multiplication {
|
$expression=~s/(\d+)(?:x|\*)10(?:\^|\*\*)([\+\-]*\d+)/$1\&\($2\)/gsi; |
$expression=~s/(\d+)(?:x|\*)10(?:\^|\*\*)([\+\-]*\d+)/$1\&\($2\)/gsi; |
# Fill in multiplication signs |
# Fill in multiplication signs |
# a b -> a*b;3 b -> 3*b;3 4 -> 3*4 |
# a b -> a*b;3 b -> 3*b;3 4 -> 3*4 |
$expression=~s/(\w)\s+(\w)/$1\*$2/gs; |
$expression=~s/([A-Za-z0-9])\s+(?=[A-Za-z0-9])/$1\*/gs; |
# )( -> )*(; ) ( -> )*( |
# )( -> )*(; ) ( -> )*( |
$expression=~s/\)\s*\(/\)\*\(/gs; |
$expression=~s/\)\s*\(/\)\*\(/gs; |
# 3a -> 3*a; 3( -> 3*(; 3 ( -> 3*(; 3A -> 3*A |
# 3a -> 3*a; 3( -> 3*(; 3 ( -> 3*(; 3A -> 3*A |
$expression=~s/(\d)\s*([a-zA-Z\(])/$1\*$2/gs; |
$expression=~s/(\d)\s*([a-zA-Z\(])/$1\*$2/gs; |
# a ( -> a*( |
# a ( -> a*( |
$expression=~s/(\w)\s+\(/$1\*\(/gs; |
$expression=~s/([A-Za-z0-9])\s+\(/$1\*\(/gs; |
# )a -> )*a; )3 -> )*3; ) 3 -> )*3 |
# )a -> )*a; )3 -> )*3; ) 3 -> )*3 |
$expression=~s/\)\s*(\w)/\)\*$1/gs; |
$expression=~s/\)\s*([A-Za-z0-9])/\)\*$1/gs; |
# 3&8 -> 3e8; 3&-4 -> 3e-4 |
# 3&8 -> 3e8; 3&-4 -> 3e-4 |
$expression=~s/(\d+)\&\(([\+\-]*\d+)\)/$1e$2/gs; |
$expression=~s/(\d+)\&\(([\+\-]*\d+)\)/$1e$2/gs; |
return $expression; |
return $expression; |