Hi Ognen,
C language sees most int as 0. But if you put it in a calculation or combine it
with another float, it will be read as a value.
So you can e.g. try
st =x /X +0.0;
This should work.
Regards,
Paul
--
You received this message because you are subscribed to the Google Groups
"FilterMeister Mailing List (FMML)" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to filtermeiste...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/filtermeister/31d08b7a-e981-4b75-b3b9-5ed7396163ban%40googlegroups.com.
One more thing,
I looked over the fact that int don’t go below 0. Because x <X, the result
will unavoidable got stuck at 0.
You can use this:
float fx, fX;
Put this in the running loop
fx =x
fX =X
…
st =fx /fX;
- - - - - - - - - - - - - - - - - - - - -
Hi Ognen,
C language sees most int as 0. But if you put it in a calculation or combine it
with another float, it will be read as a value.
So you can e.g. try
st =x /X +0.0;
This should work.
Van:
filter...@googlegroups.com [mailto:filter...@googlegroups.com] Namens
Ognen
Verzonden: woensdag 5 januari 2022 17:22
Aan: FilterMeister Mailing List (FMML)
Onderwerp: [FMML2] Always getting 0.00 when dividing x with X
Hello,
--
Hi Ognen,
This has nothing to do with FM. Integers are integers due their lack of a fractional
part. Because x is always smaller then X, the result will range between 0 and
max 1. It act like as you would calculate floor( fx /fX). That would also remain
0.0.
Mixing int with floats needs some care. Try to figure out the range that a
particular calculation will make. Therefore I proposed my filterbase, so you
can monitor step by step each variable and its result.
Correction of my former mail: integers can go negative, but not for pixel
values. I would mean they cut off behind the comma.
Paul
Van: filter...@googlegroups.com [mailto:filter...@googlegroups.com] Namens Ognen
Verzonden: woensdag 5 januari 2022 18:19
Aan: FilterMeister Mailing List (FMML)
--
You received this message because you are subscribed to the Google Groups
"FilterMeister Mailing List (FMML)" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to filtermeiste...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/filtermeister/13a58803-6e51-4ea6-88ca-85fdd5467addn%40googlegroups.com.