Options

Multiplication of Dotnet double

jimmyfjimmyf Member Posts: 103
I have defined three dotnet variables of type system.double.

System.Double.'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'

How do I multiply these together? if I try and perform the following double1 := double2 * double3; I get the following error when compiling

Type conversion is not possible because one of the operators contains an invalid type. Dotnet * Dotnet

Answers

  • Options
    txerifftxeriff Member Posts: 492
    Hi,

    I would suggest you retrieve the values in NAV decimal variables and then, do the math.

    mydotnet1:=mydotnet1.dotnet1();
    mydotnet2:=mydotnet2.dotnet2();

    result1:=mydotnet1.operation1;
    result2:=mydotnet2.operation2;

    finalres:=result1*result2;

    maybe like this?
  • Options
    NavNabNavNab Member Posts: 181
    Hi,

    Try to run this code to understand what is happening:
    MESSAGE('%1', D1.Parse('0,5') * D2.Parse('8'));
    MESSAGE('%1\%2\%3',  D1.Double, D2.Double, D1.Parse('1,5') * D2.Parse('2,0'));
    

    P.S: you may need to adapt the decimal separator inside Parse('1,5').

    But, why are you trying to do this? Why don't you use NAV decimals: System.Double is mapped to NAV Decimal:

    https://msdn.microsoft.com/en-us/library/hh165619(v=nav.90).aspx
Sign In or Register to comment.