PBXB64 Data Types

Expanded Data Types Introduced in V15

PBXB64 V18 retains the complete managed UN family introduced in V15 alongside standard PowerBASIC types and specialized numeric, COM, string, and wide-integer extensions: UNL, UNF, UNB, UNC, UNI, and UNQ.

Complete Type Reference

TypeSizeDescriptionStatus
BYTE8-bitUnsigned integer (0-255)Standard
WORD16-bitUnsigned integer (0-65535)Standard
INTEGER16-bitSigned integer (-32768 to 32767)Standard
LONG64-bitSigned integer (PBXB64 default is 64-bit)Standard
DWORD32-bitUnsigned integerStandard
QUAD64-bitSigned integer aliasStandard
SINGLE32-bitIEEE-754 floatStandard
DOUBLE64-bitIEEE-754 doubleStandard
EXTENDED80-bitExtended precision floatStandard
CURRENCY64-bitFixed-point (×10000)Standard
CURRENCYX16-byteExtended fixed-point (V12)NEW
STRINGDynamicANSI variable-length stringStandard
WSTRINGDynamicWide-character (UTF-16) stringStandard
STRINGZDynamicNull-terminated ANSI stringNEW
WSTRINGZDynamicNull-terminated wide stringNEW
DEC12816-byteDecimal fixed-point, 18-digit precisionNEW
RATIONAL16-byteExact rational (int64 num/den, auto-GCD)NEW
UNLManagedArbitrary-precision signed integerV15
UNFManagedArbitrary-precision decimalV15
UNBManagedArbitrary-precision big floatV15
UNCManagedComplex number with two UN componentsV15
UNIManagedInterval value with lower and upper componentsV15
UNQManagedFour-component quaternionV15
VARIANT16-byteCOM-compatible (VT_I8, VT_R8, VT_BSTR)NEW
OBJECT8-byteCOM object referenceNEW
GUID16-byte128-bit UUIDNEW
128-bit int16-byteInline 128-bit arithmeticNEW
256-bit int32-byteInline 256-bit arithmeticNEW
512-bit int64-byteInline 512-bit arithmeticNEW

The V15 UN Family

These managed types store numbers beyond the fixed limits of native machine types. They support declarations, assignments, conversions, arithmetic, comparisons, globals, parameters, return values, fixed and dynamic arrays, and automatic cleanup.

TypePurposeString formConversion
UNLArbitrary-precision signed integer. Also supports FOR, INCR, DECR, SWAP, division, remainder, bitwise operations, and shifts.-123456789...VALUNL() / UNL$()
UNFArbitrary-precision decimal. UNFPRECISION() reads or sets the decimal precision used by operations such as division.12.34VALUNF() / UNF$()
UNBArbitrary-precision big floating-point value.-7.5VALUNB() / UNB$()
UNCComplex number with real and imaginary UN components.real;imagVALUNC() / UNC$()
UNIInterval value represented by lower and upper UN components.lower;upperVALUNI() / UNI$()
UNQQuaternion represented by four UN components.a;b;c;dVALUNQ() / UNQ$()
UN types - parsing, precision, and string conversion
FUNCTION PBMAIN() AS LONG LOCAL huge AS UNL LOCAL decimalValue AS UNF LOCAL complexValue AS UNC LOCAL quaternion AS UNQ LOCAL precision AS LONG huge = VALUNL("999999999999999999999999999999") precision = UNFPRECISION(64) decimalValue = VALUNF("1.25") complexValue = VALUNC("3;4") quaternion = VALUNQ("1;2;3;4") PRINT UNL$(huge) PRINT UNF$(decimalValue) PRINT UNC$(complexValue) PRINT UNQ$(quaternion) FUNCTION = 0 END FUNCTION

Scalar assignment to UNC, UNI, or UNQ fills the first component and initializes the remaining components to zero. Invalid UN literals and conversions produce explicit diagnostics.

