To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.handyboardOpen lugnet.robotics.handyboard in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / Handy Board / 5570
5569  |  5571
Subject: 
Type conversion.
Newsgroups: 
lugnet.robotics.handyboard
Date: 
Fri, 19 Feb 1999 21:25:02 GMT
Original-From: 
FEDERICO SANTELLO <fedsante@tin/Spamless/.it>
Reply-To: 
<FEDSANTE@tin.!ihatespam!it>
Viewed: 
794 times
  
Hi to all.

I'm not very practice with IC.
My answere are , how can i convert a integer number to a floating point
number?
I want to make a moltiplication between an intger number and a floating.
I make this:

          int temp;
          float dtemp;

         dtemp=temp*3.5;



But when i try to download i've an error type not compatible.

Thank Federico Santello.
E.mail: fedsante@tin.it



Message has 4 Replies:
  Re: Type conversion.
 
FEDERICO SANTELLO wrote: <snip> (...) Federico - - Try doing it this way: (it's called a "cast") int temp; float dtemp; temp = 5; dtemp = (float)temp*3.5; printf("dtemp=%f\n",dtemp); Enjoy, - - - Nick - - - (26 years ago, 19-Feb-99, to lugnet.robotics.handyboard)
  Re: Type conversion.
 
(...) Hi, what you want to do is called type casting,ie. you must explicitly specify the type. I've included some sample code that uses it. Because the beeper function expects a float but the knob function returns an integer, you have to modify the (...) (26 years ago, 19-Feb-99, to lugnet.robotics.handyboard)
  Re: Type conversion.
 
Dear Federico, Typecast the integer into float. ie write the statement as dtemp=(float)temp*3.5 Refer to any C book for information on typecasting. Yours sincerely, Nitin (...) (26 years ago, 21-Feb-99, to lugnet.robotics.handyboard)
  Are E9's compatible with HB?
 
I have a line on a bunch of MC68HC11E9's and I was wondering if these were compatible with the HB. Any help would be great! STEVE ___...___ Steve Wall Sir Sandford Fleming college Swall@flemingc.on.ca (26 years ago, 15-Mar-99, to lugnet.robotics.handyboard)

5 Messages in This Thread:




Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR