Re: floating point problems
Coos Haak <chforth@hccnet .nl> writes:[color=blue]
> Op 2 Feb 2006 16:58:41 -0800 schreef G Patel:[color=green]
>> One of the cases has a triangle with a side that is of length sqrt(41),
>> which is irrational. So when the other function gets it and resquares
>> it, accuracy is lost. Yet his testing program wants an exactly
>> solution (no approximate one allowed for this case).[/color]
>
> <OT>
> This is a rectacngular triangle with sides 4, 5 and sqrt(41).
> See your Math book!
> </OT>[/color]
This is usually referred to as a "right triangle", not a "rectangula r
triangle". ("rectangula r" refers to a 4-sided polygon all of whose
vertices are 90 degress.)
But if a test case provides a triangle one of whose sides is merely *a
close approximatation to* sqrt(41), it's foolish to expect an exact
result.
--
Keith Thompson (The_Other_Keit h) kst-u@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Coos Haak <chforth@hccnet .nl> writes:[color=blue]
> Op 2 Feb 2006 16:58:41 -0800 schreef G Patel:[color=green]
>> One of the cases has a triangle with a side that is of length sqrt(41),
>> which is irrational. So when the other function gets it and resquares
>> it, accuracy is lost. Yet his testing program wants an exactly
>> solution (no approximate one allowed for this case).[/color]
>
> <OT>
> This is a rectacngular triangle with sides 4, 5 and sqrt(41).
> See your Math book!
> </OT>[/color]
This is usually referred to as a "right triangle", not a "rectangula r
triangle". ("rectangula r" refers to a 4-sided polygon all of whose
vertices are 90 degress.)
But if a test case provides a triangle one of whose sides is merely *a
close approximatation to* sqrt(41), it's foolish to expect an exact
result.
--
Keith Thompson (The_Other_Keit h) kst-u@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Comment