Skip to main content
Known Participant
Feb 28, 2025 10:13 AM UTC
Question

Regarding text()

I have a question about the text() function.
When I used "#" in the second argument to text(), the following behavior occurred.
When I tried to match the digits and separators to the format,
the numbers after the decimal point changed.
The documentation says that "#" is a format for numbers,
but does it also convert the numbers themselves?

・document

docs.appian.com/.../fnc_text_text.html

↓exmaple
text("12,333,333,333,333.12","##,###,###,###,###.##") → "12,333,333,333,333.11" is returned.

6 replies

stefanhelzle0001
Brainy
Feb 28, 2025 10:21 AM UTC

This is the result of how computers store decimal numbers. When that number is converted into a string, a rounding operation happens.

https://en.wikipedia.org/wiki/Computer_number_format

BTW, are you aware that you pass that decimal number as a string? This could already result in mathematical rounding.

Known Participant
Mar 2, 2025 11:41 PM UTC

Hi, Stefan

Thank you for your answer.
I understood the system.
Sorry I didn't know how it worked, any help would be appreciated.

konduruc733182
Inspiring
Feb 28, 2025 10:41 AM UTC

Apparently its due to the rounding of the value that happens when a number is converted to string. May be try asking ChatGPT to summarize the answer for you.

Known Participant
Mar 2, 2025 11:43 PM UTC

Hi, konduru

Sorry I didn't know how it worked, but I understood regarding round.
Thank you for your answer.

mathieud0001
Genius
Feb 28, 2025 9:11 PM UTC
Known Participant
Mar 2, 2025 11:44 PM UTC

Hi, Mathieu

Thanks for the answer and for attaching the document.
It looks like this can be overcome by using the workaround described in the documentation.