Problem with passing scalars from a field to an array
Dear Foamers,
I have this bug that I can't figure out! Three scalar fields are read from a dictionary: Code:
// Override the Ux and Uy Gains Code:
Info << "Freq = "<<filterFreqs_[i] << endl; Code:
Freq = 0.1 I fail to see what may be the problem! Best regards, Hisham |
Info is probably formatting away the extra decimals. You are comparing double precision float numbers and you want an exact match? Try instead to take a difference:
Code:
// instead of: |
Hi David,
This solved it. Thanks a lot. just to complete the picture: Code:
if (abs(value-value)<tolerance) Hisham |
Right... forgot about the absolute value. I'd suggest using OpenFOAM's built-in mag() function instead of abs()... just because I think it is more "type-safe"...
|
All times are GMT -4. The time now is 01:28. |