A data processing method, device, equipment, medium and product

By converting the format and grouping of the data to be processed in the database, the problem of high space occupancy of existing ultra-long numerical storage solutions is solved, and more efficient storage is achieved.

CN119248775BActive Publication Date: 2025-05-16TRANSWARP TECHNOLOGY (SHANGHAI) CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202411275518.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-12
Publication Date
2025-05-16
Estimated Expiration
2044-09-12

AI Technical Summary

Technical Problem

The existing ultra-long numerical storage solution occupies a large storage space in the database, resulting in a high space occupancy rate.

Method used

By formatting the data to be processed, it is converted into significant numerical bits, sign bits and exponential bits, and grouped according to the storage range of the target unsigned integer array, and stored in each target unsigned integer array.

Benefits of technology

Reduces the space occupancy rate of the to-process data and improves storage efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119248775B_ABST
    Figure CN119248775B_ABST
Patent Text Reader

Abstract

The present invention discloses a data processing method, device, equipment, medium and product. The method comprises: if the length of the data to be processed is greater than the length threshold, the format of the data to be processed is converted to obtain the converted data to be processed, wherein the converted data to be processed includes: valid digits, sign bits and exponent bits; according to the storage range of the target unsigned integer array, the valid digits, the sign bits and the exponent bits are grouped to obtain multiple sub-data groups, wherein the sub-data groups include: valid digits, or valid digits, sign bits and exponent bits; each sub-data group is stored in each target unsigned integer array accordingly, and the space occupancy rate of the data to be processed can be reduced through the technical solution of the present invention.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present invention relate to the field of database technology, and in particular, to a data processing method, device, equipment, medium and product. Background Art

[0002] The demand for large-scale and high-precision data in databases is becoming more and more widespread. Oracle database has complete data management functions and can realize distributed processing. The data types in Oracle database include: numeric types.

[0003] The existing solution for storing super-long values ​​is to convert super-long values ​​into strings before storing them. Although the above solution can meet the requirements of super-long value storage, an super-long value needs to occupy 130 bytes of space, which requires a large storage space and has a high space occupancy rate. Summary of the invention

[0004] Embodiments of the present invention provide a data processing method, apparatus, device, medium and product to reduce the space occupancy rate of data to be processed.

[0005] According to one aspect of the present invention, there is provided a data processing method, comprising:

[0006] If the length of the data to be processed is greater than the length threshold, the format of the data to be processed is converted to obtain converted data to be processed, wherein the converted data to be processed includes: a valid digit, a sign bit, and an exponent bit;

[0007] According to the storage range of the target unsigned integer array, the significant digits, the sign bits and the exponent bits are grouped to obtain a plurality of sub-data groups, wherein the sub-data groups include: significant digits, or significant digits, sign bits and exponent bits;

[0008] Store each sub-data group into each target unsigned integer array accordingly.

[0009] According to another aspect of the present invention, there is provided a data processing device, the data processing device comprising:

[0010] A format conversion module, configured to perform format conversion on the data to be processed if the length of the data to be processed is greater than a length threshold, to obtain converted data to be processed, wherein the converted data to be processed includes: a valid digit, a sign bit, and an exponent bit;

[0011] A grouping module, used for grouping the significant digits, the sign bits and the exponent bits according to the storage range of the target unsigned integer array to obtain a plurality of sub-data groups, wherein the sub-data groups include: significant digits, or significant digits, sign bits and exponent bits;

[0012] The storage module is used to store each sub-data group into each target unsigned integer array accordingly.

[0013] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:

[0014] at least one processor; and

[0015] a memory communicatively connected to the at least one processor; wherein,

[0016] The memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can perform the data processing method described in any embodiment of the present invention.

[0017] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the data processing method described in any embodiment of the present invention when executed.

[0018] According to another aspect of the present invention, a computer program product is provided. When the computer program is executed by a processor, the computer program implements the data processing method as described in any one of the embodiments of the present invention.

[0019] The embodiment of the present invention performs format conversion on the data to be processed when the length of the data to be processed is greater than the length threshold to obtain the converted data to be processed, wherein the converted data to be processed includes: valid digits, sign bits and exponent bits; according to the storage range of the target unsigned integer array, the valid digits, sign bits and exponent bits are grouped to obtain multiple sub-data groups, wherein the sub-data groups include: valid digits, or valid digits, sign bits and exponent bits; and each sub-data group is stored in each target unsigned integer array accordingly. The space occupancy rate of the data to be processed can be reduced.

[0020] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.

[0022] Figure 1 is a flow chart of a data processing method in an embodiment of the present invention;

[0023] Figure 2 is a schematic diagram of a data storage structure in an embodiment of the present invention;

[0024] Figure 3 is a calculation flow chart of multiplying two data in an embodiment of the present invention;

