Dear Gurus,
I've few concerns from the given function.
- Do I necessary have to re-implement the data-type from float/double to integers? I found it's difficult to re-scale the coefficients into integers for this particular polynomial, since the range is fall between 35333307.73 and 0.014726741 (to keep the precision at least 7 decimal places), and the integer for my machine can only support
- I've found several 3rd party tools that particularly focus on this field of application, e.g. Starbridge Inc. Viva, Mitrion-C, Celoxica-C, ImpulseC...etc. Do they really can optimize the software design into hardware design automatically without the tedious conversion? Or alternatively, Matlab combines with Xilinx's system generator, Accelchip, Xilinx core_gen (free)...etc. Which of them is the most cost-effective for my case? Kindest thanks for your feedback!
Any help will be very appreciate!
// x is fall within a range of 0.0 to 10.0 float j1(float x) { float ax,z; double xx,y,ans,ans1,ans2; if ((ax=(float)fabs(x)) < 8.0) {
y=x*x; ans1=x*(35333307.73+y*(-3855009.392+y*(118357.8384 +y*(-1451.470429+y*(7.668204395+y*(-0.014726741))))));
ans2=70666615.43+y*(1123308.192+y*(9073.879268 +y*(48.55831735+y*(0.184081611+y*4.8828125e-4)))); ans=ans1/ans2;
} else { z=(float)8.0/ax; y=z*z; xx=ax-2.356194491; ans1=1.0+y*(0.183105e-2+y*(-0.3516396496e-4 +y*(0.2457520174e-5+y*(-0.240337019e-6))));
ans2=0.04687499995+y*(-0.2002690873e-3 +y*(0.8449199096e-5+y*(-0.88228987e-6 +y*0.105787412e-6))); ans=sqrt(0.636619772/ax)*(cos(xx)*ans1-z*sin(xx)*ans2); if (x < 0.0) { ans = -ans; } } return (float)ans; }
best regards,
Stanley