this is a very common mistake, so I wanted to share my current
understanding with you (as I am learning this myelf):
One should *always* use std::abs().
In particular, one should *never* use abs(), because that returns an
integer. So for example this patch:
https://github.com/hpfem/hermes/commit/1faa5c5f0576b9440c299648e7aca62ad935cc5b
in my opinion doesn't work. I have already fixed this for the tests 50
and 52 and it should be fixed for all the other tests.
Ondrej
--
You received this message because you are subscribed to the Google Groups "hermes2d" group.
To post to this group, send email to herm...@googlegroups.com.
To unsubscribe from this group, send email to hermes2d+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/hermes2d?hl=en.
The problem with fabs() is that it is defined in C, not C++. It works
in g++, but not in MSVC (at least Ivo said so).
So it seems that std::abs() is the only option.
Ondrej
Hi,And just a note. If std:: is not used, then fabs() should be always used for doubles.I've learned it hard way...David
On Tue, Jan 25, 2011 at 10:30 PM, Ondrej Certik <ond...@certik.cz> wrote:
Hi,
this is a very common mistake, so I wanted to share my current
understanding with you (as I am learning this myelf):
One should *always* use std::abs().
In particular, one should *never* use abs(), because that returns an
integer. So for example this patch:
https://github.com/hpfem/hermes/commit/1faa5c5f0576b9440c299648e7aca62ad935cc5b
in my opinion doesn't work. I have already fixed this for the tests 50
and 52 and it should be fixed for all the other tests.
Ondrej
--
You received this message because you are subscribed to the Google Groups "hermes2d" group.
To post to this group, send email to herm...@googlegroups.com.
To unsubscribe from this group, send email to herm...@googlegroups.com.