I
I
Ivan2020-03-28 18:46:05
Programming languages
Ivan, 2020-03-28 18:46:05

Why is there a maximum of 64 bytes for a variable in Java?

Why, for example, in golang can a maximum of 64 bytes be created for the int type?
If the number is greater, then an error is written

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Ronald McDonald, 2020-03-28
@Paveldjdhhd

In Pihon you can drive at least a hundred digits, in a number of mathematical languages ​​too.

D
Dmitry Belyaev, 2020-03-29
@bingo347

This is in what kind of JAP is 64 byte ints?
64 bits (8 bytes) - the size of a machine word on 64 bit machines, this means that you have processor registers mostly 64 bits each, memory cells also 64 bits each. This means that an 8-bit int will actually take 64 bits, although if the compiler understands that there are up to 8 consecutive 8-bit ints here (or up to 4x 16-bit, up to 2x 32-bit), then they can all be put in one cell .
Ints up to 64 bits, most modern processors can process in 1 assembler instruction for basic arithmetic operations. For greater bit depth, arithmetic is already built algorithmically. In some cases, it can be optimized using SIMD instructions, but in any case, the task is not trivial and not always necessary. Therefore, mathematically oriented programming languages ​​tend to have such data types, while other languages ​​often offer the use of libraries.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question