AnsweredAssumed Answered

How to convert double to fract?

Question asked by Yaniv.Sapir on Aug 2, 2011
Latest reply on Aug 5, 2011 by MikeP

I have a program like:


#include <stdfix.h>


double sinc(double x);


void main(void)


     double x;

     fract y;


     y = sinc(x);



The runtime library provides only int-to-fract conversions. How is double-to-fract managed, like in the above case? Is it safe to implicitly cast the type, assuming that if the double contains a value that is in the fract's range it will be assigned correctly, and saturated otherwise?