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