Re: Hexadecimal numbers in Eu
- Posted by Derek Parnell <ddparnell at bigpond.com> Sep 16, 2004
- 422 views
Juergen Luethje wrote: > > Hi, > > in some other programming languages, hex numbers can represent positive > or negative values. E.g. in PowerBASIC 3.2, > ? &hFFF0 ' prints -16 > ? &h00F0 ' prints 240 > > >From what I read at 'refman_2.htm#1' (Eu 2.4), and from my experience, > I have the impression that hexadecimal numbers (that don't have a '-' > sign at the beginning) in Euphoria _always_ have positive values. > > Rob, is this true? > > In Euphoria, e.g. > }}} <eucode> > ? #FFF0 -- prints 65520 > ? #00F0 -- prints 240 > </eucode> {{{ Yes, hexadecimal literals are always positive unless they have a leading minus symbol. However it is a bit confusing because negative integers, when converted to display as hex digits via the printf() routine, display without the minus sign. printf(1, "%x", -1) --> FFFFFFFF -- Derek Parnell Melbourne, Australia