[0025] Figure 4 is a structural schematic diagram of a data processing device in an embodiment of the present invention;

[0026] Figure 5 It is a structural schematic diagram of an electronic device in an embodiment of the present invention. DETAILED DESCRIPTION

[0027] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0028] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0029] It is understandable that before using the technical solutions disclosed in the embodiments of the present disclosure, the types, scope of use, usage scenarios, etc. of the personal information involved in the present disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.

[0030] Embodiment 1

[0031] Figure 1 Flow chart of a data processing method provided by an embodiment of the present invention. This embodiment is applicable to the case of storing long data in a database. The method can be executed by a data processing device in an embodiment of the present invention. The device can be implemented in software and / or hardware. Figure 1 As shown, the method specifically comprises the following steps:

[0032] S110: If the length of the data to be processed is greater than the length threshold, format conversion is performed on the data to be processed to obtain converted data to be processed.

[0033] The converted data to be processed includes: significant digits, sign bits and exponent bits.

[0034] Wherein, the data to be processed is of numerical type.

[0035] Wherein, the length threshold may be a preset value. If the length of the data to be processed is greater than the length threshold, the data to be processed is determined to be long data. If the data to be processed is not long data, it may be stored according to an existing storage scheme.

[0036] Specifically, the format of the data to be processed can be converted to obtain the converted data to be processed by pre-acquiring the maximum number of significant digits corresponding to the target database, and then converting the data to be processed according to the maximum number of significant digits corresponding to the target database and scientific notation to obtain the converted data to be processed.

[0037] Optionally, if the length of the data to be processed is greater than the length threshold, format conversion is performed on the data to be processed to obtain the converted data to be processed, including:

[0038] If the length of the data to be processed is greater than the length threshold, the maximum number of valid digits corresponding to the target database is obtained;

[0039] Based on scientific notation and the maximum number of significant digits, the data to be processed is converted to obtain converted data to be processed.

[0040] Specifically, the method for obtaining the maximum number of significant digits corresponding to the target database may be: determining the maximum number of significant digits corresponding to the target database according to the precision of the target database. The method for obtaining the maximum number of significant digits corresponding to the target database may also be: determining the maximum number of significant digits according to the database type of the target database. Specifically, based on scientific notation and the maximum number of significant digits, the data to be processed is converted to obtain the converted data to be processed. The method may be: based on scientific notation, the data to be processed is converted to obtain first data, and then the number of significant digits of the first data is adjusted to the maximum number of significant digits (if it is less than the maximum number of significant digits, fill in the digits, and if it is greater than the maximum number of significant digits, delete the excess part).

[0041] For example, if the maximum number of significant digits is 39, the data to be processed is converted into: a1.a2a3...a39×10^n based on scientific notation, where 0≤a[1...N]<10. a1 to a39 are 39 significant digits.

[0042] S120, grouping the significant digits, the sign bits, and the exponent bits according to the storage range of the target unsigned integer array to obtain a plurality of sub-data groups.

[0043] The sub-data group includes: significant digits, or significant digits, sign bits and exponent bits.

[0044] The target unsigned integer array is an array pre-established in the target database for storing the data to be processed. The storage range of a target unsigned integer array can be: [0, 4294967295].

[0045] Specifically, the significant digits, the sign bits and the exponent bits are grouped according to the storage range of the target unsigned integer array to obtain multiple sub-data groups in the following manner: the first significant digit number corresponding to the target unsigned integer array is determined according to the storage range of the target unsigned integer array, and according to the first significant digit number corresponding to the target unsigned integer array, the significant digits, the sign bits and the exponent bits are grouped starting from the last significant digit bit to obtain multiple sub-data groups.

[0046] Optionally, according to the storage range of the target unsigned integer array, the significant digits, the sign bits, and the exponent bits are grouped to obtain a plurality of sub-data groups, including:

[0047] According to the storage range of the target unsigned integer array, determine the first significant digit number corresponding to the target unsigned integer array;

[0048] According to the first significant digit number corresponding to the target unsigned integer array, the significant digits, the sign bits and the exponent bits are grouped starting from the last significant digit to obtain a plurality of sub-data groups.

[0049] Specifically, according to the storage range of the target unsigned integer array, the method for determining the first significant digit number corresponding to the target unsigned integer array can be: determining the maximum value of the data that can be stored in the target unsigned integer array according to the storage range of the target unsigned integer array, and determining the first significant digit number corresponding to the target unsigned integer array according to the maximum value of the data that can be stored in the target unsigned integer array.

[0050] For example, if the storage range of a target unsigned integer array is: [0, 4294967295], then the maximum value of the data that can be stored in the target unsigned integer array is determined to be 4294967295. Since the value range of each significant digit is [0, 9], the maximum number of significant digits that can be stored in a target unsigned integer array is 9 (999999999 is less than 4294967295), that is, the first significant digit corresponding to the target unsigned integer array is 9.

[0051] Specifically, according to the first significant digit corresponding to the target unsigned integer array, the significant digit, the sign bit and the exponent bit are grouped starting from the last significant digit to obtain multiple sub-data groups in the following manner: starting from the last significant digit, the number of digits allocated to each group is equal to the first significant digit, until the first significant digit, if the number of digits of the sub-data group to which the first significant digit belongs is less than the first significant digit, then the sign bit and the exponent bit are added to the sub-data group to which the first significant digit belongs. If the number of digits of the sub-data group to which the first significant digit belongs is equal to the first significant digit, then the sign bit and the exponent bit are taken as a separate sub-data group.

[0052] Optionally, according to the first significant digit corresponding to the target unsigned integer array, the significant digits, the sign bits, and the exponent bits are grouped starting from the last significant digit to obtain a plurality of sub-data groups, including:

[0053] According to the first significant digit corresponding to the target unsigned integer array, the significant digits are grouped starting from the last significant digit to obtain a plurality of sub-data groups;

[0054] If there is a sub-data group whose number of digits is less than the number of the first significant digits, the sign bit and the exponent bit are added to the sub-data group.

[0055] Specifically, according to the first significant digit corresponding to the target unsigned integer array, the significant digits are grouped starting from the last significant digit to obtain multiple sub-data groups: according to the rule that the number of digits in each sub-data group is equal to the first significant digit, the significant digits are grouped starting from the last significant digit to obtain multiple sub-data groups.

[0056] In a specific example, if the first significant digit is 9, and the significant digits include: a1, a2, a3, ..., a39, then a31-a39 are grouped into one group, a22-a30 are grouped into one group, a13-a21 are grouped into one group, a4-a12 are grouped into one group, and the total number of bits of the remaining a1, a2, and a3 is 3, and 3 is less than 9, then the sign bit, exponent bit, a1, a2, and a3 are grouped into one group.

[0057] S130, storing each sub-data group into each target unsigned integer array accordingly.

[0058] Specifically, each sub-data group may be stored in each target unsigned integer array in the order of the valid digits in each sub-data group. For example, the sign bit, exponent bit, a1, a2, and a3 may be stored in arr[0], a4-a12 may be stored in arr[1], a13-a21 may be stored in arr[2], a22-a30 may be stored in arr[3], and a31-a39 may be stored in arr[4].

[0059] In a specific example, the input long data is converted into scientific notation (the sign bit is stored separately): a1.a2a3...a39×10^n, where 0≤a[1...N]<10. a1 to a39 are 39 significant digits.

[0060] Define an unsigned int array: uint arr[5]. The storage range of a uint is [0,4294967295]. Divide a2...a39 from the back to the front into groups of 9, for a total of 5 groups. The storage range of each group is 0-999999999 (9 digits can be stored in uint). Among them, the first group only has two numbers, a2 and a3, and its range is [0,99], which can be stored in 1 byte.

[0061] The values ​​of a4 to a39 are stored in four uints: arr[1], arr[2], arr[3], and arr[4].

[0062] There are 4 bytes in arr[0]. The first bit of the first byte stores the positive or negative sign, and the 5th to 8th bits (maximum range 16) store a1. The second byte stores n, the original range is [-130,125]. Positive numbers indicate integers, and negative numbers indicate decimals. The third byte is reserved, and the fourth byte stores a2a3. The storage structure is as follows: Figure 2 As shown, Figure 2 In the example, f indicates the sign, 0 indicates a positive number, 1 indicates a negative number, u indicates unused, and the fill colors from light to dark indicate: 1 bit, 4 bits, 8 bits, 32 bits. Then the arrays arr[0], arr[1], arr[2], arr[3], arr[4] are stored on disk.

[0063] It should be noted that the above method can store the data to be processed whose length is greater than the length threshold into 5 target unsigned integer arrays, occupying a total of 20 bytes of space. Compared with the method of converting into a string in the prior art, it can reduce the space occupancy rate.

[0064] Optionally, after storing each sub-data group into each target unsigned integer array, the method further includes:

[0065] When a comparison instruction for two data to be processed is received, the sub-data groups stored in the target unsigned integer arrays corresponding to the two data to be processed are read;

[0066] The sign bit, exponent bit, and significant digit bit corresponding to each data to be processed are compared in sequence, and the comparison results corresponding to the two data to be processed are determined according to the comparison results of the sign bit, exponent bit, and significant digit bit corresponding to each data to be processed.

