i using tcl version /tools/tcl/8.4.11/linux64/bin/tcl
may know how can use built in power function in tcl script?
i tried not work.
namespace import ::tcl::mathfunc::* puts [pow 10 2] unknown namespace in import pattern "::tcl::mathfunc::*" while executing "namespace import ::tcl::mathfunc::\*"
may know why?
that feature introduced in tcl 8.5. in 8.4 , before, functions implemented using special api nobody understood (passing around pointers tcl_value structures, rather strange).
the pow() function floating point function in versions of tcl (even if written call ::tcl::mathfunc::pow). integer exponentiation available via ** operator (requires tcl 8.5, first version support arbitrary size integers):
puts [expr { 10 ** 2 }] # note namespace puts [tcl::mathop::** 10 2] namespace import tcl::mathop::* puts [** 10 2] the ** operator equivalent pow() if either of arguments floating point number (and indeed call same function in standard c math library behind scenes).
Comments
Post a Comment