Answers for "bigint"

C++
6

javascript bigint

const theBiggestInt = 9007199254740991n
const alsoHuge = BigInt(9007199254740991) // 9007199254740991n
const hugeString = BigInt("9007199254740991") // 9007199254740991n
const hugeHex = BigInt("0x1fffffffffffff") // 9007199254740991n
const hugeBin = BigInt("0b11111111111111111111111111111111111111111111111111111") // 9007199254740991n
Posted by: Guest on June-02-2020
2

bigint

#include <stdexcept>
#include"Bigint.hpp"
#include<algorithm>
// CONSTRUCTOR OVERLOAD 
Bigint::Bigint(std::list<unsigned char>B) 
   :m_digits(B){}
Bigint::~Bigint(){}
//##################################### is_zero #########>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Amir Ammar
bool Bigint::is_zero()const
{
     if(m_digits.front()=='0'){
       return true;
     }
     return false;
}
//##################################### is_negative #########################################################
bool Bigint::is_negative() const{
   if(m_is_negative == true){
     return  true ;
   }else 
     return false;
}
//<<<<<<<<<<<<<<<<<<<<<<<<<<<insertion operator overloading<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Amir Ammar
std::ostream& operator<<(std::ostream& out, const Bigint& i){
  for(auto b = i.m_digits.begin(); b != i.m_digits.end(); ++b){
    out<<(*b);
  }
  return (out);
}
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>extraction operator overloading>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Efi Fogel
std::istream& operator>>(std::istream& in, Bigint& i) {
  char c;
  in.get(c);
  if (c == '-') i.m_is_negative = true;
  else {
    if (! std::isdigit(c)) throw std::runtime_error("Invalid input");
    i.m_digits.emplace_front(c);
  }
  while (in.get(c) && (c != 0xa)) {
    if (! std::isdigit(c)) throw std::runtime_error("Invalid input");
    i.m_digits.emplace_front(c);
  }
  i.m_digits.reverse(); // additional method to return the reversed value (the real input)
  while(i.m_digits.front()=='0'&&i.m_digits.size()!= 1){ // while loop to earse additional zeroes 
    i.m_digits.pop_front();
    if(i.m_digits.size()== 1)
      break;
  }
  return in;
}
Posted by: Guest on February-25-2021
2

sql tinyint range

bigint	-2^63 (-9,223,372,036,854,775,808) to 2^63-1 (9,223,372,036,854,775,807)	8 Bytes
int	-2^31 (-2,147,483,648) to 2^31-1 (2,147,483,647)	4 Bytes
smallint	-2^15 (-32,768) to 2^15-1 (32,767)	2 Bytes
tinyint	0 to 255	1 Byte
Posted by: Guest on October-08-2020
1

max value of bigint in sql server

bigint	-2^63 (-9,223,372,036,854,775,808) to 2^63-1 (9,223,372,036,854,775,807)	8 Bytes
Posted by: Guest on August-20-2020
0

main bigint

#include"Bigint.hpp"
#include"Command.hpp"
#include<string>
#include<sstream>
#include<iostream>
int main()
{
    try
    {
      Bigint list1 ;
      Bigint list2 ;
      std::string userinput;
      std::cout<<"Please enter the first integer: ";  // ===>>> Bigint 1 
      std::cin >> list1;
      std::cout<<"Please enter the second integer: ";  // ===>>> Bigint 2 
      std::cin >> list2;
      std::cout<<"Please enter the command (0=+, 1=-, 2=*):\t";
      std::cin>>userinput;
      if(userinput[0]<48||userinput[0]>50||userinput.length()>1)throw std::runtime_error("invalid input");
      switch(userinput[0]%48)
          {
            case(ADD):
             std::cout<<list1+list2<<std::endl;
             break;
            case(SUB):
             std::cout<<list1-list2<<std::endl;
             break;
            case(MUL):
             std::cout<<list1*list2<<std::endl;
             break;
          }
    }catch(std::runtime_error& e){ std::cout<<e.what()<<std::endl;}
  return 0;
}
Posted by: Guest on February-25-2021

Browse Popular Code Answers by Language