UNL and UNx in Real Code

The UN family is superior when a fixed native type would overflow, lose required precision, or force several related numeric components into a hand-built structure. The values remain strongly typed, work with PBXB64 expressions and calls, and clean up their managed storage automatically. Native integers and floating-point types remain the faster, smaller choice when their range and precision are sufficient.

UNL - integers beyond 64 bits

Exact large-integer arithmetic
LOCAL huge AS UNL, result AS UNL huge = VALUNL("999999999999999999999999999999") result = huge * huge + 1 PRINT UNL$(result)

Why it is better here: no 64-bit overflow and no manual digit-array code. UNL also participates in loops, division, MOD, bit operations, shifts, INCR, DECR, and SWAP.

UNF - controlled decimal precision

80-digit decimal division
LOCAL one AS UNF, three AS UNF, quotient AS UNF LOCAL precision AS LONG precision = UNFPRECISION(80) one = VALUNF("1") three = VALUNF("3") quotient = one / three PRINT UNF$(quotient)

Why it is better here: precision is selected for the problem instead of being fixed by DOUBLE. This is useful for long decimal calculations and repeatable high-precision results.

UNB - arbitrary-precision big float

Big-float values without a third-party library
LOCAL base AS UNB, delta AS UNB, total AS UNB base = VALUNB("40.25") delta = VALUNB("1.75") total = base + delta PRINT UNB$(total) ' 42

Why it is better here: large floating-point-style values stay in a native PBXB64 type, with parsing, arithmetic, comparison, and string conversion built in.

UNC - native complex arithmetic

Real and imaginary components
LOCAL leftValue AS UNC, rightValue AS UNC, product AS UNC leftValue = VALUNC("1;2") rightValue = VALUNC("3;4") product = leftValue * rightValue PRINT UNC$(product) ' -5;10

Why it is better here: real and imaginary components travel as one managed value. Multiplication, calls, returns, arrays, and conversion do not require a custom UDT or external complex-number package.

UNI - lower and upper bounds together

Typed interval values
LOCAL rangeA AS UNI, rangeB AS UNI, combined AS UNI rangeA = VALUNI("1;2") rangeB = VALUNI("3;4") combined = rangeA + rangeB PRINT UNI$(combined) ' 4;6

Why it is better here: lower and upper components cannot accidentally be separated. Interval values can be assigned, compared, passed, returned, and converted as one typed unit.

UNQ - four-component quaternions

Quaternion values in one expression
LOCAL rotationA AS UNQ, rotationB AS UNQ, result AS UNQ rotationA = VALUNQ("1;2;3;4") rotationB = VALUNQ("5;6;7;8") result = rotationA + rotationB PRINT UNQ$(result) ' 6;8;10;12

Why it is better here: all four components remain one first-class value for arithmetic, arrays, parameters, and returns, avoiding repetitive component-management code.

Native H-Lib Data Structure Types

PBXB64 also treats the native H-Lib containers as first-class managed data types. All 22 core families plus the Safe synchronized wrapper are built into the compiler, require no COM object or external library, use dot-method syntax, and release their internal storage automatically when the declaring scope ends.

GroupFamiliesTypical use
SequencesArr, Stk, Que, Lst, Str, 2DDynamic arrays, stacks, queues, linked lists, string builders, and two-dimensional arrays.
Maps and searchHsh, Tre, DTre, TriHash maps, ordered AVL maps, bidirectional maps, and prefix tries.
Priority and setsHeap, Deque, Set, Multiset, SkipList, B+ TreePriority queues, double-ended queues, unique or counted sets, and ordered indexes.
Graphs and spatialGraph, Union-Find, QuadtreeGraph traversal, disjoint sets, and two-dimensional spatial indexing.
SpecializedLRU Cache, Ring, Bloom Filter, SafeBounded caches, circular buffers, probabilistic membership tests, and synchronized stacks.

Type prefixes select the stored PB value: for example LnArr stores LONG, DbArr stores DOUBLE, SsArr stores ANSI strings, and WsArr stores Unicode strings. Up to 13 element variants across the families provide more than 125 recognized container types; supported families can also use UDT element forms such as AS LnArr OF MyType.

H-Lib type - managed dynamic array
LOCAL values AS LnArr values.New values.Push 10 values.Push 20 PRINT values.Count PRINT values.Pop ' values.Final is emitted automatically at scope exit
Explore all H-Lib families and methods

DEC128 - 18-Digit Decimal Precision

PBXB64 Addition A 16-byte decimal fixed-point type with 18-digit precision. Ideal for financial calculations where binary floating-point rounding errors are unacceptable.

DEC128 - Financial precision
FUNCTION PBMAIN() AS LONG LOCAL price AS DEC128 LOCAL tax AS DEC128 LOCAL total AS DEC128 price = 19.99 ' Exact decimal tax = 0.07 ' Exact 7% total = price * (1 + tax) ' Result is exact: 21.3893, not 21.389299999999996 PRINT "Total: "; total FUNCTION = 0 END FUNCTION

DEC128 stores values as decimal digits, not binary fractions. 19.99 + 0.01 equals exactly 20.00, not 19.999999999999996.

RATIONAL - Exact Arithmetic

PBXB64 Addition Stores numbers as int64 numerator/denominator pairs with automatic GCD normalization. 1/3 + 1/3 = 2/3 exactly. No rounding, ever.

RATIONAL - Exact fractions
FUNCTION PBMAIN() AS LONG LOCAL a AS RATIONAL LOCAL b AS RATIONAL LOCAL c AS RATIONAL a = 1/3 ' Stored as 1/3, not 0.333... b = 1/6 ' Stored as 1/6 c = a + b ' Result: 1/2 exactly PRINT "1/3 + 1/6 = "; c ' Prints 1/2 FUNCTION = 0 END FUNCTION

RATIONAL automatically reduces fractions (GCD normalization) and supports all arithmetic operations: +, -, *, /, comparison, conversion to/from DECIMAL/DOUBLE.

VARIANT - COM-Compatible Values

PBXB64 Addition Full VARIANT implementation with VT_EMPTY, VT_I8, VT_R8, VT_CY, VT_BOOL, VT_BSTR. Supports scalar, fixed arrays, and dynamic arrays with REDIM PRESERVE.

VARIANT - Dynamic type
FUNCTION PBMAIN() AS LONG LOCAL v AS VARIANT v = 42 ' VT_I8 PRINT VARIANTVT(v) ' 20 (VT_I8) v = "Hello" ' VT_BSTR PRINT VARIANTVT(v) ' 8 (VT_BSTR) v = 3.14159 ' VT_R8 PRINT VARIANTVT(v) ' 5 (VT_R8) FUNCTION = 0 END FUNCTION

VARIANT arrays support element-wise lifecycle management. REDIM PRESERVE performs deep element copy.

Wide Integers - 128 / 256 / 512 Bit

PBXB64 Addition Inline arithmetic on 128, 256, and 512-bit integers. No library calls, no heap allocation - pure register-based operations.

128-bit integer arithmetic
FUNCTION PBMAIN() AS LONG LOCAL a AS __int128 LOCAL b AS __int128 LOCAL c AS __int128 a = 170141183460469231731687303715884105727 ' 2^127-1 b = 2 c = a + b ' 170141183460469231731687303715884105729 PRINT c FUNCTION = 0 END FUNCTION

Wide integers support addition, subtraction, multiplication, division, comparison, and bitwise operations. All done inline in the x64 backend without external libraries.

A fair comparison with major compiler toolchains

Datatype Competition: Where They Lead, Where PBXB64 Wins

