Rounding difference apportionment method, device, medium and product

By determining the smallest apportionment unit and apportioning the remaining amount according to it, the problem of uneven apportionment of the remaining amount is solved, and the balanced apportionment and accurate allocation of the remaining amount are achieved.

WO2026045000A1PCT designated stage Publication Date: 2026-03-05SHANGHAI JUSHUITAN NETWORK TECH CO LTD +1
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2024/138400
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2024-08-28
Filing Date
2024-12-11
Publication Date
2026-03-05

AI Technical Summary

Technical Problem

In existing methods for allocating the remaining amount, the amount of the remaining amount is prone to uneven allocation due to rounding, especially when there are many details. This may result in the entire remaining amount being allocated to one detail, making it impossible to accurately allocate it to each detail.

Method used

By determining the minimum allocation unit, ensuring that it is less than or equal to the remaining amount and has the same number of decimal places as the remaining amount, the remaining amount is allocated to multiple details according to the minimum allocation unit, and the allocation amount of each detail is updated until the remaining amount is allocated correctly.

Benefits of technology

It improves the balance and accuracy of the allocation of the remaining amount, ensuring that the remaining amount is accurately allocated to each item, and avoids the problem of the remaining amount being concentrated in one item in the existing technology.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024138400_05032026_PF_FP_ABST
    Figure CN2024138400_05032026_PF_FP_ABST
Patent Text Reader

Abstract

Disclosed in the present application are a rounding difference apportionment method, a device, a medium and a product, relating to the technical field of data processing. The method comprises: upon reception of a rounding difference apportionment request, acquiring a rounding difference amount to be apportioned, the rounding difference amount and a first apportioned amount having the same number of decimal places, and the first apportioned amount being an amount apportioned to a detailed actual total amount according to an apportionment ratio; determining the minimum apportionment unit, the minimum apportionment unit being less than or equal to the rounding difference amount, and the minimum apportionment unit and the rounding difference amount having the same number of decimal places; and on the basis of the minimum apportionment unit, apportioning the rounding difference amount to at least one predetermined first apportioned amount.
Need to check novelty before this filing date? Find Prior Art

Description

Tail difference allocation methods, equipment, media and products

[0001] Priority application

[0002] This application claims priority to Chinese Patent Application No. 2024111947085, filed on August 28, 2024, entitled “Tail Difference Allocation Method, Apparatus, Media and Product”. Technical Field

[0003] This application relates to the field of data processing, and in particular to a tail difference allocation method, device, medium and product. Background Technology

[0004] Trace error is a common problem encountered in accounting, mainly due to errors caused by rounding during calculations. For example, the unit price of each item is calculated to be accurate to 5 decimal places. The total price obtained by adding all the unit prices and multiplying by the tax rate is usually rounded to 2 significant decimal places. In this case, the total price may not be equal to the sum of the amounts of each invoice. This difference is called the trace error. Therefore, the trace error is not a human calculation mistake, but an error that occurs during the calculation process.

