Hi all,

> > p.39   Number constants
>
> > For hexadecimal notation, isn't there something 
> > about the sign that deserves mention here?
> > The example uses 0X08000000 - the first 0 after the X does serve some 
> > purpose.
>
> Aage, do you know about that "something"?  If yes, would you write
> about it?

I think he's referring to this:

http://www.firebirdsql.org/file/documentation/reference_manuals/reference_material/html/langrefupd25-hexnumerals.html,
 especially the information under 'Value ranges'.

The line under Number Constants (in the LangRef beta):

  "For BIGINT numbers, hexadecimal notation is supported by Firebird 2.5 and 
higher versions, e.g., 0X080000000 as the hex representation of decimal 
2147483648."

should be:

  "Hexadecimal notation is supported by Firebird 2.5 and higher versions. 
Numbers with 1-8 hex digits (e.g. 0x325708) are parsed as INTEGER values, 
numbers with 9-16 hex digits (e.g. 0x198723457237) as BIGINT."

More explanation about the value ranges and some pitfalls (see link above) can 
be given in Data Types and Subtypes :: Integer Data Types, before the start of 
the subsections.

Also (I should have caught this during reviewing), in Data Types and Subtypes 
:: Integer Data Types :: INTEGER, there should be a similar sentence as under 
BIGINT, explaining that you can pass INTEGERs in hex notation.

As for SMALLINT: Strictly speaking, you can't write a SMALLINT in hex notation, 
because even 0x1 is parsed as an INTEGER. But you can supply any value between 
0 and 32767 in hex notation (0x0000 - 0x7FFF) wherever a SMALLINT is required 
and it will be converted automatically.

You can also pass negative smallint values, but that's trickier: you have to 
write them as 0xFFFF8000 (negative INTEGER -32768) through 0xFFFFFFFF (negative 
INTEGER -1). In a "true SMALLINT" hex notation, this would be 0x8000 - 0xFFFF.

Cheers,
Paul

------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785351&iu=/4140
_______________________________________________
Firebird-docs mailing list
Firebird-docs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/firebird-docs

Reply via email to