You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A new compile-time function is introduced.
It converts a constant floating-point string to nanotoncoins.
Example: `ton("0.05")` is equal to 50000000.
It requires a constant string; `ton(some_var)` is an error.
Type of its return value is `coins`, not `int`.
Like `intN`, it's backed by a general int at TVM level,
all arithmetics (except addition) degrade to int.
Type `coins` will be serialized as varint16 in the future.
// functions from stdlib marked as `builtin`, implemented at compiler level for optimizations
1216
1223
// (for example, `loadInt(1)` is `1 LDI`, but `loadInt(n)` for non-constant requires it be on a stack and `LDIX`)
1224
+
define_builtin_func("ton", {TypeDataUnknown::create()}, TypeDataCoins::create(), nullptr, // `unknown` to pass inferring for `ton(1)` (to fire a better error later)
0 commit comments