## Real variables

## Real variables

(OP)

I have a real variable (i) that should be multiplied by a constant (3280) to give an integer value in n2.

example: 5.7 x 3280 = 18696

however, it stores it as a real number: 1.8696 Exp 4

So if I divide n2 by 10000 i get 1.8696 but how do I make this number an integer?

Thanx

example: 5.7 x 3280 = 18696

however, it stores it as a real number: 1.8696 Exp 4

So if I divide n2 by 10000 i get 1.8696 but how do I make this number an integer?

Thanx

"To the pressure, everything's just like: an illusion. I'll be losing you before long..."

## RE: Real variables

## RE: Real variables

Any other ideas? If not ill split the number

~*Gwar3k1*~

"To the pressure, everything's just like: an illusion. I'll be losing you before long..."

## RE: Real variables

round and trunc obviously only deal with the whole number part of a real number. That's what they're for. If you want the fractional bit to x-decimal places then (1) remember that you can use ##.### etc. in print in order to print to x-decimal places, and (2) if you still need to do it, subtract from n it's whole number part, multiply by x, and round the result.

## RE: Real variables

~*Gwar3k1*~

"To the pressure, everything's just like: an illusion. I'll be losing you before long..."

## RE: Real variables

i want 18696 not 1.869600000 E4 or 1 and 0.8696

~*Gwar3k1*~

"To the pressure, everything's just like: an illusion. I'll be losing you before long..."

## RE: Real variables

Check if you don't accidentally put the result of round in a real variable! Round produces an integer, but if you store this integer in a real variable, it is converted to floating point again.

VAR r : real;

l : longint;

r:=1.869600000E4;

l:=round(r);

write(l);

=> 18696

Regards,

Bert Vingerhoets

vingerhoetsbert@hotmail.com

http://student.vub.ac.be/~bvingerh/

Don't worry what people think about you. They're too busy wondering what you think about them.

## RE: Real variables

BTW whats wrong with the Tek Tips server? I keep getting 400s and 404s

"To the pressure, everything's just like: an illusion. I'll be losing you before long..."

## RE: Real variables

## RE: Real variables

"To the pressure, everything's just like: an illusion. I'll be losing you before long..."