[0067] It should be noted that the sign bit, exponent bit, and significant digit bit corresponding to each data to be processed are compared in turn, and the comparison results corresponding to the two data to be processed are determined according to the comparison results of the sign bit, exponent bit, and significant digit bit corresponding to each data to be processed. The method can be: compare the sign bit to obtain the sign bit comparison result; compare the exponent bit to obtain the exponent bit comparison result; compare the integer part of the significant digit bit to obtain the integer part comparison result, compare the decimal part of the significant digit bit in the array to which the sign bit, exponent bit, and integer part of the significant digit bit belong to obtain the first decimal part comparison result, and compare the remaining arrays accordingly to obtain the second decimal part comparison result, and determine the comparison results corresponding to the two data to be processed according to the sign bit comparison result, the exponent bit comparison result, the integer part comparison result, the first decimal part comparison result, and the second decimal part comparison result.

[0068] In a specific example, the first step is to compare the sign bit in advance. If the sign bit is 0, it indicates a positive number or 0. If the sign bit is 1, it indicates a negative number. That is, for the sign bit, 0 (positive number or 0) is greater than 1 (negative number). The second step is to compare the exponent bit; the third step is to compare a1; the fourth step is to compare a2 and a3; the fifth step is to compare arr[1], arr[2], arr[3], and arr[4] in sequence.

[0069] It should be noted that, compared with the string comparison scheme, the above comparison scheme can directly compare sub-data groups without finding the position of the decimal point, and compare one character at a time, thereby improving the efficiency of obtaining the comparison result.

[0070] Optionally, after storing each sub-data group into each target unsigned integer array, the method further includes:

[0071] When receiving a first processing instruction for two data to be processed, determining the sign bit, exponent bit and significant digit bit of the two data to be processed according to the sub-data groups stored in the target unsigned integer arrays corresponding to the two data to be processed;

[0072] Determine integer significant digits and decimal significant digits according to the exponent digits and the significant digits;

[0073] The valid digits of the integers of the two data to be processed are stored in the first unsigned integer array set and the second unsigned integer array set respectively;

[0074] The decimal significant digits of the two data to be processed are stored in the third unsigned integer array set and the fourth unsigned integer array set respectively;

[0075] According to the sign bits of two data to be processed, the decimal significant digits stored in the third unsigned integer array set and the fourth unsigned integer array set are processed in turn, and the integer significant digits stored in the first unsigned integer array set and the second unsigned integer array set are processed first to obtain a first processing result, wherein the first processing includes: addition processing or subtraction processing.

[0076] Specifically, the method of determining the integer significant digits and the decimal significant digits according to the exponent digits and the significant digits may be: determining the integer part and the decimal part of each data to be processed according to the exponent digits and the significant digits, determining the significant digits corresponding to the decimal part as the decimal significant digits, and determining the significant digits corresponding to the integer part as the integer significant digits. For example, if the data to be processed is 1.23456e2, that is, the data to be processed is 123.456, then the integer significant digits are 123, and the decimal significant digits are 456.

[0077] Specifically, according to the sign bits of two data to be processed, the decimal significant digits stored in the third unsigned integer array set and the fourth unsigned integer array set are sequentially processed, and the integer significant digits stored in the first unsigned integer array set and the second unsigned integer array set are processed first, and the first processing result can be obtained in the following manner: if the sign bits of the two data to be processed are the same, and the first processing is an addition processing, then the decimal significant digits in the third unsigned integer array set and the fourth unsigned integer array set are added to obtain a first decimal significant digit; the integer significant digits in the first unsigned integer array set and the second unsigned integer array set are added to obtain a first integer significant digit; and the sum of the two data to be processed is determined according to the first integer significant digit, the first decimal significant digit and the sign bit. If the sign bits of the two data to be processed are different, and the first processing is an addition processing, then the decimal significant digits in the third unsigned integer array set and the fourth unsigned integer array set are subtracted to obtain a second decimal significant digit; the integer significant digits in the first unsigned integer array set and the second unsigned integer array set are subtracted to obtain a second integer significant digit; the sum of the two data to be processed is determined according to the second integer significant digit, the second decimal significant digit and the sign bit. If the sign bits of the two data to be processed are the same, and the first processing is a subtraction processing, then the decimal significant digits in the third unsigned integer array set and the fourth unsigned integer array set are subtracted to obtain a second decimal significant digit; the integer significant digits in the first unsigned integer array set and the second unsigned integer array set are subtracted to obtain a second integer significant digit; the difference between the two data to be processed is determined according to the second integer significant digit, the second decimal significant digit and the sign bit. If the sign bits of two data to be processed are different and the first processing is a subtraction processing, then the decimal significant digits in the third unsigned integer array set and the fourth unsigned integer array set are added to obtain a first decimal significant digit; the integer significant digits in the first unsigned integer array set and the second unsigned integer array set are added to obtain a first integer significant digit; and the difference between the two data to be processed is determined based on the first integer significant digit, the first decimal significant digit and the sign bit.

[0078] Optionally, according to the sign bits of two data to be processed, the decimal significant digits stored in the third unsigned integer array set and the fourth unsigned integer array set are sequentially processed, and the integer significant digits stored in the first unsigned integer array set and the second unsigned integer array set are processed first to obtain a first processing result, including:

