Solution 1:

I can vouch for the Stillwell's one : Mathematics and Its History, and here's why: unlike most math history books which are, well, focused on the history alone, Stillwell's focus on the math.

That is, it's not about the mathematicians, but about the mathematics. Each chapter deals with a math topic (be it pythagorean triples, analytic geometry, etc) and it even has exercises to help you get an idea on what the main involved ideas are.

each chapter has a supplement showcasing one or two biographies about the main mathematicians involved on the chapter's subject

But the real feature, again, it's that the book is structured focusing on the mathematics history, not the mathematicians history (hence its title)

There's also an oldie but goodie: 2 volume set Eves' Great Moments in Mathematics , part of the Dolciani Mathematical Expositions series vol1 : before 1650 vol2 : after 1650 here each chapter is devoted to help you know about a specific mathematical breakthrough and why it's important on the mathematics development

This one starts talking about the Ishango Bone, which is dated around 10 tousand years ago, given you want to go far back as possible

Solution 2:

It rather depends on what level you are aiming at. I found Morris Kline's Mathematical Thought from Ancient to Modern Times very impressive.

If you are prepared to stop in the 19th century, I enjoyed A Short Account of the History of Mathematics by W. W. Rouse Ball when I was young, blowing the dust off an inherited copy WWRB had given my grandfather.

Solution 3:

Mathematics and Its History by John Stillwell is a nice one.

Solution 4:

In my undergrad, we used Burton's History of Mathematics: An Introduction (the 5th edition of this). We also had as supplemental reading Dunham's excellent Journey Through Genius. This one is inexpensive and was an enjoyable read.

Solution 5:

I recommend very much

Felix Klein: Development of Mathematics in the 19th Century