BigInteger class in C#

王林
Release: 2023-08-25 18:25:02
forward
1601 people have browsed it

C# 中的 BigInteger 类

Use BigInteger in C# to handle large numbers. The assembly to add for BigInteger is System. numerical value.

In C#, big integers are located in System.Numerics.BigInteger.

Syntax

Syntax of BigInteger-

[SerializableAttribute]
public struct BigInteger : IFormattable, IComparable, IComparable<BigInteger>, IEquatable<BigInteger>
Copy after login

Let’s see a sample code snippet-

BigInteger num = BigInteger.Multiply(Int64.MaxValue, Int64.MaxValue);
Copy after login

You can create a BigInteger like this-

BigInteger num = new BigInteger(double.MaxValue);
Copy after login

The following are some of its constructors-

2 3           4
S.No.

Constructor and description

1

##BigInteger(Byte[ ])A new instance of the BigInteger structure using the values ​​in the byte array.

p>

td>

BigInteger(Decimal)Use Decimal value A new instance of the BigInteger structure.

BigInteger(Double)Use double precision A new instance of a BigInteger structure with a floating-point

value.

BigInteger(Int32)Use 32 bits A new instance of a BigInteger structure for signed integer values.

The above is the detailed content of BigInteger class in C#. For more information, please follow other related articles on the PHP Chinese website!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!