AGENT SKILL
大整数变量处理
35-variable-bigint
暂无简介
- License 许可
- MIT
- 最近更新
- 2026-04-12
- Stars
- ★ 0
- Forks
- 0
02 资源文件 2
- 参考文档SOURCE.md181 B
- 参考文档TRUST.auto.yaml2.2 KB
03 SKILL.md 正文
Devian v11 — Feature: Complex BigInt
정규화 규칙:
mBase == 0→(mBase=0, mPow=0)abs(mBase) >= 10이면mBase /= 10,mPow++반복abs(mBase) < 1이면mBase *= 10,mPow--반복
Compare
- 부호가 다르면 양수 > 0 > 음수
- 부호가 같으면
mPow우선 비교 mPow가 같으면mBase비교
Operators (source-compatible)
+:CBigInt + CBigInt,CBigInt + float-:CBigInt - CBigInt,float - CBigInt,CBigInt - float*:CBigInt * CBigInt,float * CBigInt,CBigInt * float/:CBigInt / CBigInt,float / CBigInt,CBigInt / float- 비교:
<, >, <=, >=(CompareTo 기반) - helper:
Zero,FromInt,FromLong,Max,Min
ToString (suffix)
mPow < 3이면 정수 반올림 문자열mPow >= 3이면 3자리 단위로 suffix(symbol) 생성하여 표시- suffix는 알파벳 기반 무한 확장(a..z, aa..)
Example Code
using System;
namespace Devian.Examples
{
public static class ComplexBigIntExample
{
public static void Run()
{
var gold = new Devian.CBigInt(5.5f, 6); // 5.5 * 10^6
var reward = gold * 5f;
var tax = reward / 10f;
var seasonBonus = new Devian.CBigInt(2f, 3); // 2000
var boosted = gold * seasonBonus;
var total = gold + seasonBonus;
if (boosted > gold)
{
Console.WriteLine("boosted is larger");
}
Console.WriteLine($"gold: {gold}");
Console.WriteLine($"reward: {reward}");
Console.WriteLine($"tax: {tax}");
Console.WriteLine($"boosted: {boosted}");
try
{
float f = gold;
double d = boosted;
Console.WriteLine($"float={f}, double={d}");
}
catch (OverflowException ex)
{
Console.WriteLine(ex.Message);
}
var spend = new Devian.CBigInt(7f, 5); // 700,000
var remain = gold - spend;
var plusSmall = gold + 123f;
Console.WriteLine($"remain: {remain}");
Console.WriteLine($"total: {total}");
Console.WriteLine($"plusSmall: {plusSmall}");
}
}
}
Table Authoring
class:CBigInt를 XLSX 테이블에 기입할 때 다음 형식을 지원한다.
{base, pow}shorthand:{5.5, 6}→5.5 * 10^6,{2, 3}→2000- plain long:
1000→1 * 10^3(빌드 시 정규화) - raw JSON:
{"base":5.5,"pow":6}
NDJSON/pb64에는 rankKey (long) 값으로 저장된다. 로드 시 CBigInt.FromRankKey(long)으로 복원.