[0005] For example, on online shopping platforms, when an order includes multiple items (each item's account can be considered a separate item), the total original price of the multiple items may differ from the total amount actually paid. In this case, the total amount actually paid needs to be allocated to each item according to the allocation ratio. This method determines the actual unit price of each item. However, after the allocation is completed, due to rounding, there may be an error between the sum of the allocated amounts for each item and the total amount actually paid. This error is called the "tail difference".

[0006] Furthermore, the difference needs to be further allocated to the goods so that the sum of the amounts allocated to each good equals the total amount actually paid.

[0007] The current method of allocating the remaining amount will directly allocate the remaining amount to the item with the highest amount, and distribute the remaining amount evenly among the items according to the predetermined number of decimal places. However, if the amount of the remaining amount to be allocated is too small and there are too many items to allocate it to, it will still lead to uneven distribution of the remaining amount, and it may even be possible to allocate the entire remaining amount to only one item.

[0008] For example, if the difference is 1 yuan and there are 1000 details (rounded to two decimal places), then the 1 yuan needs to be evenly distributed across the 1000 details.

[0009] The allocation ratio of the tail difference for each item is 1 / 1000 = 0.001, and the tail difference amount for each item is round(1*0.001, 2) = 0; here, round means rounding and 2 means keeping two decimal places.

[0010] With this allocation method, the amount of the remaining difference allocated to each sub-item is still zero, and in the end, the remaining difference will still be allocated to one of the sub-items.

[0011] As can be seen from the above, all the tail difference allocation methods known to the inventor have serious problems of unbalanced tail difference allocation. Summary of the Invention

[0012] The purpose of this application is to provide a tail difference allocation method, device, medium, and product to solve the problems described in the background art.

[0013] To achieve the above objectives, this application provides the following solution:

[0014] Firstly, this application provides a tail difference allocation method, including:

[0015] When a request for apportionment of the remaining amount is received, the remaining amount to be apportioned is obtained. The remaining amount has the same number of decimal places as the first apportionment amount. The first apportionment amount is the amount apportioned to the total amount of the detailed items according to the apportionment ratio.

[0016] Determine the minimum allocation unit, which is less than or equal to the remaining amount, and the number of decimal places retained in the minimum allocation unit is the same as the number of decimal places retained in the remaining amount.

[0017] The remaining amount is allocated to at least one predetermined first allocation amount according to the smallest allocation unit.

[0018] In a second aspect, this application provides a computer device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the method in any of the first aspects described above.

[0019] Thirdly, this application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method described in any of the first aspects above.

[0020] Fourthly, this application provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the method described in any of the first aspects above. Attached Figure Description

[0021] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0022] Figure 1 is an application environment diagram of a tail difference amortization method in an embodiment of this application;

[0023] Figure 2 is a flowchart illustrating a tail difference allocation method according to an embodiment of this application;

[0024] Figure 3 is a schematic diagram of a process for determining the amount of the tail difference according to an embodiment of this application;

[0025] Figure 4 is a flowchart illustrating a method for determining the minimum apportionment unit according to an embodiment of this application;

[0026] Figure 5 is a schematic diagram of a process for allocating the remaining amount according to an embodiment of this application;

[0027] Figure 6 is a flowchart illustrating a tail difference amortization method provided in another embodiment of this application.

[0028] Figure 7 is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation

[0029] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0030] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0031] The tail difference allocation method provided in this application embodiment can be applied to the application environment shown in Figure 1, which includes a terminal and a server. The terminal communicates with the server via a network. A data storage system can store the data that the server needs to process. The data storage system can be set up independently, integrated into the server, or placed in the cloud or on another server. The terminal can receive the detailed data to be processed and send it to the server.

[0032] After receiving the detailed data to be processed, the server can store the detailed data first and retrieve it from the storage location when processing is needed, or it can perform the processing task while storing the data. When the server receives a tail difference allocation request, it performs the tail difference allocation operation according to the tail difference allocation method in the following embodiment. After the server completes the tail difference allocation operation, it resends the data of each detail to the terminal. After receiving the data sent by the server, the terminal displays it on its monitor so that the staff can promptly know the details after the tail difference allocation operation.

[0033] In addition, in some embodiments, the tail difference allocation method can also be implemented by the server or the terminal alone. For example, the terminal can directly allocate the tail difference for the details to be processed, or the server can obtain the details to be processed from the data storage system and allocate the tail difference for the details to be processed.

[0034] The terminals can be, but are not limited to, various desktop computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices. IoT devices can include smart speakers, smart TVs, smart air conditioners, and smart in-vehicle systems. Portable wearable devices can include smartwatches, smart bracelets, and head-mounted devices. Servers can be implemented using independent servers, server clusters composed of multiple servers, or cloud servers.

[0035] In an exemplary embodiment, as shown in FIG2, a tail difference amortization method is provided. This method is executed by a computer device, specifically by a computer device such as a terminal or a server alone, or by both a terminal and a server. In this embodiment, the method is described using the server in FIG1 as an example, including the following steps 201 to 203:

[0036] Step 201: When a tail difference allocation request is received, obtain the tail difference amount to be allocated. The tail difference amount has the same number of decimal places as the first allocation amount. The first allocation amount is the amount allocated to the actual total amount in the details according to the allocation ratio.

