VOOZH about

URL: https://www.geeksforgeeks.org/c-sharp/decimal-getbits-method-in-c-sharp/

⇱ Decimal.GetBits() Method in C# - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Decimal.GetBits() Method in C#

Last Updated : 11 Jul, 2025
Decimal.GetBits() Method is used to convert the value of a specified instance of Decimal to its equivalent binary representation.
Syntax: public static int[] GetBits (decimal d); Here, it takes the floating point value to convert. Return Value: This method returns a 32-bit signed integer array with four elements that contain the binary representation of d.
Below programs illustrate the use of Decimal.GetBits() Method Example 1: Output:
Bit[0] = FFFFFFFF
Bit[1] = FFFFFFFF
Bit[2] = 00000000
Bit[3] = 00000000
Example 2:
Output:
Converted value of 79228162514264337593543950335 is
Bit[0] = FFFFFFFF
Bit[1] = FFFFFFFF
Bit[2] = FFFFFFFF
Bit[3] = 00000000

Converted value of -79228162514264337593543950335 is
Bit[0] = FFFFFFFF
Bit[1] = FFFFFFFF
Bit[2] = FFFFFFFF
Bit[3] = 80000000
Reference:
Comment
Article Tags:

Explore