SetVariableValueDblMethod

Applies to:Fast Math Parser
Class:uCalc.Item
Sets the value of a double precision floating point variable
Syntax
SetVariableValueDbl(Value)
Parameters
Value
double
Double precision floating point value that the variable will be set to
Returns
Nothing
Remarks
Example 1: Setting a variable value

Dim var = uc.DefineVariable("Var")
Dim ByteVar = uc.DefineVariable("ByteVar As Int8")
Dim Int16uVar = uc.DefineVariable("Int16uVar As Int16u")
Dim Int32uVar = uc.DefineVariable("Int32uVar As Int32u")
Dim Int64uVar = uc.DefineVariable("Int64uVar As Int64u")
Dim SingleVar = uc.DefineVariable("SingleVar As Single")
Dim DoubleVar = uc.DefineVariable("DoubleVar As Double")
Dim StringVar = uc.DefineVariable("StringVar As String")

var.SetVariableValue(1.25)
ByteVar.SetVariableValueByte(255)
Int16uVar.SetVariableValueInt16(-1)
Int32uVar.SetVariableValueInt32(-1)
Int64uVar.SetVariableValueInt64(-1)
SingleVar.SetVariableValueSng(1.5)
DoubleVar.SetVariableValueDbl(2.5)
StringVar.SetVariableValueStr("Test")

Console.WriteLine("Var value: " + uc.EvalStr("Var")) ' Returns "Var value: 1.25"
Console.WriteLine("ByteVar value: " + uc.EvalStr("ByteVar")) ' Returns "ByteVar value: -1"
Console.WriteLine("Int16uVar value: " + uc.EvalStr("Int16uVar")) ' Returns "Int16uVar value: 65535"
Console.WriteLine("Int32uVar value: " + uc.EvalStr("Int32uVar")) ' Returns "Int32uVar value: 4294967295"
Console.WriteLine("Int64uVar value: " + uc.EvalStr("Int64uVar")) ' Returns "Int64uVar value: 18446744073709551615"
Console.WriteLine("SingleVar value: " + uc.EvalStr("SingleVar")) ' Returns "SingleVar value: 1.5"
Console.WriteLine("DoubleVar value: " + uc.EvalStr("DoubleVar")) ' Returns "DoubleVar value: 2.5"
Console.WriteLine("StringVar value: " + uc.EvalStr("StringVar")) ' Returns "StringVar value: Test"

          

var var = uc.DefineVariable("Var");
var ByteVar = uc.DefineVariable("ByteVar As Int8");
var Int16uVar = uc.DefineVariable("Int16uVar As Int16u");
var Int32uVar = uc.DefineVariable("Int32uVar As Int32u");
var Int64uVar = uc.DefineVariable("Int64uVar As Int64u");
var SingleVar = uc.DefineVariable("SingleVar As Single");
var DoubleVar = uc.DefineVariable("DoubleVar As Double");
var StringVar = uc.DefineVariable("StringVar As String");

var.SetVariableValue(1.25);
ByteVar.SetVariableValueByte(255);
Int16uVar.SetVariableValueInt16(-1);
Int32uVar.SetVariableValueInt32(-1);
Int64uVar.SetVariableValueInt64(-1);
SingleVar.SetVariableValueSng((float)1.5);
DoubleVar.SetVariableValueDbl(2.5);
StringVar.SetVariableValueStr("Test");

Console.WriteLine("Var value: " + uc.EvalStr("Var")); // Returns "Var value: 1.25";
Console.WriteLine("ByteVar value: " + uc.EvalStr("ByteVar")); // Returns "ByteVar value: -1";
Console.WriteLine("Int16uVar value: " + uc.EvalStr("Int16uVar")); // Returns "Int16uVar value: 65535";
Console.WriteLine("Int32uVar value: " + uc.EvalStr("Int32uVar")); // Returns "Int32uVar value: 4294967295";
Console.WriteLine("Int64uVar value: " + uc.EvalStr("Int64uVar")); // Returns "Int64uVar value: 18446744073709551615";
Console.WriteLine("SingleVar value: " + uc.EvalStr("SingleVar")); // Returns "SingleVar value: 1.5";
Console.WriteLine("DoubleVar value: " + uc.EvalStr("DoubleVar")); // Returns "DoubleVar value: 2.5";
Console.WriteLine("StringVar value: " + uc.EvalStr("StringVar")); // Returns "StringVar value: Test";

          

//var Var = uc.DefineVariable('Var');
//var ByteVar = uc.DefineVariable('ByteVar As Int8');
//var Int16uVar = uc.DefineVariable('Int16uVar As Int16u');
//var Int32uVar = uc.DefineVariable('Int32uVar As Int32u');
//var Int64uVar = uc.DefineVariable('Int64uVar As Int64u');
//var SingleVar = uc.DefineVariable('SingleVar As Single');
//var DoubleVar = uc.DefineVariable('DoubleVar As Double');
//var StringVar = uc.DefineVariable('StringVar As String');

      var.SetVariableValue(1.25);
      ByteVar.SetVariableValueByte(255);
      Int16uVar.SetVariableValueInt16(-1);
      Int32uVar.SetVariableValueInt32(-1);
      Int64uVar.SetVariableValueInt64(-1);
      SingleVar.SetVariableValueSng(1.5);
      DoubleVar.SetVariableValueDbl(2.5);
      StringVar.SetVariableValueStr('Test');

      WriteLn('Var value: ' + uc.EvalStr('Var')); // Returns 'Var value: 1.25';
      WriteLn('ByteVar value: ' + uc.EvalStr('ByteVar')); // Returns 'ByteVar value: -1';
      WriteLn('Int16uVar value: ' + uc.EvalStr('Int16uVar')); // Returns 'Int16uVar value: 65535';
      WriteLn('Int32uVar value: ' + uc.EvalStr('Int32uVar')); // Returns 'Int32uVar value: 4294967295';
      WriteLn('Int64uVar value: ' + uc.EvalStr('Int64uVar')); // Returns 'Int64uVar value: 18446744073709551615';
      WriteLn('SingleVar value: ' + uc.EvalStr('SingleVar')); // Returns 'SingleVar value: 1.5';
      WriteLn('DoubleVar value: ' + uc.EvalStr('DoubleVar')); // Returns 'DoubleVar value: 2.5';
      WriteLn('StringVar value: ' + uc.EvalStr('StringVar')); // Returns 'StringVar value: Test';

          

