Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements

Welcome to Cisco Support Community. We would love to have your feedback.

For an introduction to the new site, click here. And see here for current known issues.

Cisco Employee

Help with large counters

Hi,

As part of an EEM script I am collecting the bytes downloaded on my WAN interface, formatting it and using it to create a banner with the monthly usage. The numbers get quite large and I am getting the following message:

%HA_EM-6-FMPD_OPERAND_INVALID: Invalid operand in action, expected value within range -2147483648 to 2147483647, received: 4824555627

Is there anyway around this?

Ryan

2 REPLIES

Re: Help with large counters

Hi Ryan,

I don't know it it's recommendable, but if you really want to do calculations with such large numbers, you could use floating-point values instead of integers:

R1(tcl)#set x 4824555627

4824555627

R1(tcl)#puts [expr $x]

integer value too large to represent

R1(tcl)#puts [expr [format "%.1f" $x]]

4824555627.0

R1(tcl)#puts [expr [format "%.1f" $x] * 10]

48245556270.0

Perhaps you should wait a while for other answers or a confirmation as I'm not very experienced with TCL.

Regards

Rolf

Cisco Employee

Re: Help with large counters

Yep, this is the way to go.  You need to use Tcl, and you need to convert to floating point.  One easy way to do the conversion is with:

set num "${num}.0"

Then you can operate on $num like an FP.  This doesn't work with applets, so Tcl is the only way to go.

350
Views
0
Helpful
2
Replies
CreatePlease login to create content