[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: sqrt(4/9) != 2/3
On Wed, Feb 02, 2000 at 02:33:48AM -0500, Nils Barth wrote:
> Well, it would be related insomuch as we have a bit of a problem
> telling when a number is rational and when it is decimal.
>
> For instance,
> genius> 3/2 == 1.5
> = 1
> genius> is_rational(1.5)
> = 0
> genius> is_rational(3/2)
> = 1
>
> So is 3/2 equal to 1.5 or are they different?
> We need to deal with this sometime.
Well ok it works like this. == is numerical equality and 3/2 and 1.5 are in
fact equal, however the types may be different.
The fact that sqrt returns a float instead of rational is just that there is
not test for perfectsquareness. Putting such a test in would slow it down
quite a bit. Several functions in fact return floats always no matter what
the input and I think that's not that bad.
> So........
> I suggest that we (eventually) have a mechanism for precision
> (volunteers?).
If somebody figures out how to do all the precision stuff I'd be waaaay more
then happy.
I think with the little time I have for drgenius right now (not that I
wouldn't have time really, but that I'm mostly lazy I think) my #1 priority
is modularizing the gel library and fixing bugs. I think I have the
interface figured out for the most part so now just to finish the
implementation changes. Although there are still large gaps in the gel*.h
interface which still need to be filled before I start converting the
implementation to the new interface.
Hopefully within like a month or so I should get it somewhat working. I
really really want to get this working so that both the canvas and drgeo can
start using it. Also it will become a library so that other programs can
embed gel as well.
George