No compiler is universally superior in every meaning of “datatype.” GHC is more expressive at the type level, Rust is stronger at compile-time memory safety, Ada/SPARK at constrained types and formal assurance, and Julia in scientific dispatch and ecosystem depth. PBXB64's defensible lead is out-of-the-box concrete datatype breadth in one native Windows toolchain: UNL, UNF, UNB, UNC, UNI, UNQ, DEC128, RATIONAL, 128/256/512-bit integers, Windows/COM types, and 22 H-Lib families with 125+ typed variants.

Comparison of datatype strengths across PBXB64 and 15 major compiler toolchains
Compiler / languageTheir datatype strengthWhere PBXB64 wins
GHC / HaskellGADTs, algebraic data types, type families, DataKinds, kind polymorphism, and advanced type-level programming.PBXB64: a much broader ready-made concrete numeric and container arsenal for native Windows programs, without requiring type-level programming.
RustOwnership, borrowing, lifetimes, algebraic enums, traits, generics, and excellent compile-time memory safety.PBXB64: arbitrary-precision decimal/big-float, interval, quaternion, 256/512-bit, and managed H-Lib types are integrated; Rust normally adds crates for these domains.
JuliaBigInt, BigFloat, Rational, Complex, parametric types, multiple dispatch, and a deep scientific package ecosystem.PBXB64: UNI intervals, UNQ quaternions, extra-wide integers, H-Lib, COM types, and direct standalone PE32+ output are delivered together.
Ada / SPARKRange-constrained subtypes, fixed and decimal fixed point, discriminated records, contracts, and formal verification.PBXB64: broader arbitrary-precision and extra-wide numeric families plus a larger integrated collection repertoire and ten frontends.
C++ (MSVC / GCC / Clang)Templates, concepts, variants, tuples, user-defined literals, compile-time programming, and the largest native library ecosystem.PBXB64: specialized numerics and managed containers are first-class compiler types instead of templates or third-party dependencies.
C# / .NETGenerics, nullable references, records, pattern matching, reflection, and a broad framework including BigInteger and Complex.PBXB64: arbitrary decimal/big-float, rational, interval, 256/512-bit, and H-Lib types produce native programs without a .NET runtime.
F# / .NETDiscriminated unions, units of measure, records, pattern matching, inference, and functional composition.PBXB64: more specialized built-in numerical representations and managed data structures in a standalone native Windows toolchain.
SwiftProtocol-oriented generics, optionals, expressive enums, value semantics, and strong pattern matching.PBXB64: stronger Windows-native positioning and a much wider integrated large-number, scientific, COM, and container range.
D (DMD / LDC / GDC)Templates, ranges, compile-time function execution, mixins, static introspection, and systems-level value types.PBXB64: direct UN, DEC128, RATIONAL, wide-integer, and H-Lib support with simpler PowerBASIC-style declarations.
NimGenerics, concepts, variant objects, distinct types, macros, and selectable memory-management models.PBXB64: more concrete high-precision numeric and managed collection families built directly into the release.
Fortran (ifx / gfortran / Flang)Kind-parameterized numerics, complex values, multidimensional arrays, coarrays, and mature HPC optimization.PBXB64: arbitrary precision, intervals, quaternions, general-purpose containers, COM, GUI, and multi-language frontends in one toolchain.
Common Lisp (SBCL)Arbitrary-size integers, rationals, complex numbers, dynamic typing, CLOS, and exceptionally powerful macros.PBXB64: static native declarations, UNI/UNQ, explicit wide integers, managed H-Lib types, and direct Windows executable production.
Delphi / Free PascalSets, variants, records, classes, generics, properties, native compilation, and mature RAD libraries.PBXB64: the complete UN family, DEC128/RATIONAL, 128/256/512-bit integers, H-Lib breadth, and ten source frontends.
GoSimple structs and interfaces, generics, slices/maps, garbage collection, and built-in concurrency primitives.PBXB64: substantially broader concrete numeric, scientific, Windows/COM, and managed container datatypes.
ZigComptime, explicit layouts, optionals, error unions, allocator control, and predictable low-level representations.PBXB64: high-level managed numerics and collections are ready to use with automatic cleanup and less manual memory work.

