Borrar filtros
Borrar filtros

Error while conditional compilation of float values.

1 visualización (últimos 30 días)
vishwajit jadhav
vishwajit jadhav el 5 de Abr. de 2017
Comentada: Alexandre De Barros el 14 de Abr. de 2017
I am using IHME-8.2.0.15 (R2011b) version of polyspace. My code has conditional compilation part where it compares(<= or >=) two float values in #if condition. The polyspace throws error as "expression must have integral type" while compilation. Is there any way to allow float comparision in polyspace?

Respuestas (1)

Vandana Ravichandran
Vandana Ravichandran el 12 de Abr. de 2017
Editada: Vandana Ravichandran el 12 de Abr. de 2017
While comparing floating-point numbers, it is invalid to use equality (==) or inequality (!=). There are two exceptions to this: when one of the operands is 0.0 because zero can be represented exactly, and when comparing a variable against itself such as foo == foo or foo != foo. However, it should be possible to use a different operator such as '>' or '<'.
Refer to the example listed on the following page:
  2 comentarios
vishwajit jadhav
vishwajit jadhav el 13 de Abr. de 2017
Hi Vandana,Thank you for your answer.Polyspace does not allow any kind of comparision('<','>','<=','>=') of two different values.Is there any way to make polyspace ignore error?
Alexandre De Barros
Alexandre De Barros el 14 de Abr. de 2017
Hi vishwajit,
can you confirm that the floats are used in the preprocessor directives like:
#if VALUE >= 1.0
If yes, what is the name of your compiler?
And can you show me the #if line?
Alex

Iniciar sesión para comentar.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by