Displaying Integer (Int32) results with Evaluate32
ID: 32
using uCalcSoftware;
var uc = new uCalc();
var VariableX = uc.DefineVariable("x");
var ParsedExpr = uc.Parse("x / 2", "Integer"); // Causes output of "x / 2" to convert to an integer
// NOTE: EvaluateInt32 should only be used when Parse() explicitly specifies Integer
// (Or Int, or Int32) as the second argument, or if the expression evaluates to an integer
// (such as evaluating a variable that was explicitly defined as integer;
// other arithmetic operators typically evaluate to Double floating point).
for (double x = 1; x <= 10; x++) {
VariableX.Value(x);
Console.WriteLine("x = " + VariableX.ValueStr() + " Result = " + (ParsedExpr.EvaluateInt32()).ToString());
}
ParsedExpr.Release();
VariableX.Release();
x = 1 Result = 0
x = 2 Result = 1
x = 3 Result = 1
x = 4 Result = 2
x = 5 Result = 2
x = 6 Result = 3
x = 7 Result = 3
x = 8 Result = 4
x = 9 Result = 4
x = 10 Result = 5 using uCalcSoftware; var uc = new uCalc(); var VariableX = uc.DefineVariable("x"); var ParsedExpr = uc.Parse("x / 2", "Integer"); // Causes output of "x / 2" to convert to an integer // NOTE: EvaluateInt32 should only be used when Parse() explicitly specifies Integer // (Or Int, or Int32) as the second argument, or if the expression evaluates to an integer // (such as evaluating a variable that was explicitly defined as integer; // other arithmetic operators typically evaluate to Double floating point). for (double x = 1; x <= 10; x++) { VariableX.Value(x); Console.WriteLine("x = " + VariableX.ValueStr() + " Result = " + (ParsedExpr.EvaluateInt32()).ToString()); } ParsedExpr.Release(); VariableX.Release();
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
auto VariableX = uc.DefineVariable("x");
auto ParsedExpr = uc.Parse("x / 2", "Integer"); // Causes output of "x / 2" to convert to an integer
// NOTE: EvaluateInt32 should only be used when Parse() explicitly specifies Integer
// (Or Int, or Int32) as the second argument, or if the expression evaluates to an integer
// (such as evaluating a variable that was explicitly defined as integer;
// other arithmetic operators typically evaluate to Double floating point).
for (double x = 1; x <= 10; x++) {
VariableX.Value(x);
cout << "x = " + VariableX.ValueStr() + " Result = " + to_string(ParsedExpr.EvaluateInt32()) << endl;
}
ParsedExpr.Release();
VariableX.Release();
}
x = 1 Result = 0
x = 2 Result = 1
x = 3 Result = 1
x = 4 Result = 2
x = 5 Result = 2
x = 6 Result = 3
x = 7 Result = 3
x = 8 Result = 4
x = 9 Result = 4
x = 10 Result = 5 #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; auto VariableX = uc.DefineVariable("x"); auto ParsedExpr = uc.Parse("x / 2", "Integer"); // Causes output of "x / 2" to convert to an integer // NOTE: EvaluateInt32 should only be used when Parse() explicitly specifies Integer // (Or Int, or Int32) as the second argument, or if the expression evaluates to an integer // (such as evaluating a variable that was explicitly defined as integer; // other arithmetic operators typically evaluate to Double floating point). for (double x = 1; x <= 10; x++) { VariableX.Value(x); cout << "x = " + VariableX.ValueStr() + " Result = " + to_string(ParsedExpr.EvaluateInt32()) << endl; } ParsedExpr.Release(); VariableX.Release(); }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Dim VariableX = uc.DefineVariable("x")
Dim ParsedExpr = uc.Parse("x / 2", "Integer") '// Causes output of "x / 2" to convert to an integer
'// NOTE: EvaluateInt32 should only be used when Parse() explicitly specifies Integer
'// (Or Int, or Int32) as the second argument, or if the expression evaluates to an integer
'// (such as evaluating a variable that was explicitly defined as integer;
'// other arithmetic operators typically evaluate to Double floating point).
For x As Double = 1 To 10
VariableX.Value(x)
Console.WriteLine("x = " + VariableX.ValueStr() + " Result = " + (ParsedExpr.EvaluateInt32()).ToString())
Next
ParsedExpr.Release()
VariableX.Release()
End Sub
End Module
x = 1 Result = 0
x = 2 Result = 1
x = 3 Result = 1
x = 4 Result = 2
x = 5 Result = 2
x = 6 Result = 3
x = 7 Result = 3
x = 8 Result = 4
x = 9 Result = 4
x = 10 Result = 5 Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Dim VariableX = uc.DefineVariable("x") Dim ParsedExpr = uc.Parse("x / 2", "Integer") '// Causes output of "x / 2" to convert to an integer '// NOTE: EvaluateInt32 should only be used when Parse() explicitly specifies Integer '// (Or Int, or Int32) as the second argument, or if the expression evaluates to an integer '// (such as evaluating a variable that was explicitly defined as integer; '// other arithmetic operators typically evaluate to Double floating point). For x As Double = 1 To 10 VariableX.Value(x) Console.WriteLine("x = " + VariableX.ValueStr() + " Result = " + (ParsedExpr.EvaluateInt32()).ToString()) Next ParsedExpr.Release() VariableX.Release() End Sub End Module