[0037] The difference is the sum of the actual total amount in the details and the first apportionment amount.

[0038] The first apportionment amount can be understood as: for each item, the amount allocated to the actual total amount of the item according to the apportionment ratio. Each item corresponds to a first apportionment amount, so firstly, the sum of the first apportionment amounts corresponding to each item is calculated and recorded as the first sum value. Then, the difference between the actual total amount of the item and the first sum value is calculated to obtain the first difference value, which is the tail difference amount.

[0039] For each item, the allocation ratio is the ratio of the original amount of that item to the original total amount of the item.

[0040] For example, as shown in Table 1 below, there are three details, labeled A, B and C, with serial numbers 1, 2 and 3 respectively. The total actual amount of the details is 10 yuan, and the first apportionment amounts are 4.55 yuan, 3.64 yuan and 1.82 yuan respectively. Then the difference amount = 10 yuan - 4.55 yuan - 3.64 yuan - 1.82 yuan = -0.01 yuan.

[0041] Table 1

[0042] Assuming Table 1 above represents the accounting for an order on a shopping platform, the order includes three items. The detailed original amount can be considered the original price of a single item, the detailed original total amount can be considered the original total amount of the order, and the detailed actual total amount can be considered the total price of the order after discounts.

[0043] Furthermore, a single detail in this application can be understood as the smallest accounting unit included in an account, or as the entity used to allocate the remaining amount. For example, taking Table 1 as an example, assuming Table 1 is the account of an order on a shopping platform, which includes three items, then one item corresponds to one detail.

[0044] In addition, it should be noted that the size and amount of the accounts, as well as the size and amount of the details included in the accounts, can be specified by the individual and there are no specific restrictions.

[0045] For details on the specific calculation method of the remaining amount, please refer to the relevant content below, which will not be elaborated here.

[0046] The difference in amount can be calculated in advance and stored on the server so that it can be retrieved promptly when needed.

[0047] The tail difference allocation request can be sent to the server by the staff through the user interface, or it can be automatically triggered by the server during the calculation process.

[0048] For example, during the calculation process, the server will calculate the tail difference amount. When a tail difference amount exists, that is, when the tail difference amount is not zero, a tail difference sharing request will be automatically generated. If the tail difference amount is zero, no tail difference sharing request will be generated.

[0049] The number of decimal places retained for the remaining amount is the same as the number of decimal places retained for the first apportionment amount of each item.

[0050] The number of decimal places retained for the first share of the amount can be determined according to the actual situation. For example, for online shopping platforms, when an order includes multiple items, the first share of the amount for each item is retained to two decimal places.

[0051] Step 202: Determine the minimum allocation unit. The minimum allocation unit is less than or equal to the remaining amount, and the number of decimal places retained in the minimum allocation unit is the same as the number of decimal places retained in the remaining amount.

[0052] The minimum allocation unit can be understood as: the minimum amount that a detail needs to be allocated each time an allocation operation is performed.

[0053] It should be noted that the minimum allocation unit can be either positive or negative, and its sign is consistent with that of the remaining amount. When the remaining amount is positive, the minimum allocation unit is positive; when the remaining amount is negative, the minimum allocation unit is negative.

[0054] The number of decimal places retained for the original amount of the details, the original total amount of the details, the actual total amount of the details, the first apportionment amount, the remaining amount, and the smallest apportionment unit are all the same.

[0055] In addition, the minimum allocation unit is less than or equal to the remaining amount, which limits the size of the minimum allocation unit to ensure that it is not too large and that at least one minimum allocation unit exists. Furthermore, the number of decimal places retained in the minimum allocation unit is the same as that retained in the remaining amount, to prevent the minimum allocation unit from being too small and thus ensuring that the remaining amount is not allocated to any details. For example, if the remaining amount is rounded to two decimal places, but the minimum allocation unit is rounded to three decimal places, the minimum allocation unit may become 0 during rounding, resulting in the remaining amount not being allocated.

