Bitcoin Forum
November 13, 2019, 03:25:54 PM *
News: 10th anniversary art contest
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: What happen write number like this at code?  (Read 103 times)
wsxdrfv
Newbie
*
Offline Offline

Activity: 322
Merit: 0


View Profile WWW
April 06, 2018, 12:19:04 AM
 #1

So it should be,
nSubsidy >>= (nHeight / 5112000);


then what happen write like
nSubsidy >>= (nHeight / 5,112,000);

?

The Bitcoin Forum is turning 10 years old! Join the community in sharing and exploring the notable posts made over the years.
1573658754
Hero Member
*
Offline Offline

Posts: 1573658754

View Profile Personal Message (Offline)

Ignore
1573658754
Reply with quote  #2

1573658754
Report to moderator
1573658754
Hero Member
*
Offline Offline

Posts: 1573658754

View Profile Personal Message (Offline)

Ignore
1573658754
Reply with quote  #2

1573658754
Report to moderator
achow101
Moderator
Legendary
*
expert
Offline Offline

Activity: 1946
Merit: 2901


bc1qshxkrpe4arppq89fpzm6c0tpdvx5cfkve2c8kl


View Profile WWW
April 06, 2018, 01:29:30 AM
 #2

Compilers don't understand human comma separating for numbers. This code should fail to compile.

wsxdrfv
Newbie
*
Offline Offline

Activity: 322
Merit: 0


View Profile WWW
April 06, 2018, 04:05:43 AM
 #3

Compilers don't understand human comma separating for numbers. This code should fail to compile.
compiled was done with just warning sign. Not failed.

As what number program recognize that , (comma) number?
Heisenberg_Hunter
Hero Member
*****
Offline Offline

Activity: 686
Merit: 640


Call a spade a spade


View Profile WWW
April 06, 2018, 04:16:39 AM
Last edit: April 06, 2018, 06:05:32 AM by Heisenberg_Hunter
 #4

So if type like,
nSubsidy >>= (nHeight / 5,112,000);
then 5,112,000 become to what number for computer?  
As other members has given out some exact answers to your question, by the way what do you mean by numbers? Do you mean binary numbers Huh Comma operators can give out a varied results based on its usage in the code. At some times, it may even change the meaning of the code.

For instance consider a simple line of code where

a= b, c here in this the compiler reads them as a=b and a=c which will be similar to your case

if you use 5,112,000 instead of 5112000 as it meant to be, the compiler would end up with compiling 5 separately and 112 separately and 000 separately which would change your code. Hence don't try to use comma unless you are clear with them of where to use them.

And for your question about the number which computer reads, if you compile the 5112000, this would be converted to binary which is 10011100000000011000000 and would be given to the computer which reads them and replies.


.Mix coins.
 
Your BITCOIN Transaction
made Truly ANONYMOUS
 

███████
█████████████████
████████████████████████
█████████████████████████████
██████████                    ██████████
█████████                          █████████
███████                                    ████████
          ███████                                        ███████        ██
          █████████████████████████████████████      ███
          █████████████████████████████████████  █████
          ████████████████████████████████████  ██████
        ██████████████████████████████████████████
  █████████████████████████████████████████
█████                                        ████████████
                                  ██████████████
██                          █████████████████████          ██     
█████              ███████████████████████          ████     
█████████████████████████████            █████████     
██████████████████                      ████████████       
██████████████████████████████████████     
████████████████████████  ███████ 
    ██████████              █████
                      ████████
      ████████████████    █
        ██████████████████
                  █████      ███
                      █████
                    ████

Blender
 
The ULTIMATE BITCOIN Mixer
with an ADVANCED TECHNOLOGY
 

███████████   
███████████████████████   
████████████████████████████     
██████████████████████████████     
██████████████████████████████     
 

                                          █████████████
                                          ███████████
██████
                                          ███████████
██████
                                          ███████████
        ██
                                        ████████████
        ██
    ██                              █████████████
        ██
    ████                      ███████████████
        ██
    ██████              █████████████████
        ██
    █████████████████████████████
          ██ 
      ███████████████████████████
          ███
      ██████  ████████████████████
        ████
      ██████████████████████████
  ██████
      ██████████████████████████
███████
  █████      ████████████████████
███
████          ████████████████
████ 
████          ████████████████       
████████████████████████
 

   
█████████████████████████       
███████████████████████████       
█████████    ██    ███    ██████████     
███████████    ██    ███     ██████████       
███████████    ██    ███     ███████████     
██████████████████████████████████     
██████████████████████████████████       
wsxdrfv
Newbie
*
Offline Offline

Activity: 322
Merit: 0


View Profile WWW
April 06, 2018, 04:25:54 AM
 #5

As what number program recognize that , (comma) number?
May I know what are you clearly speaking about? If you type your question clearly I will edit this and try to give out the answer!  Huh
So if type like,

nSubsidy >>= (nHeight / 5,112,000);

then 5,112,000 become to what number for computer?  
achow101
Moderator
Legendary
*
expert
Offline Offline

Activity: 1946
Merit: 2901


bc1qshxkrpe4arppq89fpzm6c0tpdvx5cfkve2c8kl


View Profile WWW
April 06, 2018, 04:58:43 AM
 #6

So if type like,

nSubsidy >>= (nHeight / 5,112,000);

then 5,112,000 become to what number for computer?  
It doesn't become any number. Code is just text to a computer and is completely meaningless until it is compiled. That number will never have meaning to a computer because it will never be compiled into machine code that has meaning to a computer.

HCP
Legendary
*
Offline Offline

Activity: 1148
Merit: 1847

<insert witty quote here>


View Profile
April 06, 2018, 04:58:53 AM
 #7

Depends on the programming/scripting language being used and the compiler...

In all likelihood, the statement: nSubsidy >>= (nHeight / 5,112,000);
Is being interpreted as: nSubsidy >>= ( (nHeight/5), 112, 000);

Ie. the "number" 5,112,000 is effectively being interpreted as three separate numbers... (5, 112 and 000)

Whether or not that is actually a "valid" statement is dependent on the language.

If it is C\C++, then I suspect that it will attempt to bit shift the value of nSubsidy to the right by "0" bits... the end result being that the value of nSubsidy will NOT change at all. But I haven't tested that.

starmyc
Member
**
Offline Offline

Activity: 196
Merit: 88

Some random software engineer


View Profile
April 06, 2018, 05:02:52 AM
Merited by achow101 (4), HCP (2), pebwindkraft (1)
 #8

So if type like,

nSubsidy >>= (nHeight / 5,112,000);

then 5,112,000 become to what number for computer?  

I suggest you take a look at the Comma operator page on Wikipedia, as it will explain it better than me:

In the C and C++ programming languages, the comma operator (represented by the token ,) is a binary operator that evaluates its first operand and discards the result, and then evaluates the second operand and returns this value (and type).

Your code will then only do the following:

Code:
nSubsidy >>= 000;

(The first & the 2nd statement are discarded)

You can try it out by yourself:

Code:
$ cat a.c && gcc -Wall -o a a.c && ./a
#include <stdio.h>

int main() {
    int a, b;

    a = (1, 2, 3);
    printf("a == %d\n", a);
}
a.c: In function ‘main’:
a.c:6:11: warning: left-hand operand of comma expression has no effect [-Wunused-value]
     a = (1, 2, 3);
           ^
a.c:6:14: warning: left-hand operand of comma expression has no effect [-Wunused-value]
     a = (1, 2, 3);
              ^
a == 3

A valid usage:

Code:
$ cat a.c && gcc -Wall -o a a.c && ./a
#include <stdio.h>

int main() {
    int a, b;

    b = 1;
    a = (a = b+1, a--, a+1);
    printf("a == %d\n", a);
}
a == 2

The code is executed the following: b = 1; a = b+1 (a will be == 2); a-- (a will be == 1); a+1 will return 2 then this value will be assigned to a. a results as 2.


As you'll see on the wikipedia page, the comma operator has multiple usages.

Hi, I'm just some random software engineer.
You can check my projects: Bitcoin & altcoin balances dumps: https://balances.syndevio.com/
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!