Which values ​​cannot be represented correctly double

A double data type cannot correctly represent some base values ​​of 10. This is because floating point numbers represent real numbers. This means that when representing monetary values, a decimal value type should be used to prevent errors. (feel free to correct errors in this preamble)

What I want to know are the values ​​that represent such a problem under the dual data type in 64-bit architecture in the standard .NET framework. (C # if that matters)?

I expect the answer to be a formula or rule to find such values, but I will also like some approximate values.

+5
source share
4 answers

Any number that cannot be written as the sum of positive and negative powers of 2 cannot be accurately represented as a binary floating-point number.

IEEE 32- 64- ; , . , ( +/- 10 ^ 308 (-10), ) , . , 64- 2 52, , 2 ^ 52, 't 2 ^ -1.

, , 1/3, 2/3, 1/5.

( ) , , , , - . , , 0.

+7

. .

, N ( 0) N * 2 ^ I, N * 2 ^ (- I).

, 5.625 ( 10) 101.101 ( 2).

, 2 ^ (- I) I, double.

+1

, , double, . , , - . , , , , , .

, , : " ?" , , . , "" , " ", ..

+1

s, e m

s * m * 2^e

, , ( s, e m), .

Basically, you can represent all the numbers between 0and 2^53 - 1multiplied by a certain power in two (possibly negative power).

As an example, you can specify all the numbers between 0and 2^53 - 1multiplied by 2^0 = 1. And you can also represent all of these numbers by dividing them by 2(using a fragment .5). Etc.

This answer does not fully cover the topic, but I hope this helps.

+1
source

All Articles