strange float question !
Hey strengthstrong,
Do you mind sharing relevant code? We need more information.
Cheers,
Håkon.
float r = 0, g = 0, b = 0; int i = (int) fmod((p_hsb_h / 60), 6); NRF_LOG_RAW_INFO("i= %d\r\n",i); float f = (p_hsb_h / 60) - i;
What on earth are you asking here? Would you post a proper question please. The code you've posted has nothing to do with the output at the top, nothing at all.
Post the code which generates that output, in full, and write more than 2 words of question about what it is you want to know.
And check the dev forums for hints about how to output floats, many of the printf() type functions don't actually support floats and just print 0.
And instead of using printf() debugging, use a debugger and LOOK at the numbers.
This is my program code, with NRF_LOG_INFO print, I would like to know what is the reason leading to 1-f = 0.0, you see, log print out f = 0.0
that is not the code which produces the output you are asking about.
Anyway if you are having a problem printing floats do what I suggested and go find posts about printing floats because it's more than likely in the real code, which you haven't posted, you're using a logging method which doesn't log floats and just prints 0.0
This is the code and terminal output, this function p_hsb_h start is 0.00, f = 0.00 is correct, in theory 1-f should be equal to 1.00, but the terminal output is 0.00, is not it a strange question
This is the code and terminal output, this function p_hsb_h start is 0.00, f = 0.00 is correct, in theory 1-f should be equal to 1.00, but the terminal output is 0.00, is not it a strange question