Re: a simple arithmetic(?)

From: Shulga Serge (shulga@cv.jinr.dubna.su)
Date: Tue Feb 22 2000 - 12:20:01 MET


On Tue, 22 Feb 2000 allister@physics.msuiit.edu.ph wrote:

> Hi Rooters,
> 
> 
> I tried this simple (?) operation:
> 
> root [12] Double_t a
> root [13] Int_t b
> root [14] Int_t c
> root [15] b = 354 
> (int)354
> root [16] c = 245
> (int)245
> root [17] a = (b-c)/b
> (Int_t)0

  (b-c) - Int_t type
   b    - Int_t type

   Int_t/Int_t = Int_t

    1/3 = 0      (C - rule for operation "/" with integer operand)
    1./3. = 0.333

> root [18] a = (Double_t)((b-c)/b)
> (Double_t)0.00000000000000000e+00
> 
> Why is "a" still zero?  Am I missing something here?

  root[19] a = (Double_t)(b-c)/(Double_t)b
  (double)3.07909604519774005e-01

  Segei Shulga

> 
> Thanks in advance,
> 
> Allister Levi C. Sanchez
> IITHEP, Department of Physics
> MSU - Iligan Institute of Technology
> 9200 Iligan City
> Philippines
> 
> 



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:19 MET