Tiny Core Extensions > TCE News
FlaxPDF pdf reader
hiro:
hope I found all issues.
curaga:
Applied, thanks!
Notes for the future:
- never compare floats for equality, it can fail even if they are equal
- if you'd like proper attribution in the git log, send git format-patch output instead of git diff
hiro:
Cool, I also wondered about the float comparisons, what do you think of this?
Thanks for the feedback.
Rich:
Hi hiro
The way you compare floats for equality is to test if their values are close enough for your application that you would
consider them to be equal. Something like this:
--- Code: ---float CloseEnough=0.01;
if((fabs(float1 - float2)) < CloseEnough)
{
code to execute if the two floats are considered to be equal
}
--- End code ---
curaga:
@hiro
That's missing one parenthesis, mainly for clarity - casting happens before ==, but it's good to have the parens around in case other things get added.
Applied with the parens added.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version