Jump to content


Photo

Delphi/PASCAL - Extended to integer ?


  • Please log in to reply
2 replies to this topic

#1 goaliemike

goaliemike

    Young Padawan

  • Members
  • Pip
  • 89 posts
  • Location:Rockland, ON, Canada

Posted 18 May 2007 - 05:40 PM

Hi, ive been working on Delphi for my school's programming course. We have to create a game out of stuff we learned, tho its not the best to use its still fun. Now im stuck with a extended variable that i need to convert into a integer. I have looked for a while, the best i found is that a extended variable is a longer integer... How can i convert it ?
  • tiewherie likes this

#2 U1

U1

    Young Padawan

  • Members
  • Pip
  • 245 posts

Posted 09 June 2007 - 09:36 AM

Something like this:

int x = 10;

String s = new Integer(x).toString();
Or
String.valueOf(x);


Edit: ^^ nvm that was my java snipits :)

Edited by Unknown1, 09 June 2007 - 09:37 AM.

  • shacheJeape likes this

#3 erpizn13

erpizn13

    Young Padawan

  • Members
  • Pip
  • 2 posts

Posted 29 June 2007 - 12:54 AM

Hey, I'm probably late, but did not see answer to your qtn, so here is my post!

Type-cast:
var
x: Extended;
y: Integer;
...
y := Integer(x);

Round/Ceil/Floor:
var
x: Extended;
y: Integer;
...
y := Round(x); //uses System
y := Ceil(x); //uses Math
y := Floor(x); //uses Math

-erpizn13




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users