Tags:
create new tag
, view all tags

Question

I am a bit confused. I tried to use the following SpreadSheetPlugin code in my sandbox.

%CALC{$INT(08)}%

It returns "ERROR: Illegal octal digit '8', at end of line"

I did some tests and it only returns this error for 09 and 08 so basically this error only happens when either the number 8 or 9 has a leading zero.

The reason they have a leading zero is because I am trying to do a simple calculations using the current days date which is always returned with a leading zero.

Does someone know whats going on? Is this a bug?

Environment

TWiki version: TWikiRelease04x01x02
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS: Windows Server 2003 (Indigo Perl)
Web server:  
Perl version:  
Client OS:  
Web Browser:  
Categories: Plugins

-- GregGardinier - 08 Sep 2007

Answer

ALERT! If you answer a question - or have a question you asked answered by someone - please remember to edit the page and set the status to answered. The status is in a drop-down list below the edit box.

Bug or feature, that is the question. The plugin uses the underlying Perl functions to process functions. In Perl, a leading zero indicates an octal number, hence the error message for illegal octal 08. Octal numbers are in the geek zone, so the plugin should be fixed.

-- PeterThoeny - 09 Sep 2007

Oh, okay thanks. I wound up writing an if statement that removed leading zeros. At least now I understand whats going on.

-- GregGardinier - 09 Sep 2007

Workaround: Write %CALC{$INT($VALUE(08))}% to get 8

-- PeterThoeny - 09 Sep 2007

 
Change status to:
Topic revision: r4 - 2007-09-09 - PeterThoeny
 
Twitter Delicious Facebook Digg Google Bookmarks E-mail LinkedIn Reddit StumbleUpon    
  • Download TWiki
TWiki logo Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2012 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.