How to represent decimal number
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
a=180/255; in a matlab program and type 'a' in Command window, it shows the result as '0.7058823529411765' but when b=180; c=255; a=b/c; (which is doing the same function as above) and type 'a' in Command window, it shows the result as '1'
2 comentarios
James Tursa
el 10 de Sept. de 2016
I don't think you are giving us the complete picture. E.g., on my computer:
>> b=180; c=255; a=b/c;
>> a
a =
0.705882352941177
Please start over with a clean workspace, then type in the above and see what happens. I think you will get the expected results.
If you can reproduce your '1' with other code, please show us that code.
Respuestas (1)
Steven Lord
el 10 de Sept. de 2016
One or both of the variables b and c are of type uint8. See this documentation page for information about how integer arithmetic is performed.
0 comentarios
Ver también
Categorías
Más información sobre Image Processing Toolbox en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!