[0079] If the sign bits of the two data to be processed are the same, and the first processing is an addition processing, then the decimal significant digits in the third unsigned integer array set and the fourth unsigned integer array set are added together to obtain a first decimal significant digit;

[0080] Add the integer significant digits in the first unsigned integer array set and the second unsigned integer array set to obtain the first integer significant digits;

[0081] The sum of two to-be-processed data is determined according to the first integer significant digits, the first decimal significant digits, and the sign bit.

[0082] Specifically, the method of adding the decimal significant digits in the third unsigned integer array set and the fourth unsigned integer array set to obtain the first decimal significant digits may be: adding the decimal significant digits of each unsigned integer array in the third unsigned integer array set and the corresponding unsigned integer array in the fourth unsigned integer array set to obtain the first decimal significant digits. For example, if the third unsigned integer array set includes: arr_dig1[1], arr_dig1[2], arr_dig1[3], and the fourth unsigned integer array set includes: Including: arr_dig2[1], arr_dig2[2], arr_dig2[3], then add arr_dig1[3] and arr_dig2[3] to get the decimal significant digit A, add arr_dig1[2] and arr_dig2[2] to get the decimal significant digit B, add arr_dig1[1] and arr_dig2[1] to get the decimal significant digit C, and then determine the first decimal significant digit according to the decimal significant digit A, the decimal significant digit B and the decimal significant digit C. The above example is only for explaining this solution. The number of arrays in the array set is not limited to 3. Since the decimal range is 0 to 10e-130, 15 arrays need to be set to store the decimal part.

[0083] Specifically, the method for adding the valid integer digits in the first unsigned integer array set and the second unsigned integer array set to obtain the first integer valid digits can be: adding the valid integer digits of each unsigned integer array in the first unsigned integer array set and the corresponding unsigned integer array in the second unsigned integer array set to obtain the first integer valid digits. For example, if the first unsigned integer array set includes: arr_int1[1], arr_int1[2], arr_int1[3], and the second unsigned integer array set includes: arr_int2[1], arr_int2[2], arr_int2[3], then add arr_int1[3] and arr_int2[3] to obtain integer significant digits D, add arr_int1[2] and arr_int2[2] to obtain integer significant digits E, add arr_int1[1] and arr_int2[1] to obtain integer significant digits F, and then determine the first integer significant digits based on integer significant digits D, integer significant digits E, and integer significant digits F. The above example is only for explaining the present solution. The number of arrays in the array set is not limited to 3. Since the integer range is 1 to 10e125, 14 arrays need to be set to store the integer part.

[0084] Specifically, the method for determining the sum of two data to be processed according to the first integer significant digits, the first decimal significant digits and the sign bit can be: the integer significant digits of the sum of the two data to be processed are the first integer significant digits, the decimal significant digits are the first decimal significant digits, and the sign bit is the sign bits of the two data to be processed.

[0085] In the embodiment of the present invention, during the process of adding decimal significant digits and integer significant digits, if the number of digits in the added array is greater than the first significant digit, a carry process is performed.

[0086] It should be noted that when adding numbers with the same sign, add the decimal part first, then the integer part; if the addition is of different signs, convert it to subtraction.

[0087] In a specific example, the integer parts of the two numbers are stored in uint arr_int1

[14] (14 arr_int1s, that is, arr_int1[1]-arr_int1

[14] ) and arr_int2

[14] (range 1 to 10e125) (14 arr_int2s, that is, arr_int2[1]-arr_int2

[14] ). The decimal parts are stored in uint arr_dig1

[15] (15 arr_dig1s, that is, arr_dig1[1]-arr_dig1

[15] ) and arr_dig2

[15] (range 0 to 10e-130) (15 arr_dig2s, that is, arr_dig2[1]-arr_dig2

[15] ). In the process of adding numbers with the same sign, the data stored in uint arr_dig1

[15] and uint arr_dig2

[15] are added first, and then the data stored in uint arr_int1

[14] and uint arr_int2

[14] are added. Finally, the sum of the two data to be processed is determined based on the addition result of the decimal part, the addition result of the integer part and the sign bit of the two data to be processed.

[0088] It should be noted that if the integer part exceeds 10e125, an overflow error is returned. If the decimal part is out of range, the data out of range is ignored.

[0089] Optionally, according to the sign bits of two data to be processed, the decimal significant digits stored in the third unsigned integer array set and the fourth unsigned integer array set are sequentially processed, and the integer significant digits stored in the first unsigned integer array set and the second unsigned integer array set are processed first to obtain a first processing result, including:

[0090] If the sign bits of the two data to be processed are the same, and the first processing is a subtraction processing, then the decimal significant digits in the third unsigned integer array set and the fourth unsigned integer array set are subtracted to obtain the second decimal significant digits;

