Re: [ROOT] Integer Division Error

From: Stephan Witoszynskyj (stephan.witoszynskyj@cern.ch)
Date: Mon Nov 18 2002 - 16:01:52 MET


To me this seems to be the normal behavior of C.

On the righthand side there are only integers, so it does only an 
integer operation, which is then converted into a floating point number.

Regards,
   Stephan

Am Montag den, 18. November 2002, um 14:23, schrieb Steffen Grohmann:

> Hello,
>  
> I found a problem dividing integers in root. For instance, when I 
> declare:
>   Double_t x = 2/3;
> the result of x is "0". The operation only works when I write:
>   Double_t x = 2./3.;
>  
> Could you please tell me if this is "normal" behavior in root?
>  
> Regards, Steffen
>  
>
--
The future is already there, it's just not evenly distributed yet.
                                                            (William 
Gibson)
+----------------------+-----------------------------+--------------------+
| Stephan Witoszynskyj | E-mail:                     |+41-22-76 73053  
(o)|
| 553-r-023            | stephan.witoszynskyj@cern.ch|+33-450-424355   
(h)|
| CERN/EP Division     | stephan@iaphys.org          |+41-78-725 06236 
(m)|
+----------------------+-----------------------------+--------------------+



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:18 MET