Dear ROOTERS,
it took me more than an our of bug-searching to find out the
following interesting effect:
This macro here:
ULong_t a = 3000000000, b = 2000000000;
void shit()
{
cout << " a is " << a << endl;
if (a > b)
cout << " this is GREATER THAN " << b << endl;
if (a < b)
cout << " this is LOWER THAN " << b << endl;
}
gives the following output when called in ROOT (Version
2.25/03, SuSE Linux 7.0):
root [0] .L shit.C
root [1] shit()
a is 3000000000
this is LOWER THAN 2000000000
How comes ?? This happens no matter what intereger type a
and b are (UInt_t, ULong_t,
unsigned int, unsigned long). And 3000000000 is still lower
than 2^32.
On the other hand, the following non-ROOT C-program
#include <iostream>
#include <stdlib.h>
unsigned int a = 3000000000, b = 2000000000;
void main()
{
cout << " a is " << a << endl;
if (a > b)
cout << " this is GREATER THAN " << b << endl;
if (a < b)
cout << " this is LOWER THAN " << b << endl;
}
compiles like this:
> g++ good.C -o good
good.C:4: warning: decimal integer constant is so large
that it is unsigned
and gives:
> good
a is 3000000000
this is GREATER THAN 2000000000
What is this ???
Kai
--
======================================================================
K A I - U . K Ö H L E R
-----------------------------
Institut für Teilchenphysik Institute for Particle Physics
ETH Zürich Swiss Federal Institute of Technology
Paul Scherrer Institut Villigen PSI, Villigen, Switzerland
WLGA/E27 CH-5232 Villigen-PSI
Tel.: +41 (0)56 310 4691 eMail: kai.koehler@psi.ch
----------------------------------------------------------------------
priv.: K. & D. Köhler Zurzacherstr. 52 b
CH - 5200 Brugg Tel.: +41 (0)56 442 2973
======================================================================
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:43 MET