SRL Archive - Bugs

Ceil wont work...[BUG]


weequ

2011-02-12 05:08:13

So almost every time I try write something with simba I get bugs…
This time Ceil() rounding down extendeds when it should round it to highest integer.

Edit: I just tried and it works like this: Ceil(0.25) -> 1
But doesn't work like this: Ceil(1/4) -> 0
Also won't work like this: Ceil((1/4))

Maybe I'm doing something wrong?

Edit 2: Why simba automatically rounds 1/4 to 0?

So yea it works when I do like this: Ceil(1.0/4.0);

Is there any functions that will return integer as extended?

Gu3st...

2011-02-12 06:44:39

(1/4) = 0
(1.0/4.0) = 0.25

Remember, 1 and 4 are integers, 1.0 and 4.0 are floats

Ceil(1.0/4.0) works afaik

E: Wait… This is a bug.. WriteLn(100/432); = 0 :/

weequ

2011-02-12 07:51:50

How about Ceil(X/Y);

Is there a function that returns Integer as a float?

Edit:

I made this one lol:
function IntToFloat(Int: Integer): Extended;
begin
Result := StrToFloat(IntToStr(Int));
end;

Wizzup?

2011-02-12 08:40:59

program new;
var a:integer;
begin
a := 42;
writeln(extended(a));
end.

weequ

2011-02-12 08:48:16

From: Wizzup?
program new;
var a:integer;
begin
a := 42;
writeln(extended(a));
end.

Cool :)

Close this now?