[0056] For example, the first allocated amount is 4.55, the remaining amount is 0.02, and the minimum allocated unit is 0.001. After the allocation operation is performed, the new first allocated amount is 4.551. However, after rounding the first allocated amount to two decimal places, the new first allocated amount is still 4.55, which is equivalent to not performing the allocation operation. Therefore, to avoid this situation, the number of decimal places retained by the minimum allocated unit is limited to be the same as the number of decimal places retained by the remaining amount.

[0057] Step 203: Allocate the remaining amount to at least one predetermined first allocation amount according to the minimum allocation unit.

[0058] When performing the allocation operation, each item is allocated a minimum allocation unit. Generally, the number of minimum allocation units included in the remaining amount is less than the number of items, so the remaining amount can be allocated completely.

[0059] After performing an allocation operation on a detail, update the first allocation amount corresponding to that detail to obtain the new first allocation amount, which is recorded as the second allocation amount.

[0060] This application provides a method for allocating residual costs through the above embodiments. When a residual cost allocation request is received, the residual cost amount to be allocated is obtained; a minimum allocation unit is determined, which is less than or equal to the residual cost amount, and the number of decimal places retained in the minimum allocation unit is the same as the number of decimal places retained in the residual cost amount; the residual cost amount is allocated to different items sequentially according to the minimum allocation unit. In contrast, existing technologies directly allocate the entire residual cost to the item with the largest original amount. Therefore, compared to existing technologies, this application's embodiment allocates the residual cost to different items according to the minimum allocation unit, which improves the balance of residual cost allocation.

[0061] In yet another exemplary embodiment of this application, as shown in FIG3, the difference amount in step 201 is determined by the following steps 2011-2015:

[0062] Step 2011: Determine the total amount in detail.

[0063] The total amount in the details is the sum of the original amounts of each item.

[0064] Step 2012: For each item, calculate the ratio of the original amount of the item to the original total amount of the item to obtain the allocation ratio of the item. The allocation ratio is the proportion of the item used to allocate the remaining amount.

[0065] When the sharing ratio is expressed as a decimal, there may be cases where there are many decimal places. For example, when the sharing ratio is an infinite repeating decimal, it is required to retain a certain number of decimal places, such as 7-10 decimal places.

[0066] The number of decimal places retained for the apportionment ratio is greater than that for the difference amount and the number of decimal places retained for the smallest apportionment unit, in order to improve the accuracy of the calculation.

[0067] Step 2013: For each item, calculate the product of the actual total amount of the item and the apportionment ratio to obtain the first apportionment amount.

[0068] The first share of the contribution will have fewer decimal places than the contribution ratio. For example, if the contribution ratio is rounded to 8 decimal places, the first share will be rounded to 2 decimal places.

[0069] When the first share of the contribution is rounded to retain the decimal places, there will be an error in the value of the first share of the contribution.

[0070] Step 2014: Calculate the sum of the first apportionment amounts for each item to obtain the total first apportionment amount.

[0071] Because there is an error in the first apportionment amount, the total of the first apportionment amounts will also have an error, and may be less than or greater than the actual total amount in the details.

[0072] Step 2015: Calculate the difference between the actual total amount in the details and the sum of the first apportionment amount to obtain the tail difference amount.

[0073] When the sum of the first allocated amounts is less than the actual total amount in the details, the difference is positive; when the sum of the first allocated amounts is greater than the actual total amount in the details, the difference is negative.

[0074] Steps 2011-2015 above can be understood with reference to Table 2 below.

[0075] Table 2

[0076] In another exemplary embodiment of this application, as shown in FIG4, the minimum allocation unit in step 202 is determined by the following steps 2021-2023:

[0077] Step 2021: Determine the number of decimal places to retain for the remaining amount.

[0078] The number of decimal places retained in the difference amount is the same as the number of decimal places retained in the first share amount. The number of decimal places retained in the first share amount can be determined according to the actual situation, for example, retaining two decimal places.

[0079] Step 2022: Calculate the power of the number of decimal places retained by the negative difference amount of 10 to obtain the absolute value of the smallest allocation unit.

[0080] Since the minimum apportionment unit can be positive or negative, what is calculated at this time is only the absolute value of the minimum apportionment unit.

[0081] For example, when the decimal places retained for the difference amount are 2, the minimum allocation unit is 10. -2 , which is 0.01.

[0082] Step 2023: Determine the sign of the remaining amount as the sign of the minimum allocation unit to obtain the minimum allocation unit.

[0083] The minimum allocation unit is determined by raising the power of the number of decimal places retained by the negative difference amount of 10. The number of decimal places in the minimum allocation unit is the same as the number of decimal places in the difference amount. The absolute value of the minimum allocation unit is the smallest value among all numbers with the same number of decimal places. This allows the difference amount to be allocated with the minimum value, improving the balance of the difference amount allocated to each sub-item.

[0084] In another exemplary embodiment of this application, as shown in FIG5, step 203 is implemented by the following steps 2031-2032:

[0085] Step 2031: Calculate the quotient between the absolute value of the tail difference amount and the minimum allocation unit. The quotient is the quantity n of the first allocation amount of the tail difference amount that needs to be allocated, where n is a positive integer.

[0086] The difference in amount is usually an integer multiple of the smallest unit of contribution, so n is a positive integer.

[0087] Generally, the number of first-allocated amounts used to allocate the remaining amount is less than the total number of first-allocated amounts, so the number of n is less than the total number of first-allocated amounts (the number of details).

[0088] Step 2032: Determine n first allocation amounts for allocating the remaining amount, and allocate the remaining amount to the determined n first allocation amounts according to the smallest allocation unit, so that the remaining amount is fully allocated.

[0089] Once the first allocation amount is allocated to the smallest allocation unit, a new first allocation amount is obtained. Then, the first allocation amount is updated to obtain the second allocation amount.

[0090] For each detailed item's second allocation amount, sum the second allocation amounts to obtain the second allocation total amount. This second allocation total amount should equal the actual total amount of the detailed item. If the second allocation total amount does not equal the actual total amount of the detailed item, it indicates an error occurred during the allocation of the tail difference, and the allocation operation can be re-executed to improve the allocation accuracy. Therefore, after step 203, this embodiment of the application may further include the following steps 204-207:

[0091] Step 204: Calculate the sum of each second allocation amount to obtain the total second allocation amount. The second allocation amount is the new first allocation amount obtained after performing the tail difference allocation operation.

[0092] The second allocation amount here refers to the second allocation amount for all details. For details without any allocated difference amount, the second allocation amount is the same as the first allocation amount.

[0093] Step 205: Calculate the difference between the second apportionment amount and the actual total amount in the details, and record it as the second difference.

[0094] Step 206: When the second difference is equal to zero, it is determined that the apportionment of the tail difference amount is correct.

[0095] Step 207: When the second difference is not equal to zero, it is determined that the tail difference amount allocation is incorrect, and the tail difference amount allocation operation is re-executed until the tail difference amount allocation is correct.

[0096] Optionally, the n first allocation amounts used to allocate the remaining amount are n details arranged in descending order of the first allocation amount.

[0097] Since the minimum contribution amount can be positive or negative, if the minimum contribution amount is negative and the first contribution amount is very small (for example, if the first contribution amount is less than the minimum contribution amount), the second contribution amount will be negative. Therefore, to avoid this situation, the n details are arranged in descending order of the first contribution amount.

[0098] Optionally, when n is greater than the number of details, the amount is allocated cyclically in a predetermined order until the remaining amount is fully allocated.

[0099] The predetermined order is the order of the first share of the amount from largest to smallest.

[0100] The above methods ensure that the remaining amount is fully allocated, improve the allocation accuracy, and also improve the accuracy of the second allocation amount.

[0101] In an exemplary embodiment, a computer device is provided, which may be a server or a terminal, and its internal structure diagram is shown in Figure 7. The computer device includes a processor, memory, input / output interfaces (I / O), and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is connected to the system bus via the I / O interfaces. The processor of the computer device provides computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The database of the computer device stores tail difference amortization related data. The I / O interfaces of the computer device are used for exchanging information between the processor and external devices. The communication interface of the computer device is used for communicating with external terminals via a network connection. When the computer program is executed by the processor, it implements a tail difference amortization method.

[0102] Those skilled in the art will understand that the structure shown in Figure 7 is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0103] In one exemplary embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above-described method embodiments.

