Ok, here is the best I can do for now, with Eridius's help: Create a textmate command that has input "Selected Text or Line", and output: "Replace Selected Text". The text of the command should be the following 8 lines:
#!/usr/bin/env ruby
include Math
class Float
def inspect
"%.#{ENV['TM_CALC_PREC'] || 3}f" % self
end
end
print(eval(STDIN.read).inspect)
this should be improved, but it is a start. It will not do integer division properly unless you coerce it:
2/3=0, 2.0/3=0.667