This thread is locked.Only browsing is available.
Top Page > Browsing
Bug in MIN/MAX macros causing incorrect results
Date: 2014/05/23 00:02
Name: &#197;ke Sandgren   <Ake.Sandgren@hpc2n.umu.se>

There is a bug in the MIN/MAX macros used in openmx 3.7.8 (and possibly other versions)

The definition used is

#define MIN(a,b) ((a)<(b))? (a):(b)

which causes the usage in Generate_Wannier.c to produce incorrect results.

tmp = sgn(tmp)*MIN(fabs(tmp),0.99999999999999999);

results in
tmp = (sgn(tmp)*((fabs(tmp))<(0.999999999))) ? (fabs(tmp)) : (0.99999)
since * has higher precedence than ?
メンテ
Page: [1]

Re: Bug in MIN/MAX macros causing incorrect results ( No.1 )
Date: 2014/05/23 22:28
Name: T. Ozaki

Hi,

Thank you very much for reporting the bug.
For a while, please change the part as

#define (MIN(a,b) ((a)<(b))? (a):(b))

and recompile it.

We may release a patch at a proper occasion.

Regards,

TO
メンテ

Page: [1]