Update oddty

This forum is to report technical problems with Rel.
Post Reply
Chris Walton
Posts: 76
Joined: Sat Aug 18, 2012 2:13 pm

Update oddty

Post by Chris Walton »

The following are all valid tuples of Month_days_lookup:

Code: Select all

Month_days_lookup := RELATION {
  TUPLE { sort sort# ( 00 ), name ID ( "" ), days N31Z ( 0 ), prior_days N366Z ( 0 ) },
  TUPLE { sort sort# ( 01 ), name ID ( "January" ), days N31Z ( 31 ), prior_days N366Z ( 0 ) },
  TUPLE { sort sort# ( 02 ), name ID ( "February" ), days N31Z ( 28 ), prior_days N366Z ( 31 ) },
  TUPLE { sort sort# ( 03 ), name ID ( "March" ), days N31Z ( 31 ), prior_days N366Z ( 60 ) },
  TUPLE { sort sort# ( 04 ), name ID ( "April" ), days N31Z ( 30 ), prior_days N366Z ( 91 )},
  TUPLE { sort sort# ( 05 ), name ID ( "May" ), days N31Z ( 31 ), prior_days N366Z ( 121 ) },
  TUPLE { sort sort# ( 06 ), name ID ( "June" ), days N31Z ( 30 ), prior_days N366Z ( 152 ) },
  TUPLE { sort sort# ( 07 ), name ID ( "July" ), days N31Z ( 31 ), prior_days N366Z ( 182 ) },
  TUPLE { sort sort# ( 8 ), name ID ( "August" ), days N31Z ( 31 ), prior_days N366Z ( 213 ) },
  TUPLE { sort sort# ( 9 ), name ID ( "September" ), days N31Z ( 30 ), prior_days N366Z ( 244 ) } };
But

Code: Select all

Month_days_lookup := RELATION {
  TUPLE { sort sort# ( 08 ), name ID ( "August" ), days N31Z ( 31 ), prior_days N366Z ( 213 ) } };
Month_days_lookup := RELATION {
  TUPLE { sort sort# ( 09 ), name ID ( "September" ), days N31Z ( 30 ), prior_days N366Z ( 244 ) } };
give respective errors of:

Code: Select all

ERROR: Encountered "8" at line 2, column 25.
ERROR: Encountered "9" at line 2, column 25.
I have checked for the possibility that I typed 'O' rather than '0' (oh rather than zero), but this not the position. Nonetheless it is acting as though entry has been of octal values. The definition of sort# is:

Code: Select all

TYPE sort# POSSREP { VALUE INTEGER CONSTRAINT VALUE >= 0 };
Dave
Site Admin
Posts: 368
Joined: Sun Nov 27, 2005 7:19 pm

Re: Update oddty

Post by Dave »

Prefixing an integer literal with 0 is treated as octal. It's not a bug. :)
Chris Walton
Posts: 76
Joined: Sat Aug 18, 2012 2:13 pm

Re: Update oddty

Post by Chris Walton »

Is there then a way of storing a normal integer with a fixed number of significant places?
Dave
Site Admin
Posts: 368
Joined: Sun Nov 27, 2005 7:19 pm

Re: Update oddty

Post by Dave »

A fixed-precision number is not a built-in type, and because non-floating numeric literals are recognised by the parser as INTEGER, you'll need to create a new type.
Post Reply