Forum Discussion
Radoslaw_74539
Nimbostratus
Apr 16, 2010tcl set command limit in iRule
Hi There,
I'm trying to find some info about the limitation for the tcl set command in iRule.
Basically for the following code:
when RULE_INIT {
set ::i 0
set :...
hoolio
Cirrostratus
Apr 16, 2010Hi Rado,
All current iRules versions are based on TCL 8.4. TCL 8.4 supports a max integer of 2^63:
From http://en.wikibooks.org/wiki/Tcl_Programming/Introduction
The maximal positive integer can be determined from the hexadecimal form, with a 7 in front, and else all Fs. Tcl from 8.4 can use "wide integers" of 64 bits, and the maximum integer there is
% expr 0x7fffffffffffffff
9223372036854775807
Demonstration: one more, and it turns into the minimum integer:
% expr 0x8000000000000000
-9223372036854775808
Bignums: from Tcl 8.5, integers can be of arbitrary size, so there is no maximum integer anymore. Say, you want a big factorial:
% proc tcl::mathfunc::fac x {expr {$x < 2? 1: $x * fac($x-1)}}
% expr fac(100)
93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000
when RULE_INIT {
log local0. "\[expr 0x7fffffffffffffff\]: [expr 0x7fffffffffffffff]"
log local0. "\[expr 0x8000000000000000\]: [expr 0x8000000000000000]"
}
: [expr 0x7fffffffffffffff]: 9223372036854775807
: [expr 0x8000000000000000]: -9223372036854775808
Aaron
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects
