"0.01" becomes "0,01" in Qt application

Dear ROOT expert,
I develop a Qt program that uses ROOT libraries. The problem is I do not understand why the code

int Npics = h2X->ShowPeaks(1,"",0.01);

is understood as

int Npics = h2X->ShowPeaks(1,"",0,01);

I attached a minimal reproducer

code.zip (16.1 KB)

Unzip code.zip. Type “qmake Gammalysis.pro”, then “make” and run it “./Gammalysis”

You should see the following error

./Gammalysis
input_line_31:2:50: error: too many arguments to function call, expected at most 4, have 5
TSpectrum2::StaticSearch((TH1*)0x1fdc410,1,"",0,01)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^~
/home/pamputt/root-6.14.00/builddir/include/TSpectrum2.h:58:4: note: ‘StaticSearch’ declared here
static Int_t StaticSearch(const TH1 *hist, Double_t sigma=2, Option_t *option=“goff”, Double_t threshold=0.05);

Do you have any trick to solve this issue?

It looks like you may be using a language in which the usual way to express half is 0,5. What is the output of

$ echo 1 2 | awk '{print $1/$2}'

in your machine? In any case, export LC_NUMERIC=C should fix it.

Hi amadio,
thanks for the trick. Indeed I use an OS in French.

$ echo 1 2 | awk '{print $1/$2}'

returns 0.5
Anyway, export LC_NUMERIC=C fixes the problem.
Thank you.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.