Problems with REAL type

General discussion on mikroPascal PRO for PIC.
Post Reply
Author
Message
txb
Posts: 3
Joined: 19 Mar 2015 08:46

Problems with REAL type

#1 Post by txb » 19 Mar 2015 09:08

Please help me.
2 problems in comments

program MyProject;
var
variable1: real;
begin
variable1 := 999999.98; // in fact 1000000 ! but must be (need) 999999.98
while true do
variable1 := variable1 + 0.01; // not woked ! variable1 remains equal to the value assigned before the cycle.
end.

PS: PIC16F877A, 20MHz, CONFIG : $2007 : 0x0F02, build type: release, optimization level: 0

janni
Posts: 5373
Joined: 18 Feb 2006 13:17
Contact:

Re: Problems with REAL type

#2 Post by janni » 19 Mar 2015 12:34

Floating point types have finite accuracy. Variable of type real is 32-bit long which leads at most to 7 accurate digits.

txb
Posts: 3
Joined: 19 Mar 2015 08:46

Re: Problems with REAL type

#3 Post by txb » 19 Mar 2015 12:46

Damn It. I knew.
Thank U :)

(translated from russian to english in google com)
Last edited by txb on 20 Mar 2015 09:29, edited 2 times in total.

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: Problems with REAL type

#4 Post by filip » 20 Mar 2015 09:22

Hi,

Please, use English language only in the Forum.

Thank you for the understanding.

Regards,
Filip.

Post Reply

Return to “mikroPascal PRO for PIC General”