#separator:tab
#html:true
#notetype:Basic
#tags column:3
#deck:cracked.guide::TAOCP Vol 2::4.4 Radix Conversion
#columns:Front	Back	Tags
TAOCP §4.4 Radix Conversion: what does it cover?	Converting numbers between bases efficiently, for integers and fractions, by multiplication or division, and how to do it correctly with floating point and multiple precision.	cracked.guide cracked.guide::phase::taocp-2 cracked.guide::section::4.4 cracked.guide::kind::about
TAOCP §4.4: why does it matter?	Printing and parsing numbers correctly (especially floats) is surprisingly hard; many languages had bugs here for decades.	cracked.guide cracked.guide::phase::taocp-2 cracked.guide::section::4.4 cracked.guide::kind::why
TAOCP §4.4: what traps should you watch for?	<ul><li>Converting fractions with floats and accumulating rounding error.</li></ul>	cracked.guide cracked.guide::phase::taocp-2 cracked.guide::section::4.4 cracked.guide::kind::traps
TAOCP §4.4, exercise 11 (rated 16): what is it asking?	Octal to decimal by hand. Drill.	cracked.guide cracked.guide::phase::taocp-2 cracked.guide::section::4.4 cracked.guide::kind::exercise
TAOCP §4.4, exercise 12 (rated 22, recommended): what is it asking?	A fast pencil method for ternary to decimal and back.	cracked.guide cracked.guide::phase::taocp-2 cracked.guide::section::4.4 cracked.guide::kind::exercise
TAOCP §4.4, exercise 1 (rated 25, recommended): what is it asking?	Generalize conversion to mixed-radix systems, such as times and dates.	cracked.guide cracked.guide::phase::taocp-2 cracked.guide::section::4.4 cracked.guide::kind::exercise
TAOCP §4.4, exercise 3 (rated 25, recommended): what is it asking?	Print a fraction with just enough digits to read it back exactly. The idea behind shortest float printing.	cracked.guide cracked.guide::phase::taocp-2 cracked.guide::section::4.4 cracked.guide::kind::exercise
TAOCP §4.4, exercise 7 (rated M18): what is it asking?	When multiplying by an approximate reciprocal gives the right quotient.	cracked.guide cracked.guide::phase::taocp-2 cracked.guide::section::4.4 cracked.guide::kind::exercise
TAOCP §4.4, exercise 10 (rated 22): what is it asking?	Halve a binary-coded decimal number with shifts and masks.	cracked.guide cracked.guide::phase::taocp-2 cracked.guide::section::4.4 cracked.guide::kind::exercise
TAOCP §4.4, exercise 9 (rated M29, recommended): what is it asking?	Divide by 10 using only shifts, masks and adds. Compilers do exactly this.	cracked.guide cracked.guide::phase::taocp-2 cracked.guide::section::4.4 cracked.guide::kind::exercise
TAOCP §4.4, exercise 14 (rated M27, recommended): what is it asking?	Fast conversion of huge integers with divide and conquer. The stretch.	cracked.guide cracked.guide::phase::taocp-2 cracked.guide::section::4.4 cracked.guide::kind::exercise
TAOCP §4.4: how many exercises, and how are they rated?	19 exercises, rated 16 to M47.	cracked.guide cracked.guide::phase::taocp-2 cracked.guide::section::4.4 cracked.guide::kind::exercises
TAOCP §4.4: what should you be comfortable with first?	<ul><li>4.1 Positional Number Systems</li><li>4.3.1 The Classical Algorithms</li></ul>	cracked.guide cracked.guide::phase::taocp-2 cracked.guide::section::4.4 cracked.guide::kind::prereqs
TAOCP §4.4: how should you work through it?	Implement integer to decimal string for your bignums. Then read about fraction conversion and think about why printing the shortest float that round-trips is hard.	cracked.guide cracked.guide::phase::taocp-2 cracked.guide::section::4.4 cracked.guide::kind::approach