[0091] Subtract the significant digits of the integers in the first unsigned integer array set from the significant digits of the integers in the second unsigned integer array set to obtain the significant digits of the second integer;

[0092] The difference between two to-be-processed data is determined according to the second integer significant digit, the second decimal significant digit and the sign bit.

[0093] It should be noted that the method of subtracting the decimal significant digits in the third unsigned integer array set and the fourth unsigned integer array set to obtain the second decimal significant digits is similar to the method of adding the decimal significant digits in the third unsigned integer array set and the fourth unsigned integer array set to obtain the first decimal significant digits, which will not be repeated here.

[0094] It should be noted that the method of subtracting the valid digits of the integers in the first unsigned integer array set and the second unsigned integer array set to obtain the valid digits of the second integer is similar to the method of adding the valid digits of the integers in the first unsigned integer array set and the second unsigned integer array set to obtain the valid digits of the first integer, which will not be repeated here.

[0095] The embodiment of the present invention converts high-precision, large-range numerical values, whose range is [0 to 10e-130], [0 to -10e-130], [1 to 10e125], [-1 to -10e125], into scientific notation, and then uses 20 bytes to store them, with an accuracy of 39 significant digits. The embodiment of the present invention is easy to expand (there are still 11 bits unused). For comparison and four arithmetic operations, the calculation efficiency is also improved. In particular, addition and subtraction can be calculated together with 9 significant digits, which improves the calculation efficiency and shortens the calculation time compared to the solution of performing one calculation for one significant digit in the prior art.

[0096] Optionally, after storing each sub-data group into each target unsigned integer array, the method further includes:

[0097] When receiving a second processing instruction for the first data to be processed and the second data to be processed, obtaining the exponent bit, the sign bit, and the effective digit bit of the first data to be processed and the second data to be processed, wherein the second processing instruction includes: multiplication processing or division processing;

[0098] Performing a second process on the exponent bits of the first data to be processed and the exponent bits of the second data to be processed to obtain a target exponent bit;

[0099] Performing a second process on the valid digits of the first data to be processed and the valid digits of the second data to be processed to obtain target valid digits;

[0100] A second processing result of the first data to be processed and the second data to be processed is determined according to the target exponent bit, the target significant digit bit, the sign bit of the first data to be processed and the sign bit of the second data to be processed.

[0101] Specifically, the second processing is performed on the exponent bits of the first data to be processed and the exponent bits of the second data to be processed to obtain the target exponent bits. If the second processing is a multiplication processing, the sum of the exponent bits of the first data to be processed and the exponent bits of the second data to be processed is determined as the target exponent bits; if the second processing is a division processing, the difference between the exponent bits of the first data to be processed and the exponent bits of the second data to be processed is determined as the target exponent bits.

[0102] It should be noted that when a second processing instruction is received for the first data to be processed and the second data to be processed, the valid digits of the first data to be processed are stored in the first byte array set (if the valid digits of the first data to be processed are 39 digits, the first byte array set includes 39 num1s), the valid digits of the second data to be processed are stored in the second byte array set (if the valid digits of the second data to be processed are 39 digits, the second byte array set includes 39 num2s), the valid digits of the first data to be processed are stored in the first integer variable, the exponent of the first data to be processed is stored in the second integer variable, the valid digits of the second data to be processed are stored in the third integer variable, and the exponent of the second data to be processed is stored in the fourth integer variable.

[0103] In a specific example, two numbers are stored in byte num1

[39] (39 num1, num1[1]-num1

[39] ) and num2

[39] (39 num2, num2[1]-num2

[39] ), and separate variables int dig1, dig2, exp1, exp2 are used to store the significant digits and exponent values ​​of the two numbers. First, the exponents of the two numbers are processed in the second process. If the exponent exceeds 125, an overflow error is reported. If the exponent is less than -130, null is returned. Then, the significant digits of the two numbers are processed in the second process. The carry of the highest digit is processed (whether exp should be increased by 1); if the actual length exceeds 39, the first 39 significant digits are taken (the 40th digit is rounded up).

[0104] In a specific example, Figure 3 As shown, the first data to be processed is 1230000, and the second data to be processed is 11.2. 1230000*11.2 is converted into 123*112, exp=7, first round: 1*112=112, second round: 2*112=0224, the result of the first round plus the second round=1344, third round: 3*112=00336, the result of the third round + the result of the first round + the result of the second round=13776, and the final result is 1.3776*10^7.

