Forum Discussion
Nathan_Pearce_4
May 21, 2010Historic F5 Account
Math problem (possible human error)
when RULE_INIT {
log local0. "Maths Test: 57 + 22: [expr {57 +22}]. 57 + 022: [expr {57 + 022}]"
}
Returns:
: Maths Test: 57 + 22: 79. 57 + 022: 75
Can anyone explain why this might be?
Teste...
May 21, 2010
Actually, that's not an error. When you are attempting to add "022", the TCL interpreter is treating that number as octal. octal 022 is 18 and 57 + 18 equals 75. The manual page for expr explains the rules on interpretation of numbers and their formats
http://tmml.sourceforge.net/doc/tcl/expr.html
-Joe
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