|
Home > Archive > Programming with dBASE > November 2005 > rounded
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| Nico Oudshoorn 2005-11-29, 3:23 am |
| rounded(A,2) means that 12.000 till 12.0049999 is A = 12.00 and that 12.005
till 12.009999 is A = 12.01.
But I don't use rounded and in this case with A with two decimals:
A = 12.00 for 12.000 till 12.005 and A = 12.01 for 12.005100 till 12.009999;
my question is: is this correct?
Nico Oudshoorn
| |
| John York 2005-11-29, 7:23 am |
| mostly - but the folks at dBASE never got around to fixing their basic math
problems.
Instead they give you excuses about "floating point" math
So most of the time you are correct, but sometimes it doesn't work that way
John
"Nico Oudshoorn" <noudshoorn@scarlet.nl> wrote in message
news:D5blvVF9FHA.1520@news-server...
> rounded(A,2) means that 12.000 till 12.0049999 is A = 12.00 and that
12.005
> till 12.009999 is A = 12.01.
>
> But I don't use rounded and in this case with A with two decimals:
> A = 12.00 for 12.000 till 12.005 and A = 12.01 for 12.005100 till
12. 009999;
> my question is: is this correct?
>
> Nico Oudshoorn
>
>
| |
| Ken Mayer [dBVIPS] 2005-11-29, 9:24 am |
| John York wrote:
> mostly - but the folks at dBASE never got around to fixing their basic math
> problems.
>
> Instead they give you excuses about "floating point" math
>
> So most of the time you are correct, but sometimes it doesn't work that way
If you've really read the threads where these issues have been discussed
over-and-over, these are not dBASE issues, but C++ issues.
There is a better ROUND function (or two) in the dUFLP, and my book
includes a discussion of this issue, and includes Ken Chan's excellent
function for a more accurate rounding if you need it.
Ken
--
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/
*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/dbase/dBASEBook.htm
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase
| |
| David Kerber 2005-11-29, 9:24 am |
| In article <pp2XW2O9FHA.1232@news-server>, dbase@_nospam_golden
stag.net
says...
> John York wrote:
>
> If you've really read the threads where these issues have been discussed
> over-and-over, these are not dBASE issues, but C++ issues.
More specifically, they are design issues when the first versions of
Arago were written: they decided for some reason to only use floating
point arithmetic, rather than the BCD that dBase used at that time or
scaled integer arithmetic. That is where the binary imprecision issues
arise, and dBase Inc hasn't chosen to correct those initial design
problems.
--
Remove the ns_ from if replying by e-mail (but keep posts in the
newsgroups if possible).
|
|
|
|
|