Unable to scale TH1 by a fraction

Hi,
I’ve got a confusing issue with the TH1 class. It seems to be impossible to scale a histogram by a fraction.

A very simple example would be as follows:

TH1F *h = new TH1F("h","h",10,0,10);
for (Int_t i = 0; i<11; i++) {
   h->Fill(i);
   }
h->Scale(1/2);
h->Draw();

The expected behaviour would be for this to plot a histogram from 0 to 10 in x, with each bin filled as 0.5. Instead, the bins all appear to be empty. The same issue happens if I replace the “1/2” with “Double_t(1/2)”, or even if I use a variable (i.e. Double_t a = 1/2; h->Scale(a):wink: In contrast, if I manually enter “0.5” then it works as expected. This is fine if I know in advance what I want to scale by, but if I want to divide all bins in a histogram by a certain value automatically there seems no direct way of doing this (short of a for loop with, e.g., h->SetBinContent(i,(h->GetBinContent(i)/a)); and similar for the bin errors, where a is some variable)
Is this a bug in the class, or is there some other function I should be using that I’ve missed? (this is in v5-34-05, which I need for the sake of AliROOT compatibility).
Thanks in advance.

At least ONE of these numbers MUST be a “floating point” value:
h->Scale(1./2.);
h->Scale(1./2);
h->Scale(1/2.);
h->Scale(Double_t(1)/Double_t(2));
h->Scale(Double_t(1)/2);
h->Scale(1/Double_t(2));