• Do not register here on develop.twiki.org, login with your twiki.org account.
• Use View topic Item7700 for generic doc work for TWiki-6.0.2. Use View topic Item7703 for doc work on extensions that are not part of a release. More... Close
• Anything you create or change in standard webs (Main, TWiki, Sandbox etc) will be automatically reverted on every SVN update.
Does this site look broken?. Use the LitterTray web for test cases.

Item6803: EVAL function bug with zeroes after decimal point

Item Form Data

AppliesTo: Component: Priority: CurrentState: WaitingFor: TargetRelease ReleasedIn
Extension SpreadSheetPlugin Normal Closed TWiki:Main.DaniMolina patch 5.1.1

Edit Form Data

Summary:
Reported By:
Codebase:
Applies To:
Component:
Priority:
Current State:
Waiting For:
Target Release:
Released In:
 

Detail

After using properly (it has been very useful for us) the SpreadSheet plugin... we've recently found two cases in which it doesn't work.

The INT function doesn't work with negative numbers.

$INT(-25/2) gives as result -12, instead of -13.

Also, the EVAL funcion ignores the zeroes after the decimal comma.

For example, $EVAL(8.0068/2) returns 4.34 instead of 4.0034.

Is there any way to fix (or avoid) it? Could you help me?

Twiki is running on a Fedora Core 8 64bit server (kernel 2.6.26), with Perl updated to 5.12.2 and Twiki 4.2.4

Thanks a lot,

-- TWiki:Main/DaniMolina - 2011-09-05

I've also checked another server I have access to. The same applies to a CentOS 5.4 64bit with Perl 5.8.8 and Twiki 5.0.1

-- TWiki:Main.DaniMolina - 2011-09-05

$INT(-25/2) gives -12 because INT truncates towards 0. It should be documented better. You probably need functions $FLOOR() and $CEILING(), which need to be coded. I created Item6804 to track this feature request.

On, $EVAL(8.0068/2), that is a bug that needs to be fixed. Tracked in this bug item.

-- TWiki:Main.PeterThoeny - 2011-09-06

This is now fixed in SVN trunk and 5.1 branch. New plugin release posted on twiki.org. Test cases:

  • $EVAL(+68/2) : |34|
  • $EVAL(-68/2) : |-34|
  • $EVAL(068/2) : |34|
  • $EVAL(+068/2) : |34|
  • $EVAL(-068/2) : |-34|
  • $EVAL(aaaaa068/2zzzzz) : |34|
  • $EVAL(0068/2) : |34|
  • $EVAL(.0068/2) : |0.0034|
  • $EVAL(8.0068/2) : |4.0034|
  • $EVAL(8.0068/8) : |1.00085|
  • $EVAL(8.0068/08) : |1.00085|

-- TWiki:Main.PeterThoeny - 2011-09-06

ItemTemplate
Summary EVAL function bug with zeroes after decimal point
ReportedBy TWiki:Main.DaniMolina
Codebase ~twiki4, 5.1.0, 5.0.2, 5.0.1, 5.0.0, 4.3.2, 4.3.1, 4.3.0, 4.2.4
SVN Range TWiki-5.1.0, Sat, 20 Aug 2011, build 22128
AppliesTo Extension
Component SpreadSheetPlugin
Priority Normal
CurrentState Closed
WaitingFor TWiki:Main.DaniMolina
Checkins TWikirev:22265 TWikirev:22266 TWikirev:22267 TWikirev:22268 TWikirev:22269 TWikirev:22270
TargetRelease patch
ReleasedIn 5.1.1
Edit | Attach | Watch | Print version | History: r10 < r9 < r8 < r7 < r6 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r10 - 2012-01-16 - GeorgeTrubisky
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2018 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback