tcl event manager floating point with tcl_precision

Answered Question
Jul 22nd, 2010
User Badges:

Hello,


How can the floating point be modified in a event manager tcl script ?


Currently I am trying to write a tcl script to check for disk utilization. I am dividing the free space upon the total space to get a percentage.

and I am always getting "0", so no floating point.


I have tried to modifiy the "floating point" with set tcl_precision but I get the following error :

--> can't set "tcl_precision": can't modify precision from a safe interpreter


Is there a way to modify the floating point ?


I appreciate very much the help on this issue,


Thank you in advance,

Correct Answer by Joe Clarke about 6 years 9 months ago

IOS doesn't do floating point.  You can trick it, though, with something like:


set used [expr ${free}.0 / ${total}.0]

  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 5 (1 ratings)
Loading.
Correct Answer
Joe Clarke Thu, 07/22/2010 - 06:51
User Badges:
  • Cisco Employee,
  • Hall of Fame,

    Founding Member

IOS doesn't do floating point.  You can trick it, though, with something like:


set used [expr ${free}.0 / ${total}.0]

Actions

This Discussion