DonMilne:
Eh?? I made no mention of strings. I said "an appropriately scaled integer". You can't compare a string with anything except another string, so I don't see why that remark is relevant at all.
The remark is an example that there need to be conversion. The scaled integer of the DHT needs to be converted to a standard supported data type to be comparable. The raw scaled integer cannot be compared to anything except its own format, and even that may not be true as operators are not defined, they might work by accident.
I used the string as an (apparently too) extreme example that conversion is needed before compare without using float as example.
The DHT sensor returns temperatures scaled up by 256. So, for example, to compare the returned value against 25degC you might say "if (val_read >= ( 25<<8 )) {". On the AVR one must of course be careful to consider overflows when working with 16 bit signed ints.
So what you say is that you need to convert the value 25 to something other before it can be compared to the internal fixed point format of the sensor. That is exactly the point I want to make one way or the other you need to convert internal formats. The easiest and the logical way is to convert the internal representation to a standard supported format (which can be float).
So I would write that line of code as "if ( ( val_read >> 8 ) >= 25 ) {".
Or even "temperature = ( val_read >> 8 ); if ( temperature >= 25 ) {"
That makes it more explicit that 25 is the value compare to. 25 has a semantic meaning outside the code, ( 25 << 8 ) has not. There is imho just no need to stick with the internal format of the sensor when the data is "out of the box". What if you have 2 different sensors with 2 different internal fixed point representations, which representation should I use?. The standard design pattern is to normalize first (OK not necessary to float) and then do a compare.
And no, floating point has a very specific definition which is quite different from fixed point, which is really what we're discussing here. An implied exponent makes it fixed point, to be floating point it needs an explicit exponent term (and sign bits, if you mean a standard floating point format).
Agree 100%, but the Arduino does not support a fixed point data type.
p.s. Just for what it's worth: I've been a fulltime professional C programmer for 30 years. On the other hand, what we're discussing here is very much at a beginners level. You might like to bear that in mind before trying to score silly points off me.
Sorry if you feel offended, that is not my intention at all, it is not my intention "to score" silly points off you.
I just disagree with your arguments to use a proprietary fixed point data types in code longer than strictly needed. Imho they should be converted to supported data types asap (unless in optimizing mode). You have arguments to not do that, OK, agree to disagree
In my opinion this discussion is not only beginners level, as I see (too) much professional programmers with years of experience still making mistakes with data types. It should be in the design (role of the architect != beginner) to decide what data formats to use and why. Thinking about consequences of design decisions is done too few times.