# Number Format Pattern shows Negative Zero on Numeric Label Component

**URL:** <https://forum.inductiveautomation.com/t/number-format-pattern-shows-negative-zero-on-numeric-label-component/40137>\
**Category:** Ignition\
**Tags:** ignition79\
**Created:** [October 29, 2020, 3:21pm UTC](https://forum.inductiveautomation.com/t/number-format-pattern-shows-negative-zero-on-numeric-label-component/40137 "2020-10-29T15:21:01Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mlindstrom](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mlindstrom/32/30000_2.png) [@mlindstrom](https://forum.inductiveautomation.com/u/mlindstrom)\
**Post date:** [October 29, 2020, 3:21pm UTC](https://forum.inductiveautomation.com/t/number-format-pattern-shows-negative-zero-on-numeric-label-component/40137/1 "2020-10-29T15:21:02Z")

</div>

I have a floating-point value which I want to display as an integer. When the value is in the range [-0,-0.5] including both -0 and -0.5, it displays as “–0”, or a zero with a negative sign. It looks kinda funky. Any way to make that disappear? Also a little surprising that it treats the value “-0” differently from “0”. I suppose that’s because of floating-point differences. Regardless, imo it should be able to be worked around with the number format pattern.

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/7/77d197291f1781a1af2b608b3433ee8fd43d1e4a.png)

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/b/6/b6abaf171dc8a85408c59cb503d249737ce7b6c8.png)

---

<div class="post-metadata">

**Author:** ![schenk](https://avatars.discourse-cdn.com/v4/letter/s/6bbea6/32.png) [@schenk](https://forum.inductiveautomation.com/u/schenk)\
**Post date:** [October 29, 2020, 3:59pm UTC](https://forum.inductiveautomation.com/t/number-format-pattern-shows-negative-zero-on-numeric-label-component/40137/2 "2020-10-29T15:59:21Z")

</div>

Try converting your bound value to an integer using [toInt()](https://docs.inductiveautomation.com/display/DOC80/toInt) and see if that gives you the output you want.

---

<div class="post-metadata">

**Author:** ![KathyApplebaum](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kathyapplebaum/32/7261_2.png) [@KathyApplebaum](https://forum.inductiveautomation.com/u/KathyApplebaum)\
**Post date:** [October 29, 2020, 4:53pm UTC](https://forum.inductiveautomation.com/t/number-format-pattern-shows-negative-zero-on-numeric-label-component/40137/3 "2020-10-29T16:53:34Z")

</div>

Unfortunately, the decimal format pattern you see in the property editor is Java’s format pattern, and you can’t use it to work around this.

It’s a rounding issue, like you guessed. One work around would be to have your bound value as part of an expression that rounds to an int first (like @schenk suggested).

---

<div class="post-metadata">

**Author:** ![mlindstrom](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mlindstrom/32/30000_2.png) [@mlindstrom](https://forum.inductiveautomation.com/u/mlindstrom)\
**Post date:** [October 29, 2020, 5:22pm UTC](https://forum.inductiveautomation.com/t/number-format-pattern-shows-negative-zero-on-numeric-label-component/40137/4 "2020-10-29T17:22:57Z")

</div>

Thanks for the extra explanation Kathy, and confirmation that Java’s format pattern isn’t enough to handle this. Using `toInt()` causes [-0,-0.5] to round to “0”, which is then displayed as expected without a negative.

Let’s hope I never need to round to one decimal place and want to only show “0.0” instead of “-0.0”. I tested the `round()` function with -0.04, which rounds to -0.0 and thus still displays the negative. I suppose I could write a custom rounding function with `toInt()` to get around that, but let’s hope I just don’t need to 🙂

---

<div class="post-metadata">

**Author:** ![schenk](https://avatars.discourse-cdn.com/v4/letter/s/6bbea6/32.png) [@schenk](https://forum.inductiveautomation.com/u/schenk)\
**Post date:** [October 29, 2020, 5:29pm UTC](https://forum.inductiveautomation.com/t/number-format-pattern-shows-negative-zero-on-numeric-label-component/40137/5 "2020-10-29T17:29:32Z")

</div>

If that’s the case, you can always use `numberFormat({value}, '#.0')`
