https://bugs.documentfoundation.org/show_bug.cgi?id=169217

            Bug ID: 169217
           Summary: BAHTTEXT() wrong output with large number
           Product: LibreOffice
           Version: 25.8.2.2 release
          Hardware: All
                OS: Linux (All)
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: Calc
          Assignee: [email protected]
          Reporter: [email protected]

Description:
With large number (eg. 123,001,998,830,750,501) BAHTTEXT function output wrong
text.

Example
First case: 123,001,998,830,750,501

Second case: 4,123,001,998,830,750,501

BATHTEXT output:
First case:
หนึ่งแสนสองหมื่นสามพันหนึ่งล้านเก้าแสนเก้าหมื่นแปดพันแปดร้อยสามสิบล้านเจ็ดแสนห้าหมื่นห้าร้อยสามบาทถ้วน

Second case:
สี่ล้านหนึ่งแสนสองหมื่นสามพันหนึ่งล้านเก้าแสนเก้าหมื่นแปดพันแปดร้อยสามสิบล้านเจ็ดแสนห้าหมื่นสี่ร้อยแปดสิบแปดบาทถ้วน

The correct output:
หนึ่งแสนสองหมื่นสามพันเอ็ดล้านเก้าแสนเก้าหมื่นแปดพันแปดร้อยสามสิบล้านเจ็ดแสนห้าหมื่นห้าร้อยเอ็ดบาทถ้วน

สี่ล้านหนึ่งแสนสองหมื่นสามพันเอ็ดล้านเก้าแสนเก้าหมื่นแปดพันแปดร้อยสามสิบล้านเจ็ดแสนห้าหมื่นห้าร้อยเอ็ดบาทถ้วน

The difference:
First case: At the very end, BAHTTEXT output this is  ...สามบาทถ้วน which สาม is
3. Which meant the output number is 123,001,998,830,750,503

Second case: At the very end, BAHTTEXT output this is  
...สี่ร้อยแปดสิบแปดบาทถ้วน
which is 488. Which meant the output number is 4,123,001,998,830,750,488   

Reference: https://earthchie.github.io/BAHTTEXT.js/

Also notice "เอ็ด" and "หนึ่่ง" is different.

Always use "เอ็ด" (as the default form) for units with the value 1, including
when the million digit has the value 1. This is the recommended form according
to the correct Thai language rules prescribed by the Royal Society of Thailand.

Reference: https://github.com/greatfriends/ThaiBahtText


Version: 25.8.2.2 (X86_64) / LibreOffice Community
Build ID: d401f2107ccab8f924a8e2df40f573aab7605b6f
CPU threads: 12; OS: Linux 6.17; UI render: default; VCL: gtk3
Locale: en-GB (en_US.UTF-8); UI: en-GB
Flatpak
Calc: threaded

Steps to Reproduce:
1. Type 123,001,998,830,750,501 and format cell as text on A1 cell. Format as
text because number is too large.
2. Type =BAHTTEXT(A1) on A2 cell

Actual Results:
หนึ่งแสนสองหมื่นสามพันหนึ่งล้านเก้าแสนเก้าหมื่นแปดพันแปดร้อยสามสิบล้านเจ็ดแสนห้าหมื่นห้าร้อยสามบาทถ้วน

Expected Results:
หนึ่งแสนสองหมื่นสามพันเอ็ดล้านเก้าแสนเก้าหมื่นแปดพันแปดร้อยสามสิบล้านเจ็ดแสนห้าหมื่นห้าร้อยเอ็ดบาทถ้วน


Reproducible: Always


User Profile Reset: No

Additional Info:
The correct output example was taken from
https://earthchie.github.io/BAHTTEXT.js/

For the rule on "เอ็ด" and "หนึ่่ง" see
https://github.com/greatfriends/ThaiBahtText

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to