Giter Site home page Giter Site logo

hsh778205 / ordinary-high-precision-templates Goto Github PK

View Code? Open in Web Editor NEW
0.0 0.0 0.0 1.62 MB

普通数字(非浮点数)的高精度运算模板,追求功能完善、效率和兼容|High-precision computing template for ordinary numbers (non-floating points) for functional perfection, efficiency and compatibility

C++ 100.00%

ordinary-high-precision-templates's Introduction

Ordinary-high-precision-templates

High-precision computing for ordinary numbers (non-floating points) for functional perfection, efficiency and compatibility

I thought it was a good code for myself, although I didn't encapsulate it as a class or put it in the header file.

I think it's just a structure, just fine.

Here's what to say.

First, the array version is obsolete because it does not support dynamic storage, there will be a lot of space left, a lot of unnecessary computation loss (although that's not a thing for the computer...). )

So I used the vector version.

The structure is named number, which means that it is actually a large number

Features currently supported

The ordinary four operations (although there are negative numbers, but not yet perfect!) ), directly with symbols instead of functions!

Order (.factor))

Power (.power()))

greatest common divisor (gcd() or .gcd())

Through Friends, you can even use cout and cin directly to input and output!

Example

Statement

number a,b;

number a(10),b(20);//Directly assign a to 10

input

cin>>a>>b;

a.input();b.input();//Of course, if you like, you can use this...

output

cout<<a<<b;

a.output();b.output();//Maybe no one likes it...

Assignment

a=10,b=20;

Add and subtract, multiply and subtract

number c=a+b;

c=a-b;

c=a*b;

c=a/b;

greatest common divisor

c=a.gcd(b);

c=gcd(a,b);

Factorial

c=a.factor();

Power

c=a.power(b);

c=power(a,b);

ordinary-high-precision-templates's People

Contributors

hsh778205 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.