auto var = uc.DefineVariable("Var");
auto ByteVar = uc.DefineVariable("ByteVar As Int8");
auto Int16uVar = uc.DefineVariable("Int16uVar As Int16u");
auto Int32uVar = uc.DefineVariable("Int32uVar As Int32u");
auto Int64uVar = uc.DefineVariable("Int64uVar As Int64u");
auto SingleVar = uc.DefineVariable("SingleVar As Single");
auto DoubleVar = uc.DefineVariable("DoubleVar As Double");
auto StringVar = uc.DefineVariable("StringVar As String");

var.SetVariableValue(1.25);
ByteVar.SetVariableValueByte(255);
Int16uVar.SetVariableValueInt16(-1);
Int32uVar.SetVariableValueInt32(-1);
Int64uVar.SetVariableValueInt64(-1);
SingleVar.SetVariableValueSng((float)1.5);
DoubleVar.SetVariableValueDbl(2.5);
StringVar.SetVariableValueStr("Test");

cout << "Var value: " << uc.EvalStr("Var") << endl; // Returns "Var value: 1.25";
cout << "ByteVar value: " << uc.EvalStr("ByteVar") << endl; // Returns "ByteVar value: -1";
cout << "Int16uVar value: " << uc.EvalStr("Int16uVar") << endl; // Returns "Int16uVar value: 65535";
cout << "Int32uVar value: " << uc.EvalStr("Int32uVar") << endl; // Returns "Int32uVar value: 4294967295";
cout << "Int64uVar value: " << uc.EvalStr("Int64uVar") << endl; // Returns "Int64uVar value: 18446744073709551615";
cout << "SingleVar value: " << uc.EvalStr("SingleVar") << endl; // Returns "SingleVar value: 1.5";
cout << "DoubleVar value: " << uc.EvalStr("DoubleVar") << endl; // Returns "DoubleVar value: 2.5";
cout << "StringVar value: " << uc.EvalStr("StringVar") << endl; // Returns "StringVar value: Test";

          

auto var = uc.DefineVariable("Var");
auto ByteVar = uc.DefineVariable("ByteVar As Int8");
auto Int16uVar = uc.DefineVariable("Int16uVar As Int16u");
auto Int32uVar = uc.DefineVariable("Int32uVar As Int32u");
auto Int64uVar = uc.DefineVariable("Int64uVar As Int64u");
auto SingleVar = uc.DefineVariable("SingleVar As Single");
auto DoubleVar = uc.DefineVariable("DoubleVar As Double");
auto StringVar = uc.DefineVariable("StringVar As String");

var.SetVariableValue(1.25);
ByteVar.SetVariableValueByte(255);
Int16uVar.SetVariableValueInt16(-1);
Int32uVar.SetVariableValueInt32(-1);
Int64uVar.SetVariableValueInt64(-1);
SingleVar.SetVariableValueSng((float)1.5);
DoubleVar.SetVariableValueDbl(2.5);
StringVar.SetVariableValueStr("Test");

Console::WriteLine("Var value: " + uc.EvalStr("Var")); // Returns "Var value: 1.25";
Console::WriteLine("ByteVar value: " + uc.EvalStr("ByteVar")); // Returns "ByteVar value: -1";
Console::WriteLine("Int16uVar value: " + uc.EvalStr("Int16uVar")); // Returns "Int16uVar value: 65535";
Console::WriteLine("Int32uVar value: " + uc.EvalStr("Int32uVar")); // Returns "Int32uVar value: 4294967295";
Console::WriteLine("Int64uVar value: " + uc.EvalStr("Int64uVar")); // Returns "Int64uVar value: 18446744073709551615";
Console::WriteLine("SingleVar value: " + uc.EvalStr("SingleVar")); // Returns "SingleVar value: 1.5";
Console::WriteLine("DoubleVar value: " + uc.EvalStr("DoubleVar")); // Returns "DoubleVar value: 2.5";
Console::WriteLine("StringVar value: " + uc.EvalStr("StringVar")); // Returns "StringVar value: Test";

          
DLL import code
<DllImport(uCalcDLL, CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.Cdecl, EntryPoint:="SetVariableValueDbl")> _

Private Sub SetVariableValueDbl__(ByVal ItemHandle As IntPtr,ByVal Value As Double)
End Sub
            
[DllImport(uCalcDLL, CharSet=CharSet.Ansi, CallingConvention=CallingConvention.Cdecl, EntryPoint="SetVariableValueDbl")]

protected static extern  void SetVariableValueDbl_(IntPtr ItemHandle, double Value);
            
{DLLImport}procedure SetVariableValueDbl__(ItemHandle: System.Pointer;Value: Double); cdecl; external uCalcDLL name 'SetVariableValueDbl';

            
typedef  void (* __SetVariableValueDbl)(void *ItemHandle, double Value); 

            
[DllImport(uCalcLib, CharSet=CharSet::Ansi, CallingConvention=CallingConvention::Cdecl, EntryPoint = "SetVariableValueDbl")]

static void SetVariableValueDbl_(void *  ItemHandle, double Value);
            
See also
Prev | Next