Skip to main content
February 28, 2025
Question

Regarding text()

  • February 28, 2025
  • 6 replies
  • 0 views

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
February 28, 2025

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.

March 2, 2025

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
February 28, 2025

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.

March 2, 2025

Hi, konduru

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

mathieud0001
February 28, 2025
March 2, 2025

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.