uCalc API Version: 5.7.0-preview.1 Released: 7/30/2026
Warning
uCalc API Preview Release Notice:This preview documentation describes the intended behavior of the API. It is not fully accurate or complete.The current preview build contains incomplete features, unoptimized performance, and is subject to breaking changes.Use of the preview version in your production code is not recommended.
Product:
Class:
Sets the value of a variable that was defined with the 'Single' (32-bit float) data type.
This method does not return a value.
This method sets the value of a uCalc variable that was specifically defined as a Single (a 32-bit floating-point number).
It is the type-safe and recommended way to update single-precision variables from your host application. The variable must first be created using a method like DefineVariable, explicitly specifying the type:
var myFloat = uc.DefineVariable("myFloat As Single");myFloat.ValueSng(1.23);
vs. Value(string): You could set the value using the generic string-based Value("1.23"), but ValueSng is more efficient. It avoids the overhead of parsing and evaluating a string, passing the native float value directly to the engine.
vs. Direct Memory Binding: For maximum performance in C++ or unsafe C#, you can bind a uCalc variable directly to a host variable's memory address when calling DefineVariable. This creates a live link, eliminating the need for setter methods entirely. ValueSng provides a safe, cross-platform alternative that does not require direct memory manipulation.