[0105] In another specific example, the exponent of the first data to be processed is exp1, and the exponent of the second data to be processed is exp2. The first data to be processed is divided by the second data to be processed, and the exponent of the final result is calculated first: exp=exp1-exp2. If it exceeds 125, an overflow error is reported, and if it is less than -130, null is returned. Traverse the dividend num1 from the highest bit to the lowest bit (39 num1s, num1[1]-num1

[39] ): initialize the result array quotient. Initialize the temporary array temp to store the current dividend num1. Traverse the dividend num1 from the highest bit to the lowest bit: add the current bit to the temporary array temp. Estimate the current bit of the quotient: use binary search to find the maximum value mid between 0 and 9, so that temp is not less than mid times the divisor b. Store the estimated value mid in the current bit of quotient. Update the temporary array temp: subtract mid times the divisor b from temp.

[0106] The technical solution of this embodiment is as follows: if the length of the data to be processed is greater than a length threshold, the format of the data to be processed is converted to obtain the converted data to be processed, wherein the converted data to be processed includes: significant digits, sign bits and exponent bits; according to the storage range of the target unsigned integer array, the significant digits, the sign bits and the exponent bits are grouped to obtain multiple sub-data groups, wherein the sub-data groups include: significant digits, or significant digits, sign bits and exponent bits; each sub-data group is stored in each target unsigned integer array accordingly, so that the storage space of the data to be processed whose length is greater than the length threshold can be reduced to a certain number of target unsigned integer array spaces, thereby reducing the space occupancy rate.

[0107] Embodiment 2

[0108] Figure 4 This is a schematic diagram of the structure of a data processing device provided by an embodiment of the present invention. This embodiment is applicable to data processing. The device can be implemented in software and / or hardware. The device can be integrated in any device that provides data processing functions, such as Figure 4 As shown, the data processing device specifically includes: a format conversion module 410, a grouping module 420 and a storage module 430.

[0109] The format conversion module is used to convert the format of the data to be processed to obtain converted data to be processed if the length of the data to be processed is greater than the length threshold, wherein the converted data to be processed includes: valid digits, sign bits, and exponent bits;

[0110] A grouping module, used for grouping the significant digits, the sign bits and the exponent bits according to the storage range of the target unsigned integer array to obtain a plurality of sub-data groups, wherein the sub-data groups include: significant digits, or significant digits, sign bits and exponent bits;

[0111] The storage module is used to store each sub-data group into each target unsigned integer array accordingly.

[0112] The above-mentioned product can execute the method provided by any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0113] Embodiment 3

[0114] Figure 5 A schematic diagram of the structure of an electronic device 10 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.

[0115] like Figure 5 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0116] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0117] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 performs the various methods and processes described above, such as a data processing method.

[0118] In some embodiments, the data processing method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the data processing method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the data processing method in any other appropriate manner (e.g., by means of firmware).

[0119] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0120] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0121] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0122] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).

[0123] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0124] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.

[0125] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.

[0126] An embodiment of the present invention further provides a computer program product, including a computer program, wherein when the computer program is executed by a processor, the data processing method according to any embodiment of the present invention is implemented.

[0127] In the process of implementation, the computer program product can be written in one or more programming languages ​​or a combination thereof to perform the computer program code of the present invention, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (for example, using an Internet service provider to connect through the Internet).

[0128] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A data processing method, characterized in that: include: If the length of the data to be processed is greater than the length threshold, the format of the data to be processed is converted to obtain converted data to be processed, wherein the converted data to be processed includes: a valid digit, a sign bit, and an exponent bit; According to the storage range of the target unsigned integer array, the significant digits, the sign bits and the exponent bits are grouped to obtain a plurality of sub-data groups, wherein the sub-data groups include: significant digits, or significant digits, sign bits and exponent bits; Store each sub-data group into each target unsigned integer array accordingly; According to the storage range of the target unsigned integer array, the significant digits, the sign bits, and the exponent bits are grouped to obtain a plurality of sub-data groups, including: According to the storage range of the target unsigned integer array, determine the first significant digit number corresponding to the target unsigned integer array; According to the first significant digit number corresponding to the target unsigned integer array, the significant digits, the sign bits and the exponent bits are grouped starting from the last significant digit to obtain a plurality of sub-data groups.

2. The method according to claim 1, characterized in that If the length of the data to be processed is greater than the length threshold, the data to be processed is format converted to obtain the converted data to be processed, including: If the length of the data to be processed is greater than the length threshold, the maximum number of valid digits corresponding to the target database is obtained; Based on scientific notation and the maximum number of significant digits, the data to be processed is converted to obtain converted data to be processed.

3. The method according to claim 1, characterized in that: According to the first significant digit corresponding to the target unsigned integer array, the significant digit, the sign bit and the exponent bit are grouped starting from the last significant digit to obtain a plurality of sub-data groups, including: According to the first significant digit corresponding to the target unsigned integer array, the significant digits are grouped starting from the last significant digit to obtain a plurality of sub-data groups; If there is a sub-data group whose number of digits is less than the number of the first significant digits, the sign bit and the exponent bit are added to the sub-data group.

