Floating-point number overflow protection middleware, electronic equipment and readable storage medium
Through the coordinated work of platform adaptation, power calculation, recursive decomposition and lightweight storage modules, compatibility and efficiency problems in cross-platform floating-point number overflow protection are solved, ensuring data reliability and consistency in complex computing environments.
Patent Information
- Application Number
- CN202510661015.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-22
- Publication Date
- 2025-08-15
AI Technical Summary
The existing floating-point overflow protection scheme has problems in cross-platform compatibility and implementation complexity, especially the accuracy deviation and data recovery errors caused by hardware differences between ARMv8 and x64 platforms.
The platform adaptation module is used to identify hardware platform type and endianness conversion. The power calculation module generates integer power values of 10, the recursive decomposition module performs multi-level decomposition, and the lightweight storage module integrates the decomposition results, and processes non-standard values through the boundary compatible module to achieve cross-platform consistency and lossless protection.
The binary level consistency of floating-point number decomposition results between x64/ARMv8 architectures is achieved, which reduces computational overhead and resource consumption, and improves data reliability and computing efficiency.
Smart Images

Figure CN120491927A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a floating point overflow protection middleware, an electronic device and a readable storage medium. Background Art
[0002] Existing floating-point overflow protection solutions generally face the dual dilemma of poor cross-platform compatibility and high implementation complexity. Traditional methods rely on hardware expansion (such as 128-bit floating-point operations) or dynamic range compression algorithms. The former requires the transformation of data storage structures, resulting in data incompatibility between x64 / ARMv8 platforms, while the latter significantly increases computational time due to the introduction of complex segmentation optimization strategies (such as dynamic programming to find the optimal demarcation point). More seriously, most solutions do not strictly isolate hardware differences - for example, the different processing strategies for floating-point register precision between ARMv8 and x64 may cause irreversible deviations when the same value is decomposed on different platforms, ultimately leading to data recovery errors and triggering systemic risks. Summary of the Invention
[0003] In view of the above problems, the present invention is proposed to provide a floating point overflow protection middleware, an electronic device and a readable storage medium that overcome the above problems or at least partially solve the above problems.
[0004] The present invention provides a floating point overflow protection middleware, comprising:
[0005] The platform adaptation module is used to determine the current hardware platform type after the middleware receives the floating-point number to be processed sent by the cross-platform unified API interface module on the user platform side, and use the memory-based byte order conversion function library to unify the byte order format and lock the floating-point number calculation mode;
[0006] The power calculation module is used to quickly generate integer powers of 10 and supports the recursive decomposition module to perform floating-point number decomposition and recovery calculations;
[0007] A recursive decomposition module is used to detect whether the floating-point number to be processed overflows, and if overflow occurs, decomposes the floating-point number to be processed into non-overflow values and corresponding power values within a safe range through multi-level decomposition;
[0008] A lightweight storage module that integrates the decomposed non-overflow values and power values into a portable data structure and supports restoring the original values through reverse calculation.
[0009] Optionally, the platform adaptation module is further configured to:
[0010] The current hardware platform type is dynamically determined through precompiled macros, and the corresponding byte order conversion function is called according to the hardware platform type to convert the floating point number to be processed into a little-endian byte order format floating point number, and the floating point calculation mode is locked to the nearest rounding mode.
[0011] Optionally, the power calculation module is further configured to pre-generate a lookup table of integer powers of 10, and split the calculation of an out-of-limit power into products of multiple maximum normalized value orders of magnitude to avoid quadratic overflow.
[0012] Optionally, the recursive decomposition module is further configured to:
[0013] The overflow threshold is set to the order of magnitude of the maximum canonical value of a double-precision floating-point number, and the current power value is recorded during each decomposition, and the remaining quotient is further decomposed until the remaining quotient is a non-overflow value within a safe range; the power value generated by the decomposition process is provided by the power calculation module through a table lookup.
[0014] Optionally, the lightweight storage module is further used to store the decomposition results, including the decomposition times, non-overflow values and power values, in a binary data structure, and preset a checksum during storage.
[0015] Optionally, the floating point overflow protection middleware further includes a boundary compatibility module, which is configured to:
[0016] Before decomposition, the floating-point number to be processed is normalized to the standard floating-point representation by mantissa-exponent decomposition;
[0017] During recovery, the denormalized number flag of the floating-point status register is detected in real time. When it is detected that the denormalized number flag is set, the recovery process is interrupted, the decomposition result of the previous level is rolled back, and the floating-point number to be processed is decomposed again. If it fails, the error is recorded to the log module on the user platform side, prompting the user that the numerical precision has reached the limit.
[0018] Optionally, the lightweight storage module is further used to:
[0019] Precalculate the required memory size based on the number of decompositions, and apply for continuous storage space through memory alignment.
[0020] Optionally, the hardware platform type includes x64 and ARMv8;
[0021] The platform adaptation module is also used to support users to expand new macros to define and determine new hardware platform types.
[0022] The present invention also provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor. When the electronic device executes the computer program, it loads the floating-point overflow protection middleware as described in any one of the embodiments of the present invention.
[0023] The present invention further provides a readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the floating point overflow protection middleware as described in any one of the embodiments of the present invention is loaded.
[0024] The present invention includes the following advantages:
[0025] The floating-point overflow protection middleware of the present invention realizes error-controllable numerical decomposition based on a pre-generated power-of-10 lookup table through a platform-independent decimal power stripping mechanism, thereby eliminating precision deviations caused by hardware differences; designs a cross-platform unified data storage protocol, enforces little-endian byte order conversion and floating-point normalization processing, and ensures binary-level consistency of decomposition results between x64 / ARMv8 architectures; adopts a one-way recursive stripping strategy, and realizes overflow protection with linear time complexity by dividing by the maximum safe power (10^308) step by step, thereby avoiding the computational overhead caused by dynamic programming demarcation point optimization; and simultaneously enforces normalized floating-point number representation through a boundary-compatible module, thereby eliminating the influence of non-normalized values on cross-platform recovery in the preprocessing stage, thereby realizing overflow protection that does not require hardware expansion, is lossless, and is decoupled from the instruction set, and significantly improves the data reliability of key systems in complex computing environments. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] Figure 1 This is a structural block diagram of a floating point overflow protection middleware provided by an embodiment of the present invention;
[0027] Figure 2 This is a processing flow chart of floating point overflow protection provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0028] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0029] Reference Figure 1 , shows a structural block diagram of a floating point overflow protection middleware provided in an embodiment of the present invention, which may specifically include the following modules:
[0030] The platform adaptation module is used to determine the current hardware platform type after the middleware receives the floating-point number to be processed sent by the cross-platform unified API interface module on the user platform side, and use the memory-based byte order conversion function library to unify the byte order format and lock the floating-point number calculation mode;
[0031] The power calculation module is used to quickly generate integer powers of 10 and supports the recursive decomposition module to perform floating-point number decomposition and recovery calculations;
[0032] A recursive decomposition module is used to detect whether the floating-point number to be processed overflows, and if overflow occurs, decomposes the floating-point number to be processed into non-overflow values and corresponding power values within a safe range through multi-level decomposition;
[0033] A lightweight storage module that integrates the decomposed non-overflow values and power values into a portable data structure and supports restoring the original values through reverse calculation.
[0034] In this embodiment, the platform adaptation module is responsible for shielding the differences between different hardware architectures, ensuring that the numerical processing logic behaves consistently across different hardware architectures (such as x64 and ARMv8). The recursive decomposition module has built-in overflow threshold judgment and step-by-step loop control to implement multi-level decomposition logic for floating-point numbers. The power calculation module can quickly generate integer powers of 10 to avoid real-time calculation errors. The lightweight storage module integrates the decomposed safe values and the powers of 10 at each stage into a portable data structure. The middleware of this embodiment implements floating-point overflow protection through the collaboration of these modules.
[0035] Specifically, after receiving floating-point numbers from the user platform, the platform adaptation module first identifies the hardware architecture type of the current operating environment (e.g., x64, ARMv8, etc.) and standardizes the byte order based on a unified memory operation function library to ensure cross-platform data consistency. Furthermore, this module avoids calculation errors caused by platform differences by locking the floating-point calculation mode. The power calculation module uses a fast table lookup mechanism to dynamically generate integer powers of 10 (e.g., 10^0, 10^1, ..., 10^n) to support exponentiation operations during decomposition and recovery, thereby avoiding the precision loss and performance overhead associated with real-time calculations. The recursive decomposition module detects whether the floating-point number being processed exceeds a safe range by setting an overflow threshold (e.g., the maximum representable floating-point value). If overflow is detected, the power of 10 provided by the power calculation module is used to decompose the floating-point number into non-overflowing values and corresponding powers within the safe range through a multi-level decomposition process. The lightweight storage module integrates the security value output by the recursive decomposition module and the power-of-10 information corresponding to each stage into a portable binary structure, which is convenient for cross-system transmission and storage.
[0036] In an optional embodiment of the present invention, the platform adaptation module is further configured to:
[0037] The current hardware platform type is dynamically determined through precompiled macros, and the corresponding byte order conversion function is called according to the hardware platform type to convert the floating point number to be processed into a little-endian byte order format floating point number, and the floating point calculation mode is locked to the nearest rounding mode.
[0038] In this embodiment, scalability can be achieved by using precompiled macros to determine the platform type and calling the corresponding memory read and write interfaces. By forcing the standard to be little-endian and locking the floating-point calculation mode, the numerical calculations in the decomposition process can produce the same results under different CPU instruction sets.
[0039] Specifically, the precompiled macros define platform flag macros (#if defined(__x86_64__) and #if defined(__aarch64__)). According to the macro matching platform type and memory read and write interface, the relevant codes of different architectures are packaged respectively, and users are supported to expand new macro definitions to judge other platform types.
[0040] After determining the hardware platform type, use appropriate processing methods to unify the byte order format and lock the floating-point calculation mode according to the different hardware platform types. Take the x64 architecture and ARMv8 architecture as examples:
[0041] Before decomposition, the input floating-point numbers are first forcibly converted to little-endian byte order. That is, a memory-based byte order conversion function library is used to implement byte order unification, and dynamic adaptation is performed for different platforms: ① For the x64 architecture, the _byteswap_uint64 (Windows) and bswap_64 (Linux) instructions are called to implement byte order conversion of 8-byte floating-point numbers.
[0042] ② For the ARMv8 architecture, call the __builtin_bswap64 function to achieve the same functionality. The data is stored in little-endian format and then converted back to host byte order when restored.
[0043] By calling the fesetround(FE_TONEAREST) function, all floating-point operations are forced to be in the "round to nearest" mode, locking the floating-point calculation mode and disabling the output of non-standard values, and dynamically adapting to different platforms:
[0044] ① For the x64 architecture, use the _controlfp(_DN_FLUSH,_MCW_DN) instruction to refresh the non-standard value to zero;
[0045] ②For the ARMv8 architecture, set the DN (denormalized number processing) flag to "Flush-to-Zero" through the FPCR register.
[0046] In an optional embodiment of the present invention, the power calculation module is further used to pre-generate a lookup table of integer powers of 10, and split the calculation of excessive powers into products of multiple maximum normalized values to avoid quadratic overflow.
[0047] In this embodiment, a table of values representing 10^0 to 10^308 (309 values in total) is pre-generated and directly accessed, avoiding errors that may be introduced by calling math libraries on different platforms. For powers exceeding 308, the power is broken down into multiple 10^308 multiplications (e.g., 10^500 = 10^308 * 10^192), ensuring that the calculation process does not trigger a secondary overflow.
[0048] In an optional embodiment of the present invention, the recursive decomposition module is further configured to:
[0049] The overflow threshold is set to the order of magnitude of the maximum canonical value of a double-precision floating-point number, and the current power value is recorded during each decomposition, and the remaining quotient is further decomposed until the remaining quotient is a non-overflow value within a safe range; the power value generated by the decomposition process is provided by the power calculation module through a table lookup.
[0050] In this example, the threshold is set to the order of magnitude of the maximum canonical value of IEEE 754 double-precision floating-point numbers (10^308). Each time, the overflow value is multiplied or divided by the order of magnitude of the maximum canonical value until the result falls within a safe range. The resulting power is recorded and the quotient is used as the new input for repeated testing until overflow is no longer detected. For example, the input 1e400 is decomposed into 1e400 = (1e92) * 10^308. If 1e92 still overflows, the decomposition continues.
[0051] In an optional embodiment of the present invention, the lightweight storage module is further used to store the decomposition results using a binary data structure, including the decomposition times, non-overflow values and power values, and preset a checksum during storage.
[0052] In an optional embodiment of the present invention, the lightweight storage module is further used to:
[0053] Precalculate the required memory size based on the number of decompositions, and apply for continuous storage space through memory alignment.
[0054] In this embodiment, a binary format is used: the decomposition times are stored first, followed by the final non-overflow value (8-byte double precision), and then all power values are stored in order (4-byte integer array). When restoring, it is only necessary to multiply from back to front step by step.
[0055] The binary format is implemented as follows:
[0056] The header (1 byte) is the number of decompositions (8 bits), supporting up to 255 decompositions;
[0057] Safe value (8 bytes): double-precision floating-point representation of the final non-overflow value (IEEE 754 standard);
[0058] Power array (4 × n bytes): Each power value is a signed 32-bit integer stored in decomposition order ([Kn, Kn-1, ..., K1]).
[0059] The data is stored in pre-allocated continuous memory blocks and its integrity is verified by a pre-set checksum (CRC32) to avoid recovery failures due to transmission errors.
[0060] Example: The decomposition results Yn=1e92 and K=
[308] are stored as [1][1e92]
[308] [CRC32].
[0061] Precalculate the required memory size (1+8+4*n+4) based on the header information, and directly apply for aligned memory through mmap or malloc_aligned to improve storage and loading efficiency.
[0062] In an optional embodiment of the present invention, the floating point overflow protection middleware further includes a boundary compatibility module, and the boundary compatibility module is configured to:
[0063] Before decomposition, the floating-point number to be processed is normalized to the standard floating-point representation by mantissa-exponent decomposition;
[0064] During recovery, the denormalized number flag of the floating-point status register is detected in real time. When it is detected that the denormalized number flag is set, the recovery process is interrupted, the decomposition result of the previous level is rolled back, and the floating-point number to be processed is decomposed again. If it fails, the error is recorded to the log module on the user platform side, prompting the user that the numerical precision has reached the limit.
[0065] The floating-point overflow protection middleware of the present invention may also include a boundary compatibility module to handle platform compatibility issues in extreme scenarios. ARMv8's handling strategy for non-standard floating-point numbers may differ from that of x64. This module will force input values to be normalized to standard floating-point representation before decomposition and explicitly prohibit the generation of non-standard values during recovery, thereby eliminating the impact of hardware details on core logic. Specifically:
[0066] Before decomposition, the std::frexp function is called to extract the mantissa and exponent of the floating-point number. The multiple is forced to be extracted, the mantissa is normalized to the range [1.0, 2.0), and the multiple is added to the exponent. For non-normalized values, the exponent is directly set to the minimum normalized value (-1022), and the mantissa is scaled proportionally to ensure that all inputs conform to the IEEE 754 standard.
[0067] During recovery, if the intermediate calculation result triggers the generation of non-standard values, the non-standard flag in the floating-point status register (MXCSR for x64 and FPSR for ARMv8) is checked. If the flag is set, the recovery process is immediately interrupted, the result of the previous level of decomposition is rolled back, and the value is decomposed again. If it fails, the error is recorded in the log module to prompt the user that the numerical precision has reached the limit.
[0068] The main functions of the user platform side that communicates with the middleware are as follows:
[0069] 1. Cross-platform unified API interface module: This module provides a unified floating-point decomposition and recovery interface, transmits signals with the middleware, and runs directly on x64 / ARMv8, without the user having to worry about the underlying architecture of the library.
[0070] 2. Log recording module: records warnings, error time periods and other logs of each module to facilitate OA R&D personnel to troubleshoot problems.
[0071] Reference Figure 2 The floating point overflow protection process of the present invention is as follows:
[0072] ① Input the floating-point number X (64-bit double precision) to be processed and create multiplier queues K = [] and Y = []; ② Determine whether X exceeds the order of magnitude of the IEEE 754 double-precision maximum specification value (10^308); ③ If not, store the value of X and queue Y and K; ④ If so, solve for the largest integer Kn such that Yn = X / 10^Kn and satisfies |Yn| < 10^308. After the operation, store the multiplier Kn in queue K, store the value Yn in queue Y, update the remainder X = Yn, and return to step ② until step ③ is reached.
[0073] The present invention has the following technical effects:
[0074] 1. High cross-platform compatibility: By enforcing a unified little-endian byte order, normalizing floating-point processing, and pre-generating power tables, this eliminates decomposition deviations caused by differences in floating-point register precision between the ARMv8 and x64 architectures. This ensures that the decomposition and recovery results of the same value on different platforms are consistent at the binary level, avoiding the risk of data recovery errors caused by lax hardware isolation in traditional solutions.
[0075] 2. Computational efficiency: Using a one-way recursive peeling strategy (linear time complexity O(n)) instead of dynamic programming cutoff point optimization (O(n²)) significantly reduces decomposition time, especially for processing very large values (such as 10^1000). Pre-calculating the power table to directly look up the value instead of calculating the 10^N power in real time will reduce the operation instruction overhead by 80%.
[0076] 3. Reduced resource consumption: The lightweight storage module uses a fixed 8-byte + 4×n-byte compact data structure (n is the number of decompositions). Compared with the dynamic memory allocation and multi-segment metadata storage required by traditional dynamic range compression algorithms, it reduces memory usage. The platform adaptation module uses pre-compiled macros to achieve hardware difference shielding, eliminating the need to rely on hardware expansion and saving hardware costs.
[0077] 4. Enhanced precision and reliability: The boundary compatibility module enforces standardized floating-point representation, eliminating the interference of non-standard values on cross-platform recovery. The recovery accuracy error control is further reduced by 5 orders of magnitude compared with traditional solutions. The power calculation module avoids secondary overflow by splitting out-of-limit powers, such as 10^500=10^308×10^192, achieving lossless decomposition and recovery, and ensuring the integrity of critical data.
[0078] Based on the same inventive concept, another embodiment of the present invention provides an electronic device, including a memory, a processor, and a computer program stored on the memory, wherein the processor executes the computer program to load the floating-point overflow protection middleware as described in any one of the embodiments of the present invention.
[0079] Specifically, the electronic device includes: a memory and a processor, the memory and the processor are connected via a bus communication, a computer program is stored in the memory, and the computer program can be run on the processor, thereby loading the floating point overflow protection middleware described in any one of the first aspects of the embodiments of the present invention.
[0080] The memory may include random access memory (RAM) or non-volatile memory, such as at least one disk storage. Alternatively, the memory may be at least one storage device located away from the processor.
[0081] The above-mentioned processors can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0082] Based on the same inventive concept, another embodiment of the present invention provides a computer-readable storage medium having a computer program / instruction stored thereon. When the computer program / instruction is executed by a processor, the floating-point overflow protection middleware as described in any one of the first aspects of the embodiments of the present invention is loaded.
[0083] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0084] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, devices, electronic devices, storage media, or computer program products. Therefore, embodiments of the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Furthermore, embodiments of the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CDROM, optical storage, etc.) containing computer-usable program code.
[0085] While embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions, and variations may be made to the embodiments without departing from the principles and spirit of the invention, and that the scope of the invention is defined by the claims and their equivalents.
[0086] Finally, it should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that includes a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or terminal device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or terminal device that includes the element.
[0087] The above is a detailed introduction to a floating-point overflow protection middleware, electronic device and readable storage medium provided by the present invention. Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method and core idea of the present application. At the same time, for those skilled in the art, according to the idea of the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application. The above embodiments are only preferred embodiments for fully illustrating the present invention, and the scope of protection of the present invention is not limited thereto. Equivalent substitutions or transformations made by those skilled in the art on the basis of the present invention are all within the scope of protection of the present invention.
Claims
1. A floating point overflow protection middleware, characterized in that: include: The platform adaptation module is used to determine the current hardware platform type after the middleware receives the floating-point number to be processed sent by the cross-platform unified API interface module on the user platform side, and use the memory-based byte order conversion function library to unify the byte order format and lock the floating-point number calculation mode; The power calculation module is used to quickly generate integer powers of 10 and supports the recursive decomposition module to perform floating-point number decomposition and recovery calculations; A recursive decomposition module is used to detect whether the floating-point number to be processed overflows, and if overflow occurs, decomposes the floating-point number to be processed into non-overflow values and corresponding power values within a safe range through multi-level decomposition; A lightweight storage module that integrates the decomposed non-overflow values and power values into a portable data structure and supports restoring the original values through reverse calculation.
2. The floating point overflow protection middleware according to claim 1, wherein: The platform adaptation module is further used for: The current hardware platform type is dynamically determined through precompiled macros, and the corresponding byte order conversion function is called according to the hardware platform type to convert the floating point number to be processed into a little-endian byte order format floating point number, and the floating point calculation mode is locked to the nearest rounding mode.
3. The floating point overflow protection middleware according to claim 1, wherein: The power calculation module is further configured to pre-generate a lookup table of integer powers of 10, and to split the calculation of excess powers into products of multiple maximum normalized value orders of magnitude to avoid secondary overflow.
4. The floating point overflow protection middleware according to claim 1, wherein: The recursive decomposition module is further used to: Set the overflow threshold to the maximum normalized value of the double-precision floating-point number, record the current power value each time the decomposition is performed, and continue to decompose the remaining quotient until the remaining quotient is a non-overflow value within a safe range; The power value generated by the decomposition process is provided by the power calculation module through table lookup.
5. The floating point overflow protection middleware according to claim 1, wherein: The lightweight storage module is also used to store the decomposition results using a binary data structure, including the decomposition times, non-overflow values and power values, and preset a checksum when storing.
6. The floating point overflow protection middleware according to claim 1, wherein: The floating point overflow protection middleware further includes a boundary compatibility module, which is used to: Before decomposition, the floating-point number to be processed is normalized to the standard floating-point representation by mantissa-exponent decomposition; During recovery, the denormalized number flag of the floating-point status register is detected in real time. When it is detected that the denormalized number flag is set, the recovery process is interrupted, the decomposition result of the previous level is rolled back, and the floating-point number to be processed is decomposed again. If it fails, the error is recorded to the log module on the user platform side, prompting the user that the numerical precision has reached the limit.
7. The floating point overflow protection middleware according to claim 1, wherein: The lightweight storage module is further used for: Precalculate the required memory size based on the number of decompositions, and apply for continuous storage space through memory alignment.
8. The floating point overflow protection middleware according to claim 1, wherein: Hardware platform types include x64 and ARMv8; The platform adaptation module is also used to support users to expand new macros to define and determine new hardware platform types.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the electronic device executes the computer program, it loads the floating point overflow protection middleware according to any one of claims 1 to 8.
10. A readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the floating point overflow protection middleware according to any one of claims 1 to 8 is loaded.