Bitcoin Forum
May 07, 2024, 01:06:55 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: What happen write number like this at code?  (Read 182 times)
wsxdrfv (OP)
Jr. Member
*
Offline Offline

Activity: 405
Merit: 5


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);

?

1715087215
Hero Member
*
Offline Offline

Posts: 1715087215

View Profile Personal Message (Offline)

Ignore
1715087215
Reply with quote  #2

1715087215
Report to moderator
1715087215
Hero Member
*
Offline Offline

Posts: 1715087215

View Profile Personal Message (Offline)

Ignore
1715087215
Reply with quote  #2

1715087215
Report to moderator
1715087215
Hero Member
*
Offline Offline

Posts: 1715087215

View Profile Personal Message (Offline)

Ignore
1715087215
Reply with quote  #2

1715087215
Report to moderator
Each block is stacked on top of the previous one. Adding another block to the top makes all lower blocks more difficult to remove: there is more "weight" above each block. A transaction in a block 6 blocks deep (6 confirmations) will be very difficult to remove.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715087215
Hero Member
*
Offline Offline

Posts: 1715087215

View Profile Personal Message (Offline)

Ignore
1715087215
Reply with quote  #2

1715087215
Report to moderator
achow101
Moderator
Legendary
*
expert
Offline Offline

Activity: 3388
Merit: 6631


Just writing some code


View Profile WWW
April 06, 2018, 01:29:30 AM
Merited by ABCbits (1)
 #2

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

wsxdrfv (OP)
Jr. Member
*
Offline Offline

Activity: 405
Merit: 5


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
Legendary
*
Offline Offline

Activity: 1583
Merit: 1276


Heisenberg Design Services


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.
wsxdrfv (OP)
Jr. Member
*
Offline Offline

Activity: 405
Merit: 5


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: 3388
Merit: 6631


Just writing some code


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: 2086
Merit: 4316

<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.

█████████████████████████
████▐██▄█████████████████
████▐██████▄▄▄███████████
████▐████▄█████▄▄████████
████▐█████▀▀▀▀▀███▄██████
████▐███▀████████████████
████▐█████████▄█████▌████
████▐██▌█████▀██████▌████
████▐██████████▀████▌████
█████▀███▄█████▄███▀█████
███████▀█████████▀███████
██████████▀███▀██████████
█████████████████████████
.
BC.GAME
▄▄░░░▄▀▀▄████████
▄▄▄
██████████████
█████░░▄▄▄▄████████
▄▄▄▄▄▄▄▄▄██▄██████▄▄▄▄████
▄███▄█▄▄██████████▄████▄████
███████████████████████████▀███
▀████▄██▄██▄░░░░▄████████████
▀▀▀█████▄▄▄███████████▀██
███████████████████▀██
███████████████████▄██
▄███████████████████▄██
█████████████████████▀██
██████████████████████▄
.
..CASINO....SPORTS....RACING..
█░░░░░░█░░░░░░█
▀███▀░░▀███▀░░▀███▀
▀░▀░░░░▀░▀░░░░▀░▀
░░░░░░░░░░░░
▀██████████
░░░░░███░░░░
░░█░░░███▄█░░░
░░██▌░░███░▀░░██▌
░█░██░░███░░░█░██
░█▀▀▀█▌░███░░█▀▀▀█▌
▄█▄░░░██▄███▄█▄░░▄██▄
▄███▄
░░░░▀██▄▀


▄▄████▄▄
▄███▀▀███▄
██████████
▀███▄░▄██▀
▄▄████▄▄░▀█▀▄██▀▄▄████▄▄
▄███▀▀▀████▄▄██▀▄███▀▀███▄
███████▄▄▀▀████▄▄▀▀███████
▀███▄▄███▀░░░▀▀████▄▄▄███▀
▀▀████▀▀████████▀▀████▀▀
starmyc
Full Member
***
Offline Offline

Activity: 198
Merit: 130

Some random software engineer


View Profile
April 06, 2018, 05:02:52 AM
Merited by achow101 (4), ABCbits (3), 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/addresses listing dumps: https://balances.crypto-nerdz.org/
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!