Bug? Convert Int to String (Version 3.0.)

Nino C.

Member
Licensed User
Longtime User
Convert Int to String does not work well after the random function only with rapid debug (debug legacy is fine)

Source is attached

Regards

Nino
 

Attachments

  • Bug_IntToStr.zip
    446.6 KB · Views: 358

Nino C.

Member
Licensed User
Longtime User
No errors, but the value of the string is not correct. It happens only with rapid debug

Regards
Nino
 

notedop

Member
Licensed User
Longtime User
I have as similar issue with Rapid debug. INT is not acting as an INT, I am unable to multiply it.
B4X:
Sub combine(male AsList, female AsList)
Dim m_result AsList
Dim f_result AsList
Dim m_percent AsList
Dim f_percent AsList
m_result.Initialize
f_result.Initialize
m_percent.Initialize
f_percent.Initialize
m_result = male.Get(0)
m_percent = male.Get(1)
f_result = female.Get(0)
f_percent = female.Get(1)
Main.SQL1.BeginTransaction
Try
  Main.SQL1.ExecNonQuery("DELETE FROM data")
  For i = 0To m_result.Size-1
 
  For j = 0To f_result.Size-1
  Log( m_result.Get(i) & "/" & f_result.Get(j) & "'," & (m_percent.Get(i) * f_percent.Get(j)) & ")")
  Log( m_percent.Get(i) * f_percent.Get(j) )
  Log( f_percent.Get(j))
  Main.SQL1.ExecNonQuery("INSERT INTO data (genetics, percent) VALUES ('" & m_result.Get(i) & "/" & f_result.Get(j) & "'," & (m_percent.Get(i) * f_percent.Get(j)) & ")")
  Next
  Next
 
  Main.SQL1.TransactionSuccessful
Catch
  Log(LastException.Message)
EndTry
Main.SQL1.EndTransaction
Dim Cursor1 AsCursor
Dim test AsList
test.Initialize
Cursor1 = Main.SQL1.ExecQuery("SELECT DISTINCT(genetics), SUM(percent) FROM data GROUP BY genetics, percent")
For i = 0To Cursor1.RowCount -1
  Cursor1.Position=i
  test.Add(Cursor1.getstring2(0) & " - " & Round2((Cursor1.GetString2(1) * 100), 2) & "%")
Next
Cursor1.Close
Msgbox(test, "Output")
End Sub
Normal debug mode output
B4X:
bl*tq_D/bl+_D+',0.215)
0.215
0.5
bl*tq_D/bl+_D+',0.215)
0.215
0.5
bl+_D+/bl+_D+',0.215)
0.215
0.5
bl+_D+/bl+_D+',0.215)
0.215
0.5
bl*tq_D+/bl+_D+',0.035)
0.035
0.5
bl*tq_D+/bl+_D+',0.035)
0.035
0.5
bl+_D/bl+_D+',0.035)
0.035
0.5
bl+_D/bl+_D+',0.035)
0.035
0.5
Rapid debug mode output As you can see, where I multiply the percentages with each other, I now get Zero (0). Integers are not multiplying.
B4X:
bl*tq_D/bl+_D+',0)
0
0.5
bl*tq_D/bl+_D+',0)
0
0.5
bl+_D+/bl+_D+',0)
0
0.5
bl+_D+/bl+_D+',0)
0
0.5
bl*tq_D+/bl+_D+',0)
0
0.5
bl*tq_D+/bl+_D+',0)
0
0.5
bl+_D/bl+_D+',0)
0
0.5
bl+_D/bl+_D+',0)
0
0.5
 

notedop

Member
Licensed User
Longtime User
in addition, rapid debug mode seems to affect the speed significantly of the application. Where it normally reacts instantly, it now takes up to 5 seconds to perform simple code.

edit. this is on the AVD manager, have not tried on real device yet with rapid debug.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
This is the result I see:

upload_2013-10-20_9-9-53.png


Do you get a different result?

I'm running a slightly modified version.
 

Nino C.

Member
Licensed User
Longtime User
Your value is good, I get these values:

Int=142 > String=1167677320
Int=115 > String=1167814144
Int=112 > String=1167849008
Int=185 > String=1167891696
Int=158 > String=1167954608
... etc.

Regards
Nino
 

TheMightySwe

Active Member
Licensed User
Longtime User
Hi,

I have a similar problem.

I get a NullException on this code, and it's has been working for ages. But after 3.0 i get a NullException.

This_Item.ID = 5 and in the database unit_id = 1 and of the type INTEGER

This_Item.Unit_ID = SQL.Register_Data.ExecQuerySingleResult("SELECT unit_id FROM items WHERE id = " & This_Item.ID)
 
Top