Single-precision floating point (±3.4E±38, ~7 decimal digits)
Read about return values of quantized32 function .
1st Parameter Type : float
Single-precision floating point (±3.4E±38, ~7 decimal digits)
1st Parameter
The input 32-bit floating-point value to be quantized.
2nd Parameter Type : int
Integer type (typically 4 bytes, -2,147,483,648 to 2,147,483,647)
2nd Parameter
The number of discrete levels to which the input value will be quantized.
Read more about parameters of quantized32 in parameters section
The quantized32function in C language Quantizes a decimal floating-point number (_Decimal32) to the same exponent as another. Note: This is part of the optional decimal floating-point arithmetic support.
The quantized32 function sets the quantum exponent of x to the quantum exponent of y, while trying to keep the value the same. This is useful for adjusting the precision of decimal numbers, particularly in financial calculations where a specific number of decimal places is required.
The quantized32function takes 2
parameters:
•
float `value`: The input 32-bit floating-point value to be quantized.
•
int `levels`: The number of discrete levels to which the input value will be quantized.
Quantizes the input 32-bit floating-point value `value` into one of `levels` discrete levels. Useful for applications like signal processing, machine learning, or compression, where reduced precision is needed. Returns the quantized value as a `float`.
The quantized32 function return value :
Returns the quantized value of x with the quantum exponent of y
Output
This example demonstrates how quantized32 adjusts the quantum exponent of x to match that of y, effectively rounding x to two decimal places.