# TMVA::RReader::AddVariable doesn't accept doubles

**URL:** <https://root-forum.cern.ch/t/tmva-addvariable-doesnt-accept-doubles/47891>\
**Category:** TMVA\
**Created:** [November 30, 2021, 3:45pm UTC](https://root-forum.cern.ch/t/tmva-addvariable-doesnt-accept-doubles/47891 "2021-11-30T15:45:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![avilla](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/f1d935/32.png) [@avilla](https://root-forum.cern.ch/u/avilla)\
**Post date:** [November 30, 2021, 3:45pm UTC](https://root-forum.cern.ch/t/tmva-addvariable-doesnt-accept-doubles/47891/1 "2021-11-30T15:45:58Z")

</div>

Hi,  
while working with the `TMVA::RReader` object I faced the problem of the method `AddVariable` only accepting `Float_t` variables (or `Int_t`), but not `Double_t`. This was already brought up [quite a long time ago](https://root-forum.cern.ch/t/passing-variable-type-double-to-tmva-reader-addvariable/15208), and I see that no progress has been made so far. While it is true that one can work around this by simply casting the needed variables, this can cause unexpected behaviour due to rounding errors, so I wonder if it is possible to provide handling of `Double_t` variables.  
Thanks in advance,  
Andrea

---

<div class="post-metadata">

**Author:** ![moneta](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/moneta/32/19423_2.png) [@moneta](https://root-forum.cern.ch/u/moneta)\
**Post date:** [December 2, 2021, 8:53pm UTC](https://root-forum.cern.ch/t/tmva-addvariable-doesnt-accept-doubles/47891/2 "2021-12-02T20:53:40Z")

</div>

Hi,

TMVA (and therefore also the Reader and RReader) accepts floating as input data, given the fact that the majority of machine learning algorithms work with single precision and the input data contain uncertainties or noise that are in the majority of the case larger than the floating point precision. If you have a real use case where you need double precision, I would be interested to know about it.

Best regards

Lorenzo

---

<div class="post-metadata">

**Author:** ![avilla](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/f1d935/32.png) [@avilla](https://root-forum.cern.ch/u/avilla)\
**Post date:** [December 6, 2021, 10:24am UTC](https://root-forum.cern.ch/t/tmva-addvariable-doesnt-accept-doubles/47891/3 "2021-12-06T10:24:33Z")

</div>

Hi @moneta,  
thanks for the answer, I understand your point. The case in which I encountered the problem is evaluating a TMVA classifier on data coming from a TTree which I did not create that already has `Double_t` branches, so to use them the only way was casting to `Float_t`.  
Having the chance to use `Double_t` directly in `TMVA::RReader::AddVariable` would be very useful, but since casting is a valid workaround I understand if this isn’t top priority.  
Thanks again,  
Andrea
