floating point - How do I round this binary number to the nearest even -


i have binary representation of 0.1:

0.00011001100110011001100110011001100110011001100110011001100110 

i need round nearest able store in double precision floating point. can't seem understand how that. tutorials talk guard, round , sticky bits - in representation?

also i've found following explanation:

let’s see 0.1 looks in double-precision. first, let’s write in binary, truncated 57 significant bits:

0.000110011001100110011001100110011001100110011001100110011001… 

bits 54 , beyond total greater half value of bit position 53, rounds to

0.0001100110011001100110011001100110011001100110011001101 

this 1 doesn't talk grs bits, why? aren't required?

the text quote article why 0.1 not exist in floating-point . in article showing how conversion hand, , "grs" bits ieee implementation detail. if using computer conversion, don't have use ieee arithmetic (and shouldn't if want correctly ), grs bits won't come play there either. in case, grs bits apply calculations, not conceptual idea of conversion.


Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -