is binary system internal with multiplikation transformed into decimal

Stefan Schmidt 116 Reputation points
2024-09-22T20:44:42.9733333+00:00

Hello,

me is at sec working on mathematical system and has have a huge difficult questions. me find at sec out how to transform a binary pattern into a quaternary pattern with just setting into some kind of number,, also with string concatenation. In how far this is intelligent with binary operations, if the system internal from windows does this with the common suggested method of to multiply a given position with 2 simply,, also uses still the cpu this way or not???

thx for ya efforts

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,939 questions
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,734 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Minxin Yu 11,751 Reputation points Microsoft Vendor
    2024-09-23T02:07:11.42+00:00

    Hi,

    CPU processes binary numbers directly.
    It is recommended to use shift and add for multiplication.

      int i = 10;
      i=i << 1; // 10*2
    

    Best regards,

    Minxin Yu


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

  2. Bruce (SqlWork.com) 65,396 Reputation points
    2024-09-23T16:48:36.7566667+00:00

    your question is not clear. with computers generally all arithmetic is binary (base 2). the conversion to decimal is done when converted to a string. There are some speciality libraries that do decimal arithmetic (but they are slower). .net has a decimal type. while the arithmetic is done in binary, because it's integer with an implied decimal point, it has a fixed precision in decimal.

    characters (strings) are an array of bytes (or words depending on charset size). concatenation is done by allocating a new array, and copying the source bytes to the target.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.