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
BTW, if you do want to ensure that a number is treated as an integer, you can use the scan command
[expr 57 + [scan 022 %d]]
That should produce the expected value of 59 since "scan 022 %d" will return 22.
-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