Series of know issues articles are showing known issue itself about Small Basic and it's workaround.


Phenomenon

Decimal (e.g. 2.5) + "" becomes 0 when the decimal has a decimal point set as "," (comma) in Control Panel.  Normally, if the decimal point is set as "." (dot) then, a decimal (e.g. 2.5) + "" becomes the decimal (e.g. 2.5).  This issue still remains from SB 1.0 to SB 1.3.

Reproduce Steps

  1. Select "Change date, time or number formats" in "Clock, Language and Region" in Control Panel.
  2. Push [Additional settings] button.
  3. Type "," (comma) in "Decimal symbol" text box.
  4. Push [OK] button in the Numbers tag.
  5. Push [OK] button in the Formats tag.
  6. Run following code.
  7. The code shows a=2,5 and b=0.
a = 2.5 + ""
b = a * 1
TextWindow.WriteLine("a=" + a)
TextWindow.WriteLine("b=" + b)

Workaround

A program NML535-1 has this issue in following line.

    Shapes.Rotate(shp["obj"], angle + shp["angle"])

Workaround is not to add null text to decimal. Fixed program NML535-2 has following code instead of the code above.

    If shp["angle"] = "" Then
      a = angle
    Else
      a = angle + shp["angle"]
    EndIf
    Shapes.Rotate(shp["obj"], a)

See Also