# Formatting a Number with an Integer Picture Rounds Up

**URL:** <https://clarionhub.com/t/formatting-a-number-with-an-integer-picture-rounds-up/8156>\
**Category:** questions\
**Tags:** math\
**Created:** [May 12, 2025, 7:35pm UTC](https://clarionhub.com/t/formatting-a-number-with-an-integer-picture-rounds-up/8156 "2025-05-12T19:35:34Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Genricke](https://clarionhub.com/user_avatar/clarionhub.com/genricke/32/5271_2.png) [@Genricke](https://clarionhub.com/u/Genricke)\
**Post date:** [May 12, 2025, 7:35pm UTC](https://clarionhub.com/t/formatting-a-number-with-an-integer-picture-rounds-up/8156/1 "2025-05-12T19:35:35Z")

</div>

Hi !  
Can you please tell me why such a strange result is obtained ?

```auto
  Message(Format(999999.99,@n14)) ! = '1,000,000' ?!!!

```

---

<div class="post-metadata">

**Author:** ![Jane](https://clarionhub.com/letter_avatar_proxy/v4/letter/j/ecb155/32.png) [@Jane](https://clarionhub.com/u/Jane)\
**Post date:** [May 12, 2025, 7:53pm UTC](https://clarionhub.com/t/formatting-a-number-with-an-integer-picture-rounds-up/8156/2 "2025-05-12T19:53:15Z")

</div>

> [@Genricke](#):
>
> `Message(Format(999999.99,@n14))`

What are you expecting?  
You’re giving it an integer format picture and getting back an integer. Appropriately rounded.

Do you want the decimal (@n12.2) or truncated integer (999,999) ?

---

<div class="post-metadata">

**Author:** ![Genricke](https://clarionhub.com/user_avatar/clarionhub.com/genricke/32/5271_2.png) [@Genricke](https://clarionhub.com/u/Genricke)\
**Post date:** [May 13, 2025, 3:28am UTC](https://clarionhub.com/t/formatting-a-number-with-an-integer-picture-rounds-up/8156/3 "2025-05-13T03:28:59Z")

</div>

> [@Jane](#):
>
> Appropriately rounded.

Why? I don’t want hidden rounding! I didn’t set any rounding rules.  
Here, the fractional part should simply be discarded. 🤷‍♂️

---

<div class="post-metadata">

**Author:** ![Jane](https://clarionhub.com/letter_avatar_proxy/v4/letter/j/ecb155/32.png) [@Jane](https://clarionhub.com/u/Jane)\
**Post date:** [May 13, 2025, 4:22am UTC](https://clarionhub.com/t/formatting-a-number-with-an-integer-picture-rounds-up/8156/4 "2025-05-13T04:22:36Z")

</div>

Dunno if relevant, but the help under DECIMAL data types says

> DECIMAL  
> A packed decimal floating point number.  
> […]  
> places  
> A numeric constant that fixes the number of decimal digits in the fractional portion (to the right of the decimal point) of the variable. It must be less than or equal to the length parameter. If omitted, the variable will be declared as a math based integer. As a result, when places is omitted or zero, fractional values are rounded up.

Try searching the help for INT(truncate fraction)

> The INT procedure returns the integer portion of a numeric expression. No rounding is performed, and the sign remains unchanged.

---

<div class="post-metadata">

**Author:** ![Genricke](https://clarionhub.com/user_avatar/clarionhub.com/genricke/32/5271_2.png) [@Genricke](https://clarionhub.com/u/Genricke)\
**Post date:** [May 13, 2025, 4:51am UTC](https://clarionhub.com/t/formatting-a-number-with-an-integer-picture-rounds-up/8156/5 "2025-05-13T04:51:42Z")

</div>

> [@Jane](#):
>
> Dunno if relevant

Probably not. Why DECIMAL? You can view the help for REAL (SREAL, PDECIMAL, etc.).  
No data type is specified here and no implicit data type conversion is performed.  
It’s just that the FORMAT() operator is not working correctly. 😢

---

<div class="post-metadata">

**Author:** ![seanh](https://clarionhub.com/letter_avatar_proxy/v4/letter/s/4af34b/32.png) [@seanh](https://clarionhub.com/u/seanh)\
**Post date:** [May 13, 2025, 7:19am UTC](https://clarionhub.com/t/formatting-a-number-with-an-integer-picture-rounds-up/8156/6 "2025-05-13T07:19:56Z")

</div>

I’m not certain that it is incorrect.  
You are asking it to display your number, which has decimals, but to display it as an integer number. That would imply rounding. So I think it’s working correctly using your whole number.  
If you want the number to be truncated at the decimal, you need to seperate the integer portion to display.

---

<div class="post-metadata">

**Author:** ![Genricke](https://clarionhub.com/user_avatar/clarionhub.com/genricke/32/5271_2.png) [@Genricke](https://clarionhub.com/u/Genricke)\
**Post date:** [May 13, 2025, 8:40am UTC](https://clarionhub.com/t/formatting-a-number-with-an-integer-picture-rounds-up/8156/7 "2025-05-13T08:40:41Z")

</div>

> [@seanh](#):
>
> You are asking it to display your number, which has decimals, but to display it as an integer number

No! I’m asking you to display a number without a fractional part, rather than changing its value. If I want to display a number as an integer, then everything is fine here.

```auto
lVar Long,Auto
Code
lVar = 999999.99
Message(Format(lVar,@n14)) ! = '999,999' OK !
!Message(Format(999999.99,@n14)) ! = '1,000,000' ?!!!

```

---

<div class="post-metadata">

**Author:** ![Joei](https://clarionhub.com/letter_avatar_proxy/v4/letter/j/d78d45/32.png) [@Joei](https://clarionhub.com/u/Joei)\
**Post date:** [May 13, 2025, 11:07am UTC](https://clarionhub.com/t/formatting-a-number-with-an-integer-picture-rounds-up/8156/8 "2025-05-13T11:07:05Z")

</div>

> [@Genricke](#):
>
> ```auto
> lVar Long,Auto
> Code
> lVar = 999999.99
> 
> ```

Not realy clear for me, what you want to do…

lVar = 999999.99 ! lVar is LONG, then it makes no sense

For me: lVar = Round(someNumber, someFormatyouWant)

---

<div class="post-metadata">

**Author:** ![Genricke](https://clarionhub.com/user_avatar/clarionhub.com/genricke/32/5271_2.png) [@Genricke](https://clarionhub.com/u/Genricke)\
**Post date:** [May 13, 2025, 11:36am UTC](https://clarionhub.com/t/formatting-a-number-with-an-integer-picture-rounds-up/8156/9 "2025-05-13T11:36:49Z")

</div>

Thanks ! I know how to round a number.  
Here the task is to get an adequate result when formatting arbitrary values.

---

<div class="post-metadata">

**Author:** ![Slava](https://clarionhub.com/letter_avatar_proxy/v4/letter/s/b487fb/32.png) [@Slava](https://clarionhub.com/u/Slava)\
**Post date:** [May 13, 2025, 11:50am UTC](https://clarionhub.com/t/formatting-a-number-with-an-integer-picture-rounds-up/8156/10 "2025-05-13T11:50:37Z")

</div>

Genricke, it’s not a bug, it’s a feature. 😖

Use Message(Format(int(999999.99),@n14))

---

<div class="post-metadata">

**Author:** ![urayoan](https://clarionhub.com/user_avatar/clarionhub.com/urayoan/32/1288_2.png) [@urayoan](https://clarionhub.com/u/urayoan)\
**Post date:** [May 13, 2025, 12:02pm UTC](https://clarionhub.com/t/formatting-a-number-with-an-integer-picture-rounds-up/8156/11 "2025-05-13T12:02:28Z")

</div>

I was getting to a similar conclusion 🙂

FORMAT(INT(999999.99), @N10.0)

I was looking at this in .NET and it has a function to address that. Maybe @Bruce can joy us adding some of this in String Theory

String.Format(“{0:N0}”)

> <https://stackoverflow.com/questions/105770/net-string-format-to-add-commas-in-thousands-place-for-a-number>

---

<div class="post-metadata">

**Author:** ![Genricke](https://clarionhub.com/user_avatar/clarionhub.com/genricke/32/5271_2.png) [@Genricke](https://clarionhub.com/u/Genricke)\
**Post date:** [May 13, 2025, 12:12pm UTC](https://clarionhub.com/t/formatting-a-number-with-an-integer-picture-rounds-up/8156/12 "2025-05-13T12:12:37Z")

</div>

The list of features is already longer than the list of promises in C12 (necessarily AI). 🤔

---

<div class="post-metadata">

**Author:** ![Mike\_Duglas](https://clarionhub.com/user_avatar/clarionhub.com/mike_duglas/32/1061_2.png) [@Mike\_Duglas](https://clarionhub.com/u/Mike_Duglas)\
**Post date:** [May 13, 2025, 2:18pm UTC](https://clarionhub.com/t/formatting-a-number-with-an-integer-picture-rounds-up/8156/13 "2025-05-13T14:18:25Z")

</div>

It seems that in this case rule #3 applies (with 0 decimal places), see “BCD Conversion” help topic:

> String(@Nx.y) = BCD  
> The BCD value is rounded to y decimal places, the result is fitted into the pictured string. If overflow occurs, an invalid picture (####) results.
