NOTE: If you are a developer, please use a private wiki based on foswiki/trunk on a daily base ...or use trunk.foswiki.org to view this page for some minimal testing.
Use Item9693 for docu changes for 1.2 and 2.0.

Item1822: IF broken for numerical comparisons against zero

Priority: CurrentState: AppliesTo: Component: WaitingFor:
Urgent Closed Engine    
You type:
%IF{
  "-1 > 0"
  then="<b>test FAILED</b>"
  else="test PASSED"
}%
You get:
test PASSED

That's an error in BinaryOP and UnaryOP where the sub expression is defaulting to the empty string if their return value is perl-false, i.e. numerically zero.

So any further numerical comparison like -1 > 0 are evaluated lexically - not numerically because the second argument is translated to the empty string.

-- MichaelDaum - 10 Jul 2009

ItemTemplate edit

Summary IF broken for numerical comparisons against zero
ReportedBy MichaelDaum
Codebase
SVN Range Foswiki-1.0.0, Thu, 08 Jan 2009, build 1878
AppliesTo Engine
Component
Priority Urgent
CurrentState Closed
WaitingFor
Checkins Foswikirev:4489
TargetRelease patch
ReleasedIn 1.0.7
Topic revision: r6 - 20 Sep 2009, KennethLavrsen
 
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. see CopyrightStatement. Creative Commons LicenseGet Foswiki at sourceforge.net. Fast, secure and Free Open Source software downloads