Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

double < 0

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    www.mcselec.com Forum Index -> BASCOM-AVR Archive
View previous topic :: View next topic  
Author Message
uga237

Bascom Member



Joined: 15 May 2012
Posts: 32

blank.gif
PostPosted: Tue Aug 12, 2014 2:20 am    Post subject: double < 0 Reply with quote

Dim test as double

test = 12345

IF test < 0 then 'some time fail
.
.
.



IF test < 0.0 then 'work good
.
.
.



why?

(BASCOM-AVR version : 2.0.7.7 )
Back to top
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5061
Location: Holland

blank.gif
PostPosted: Tue Aug 12, 2014 9:05 am    Post subject: Reply with quote

0 and 0.0 are the same and will give the same result. if you compile 2 different samples and compare the output you will find they are (binary) identical.
so please produce a sample that demonstrates this problem.
Or send a sample/code to support.

_________________
Mark
Back to top
View user's profile Visit poster's website
six1

Bascom Expert



Joined: 27 Feb 2009
Posts: 552

germany.gif
PostPosted: Tue Aug 12, 2014 2:18 pm    Post subject: Reply with quote

http://wiki.mcselec.com/bavr/Language_Fundamentals/#Floating-Point_Complications
_________________
For technical reasons, the signature is on the back of this message.
Back to top
View user's profile
uga237

Bascom Member



Joined: 15 May 2012
Posts: 32

blank.gif
PostPosted: Thu Aug 14, 2014 6:05 am    Post subject: Reply with quote

http://wiki.mcselec.com/bavr/Language_Fundamentals/#Floating-Point_Complications - and?
Back to top
View user's profile
six1

Bascom Expert



Joined: 27 Feb 2009
Posts: 552

germany.gif
PostPosted: Thu Aug 14, 2014 10:32 am    Post subject: Reply with quote

Hi,
in my mind, you didn't understand, that in binary system you can not show all possible floatingpoint numbers.
Read the help and think about.

regards, michael

_________________
For technical reasons, the signature is on the back of this message.
Back to top
View user's profile
uga237

Bascom Member



Joined: 15 May 2012
Posts: 32

blank.gif
PostPosted: Thu Aug 14, 2014 2:13 pm    Post subject: Reply with quote

Michael.
You don't understand my question about compare Double and Zero.
Think about.

Ivan.
Back to top
View user's profile
six1

Bascom Expert



Joined: 27 Feb 2009
Posts: 552

germany.gif
PostPosted: Thu Aug 14, 2014 4:22 pm    Post subject: Reply with quote

ahh, ok... that can be the solution...
i do not understand and therefore your code doesn't work... Laughing

You ask about precision and have doubt about my skill?

Maybe you better start debug and have a look for what exactliy going on in your micro...


best, michael

_________________
For technical reasons, the signature is on the back of this message.
Back to top
View user's profile
uga237

Bascom Member



Joined: 15 May 2012
Posts: 32

blank.gif
PostPosted: Fri Aug 15, 2014 3:44 am    Post subject: Reply with quote

You ask about precision and have doubt about my skill? - no

Some time positive double value lower then Zero.
Why precision?

my code is very big size. i try simulate this on small code and post here.

And sorri my english ) I am from Russia.

P. S. ..and have doubt about my skill?.. - i smile )))
Back to top
View user's profile
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    www.mcselec.com Forum Index -> BASCOM-AVR Archive All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum