Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pranet dev #1895

Closed
wants to merge 2 commits into from
Closed

Pranet dev #1895

wants to merge 2 commits into from

Conversation

pranet
Copy link

@pranet pranet commented Feb 26, 2014

Proper comparison of floating point values in equals method #1888

// return a;
// else
// return -a;
// }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologize if I am missing something obvious, but I don't quite get why commenting the abs method?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any difference between these two below in order to compute the absolute value?

else if (a>0)
      return a;
else
      return -a;

and

else if (a<0)
      return -a;
else
      return a;

@dhruv13J
Copy link
Contributor

This patch also fails to call the new function from within the TParameter::compare_ptype() function... I will submit my patch soon

@pranet
Copy link
Author

pranet commented Feb 27, 2014

Hi,
@iglesias
This was what I had in mind when I commented out the zero. I may have been wrong though...The intention was to avoid direct comparison with zero
http://stackoverflow.com/questions/2378628/can-you-compare-floating-point-values-exactly-to-zero

@dhruv13J
I completely missed that part . I'll try again

@iglesias
Copy link
Collaborator

All right @pranet, I get it now. Thanks for the clarification!

@pranet
Copy link
Author

pranet commented Feb 27, 2014

And how do I call the new function from TParameter::compare_ptype()? Do I have to use the existing one , or am I allowed to overload it as a template?

@dhruv13J
Copy link
Contributor

@pranet: check this - #1896

@pranet
Copy link
Author

pranet commented Feb 27, 2014

I see. thanks!

@karlnapf
Copy link
Member

karlnapf commented Mar 5, 2014

I guess this one is redundant to #1896, so I am closing it for now

@karlnapf karlnapf closed this Mar 5, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants