Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
08/05/07 18:51
Modified:
  08/05/07 18:52

Read: times


 
#142784 - drop float
Responding to: ???'s previous message
Stanley Lio said:
Now I don't understand what the textbook says about the range of the float variable because the calculated value can still fit in the range of a float variable (1.xxxE-38 to 1.xxxE+38), like "tmp" in the code.


Drop float if this is for '51 or any other mcu.
Try to stick to the smallest type you can. Long is bad enough, already.

Stanley Lio said:
So the complier does not look after that, does it? It is new to me, and I have no idea what level of "intelligence" it has.


Well, you'd expect a complier would comply to your expectations, woudln't you... :-) (Sorry, I couldn't stand - this typo happens SO often...)

There is no more intelligence in any compiler than its author built in - and don't have too big expectations for them, they are usually happy if it conforms to basic standards and does not eat up all the memory and processor time (some don't even care for that).

<flame of the week>And, the language of your choice - C - is inherently stupid by definition, so the compiler cannot remedy that. If you want range checking, go for real programming languages.</flame of the week>

JW


List of 31 messages in thread
TopicAuthorDate
Problem with using Timer 1 of AT89S52 in C            01/01/70 00:00      
   methodology and the raw reason            01/01/70 00:00      
      Range of Variables            01/01/70 00:00      
         What type is AxisAngle?            01/01/70 00:00      
            AxisAngle is char            01/01/70 00:00      
            Integer < 65536?            01/01/70 00:00      
               Working within the range of long integers            01/01/70 00:00      
                  so I should....?            01/01/70 00:00      
                     A float constant            01/01/70 00:00      
                        what's the different            01/01/70 00:00      
                           const float...            01/01/70 00:00      
                              which means the compiler            01/01/70 00:00      
                     floats            01/01/70 00:00      
         drop float            01/01/70 00:00      
            Since I have just started to learn C...            01/01/70 00:00      
               A real programming language            01/01/70 00:00      
            Fractional Equivalence            01/01/70 00:00      
         Why?            01/01/70 00:00      
            there is a reason for this...            01/01/70 00:00      
               don't think as a PC programmer....            01/01/70 00:00      
                  Application vs. Hardware Platform            01/01/70 00:00      
                     the prudent programmer...            01/01/70 00:00      
                  PDP?            01/01/70 00:00      
                     it's not similar to the REAL assembly, of course,            01/01/70 00:00      
            Division is not always first            01/01/70 00:00      
               You are right.            01/01/70 00:00      
                  Explicitness            01/01/70 00:00      
                     is this when the C-code...            01/01/70 00:00      
                     agree with the agreement            01/01/70 00:00      
   Try this, can be better            01/01/70 00:00      
      Superfluous casts            01/01/70 00:00      

Back to Subject List