Scope: major relevant compiler families in their standard or commonly shipped form, not every research compiler or third-party package. “PBXB64 wins” means the capability is integrated in the V18 compiler/package and fits the stated use case; it is not a claim that PBXB64 has the world's most expressive type system. Comparison anchors: GHC GADTs, Rust generics, traits and lifetimes, Julia types, and Ada 2022.

Like for like: PBXB64's concrete datatype arsenal

Datatype Feature Availability Matrix

This matrix compares the concrete PBXB64 datatype families above with the same 15 toolchains. An orange tools symbol is only awarded when a named, established package or platform route supplies a practical equivalent. A type that could merely be hand-written from scratch remains unavailable here.

Built in or standard/platform library Library / emulation, named in the cell Not available as a standard or established equivalent

Swipe horizontally to compare every compiler.

Availability of 11 PBXB64 datatype features across PBXB64 and 15 competing toolchains
PBXB64 feature PBXB64 GHC Rust Julia Ada C++ C# F# Swift D Nim Fortran Lisp Delphi / FPC Go Zig
UNLArbitrary-precision integer num-bigint Boost BigInt pkg bigints pkg MPFUN / GMP Big-int lib
UNFArbitrary-precision decimal Decimal pkg bigdecimal Decimals.jl Boost EDecimal EDecimal apd
UNBArbitrary-precision binary float MPFR rug Boost / MPFR EFloat EFloat MPFR MPFR MPFUN
UNCComplex arbitrary-precision value Complex + MPFR rug Boost MPFUN
UNIInterval arithmetic data-interval interval crate IntervalArithmetic Boost.Interval Compiler ext.
UNQQuaternion value linear nalgebra Quaternions.jl Boost.Math Accelerate Quaternion lib Math lib Gonum quat
DEC128Exact decimal / fixed 18 digits rust_decimal DecFP.Dec128 Boost.Decimal varDecimal apd
RATIONALExact rational arithmetic num-rational Boost.Rational ERational ERational
128 / 256 / 512-bitFixed-width integer family wide-word i128 + crates BitIntegers.jl Big_Integer Boost Int128 + BigInteger Int128 + BigInteger DoubleWidth Int128 + BigInt bigints / stint kind 16 + MPFUN Bounded integer Int128 + libs big.Int masks
VARIANT / COMWindows automation and platform types Win32 / FFI windows crate FFI / PyCall Win32Ada WinSDK winim go-ole C import
H-Lib familiesManaged map, set, deque, graph, trie and specialist containers containers + pkgs std + crates Base + pkgs Containers + libs STL + Boost .NET + NuGet .NET + NuGet Collections + pkgs FSet / cl-containers RTL / FCL + libs std + GoDS

“Built in” includes the language's normal standard or official platform library. “Library / emulation” means the green result depends on the named package, binding, or composition and may not match PBXB64's syntax, precision model, lifecycle, or deployment profile exactly. Evidence anchors include Julia numbers, .NET numerics, D BigInt, Go math/big, and Zig integer types.

Try It Yourself

CLI - compile and run
REM DEC128 precision test PBXB64 test_dec128.pb -o test_dec128.exe test_dec128.exe REM RATIONAL exact arithmetic PBXB64 test_rational.pb -o test_rational.exe test_rational.exe REM VARIANT type switching PBXB64 test_variant.pb -o test_variant.exe test_variant.exe REM 128-bit integer PBXB64 test_128bit.pb -o test_128bit.exe test_128bit.exe

All test files are in examples/basic/ - compile and run them to verify.

By The Numbers

6Managed UN types
22/22Focused UN tests passed
512Max bit width
V15Complete UN family

Related Features

Back to Feature List