Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jftuga/7848f181ba72ecf9647056ba3ab58fe0 to your computer and use it in GitHub Desktop.
Save jftuga/7848f181ba72ecf9647056ba3ab58fe0 to your computer and use it in GitHub Desktop.
Programming languages that natively support 128 bit integers

what programming languages natively support 128 bit integers

2022-12-16

ChatGPT answer:

There are several programming languages that natively support 128-bit integers. Here is a list of some of them:

  • C and C++: C and C++ support 128-bit integers through the __int128 data type, which is defined in the <stdint.h> header file.
  • Java: Java supports 128-bit integers through the java.math.BigInteger class, which can represent integers of any size.
  • Python: Python supports 128-bit integers through the int data type, which can represent integers of any size.
  • Go: Go supports 128-bit integers through the int128 data type, which is defined in the math/big package.
  • Rust: Rust supports 128-bit integers through the i128 and u128 data types.
  • Swift: Swift supports 128-bit integers through the Int128 and UInt128 data types, which are available in the Swift Standard Library.
  • C#: C# supports 128-bit integers through the System.Numerics.BigInteger struct, which can represent integers of any size.
  • Haskell: Haskell supports 128-bit integers through the Integer data type, which can represent integers of any size.
  • OCaml: OCaml supports 128-bit integers through the Int128 and Uint128 data types, which are available in the Int128 module.
  • F#: F# supports 128-bit integers through the System.Numerics.BigInteger type, which can represent integers of any size.

Note that some of these languages also support other types of fixed-width integers, such as 64-bit or 32-bit integers.


Second ChatGPT answer:

As far as I know, there are several programming languages that natively support 128-bit integers:

  • C and C++: Both languages have a native 128-bit integer type called __int128. This type is supported by the GCC compiler and some other compilers as well.
  • Java: In Java, you can use the BigInteger class to represent arbitrarily large integers. This class has a method called shiftLeft that allows you to perform left shift operations on 128-bit integers.
  • Python: Python supports arbitrarily large integers and does not have a fixed limit on the number of bits that an integer can have. You can use the int type to represent 128-bit integers.
  • Go: Go has a native 128-bit integer type called int128. This type is supported by the Go compiler and is available in versions 1.13 and above.
  • Rust: Rust has a native 128-bit integer type called i128. This type is supported by the Rust compiler and is available in versions 1.26 and above.
  • C#: C# has a native 128-bit integer type called System.Numerics.BigInteger. This type is available in the System.Numerics namespace and can be used to represent arbitrarily large integers.
  • Swift: Swift has a native 128-bit integer type called Int128. This type is supported by the Swift compiler and is available in versions 5.3 and above.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment