# Rounding or display error in threshold level selector

**URL:** <https://discourse.slicer.org/t/rounding-or-display-error-in-threshold-level-selector/48470>\
**Category:** Support\
**Tags:** segmentation\
**Created:** [October 10, 2026, 3:31pm UTC](https://discourse.slicer.org/t/rounding-or-display-error-in-threshold-level-selector/48470 "2026-10-10T15:31:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)\
**Post date:** [October 10, 2026, 3:31pm UTC](https://discourse.slicer.org/t/rounding-or-display-error-in-threshold-level-selector/48470/1 "2026-10-10T15:31:03Z")

</div>

This is with the latest stable, but I have seen this issue with the float volumes before I don’t think it is new. The gist it cannot capture the true max and it leaves some of the voxels unselected.

Unselected region values are around 33.317… and should be included in the selection (since the max is set to 33.32). I cannot manually change the value either. So I think the internal selection logic is not using the same level of precision as the widget displaying selected threshold range

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/d/8/d8d46a34394d840846f9c0b497cb609a0a7fe920.jpeg)

Tried increasion the digits and enter the exact max value that’s being excluded and had no effect.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/1/0/109852728c8e32d62fc0b6585fbe0810216ef43d.jpeg)

---

<div class="post-metadata">

**Author:** ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)\
**Post date:** [October 10, 2026, 4:52pm UTC](https://discourse.slicer.org/t/rounding-or-display-error-in-threshold-level-selector/48470/2 "2026-10-10T16:52:09Z")

</div>

I opened a PR with help of claude:

> <https://github.com/Slicer/Slicer/pull/9457>
>
> Segment editor effects store \`double\` parameters via \`QString::number(value)\`, w…hich uses 6 significant
> digits. \`doubleParameter()\` therefore returns a different value than what was set.
> 
> Most visible in the Threshold effect on floating-point volumes: setting the maximum threshold to the
> volume maximum (e.g. 33.31780242919922) stores "33.3178", so voxels at the maximum are excluded in both
> the preview and Apply, regardless of the slider's displayed decimals.
> Reported in https://discourse.slicer.org/t/rounding-or-display-error-in-threshold-level-selector/48470
> 
> Fix: use \`QLocale::FloatingPointShortest\`, the shortest string that converts back to the exact same
> double, in \`setParameter(QString, double)\` and \`setCommonParameter(QString, double)\`. Integer-valued and
> short decimal values are stored the same as before (e.g. "0.1", "848").
> 
> Added \`TestSection\_DoubleParameterPrecision\` to \`SegmentationsModuleTest2\`; it fails on Slicer 5.12.4
> (33.31780242919922 -\> 33.3178, 123456.7 -\> 123457).
> 
> 🤖 Generated with \[Claude Code\](https://claude.com/claude-code)

@lassoan
