M.Rehan
Full Member level 2
Can some one expalin the temp1 value?
dsPIC30Fxxxxxx
MPLAB XC16
Image for reference is attached and mentioned in comments
MPLAB stores double in little-endian method (3rd image attached)
My Confusions are:
1st --> "builtin_mulss" accepts integers so converting "speed" to int, How this will happen? I mean in what way MPLAB converts it(Remember its Q15 Fraction format)
2nd --> How double will be shifted 15 bits to store value in an int (Because there are 17 Bits remaining) and data loss?
3rd --> Can some one expalin the temp1 value?
I am new to MPLAB
dsPIC30Fxxxxxx
MPLAB XC16
Image for reference is attached and mentioned in comments
Code C - [expand] 1 2 3 4 5 6 7 8 #define Speed Q15(0.51) // Fixed Point Math Library // 16 Bit Fraction --> "First Image" int temp1; int distance = 30601 temp1 = ((__builtin_mulss((int) speed,distance))>>15); // Multiplication of both variables // Accepts both signed integers and returns double // 2nd Image attached
MPLAB stores double in little-endian method (3rd image attached)
My Confusions are:
1st --> "builtin_mulss" accepts integers so converting "speed" to int, How this will happen? I mean in what way MPLAB converts it(Remember its Q15 Fraction format)
2nd --> How double will be shifted 15 bits to store value in an int (Because there are 17 Bits remaining) and data loss?
3rd --> Can some one expalin the temp1 value?
I am new to MPLAB