V
vectorizor
Hello,
I am writing a significant amount of floating-point computational
routines as template, so float or double values can be used depending
on the accuracy needed. There are many numerical constants defined in
these routines, and they keep generating a warning in VC++ 8.0:
"warning C4244: '=' : conversion from 'double' to 'float', possible
loss of data"
This warning is obviously generated when the template is compiled with
type=float. I could get around by appending a f at the end of the
constants, i.e. "1.0f" vs "1.0", but that would lose precision when
doing computation in double. So I am looking for a workaround.
I understand that macro are not well loved around here, but is there a
way to define a macro in order to get rid of this problem?
Thanks in advance,
Alex
I am writing a significant amount of floating-point computational
routines as template, so float or double values can be used depending
on the accuracy needed. There are many numerical constants defined in
these routines, and they keep generating a warning in VC++ 8.0:
"warning C4244: '=' : conversion from 'double' to 'float', possible
loss of data"
This warning is obviously generated when the template is compiled with
type=float. I could get around by appending a f at the end of the
constants, i.e. "1.0f" vs "1.0", but that would lose precision when
doing computation in double. So I am looking for a workaround.
I understand that macro are not well loved around here, but is there a
way to define a macro in order to get rid of this problem?
Thanks in advance,
Alex