Borrar filtros
Borrar filtros

How to find One's complement of floating point variable ?

3 visualizaciones (últimos 30 días)
Hi,
I used Simulink Bitwise Not operator to find the one's complement of uint8 type variable.
Now I want to find one's complement of float variable (double) using simulink.
Can you please help me on how to perform the task.
Thank you
  2 comentarios
James Tursa
James Tursa el 5 de Feb. de 2021
What does a 1's complement of a floating point bit pattern even mean to you? How do you intend to use this result?
kintali narendra
kintali narendra el 5 de Feb. de 2021
Editada: kintali narendra el 5 de Feb. de 2021
I need to convert float variable to binary number and then find one's complement of that, covert it into float variable again.
I am using it for redundancy validation.

Iniciar sesión para comentar.

Respuesta aceptada

Walter Roberson
Walter Roberson el 5 de Feb. de 2021
typecast to uint64, take the one's complement, typecast back.
Caution: 1's complement of 0.0 is NaN.
  9 comentarios
kintali narendra
kintali narendra el 8 de Feb. de 2021
yes, I want decimal representation of the one's complement.
The function which Walter recommened worked.
Walter Roberson
Walter Roberson el 8 de Feb. de 2021
@Paul note in particular they wanted the one's complement of the binary representation of double precision numbers, not of an integer data type.

Iniciar sesión para comentar.

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by