Slacker News Slacker News logo featuring a lazy sloth with a folded newspaper hat
  • top
  • new
  • show
  • ask
  • jobs
Library
← Back to context

Comment by lilyball

4 years ago

When the author started introducing all the calculations to figure out if the printed version would round up, my first thought was, why not just look at the printed version? Print it as %.1f, then chop off anything past the period and re-parse it as an integer. Now you can trivially tell if it rounded up past the threshold and you need to bump the suffix.

0 comments

lilyball

Reply

No comments yet

Contribute on Hacker News ↗

Slacker News

Product

  • API Reference
  • Hacker News RSS
  • Source on GitHub

Community

  • Support Ukraine
  • Equal Justice Initiative
  • GiveWell Charities