AnsweredAssumed Answered

Fraction data convert to Float

Question asked by Ahn Joseph on Apr 5, 2016
Latest reply on Apr 7, 2016 by Radek Sestak

Fraction data convert to Float

 

I have result fraction data format with below Math_Lib

 

But that is the data type difficult show to me

So, i want to show "0x10000000(FRAC32)" --> "0.125"

 

How can i do?

 

 

 

#include "mlib.h"

tFrac32 f32In1;

tFrac32 f32In2;

tFrac32 f32Out;

 

Function MLIB_Mul_F32

Automotive Math and Motor Control Library Set for Carcassonne MC9S12ZVM devices, Rev. 8

450 Freescale Semiconductor, Inc.

void main(void)

{

// first input = 0.5

f32In1 = FRAC32 (0.5);

// second input = 0.25

f32In2 = FRAC32 (0.25);

// output should be 0x10000000 = FRAC32(0.125)

f32Out = MLIB_Mul_F32(f32In1,f32In2);

// output should be 0x10000000 = FRAC32(0.125)

f32Out = MLIB_Mul (f32In1,f32In2,F32);

// ##############################################################

// Available only if 32-bit fractional implementation selected

// as default

// ##############################################################

// output should be 0x10000000 = FRAC32(0.125)

f32Out = MLIB_Mul (f32In1,f32In2);

Outcomes