ieee 754 - Meaning of Precision Vs. Range of Double Types -
to begin with, allow me confess i'm experienced programmer, has on 10 years of programming experience. however, question i'm asking here one, has bugged me ever since, first picked book on c decade back.
below excerpt book on python, explaining python floating type.
floating-point numbers represented using native double-precision (64-bit) representation of floating-point numbers on machine. ieee 754, provides approximately 17 digits of precision , exponent in range of –308 308.this same double type in c.
what never understood meaning of phrase
" ... provides approximately 17 digits of precision , exponent in range of –308 308 ... "
my intuition here goes astray, since can understand meaning of precision, how can range different that. mean, if floating point number can represent value 17 digits, (i.e. max of 1,000,000,000,000,000,00 - 1), how can exponent +308. wouldn't make 308 digit number if exponent 10 or rough 100 digit number if exponent 2.
i hope, i'm able express confusion.
regards vaid, abhishek
suppose write 1500 2 digits of precision. means being precise enough distinguish 1500 1600 , 1400, not precise enough distinguish 1500 1510 or 1490. telling numbers apart require 3 digits of precision.
even though wrote 4 digits, floating-point representation doesn't contain these digits. 1500 1.5 * 10^3. in decimal floating-point representation, 2 digits of precision, first 2 digits of number , exponent stored, write (1.5, 3).
why there distinction between "real" digits , placeholder zeros? because tells how precisely can represent numbers, is, what fraction of value lost due approximation. can distinguish 1500 = (1.5, 3) 1500+100 = (1.6, 3). if increase exponent, can't distinguish 15000 = (1.5, 4) 15000+100 = (1.51, 4). @ best, can approximate numbers within +/- 10% 2 decimal digits of precision. true no matter how small or large exponent allowed be.
Comments
Post a Comment