Rounding
Stochastic Rounding
Install / Use
/learn @dmaust/RoundingREADME
rounding
Rounding methods
StandardRound rounds to the nearest, and in the event of a tie, rounds up.
RoundToEven rounds to the nearest, but in the event of a tie, rounds toward
the nearest even number.
StochasticRound provides a mechanism to eliminate accumulated
roundoff error in the presence of a distribution where for
individual samples, the roundoff error is skewed. This is typically
caused by small values. This may be a common problem when dealing with applying a
function to many small integer values as the number of discrete inputs is small.
One drawback to stochastic rounding is the output is non-deterministic, but this can be avoided by providing a custom deterministic generator, or invoking providing the random number generator with a fixed seed.
.. code:: python
r = random.Random() r.seed(123) sr = StochasticRound(precision=0, random_generator=r)
Related Skills
node-connect
351.4kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
110.7kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
351.4kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
351.4kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
