Post Reply 
Mini-challenge: MAX(factors of 2 or 5)
01-20-2018, 08:18 AM (This post was last modified: 01-20-2018 08:23 AM by Thomas Okken.)
Post: #19
RE: Mini-challenge: MAX(factors of 2 or 5)
(01-20-2018 04:21 AM)Joe Horn Wrote:  Please be aware that MAX(factors of 2 or 5) is actually needed for an actual programming task, namely, printing integer ratios as repeating decimals. MAX(denominator's factors of 2 or 5) yields the number of digits after the decimal point which do NOT repeat.

That makes it a not very interesting task (*), though, because printing numbers is something you only have to do fast enough for humans to keep up with, which is many orders of magnitude removed from the requirements of industrial-scale number crunching.

I noticed several years ago that the glibc version of printf(3) will print binary floating-point numbers at full precision, in decimal, and that it actually contains arbitrary-precision math logic to allow it to do that. It seemed crazy to me when I first saw that code, but it made more sense once I realized that it doesn't have to do all that usually, when people are looking for numbers with maybe 5 digits, and basically never while the computer is doing hard-core number crunching.

(*) Not very interesting from my point of view, anyway. Smile
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Mini-challenge: MAX(factors of 2 or 5) - Thomas Okken - 01-20-2018 08:18 AM



User(s) browsing this thread: 1 Guest(s)