Go to Post [A screen shot] is very helpful - I've sent Brandon many of those the various times I've broken ChiefDelphi.com! - Jessica Boucher [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 27-01-2008, 19:46
baop858 baop858 is offline
Registered User
FRC #0069 (Hyper)
Team Role: Programmer
 
Join Date: Jan 2007
Rookie Year: 2002
Location: Quincy, MA
Posts: 25
baop858 will become famous soon enough
Send a message via AIM to baop858
int times long?

What happens when I multiple an int by a long, is the result an long or an int?
  #2   Spotlight this post!  
Unread 27-01-2008, 20:00
Kyle Fenton Kyle Fenton is offline
GET IT ON!!
FRC #0121 (Rhode Warrior)
Team Role: Engineer
 
Join Date: May 2001
Rookie Year: 2000
Location: Middletown, R.I.
Posts: 785
Kyle Fenton has much to be proud ofKyle Fenton has much to be proud ofKyle Fenton has much to be proud ofKyle Fenton has much to be proud ofKyle Fenton has much to be proud ofKyle Fenton has much to be proud ofKyle Fenton has much to be proud ofKyle Fenton has much to be proud ofKyle Fenton has much to be proud ofKyle Fenton has much to be proud of
Send a message via AIM to Kyle Fenton
Re: int times long?

Depends, what did you declare your answer variable to be?

int answer

a * b = answer
would result in an integer answer
__________________
121
Rhode Warriors
NAVSEA/Raytheon/URI/Middletown, Portsmouth, Tiverton, Mt. Hope HS
Quality Robots Since 1996
  #3   Spotlight this post!  
Unread 27-01-2008, 20:08
Roger Roger is offline
Registered User
FRC #1153
 
Join Date: Jan 2006
Rookie Year: 1900
Location: Walpole MA
Posts: 684
Roger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond repute
Re: int times long?

I can never remember this, and my K&R is back at school.

int A;
long B;

int answerint;
long answerlong;

I think having a long in the expression casts it to long:

A * B produces a long. But to be sure you can cast it:

answerlong= (long) (A * B);
  #4   Spotlight this post!  
Unread 27-01-2008, 20:14
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: int times long?

With a long as one of the operands, the Microchip C compiler will do a 32-bit multiplication. The result will be a long.
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Lap Times Dgrez Rules/Strategy 11 01-02-2008 12:50
L.A. Times Article Greg Ross Dean Kamen's Inventions 25 26-07-2002 22:00
IRI Good Times archiver 2001 3 24-06-2002 04:05
NY TIMES ARTICLE SkitzoSmurf Chit-Chat 1 18-04-2002 14:42
Competition Times Pengiun Joe Off-Season Events 1 12-11-2001 18:11


All times are GMT -5. The time now is 09:21.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi