Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 30, 2005, 1:57:12 AM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: merged the network branche back to the trunk, so we do not get away from each other to fast

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/subprojects/network/network_unit_test.cc

    r6139 r6341  
    284284}
    285285
    286 
     286void testFloatConverter(float f)
     287{
     288  char* s = Converter::floatToBinString(f);
     289  printf("%f = ", f);
     290  printf(s); printf("\n");
     291 
     292  byte* res = Converter::floatToByteArray(f);
     293  printf("Byte Array: ");
     294  for (int i = 0; i < 4; i++)
     295    printf("%i  ", res[i]);
     296  printf("\n");
     297 
     298  float b = Converter::byteArrayToFloat(res);
     299  printf("ReConvert: %f \n", b);
     300}
     301
     302void testFloatConverter2(float f)
     303{
     304  char* s = Converter::floatToBinString(f);
     305  printf("### %f = ", f);
     306  printf(s); printf("\n");
     307 
     308  byte* res = Converter::_floatToByteArray(f);
     309  printf("Byte Array: ");
     310  for (int i = 0; i < 4; i++)
     311    printf("%i  ", res[i]);
     312  printf("\n");
     313 
     314  float b = Converter::_byteArrayToFloat(res);
     315  printf("ReConvert: %f \n", b);
     316}
    287317int converter(int argc, char** argv)
    288318{
     319  /*
    289320  int x = 200564786;
    290321  printf("To convert: %i\n", x);
     
    305336  printf("\n");
    306337 
     338  */
     339  /*
    307340  float y;
    308341  char* s;
     
    328361  printf(s); printf("\n");
    329362 
    330  
     363  y = -4.7824f;
     364  s = Converter::floatToBinString(y);
     365  printf("%f = ", y);
     366  printf(s); printf("\n");
     367 
     368  y = -14.35e14f;
     369  s = Converter::floatToBinString(y);
     370  printf("%f = ", y);
     371  printf(s); printf("\n");
     372                                                            */
     373 
     374 
     375  /*
     376  float a = 12.3f;
     377 
     378  char* s = Converter::floatToBinString(a);
     379  printf("%f = ", a);
     380  printf(s); printf("\n");
     381 
     382  byte* res = Converter::floatToByteArray(a);
     383  printf("Byte Array: \n");
     384  for (int i = 0; i < 4; i++)
     385    printf("%i  ", res[i]);
     386  printf("\n");
     387 
     388  float b = Converter::byteArrayToFloat(res);
     389  printf("ReConvert: %f \n", b);
     390  */
     391//  testFloatConverter(12.3e-53f); printf("\n");
     392//  testFloatConverter(134.26455646546548741661675165f); printf("\n");
     393 // testFloatConverter(35.67e14f); printf("\n");
     394 
     395  testFloatConverter(12.3e-7f); printf("\n");
     396  testFloatConverter(134.26455646546548741661675165f); printf("\n");
     397  testFloatConverter(35.67e14f); printf("\n");
    331398 
    332399  return 0;
Note: See TracChangeset for help on using the changeset viewer.