[0104] In one exemplary embodiment, a computer-readable storage medium is provided storing a computer program that, when executed by a processor, implements the steps in the above-described method embodiments.

[0105] In one exemplary embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above-described method embodiments.

[0106] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.

[0107] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM).

[0108] The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.

[0109] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0110] This document uses specific examples to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the methods and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. In summary, the content of this specification should not be construed as a limitation of this application.

Claims

1. A tail difference allocation method, characterized in that, include: When a tail difference allocation request is received, the tail difference amount to be allocated is obtained. The tail difference amount has the same number of decimal places as the first allocation amount, which is the amount allocated to the detailed actual total amount according to the allocation ratio. Determine the minimum allocation unit, wherein the minimum allocation unit is less than or equal to the remaining amount, and the number of decimal places retained by the minimum allocation unit is the same as the number of decimal places retained by the remaining amount; The remaining amount is allocated to at least one predetermined first allocation amount according to the minimum allocation unit.

2. The tail difference allocation method according to claim 1, characterized in that, The difference amount is determined using the following method: Determine the original total amount in detail; For each item, the ratio of the original amount of the item to the original total amount of the item is calculated to obtain the allocation ratio of the item. The allocation ratio is the proportion of the item used to allocate the remaining amount. For each item, calculate the product of the actual total amount of the item and the allocation ratio to obtain the first allocation amount; Calculate the sum of the first apportionment amounts for each item to obtain the total first apportionment amount; The difference between the actual total amount of the detailed breakdown and the sum of the first apportioned amounts is calculated to obtain the residual amount.

3. The tail difference allocation method according to claim 1, characterized in that, The minimum allocation unit is determined by the following method: Determine the number of decimal places to retain in the remaining amount; Calculate the absolute value of the smallest apportionment unit by raising the negative of the remaining decimal places of the amount to be 10. The sign of the tail difference amount is determined as the sign of the minimum allocation unit, thus obtaining the minimum allocation unit.

4. The tail difference allocation method according to claim 1, characterized in that, The step of allocating the remaining amount to at least one predetermined first allocation amount according to the minimum allocation unit includes: Calculate the quotient between the absolute value of the tail difference amount and the minimum allocation unit, where the quotient is the quantity n of the first allocation amount that needs to be allocated for the tail difference amount, and n is a positive integer; Determine n first allocation amounts for allocating the remaining amount, and distribute the remaining amount to the determined n first allocation amounts according to the minimum allocation unit, so that the remaining amount is fully allocated.

5. The tail difference allocation method according to claim 4, characterized in that, The n first allocation amounts used to allocate the remaining amount are n details arranged in descending order of the first allocation amount.

6. The tail difference allocation method according to claim 4, characterized in that, When n is greater than the number of details, the amount is allocated cyclically in a predetermined order until the remaining amount is fully allocated.

7. The tail difference allocation method according to any one of claims 1-6, characterized in that, After allocating the remaining amount to at least one predetermined first allocation amount, the method further includes: Calculate the sum of each second allocation amount to obtain the total second allocation amount. The second allocation amount is the new first allocation amount obtained after performing the tail difference allocation operation. Calculate the difference between the second apportioned amount and the actual total amount in the details, and record it as the second difference; When the second difference is equal to zero, it is determined that the apportionment of the remaining amount is correct; When the second difference is not equal to zero, it is determined that the allocation of the tail difference amount is incorrect, and the tail difference amount allocation operation is re-executed until the tail difference amount is allocated correctly.

8. A computer device, comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that the processor executes the computer program to implement the tail difference amortization method according to any one of claims 1-7.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the tail difference amortization method as described in any one of claims 1-7.

10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the tail difference amortization method as described in any one of claims 1-7.

Citation Information

Patent Citations

  • Cost sharing device and method

    CN111275284A

  • Data allocation method and device, computer equipment and storage medium

    CN111752944A

  • Data allocation method and device, computer equipment and storage medium

    CN116739543A

  • Data allocation method and device, electronic equipment and storage medium

    CN117609302A

  • Method and device for apportionment by a conversational agent of an expenditure incurred by a user within a group of users

    US20200258060A1