Changeset 6571 in orxonox.OLD for branches/network
- Timestamp:
- Jan 18, 2006, 3:31:05 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/network/src/lib/network/converter.cc
r6564 r6571 229 229 // printf("Denormalisiert!\n"); 230 230 //printf("DenormConst = %e", getDenormConst()); 231 231 232 232 float sub = 1; 233 233 while (sub < x) … … 251 251 exponent++; 252 252 mantisse /= 2; 253 253 254 254 printf("Conv: mantisse = %i exponent = %i \n", mantisse, exponent); 255 255 256 256 257 257 if (mantisse != 0) 258 258 { … … 262 262 exponent--; 263 263 } 264 264 265 265 mantisse -= expmult; 266 266 } … … 294 294 int hexp = a[2] + a[3] * 256; 295 295 int exponent = (hexp / 128) % 256; 296 296 297 297 int hmant = a[0] + a[1] * 256 + a[2] * 65536; 298 298 int mantisse = hmant % expmult; 299 299 if (mantisse == 0 && exponent == 255) 300 300 return 0; 301 301 302 302 mantisse += expmult; 303 303 exponent -= 128; … … 371 371 // printf("Denormalisiert!\n"); 372 372 //printf("DenormConst = %e", getDenormConst()); 373 373 374 374 float sub = 1; 375 375 while (sub < x) … … 393 393 exponent++; 394 394 mantisse /= 2; 395 395 396 396 397 397 /// printf("Conv: mantisse = %i exponent = %i \n", mantisse, exponent); 398 398 399 399 400 400 if (mantisse != 0) 401 401 { … … 405 405 exponent--; 406 406 } 407 407 408 408 mantisse -= expmult; 409 409 } … … 412 412 /// printf("Conv: mantisse = %i exponent = %i \n", mantisse, exponent); 413 413 414 414 415 415 int hx = mantisse + expmult * exponent; 416 416 int result = intToByteArray(hx, a, length); … … 449 449 int hexp = a[2] + a[3] * 256; 450 450 int exponent = (hexp / 128) % 256; 451 451 452 452 int hmant = a[0] + a[1] * 256 + a[2] * 65536; 453 453 int mantisse = hmant % expmult; 454 454 455 455 //handle 0 456 456 if (mantisse == 0 && exponent == 255) 457 457 return 0; 458 458 459 459 mantisse += expmult; 460 460 exponent -= 128; … … 581 581 int n = Converter::byteArrayToInt( a, &length ); 582 582 583 PRINTF(0)("length = %d\n", length); 584 583 585 s = new char[length+1]; 584 586 … … 602 604 //float x = 8.0f; 603 605 //float x = numeric_limits<float>::infinity(); 604 606 605 607 printf("To Convert: %e\n", x); 606 608 607 609 byte* res = floatToByteArray(x); 608 610 for (int i = 0; i < 4; i++) 609 611 printf("%i ", res[i]); 610 612 printf("\n"); 611 613 612 614 float y = byteArrayToFloat(res); 613 615 printf("ReConvert: %e\n", y); 614 616 615 617 if (x == y) 616 618 printf("equal\n"); … … 622 624 { 623 625 printf("We rulez\n"); 624 626 625 627 //Denormalized? 626 628 //floatTest(-9.87624e-38f); … … 628 630 //floatTest(-9.87624e-36f); 629 631 //floatTest(-9.87624e-35f); 630 632 631 633 /* 632 634 floatTest(14.7f); … … 635 637 floatTest(5.67e-15f); 636 638 */ 637 639 638 640 //floatTest(-18.0098f); 639 641 //floatTest(-24.07e23f);
Note: See TracChangeset
for help on using the changeset viewer.