type-conversionab-initio

abinitio decimal to floating conversion


In abinitio I have a code like below. Both divisior and denominator are decimals. In my example, when 1 is divided by 2 , the result is 0. However I want it to be like 0.50. How can I achieve this ? I tried several castings but it didn't work.

count(in.bad_video_experience_grid_div)/ 
if( count(in.bad_video_experience_grid_dnm)==0)(1)
else count(in.bad_video_experience_grid_dnm))

Solution

  • I've multipled the divisor by 1.0 and the denominator by 1.0 , then it worked.