4. The method according to claim 1, characterized in that: After storing each sub-data group into each target unsigned integer array, it also includes: When a comparison instruction for two data to be processed is received, the sub-data groups stored in the target unsigned integer arrays corresponding to the two data to be processed are read; The sign bit, exponent bit, and significant digit bit corresponding to each data to be processed are compared in sequence, and the comparison results corresponding to the two data to be processed are determined according to the comparison results of the sign bit, exponent bit, and significant digit bit corresponding to each data to be processed.

5. The method according to claim 1, characterized in that After storing each sub-data group into each target unsigned integer array, it also includes: When receiving a first processing instruction for two data to be processed, determining the sign bit, exponent bit and significant digit bit of the two data to be processed according to the sub-data groups stored in the target unsigned integer arrays corresponding to the two data to be processed; Determine integer significant digits and decimal significant digits according to the exponent digits and the significant digits; The valid digits of the integers of the two data to be processed are stored in the first unsigned integer array set and the second unsigned integer array set respectively; The decimal significant digits of the two data to be processed are stored in the third unsigned integer array set and the fourth unsigned integer array set respectively; According to the sign bits of two data to be processed, the decimal significant digits stored in the third unsigned integer array set and the fourth unsigned integer array set are processed in turn, and the integer significant digits stored in the first unsigned integer array set and the second unsigned integer array set are processed first to obtain a first processing result, wherein the first processing includes: addition processing or subtraction processing.

6. The method according to claim 5, characterized in that According to the sign bits of the two data to be processed, the decimal significant digits stored in the third unsigned integer array set and the fourth unsigned integer array set are sequentially processed, and the integer significant digits stored in the first unsigned integer array set and the second unsigned integer array set are processed first to obtain a first processing result, including: If the sign bits of the two data to be processed are the same, and the first processing is an addition processing, then the decimal significant digits in the third unsigned integer array set and the fourth unsigned integer array set are added together to obtain a first decimal significant digit; Add the integer significant digits in the first unsigned integer array set and the second unsigned integer array set to obtain the first integer significant digits; The sum of two to-be-processed data is determined according to the first integer significant digits, the first decimal significant digits, and the sign bit.

7. The method according to claim 5, characterized in that According to the sign bits of the two data to be processed, the decimal significant digits stored in the third unsigned integer array set and the fourth unsigned integer array set are sequentially processed, and the integer significant digits stored in the first unsigned integer array set and the second unsigned integer array set are processed first to obtain a first processing result, including: If the sign bits of the two data to be processed are the same, and the first processing is a subtraction processing, then the decimal significant digits in the third unsigned integer array set and the fourth unsigned integer array set are subtracted to obtain the second decimal significant digits; Subtract the significant digits of the integers in the first unsigned integer array set from the significant digits of the integers in the second unsigned integer array set to obtain the significant digits of the second integer; The difference between two to-be-processed data is determined according to the second integer significant digit, the second decimal significant digit and the sign bit.

8. The method according to claim 1, characterized in that After storing each sub-data group into each target unsigned integer array, it also includes: When receiving a second processing instruction for the first data to be processed and the second data to be processed, obtaining the exponent bit, the sign bit, and the effective digit bit of the first data to be processed and the second data to be processed, wherein the second processing instruction includes: multiplication processing or division processing; Performing a second process on the exponent bits of the first data to be processed and the exponent bits of the second data to be processed to obtain a target exponent bit; Performing a second process on the valid digits of the first data to be processed and the valid digits of the second data to be processed to obtain target valid digits; A second processing result of the first data to be processed and the second data to be processed is determined according to the target exponent bit, the target significant digit bit, the sign bit of the first data to be processed and the sign bit of the second data to be processed.

9. A data processing device, characterized in that: include: A format conversion module, configured to perform format conversion on the data to be processed if the length of the data to be processed is greater than a length threshold, to obtain converted data to be processed, wherein the converted data to be processed includes: a valid digit, a sign bit, and an exponent bit; A grouping module, used for grouping the significant digits, the sign bits and the exponent bits according to the storage range of the target unsigned integer array to obtain a plurality of sub-data groups, wherein the sub-data groups include: significant digits, or significant digits, sign bits and exponent bits; A storage module, used for storing each sub-data group into each target unsigned integer array; The grouping module is specifically used for: According to the storage range of the target unsigned integer array, determine the first significant digit number corresponding to the target unsigned integer array; According to the first significant digit number corresponding to the target unsigned integer array, the significant digits, the sign bits and the exponent bits are grouped starting from the last significant digit to obtain a plurality of sub-data groups.

10. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can perform the data processing method according to any one of claims 1 to 8.

11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the data processing method according to any one of claims 1 to 8 when executed.

12. A computer program product, characterized in that The computer program product comprises a computer program, which, when executed by a processor, implements the data processing method according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Data storage and reading method based on high-precision calculation of computer

    CN112905125A