Announcement

Collapse
No announcement yet.

System.Math

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    System.Math

    I am having trouble using Math.Round() in my scripts

    I have the following in my Ini file

    ScriptingReferences = System.Data;System.Data.dll,ChartDirector;C:\Program Files\HomeSeer HS3\netchartdir.dll,System.Data.SQLite;C:\Program Files\HomeSeer HS3\Bin\System.Data.SQLite.dll,System.Math;MScorlib.dll

    I have also tried this

    ScriptingReferences = System.Data;System.Data.dll,ChartDirector;C:\Program Files\HomeSeer HS3\netchartdir.dll,System.Data.SQLite;C:\Program Files\HomeSeer HS3\Bin\System.Data.SQLite.dll,System.Math;system.math.dll

    I have Imports System.Math in my script

    obviously doing something wrong but I dont know what can anybody help?


    thanks Phill

    #2
    You shouldn't need to import it...try this;

    Code:
    Sub Main(ByVal Parms As Object)
    
        Dim SampleValue As Decimal = 2.67889997755
    
        hs.writelog("", Math.Round(SampleValue, 2))
    
    End Sub
    Edit: and you shouldn't need to reference it either..

    Comment


      #3
      Thanks will try

      Yes kinda thought that but when it did not work I thought i would need to reference it I will try simple example you quoted

      Comment


        #4
        Yup Thank You

        Yes as I suspected it was my incompetence causing the issue I tried your code no issues and then went back to mine and found an issue with brackets! That was throwing up this error from which i drew the wrong conclusions lol thanks for letting me know it should work i could have spent ages trying to include nothing!

        Overload resolution failed because no accessible 'Round' can be called without a narrowing conversion: 'Public Shared Function Round(d As Decimal, mode As System.MidpointRounding) As Decimal':

        Comment

        Working...
        X