Qhov loj ntawm float variable yog dab tsi?
Qhov loj ntawm float variable yog dab tsi?

Video: Qhov loj ntawm float variable yog dab tsi?

Video: Qhov loj ntawm float variable yog dab tsi?
Video: Qhov tseem ceeb ntawm koj mus txhaj koob tshuaj COVID-19 rau zaum ob (Hmong) 2024, Kaum ib hlis
Anonim

Qhov loj ntawm ntab (ib zaug precision ntab cov ntaub ntawv hom) yog 4 bytes . Thiab qhov loj ntawm ob (ob chav precision ntab datatype) yog 8 bytes.

Ntawm no, qhov loj ntawm cov ntaub ntawv ntab yog dab tsi?

Floating-Point Hom

Hom Cia loj Tus nqi ntau
ntab 4 byte 1.2E-38 rau 3.4E+38
ob npaug 8 byte ib 2.3E-308 rau 1.7E+308
ntev ob 10 byte 3.4E-4932 rau 1.1E+4932

Ib tug kuj yuav nug, dab tsi yog qhov luaj li cas ntawm luv luv variable? 2 bytes

Ib yam li ntawd, tib neeg nug, dab tsi yuav yog qhov loj tshaj plaws ntawm float variable?

Qhov loj ntawm Floats

Floating Point Primitive Data Types
Hom Loj Ntau yam
ntab 32bit ib -3.4E+38 to +3.4E+38
ob npaug 64bit ib -1.7E+308 to +1.7E+308

Qhov loj npaum li cas yog 64 ntsis ntab?

Cov ntaub ntawv hom thiab qhov ntau thiab tsawg

Hom Lub Npe 32-ntsis Loj 64-ntsis Loj
ntab 4 bytes 4 bytes
ob npaug 8 bytes 8 bytes
ntev ob 16 bytes 16 bytes

Pom zoo: