# Can't add Fit Parameter in Add Entry's Legend

**URL:** <https://root-forum.cern.ch/t/cant-add-fit-parameter-in-add-entrys-legend/39486>\
**Category:** Newbie\
**Created:** [May 19, 2020, 10:01am UTC](https://root-forum.cern.ch/t/cant-add-fit-parameter-in-add-entrys-legend/39486 "2020-05-19T10:01:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![marcogobbo](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/m/9d8465/32.png) [@marcogobbo](https://root-forum.cern.ch/u/marcogobbo)\
**Post date:** [May 19, 2020, 10:01am UTC](https://root-forum.cern.ch/t/cant-add-fit-parameter-in-add-entrys-legend/39486/1 "2020-05-19T10:01:54Z")

</div>

I’m trying to add the output of fit in TLegend, but I have a problem to concatenate char with double.  
I tried to do this:

`leg->AddEntry(fit1, "2960 mV #mu = " << (const char [15])fit1->GetParameter(0), "l");`

But I got:

`error: C-style cast from 'Double_t' (aka 'double') to 'const char [15]' is not allowed`

Any ideas? I tried to find similar topics but I didn’t get anything useful.

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [May 19, 2020, 10:11am UTC](https://root-forum.cern.ch/t/cant-add-fit-parameter-in-add-entrys-legend/39486/2 "2020-05-19T10:11:16Z")

</div>

`TString::Format("2960 mV #mu = %g", fit1->GetParameter(0))`

---

<div class="post-metadata">

**Author:** ![marcogobbo](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/m/9d8465/32.png) [@marcogobbo](https://root-forum.cern.ch/u/marcogobbo)\
**Post date:** [May 19, 2020, 10:57am UTC](https://root-forum.cern.ch/t/cant-add-fit-parameter-in-add-entrys-legend/39486/3 "2020-05-19T10:57:11Z")

</div>

If I want to limit the precision of GetParameter at the third decimal?

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [May 19, 2020, 11:02am UTC](https://root-forum.cern.ch/t/cant-add-fit-parameter-in-add-entrys-legend/39486/4 "2020-05-19T11:02:57Z")

</div>

[“`%.3g`”](http://www.cplusplus.com/reference/cstdio/fprintf/)
