Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. int speed1 = (int)(6.2f * 10);
  2. float tmp = 6.2f * 10;
  3. int speed2 = (int)tmp;
  4.  
  5. speed1 = 61
  6. speed2 = 62
  7.  
  8. IL_01b3: ldloc.s V_8
  9. IL_01b5: callvirt instance float32 myPackage.MyClass::getSpeed()
  10. IL_01ba: ldc.r4 10.
  11. IL_01bf: mul
  12. IL_01c0: conv.i4
  13. IL_01c1: stloc.s V_9
  14.  
  15. IL_01c3: ldloc.s V_8
  16. IL_01c5: callvirt instance float32 myPackage.MyClass::getSpeed()
  17. IL_01ca: ldc.r4 10.
  18. IL_01cf: mul
  19. IL_01d0: stloc.s V_10
  20. IL_01d2: ldloc.s V_10
  21. IL_01d4: conv.i4
  22. IL_01d5: stloc.s V_11
  23.  
  24. double d = 6.2f * 10;
  25. int tmp2 = (int)d;
  26. // evaluate tmp2
  27.  
  28. DoubleConverter.ToExactString((6.2f * 10))
  29. // output 61.9999980926513671875
  30.  
  31. IL_0000: ldc.i4.s 3D // speed1 = 61
  32. IL_0002: stloc.0
  33. IL_0003: ldc.r4 00 00 78 42 // tmp = 62.0f
  34. IL_0008: stloc.1
  35. IL_0009: ldloc.1
  36. IL_000A: conv.i4
  37. IL_000B: stloc.2
  38.  
  39. int speed1 = (int)(6.2f * 10);
  40. mov dword ptr [rbp+8],3Dh //result is precalculated (61)
  41.  
  42. float tmp = 6.2f * 10;
  43. movss xmm0,dword ptr [000004E8h] //precalculated (float format, xmm0=0x42780000 (62.0))
  44. movss dword ptr [rbp+0Ch],xmm0
  45.  
  46. int speed2 = (int)tmp;
  47. cvttss2si eax,dword ptr [rbp+0Ch] //instrunction converts float to Int32 (eax=62)
  48. mov dword ptr [rbp+10h],eax
  49.  
  50. Int32 speed0 = (Int32)(6.2f * 100000000);
  51.  
  52. int speed1 = (int)(6.2f * 10)
  53.  
  54. int speed1 = Int.Parse((6.2f * 10).ToString());
  55.  
  56. int speed1 = (int)(6.2f * 10);//61
  57. double speed2 = (6.2f * 10);//61.9999980926514
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement