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 CCS Technical Support

Search found 61 matches
CCS Forum Index
Author Message
  Topic: How to printf float32 float64..
miro

Replies: 22
Views: 23928

PostForum: General CCS C Discussion   Posted: Wed Sep 06, 2023 2:06 am   Subject: How to printf float32 float64..
The point is what you posted is wrong. You say:

the precise result is (win calc bcd math)
1.1192533462602198715876021987159E+03

But you have a value scaled 1E5 by 1E13. Result should be
scaled ...
  Topic: How to printf float32 float64..
miro

Replies: 22
Views: 23928

PostForum: General CCS C Discussion   Posted: Wed Sep 06, 2023 1:50 am   Subject: How to printf float32 float64..
..

float32 a32, b32, c32;
float64 a64, b64, c64;

a32 = 157.827;
b32 = 346.384;
c32 = (a32 / b32) * 2.456433e3;

a64 = 1 ...
  Topic: How to printf float32 float64..
miro

Replies: 22
Views: 23928

PostForum: General CCS C Discussion   Posted: Wed Sep 06, 2023 1:14 am   Subject: How to printf float32 float64..
Er:

int64_t c64i = 10000000000000;
c64i = (int64_t)(c64 * c64i);
printf("ic64 = %Ld\n", c64i);

results in:
c64 = 1.1192533449572376197389544927318638656288385391E+05
ic64 = 1119253 ...
  Topic: Programming with PICKIT2 off the IDE
miro

Replies: 0
Views: 4472

PostForum: General CCS C Discussion   Posted: Thu Aug 31, 2023 11:15 am   Subject: Programming with PICKIT2 off the IDE
For those who want to directly flash off the compiler with the PicKit2 - here is the command you may enter into the Options-> IDE-> Tools-> Command, which works fine here:

"C:\Pro ...
  Topic: How to printf float32 float64..
miro

Replies: 22
Views: 23928

PostForum: General CCS C Discussion   Posted: Wed Aug 30, 2023 3:28 am   Subject: How to printf float32 float64..
For example - you want to deliver a package from pointA to pointB and your pic24/dspic driving the drone wants to know where to fly.. Very Happy

printf ("\n###### DISTANCE AND INITIAL BEARI ...
  Topic: How to printf float32 float64..
miro

Replies: 22
Views: 23928

PostForum: General CCS C Discussion   Posted: Tue Aug 29, 2023 7:15 am   Subject: How to printf float32 float64..
For example: sin(PI/5.0)
Wolfram Alpha
Win7 calculator
PCD float64

0.5877852522924731291687059546390727685976524376431459910722724807...
0.58778525229247312916870595463907
0.5877852522924738
  Topic: How to printf float32 float64..
miro

Replies: 22
Views: 23928

PostForum: General CCS C Discussion   Posted: Tue Aug 29, 2023 6:09 am   Subject: How to printf float32 float64..
The win7/10 calculator is pretty precise, it uses 34 digits decimal math, afaik. Of course there is Wolfram Alpha and others with arbitrary precision you may compare with.
I messed a lot with double ...
  Topic: How to printf float32 float64..
miro

Replies: 22
Views: 23928

PostForum: General CCS C Discussion   Posted: Tue Aug 29, 2023 1:57 am   Subject: How to printf float32 float64..
..and it is not only the issue with too many digits in their printf, but the precision trouble is there as well.
For example:

..
int64_t c64i = 10000000000000;
c64i = (int64_t)(c64 * c64i);
pr ...
  Topic: How to printf float32 float64..
miro

Replies: 22
Views: 23928

PostForum: General CCS C Discussion   Posted: Mon Aug 28, 2023 11:37 am   Subject: How to printf float32 float64..
Yep, I think the "f" did the same (I may retest that again).
Tried to format with %m.ne but the same.
There is also f48, but the math results I got with a test were off, thus I do not both ...
  Topic: How to printf float32 float64..
miro

Replies: 22
Views: 23928

PostForum: General CCS C Discussion   Posted: Mon Aug 28, 2023 8:44 am   Subject: How to printf float32 float64..
..

float32 a32, b32, c32;
float64 a64, b64, c64;

a32 = 157.827;
b32 = 346.384;
c32 = (a32 / b32) * 2.456433e3;

a64 = 1 ...
  Topic: How to printf float32 float64..
miro

Replies: 22
Views: 23928

PostForum: General CCS C Discussion   Posted: Mon Aug 28, 2023 8:06 am   Subject: How to printf float32 float64..
Hi, we want to printf the float32/64 values and are coping with a problem.
Whatever we do the results are aprox 50 char long strings, basically a correct value, but the printf adds aprox 30-40 chars, ...
  Topic: COS SIN broken?
miro

Replies: 11
Views: 15495

PostForum: General CCS C Discussion   Posted: Sun Jul 05, 2015 11:07 am   Subject: COS SIN broken?
Reducing the range is matter of "highest precision", not stopping to work Smile
The ccs compiler is the only one I know where cos/sin stop working with arguments larger a few hundreds of radia ...
  Topic: COS SIN broken?
miro

Replies: 11
Views: 15495

PostForum: General CCS C Discussion   Posted: Sun Jul 05, 2015 9:26 am   Subject: COS SIN broken?
It seems the trick with getting COS into radian quadrants is quite limited in its scope - see the math.h (lines 1188-1197):


quad = (unsigned int8)(x * PI_DIV_BY_TWO_INV); // ...
  Topic: COS SIN broken?
miro

Replies: 11
Views: 15495

PostForum: General CCS C Discussion   Posted: Sun Jul 05, 2015 8:18 am   Subject: COS SIN broken?
May be I am doing something wrong, but for these arguments I get following COS values (pcwhd 5.048 and others most probably):
rad COS(rad)
3.7129E+02 8.3146E-01
3.7738E+02 9.2388E ...
  Topic: dspic33fj - fft.h and adc dma
miro

Replies: 0
Views: 4823

PostForum: General CCS C Discussion   Posted: Thu Jun 18, 2015 7:18 am   Subject: dspic33fj - fft.h and adc dma
Hi, after a long evening elaborating a piece of code which worked fine in past I share my lesson learned:
1. the code does fft with adc->dma_buffers-ping-pong
2. I had to place the stack at a fre ...
 
Page 1 of 5 Goto page 1, 2, 3, 4, 5  Next
All times are GMT - 6 Hours
Jump to:  


Powered by phpBB © 2001, 2005 phpBB Group