AnsweredAssumed Answered

How to convert from double to signed short?

Question asked by johnny45 on Jan 8, 2013
Latest reply on Jul 22, 2014 by CraigG

Hi.

What's the easiest way to convert variable from double to signed short?

 

I'm total beginner in DSP area.In other C-language environments I did this task in following manner:

 

double myDouble = - 3.14;

 

myDouble = floor(myDouble);

signed short = (signed short) myDouble;

 

Surprisingly that doesn't work for negative numbers in VisualDSP++, but still it compiles.

 

I'm using ADSP-BF548 EZ-KIT LITE (blackfin) and programming environment VisualDSP++ 5.0.

 

thank you

Outcomes