32 bits of accuracy. What does it mean?

I am reading a book about the development of OPENGL ES. I came across this suggestion.

Floating in Java 32 bits of precision, while the byte has 8 bits of precision. This may seem like an obvious point to create, but there are 4 bytes in each float.

What exactly does this mean? Is it important to know when developing games for Android?

Thanks for any help.

0
source share
1 answer

What exactly does this mean?

1 byte = 8 bits

4 bytes = 32 bits


1Bit can have 2 conditions 0 or 1

2Bits can have 2Β² conditions 00, 01, 10 and 11


Ok now it comes to a difficult point

If your accuracy should be +/- 0.5 *, the maximum size * that your number can have is 2 ^ 23. Now you can ask yourself, what if I got a number that is larger than this? Anything larger than this is greater than 0.5.

(Single-Precission / 32 bit)


How important is it to know when developing games for Android?

It is important that you understand the basic concept behind this in almost any programming language.

Take a look at this simple program, if you understand the result, that’s all you need to know first

public class DoubleError { public static void main(String[] args) { double x = 1.1; double y = 0.1; System.out.println("X is: " + x); System.out.println("Y is: " + y); System.out.println("X+Y is: " + (x + y)); } } 

EDIT:

Oh, and completely ruin your head,

Here are a few more points you should know:

Half-Precision = 16 bit

Single point = 32 bit

Double-Precision = 64 bit


EDIT 2:

Oh, and if you want to understand something, check out this: IEEE_754-2008

+2
source

Source: https://habr.com/ru/post/1200866/


All Articles