title: Convert 4 bytes into 32-bit Float in CAPL?
body: <p>I Want to convert a CAN Message(4Bytes) into a Float value.</p>
  
  <p>I'm reading a value from the current sensor and convert into 4 bytes send them using CAN Shield to Vector CANoe.In the Arduino program, converted the float value into bytes and back again is possible using Unions. In CAPL, I Can't use unions &amp; pointers.</p>
  
  <p>Arduino code:</p>
  
  <pre><code>unsigned char arr[4] = {0,0,0,0};
  
  typedef union
  {
   float number;
   uint8_t bytes[4];
  } floatunion;
  
  floatunion myFloat;
  
  myFloat.number = lowAmps; // Assign a converted current value to the float
  
  lowRawValue = AvgSnsrData[0]; //Input Sensor Data
  lowVoltage = (lowRawValue / 1024.0) * 5000; // Gets you mV
  lowAmps = ((lowVoltage - ACoffset) / mVperAmp);
  
  for (int i=0; i&lt;4; i++)
  {
       Serial.print(myFloat.bytes[i], HEX); // Print the hex representation of the float
       Serial.print(' ');
       arr[i] = myFloat.bytes[i]; //Save in unsigned char array 
  }
  I've tried a few from web(https://stackoverflow.com/questions/52590435/capl-converting-4-raw-bytes-into-floating-point) but nothing works well.
  
  </code></pre>
  
  <p>Also tried:</p>
  
  <pre><code>float test = (myFloat.bytes[3]&lt;&lt;24|myFloat.bytes[2]&lt;&lt;16|myFloat.bytes[1]&lt;&lt;8|myFloat.bytes[0]&lt;&lt;0);
  </code></pre>
  
  <p>Is there is anyway to convert this without using union or pointer in CAPL/C?
  Any builtin function in CAPL?</p>
  
  <p>Thanks in Advance. </p>