CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

CCS C double variable
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
temtronic



Joined: 01 Jul 2010
Posts: 9120
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Wed Mar 20, 2024 6:24 am     Reply with quote

hmm..curious .HOW did you display the result ?
The printf() may have reformatted the actual result into 'readable' format ?
Maybe a compiler 'bug' that converts 'double' into 'float' ?
Maybe it's the first day of Spring ?
Ttelmah



Joined: 11 Mar 2010
Posts: 19238

View user's profile Send private message

PostPosted: Wed Mar 20, 2024 9:08 am     Reply with quote

What he has is a compiler bug. It was documented here a few versions
ago. It is very interesting that using double made it work, but he is not
actually using double, what is happening is that this keyword just happens
to be fixing a bug with the compiler!.....
Get a replacement for the compiler. CCS will supply you a fixed version.
Won't fix your speed issue, but at least will get rid of the confusion.

The one that will genuinely give you the right value, is int32, and this will
be enormously faster. What is posted here will be very inefficient, since
each integer has to be converted to float, then added. Much faster to
do the additions, and then convert the answer to float for the division.
This is an example of how important understanding the implications of
type on speed is.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
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


Powered by phpBB © 2001, 2005 phpBB Group