[haiku-development] Re: DeskCalc Improvements (was need strtold() function)

  • From: John Scipione <jscipione@xxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Tue, 2 Feb 2010 13:02:02 -0500

I have attached a new patch to ticket #5203 at
http://dev.haiku-os.org/ticket/5203

This patch will ensure that deskcalc will (almost) always fit the
result in the display window. An easy way to test the code is to make
the window short and wide and type pi or sin(0.5) and watch the digits
fill the screen. Then make the window tall and narrow and watch the
result come back puny and inaccurately. You can also test negative
numbers and watch how the result is shrunk to make room for the
negative sign. Try different window sizes, you should not be able to
get a result to not fit unless the window is tall and narrow and the
result won't fit even in scientific notation with all decimal digits
removed.

Two conditions will set off a conversion to scientific notation--if
the magnitude of the result is too large to fit into the window or the
magnitude has too many significant decimal places to fit into the
window. There is no longer any arbitrary cutoff for scientific
notation. I did this because converting to scientific notation limits
the accuracy of further calculations with the result and I wanted to
avoid that as much as possible.

John Scipione

Other related posts: