phanerozoic / threshold-overflowdetect

huggingface.co
Total runs: 4
24-hour runs: 0
7-day runs: 0
30-day runs: -4
Model's Last Updated: January 24 2026

Introduction of threshold-overflowdetect

Model Details of threshold-overflowdetect

threshold-overflowdetect

Detect signed addition overflow from sign bits of operands and result.

Function

overflow(a_sign, b_sign, sum_sign) = 1 if overflow occurred

In 2's complement addition, overflow occurs when:

  • Two positive numbers produce a negative result
  • Two negative numbers produce a positive result
Truth Table
a_sign b_sign sum_sign overflow meaning
0 0 0 0 pos + pos = pos (ok)
0 0 1 1 pos + pos = neg (OVERFLOW)
0 1 0 0 pos + neg = pos (ok)
0 1 1 0 pos + neg = neg (ok)
1 0 0 0 neg + pos = pos (ok)
1 0 1 0 neg + pos = neg (ok)
1 1 0 1 neg + neg = pos (OVERFLOW)
1 1 1 0 neg + neg = neg (ok)
Architecture

2-layer circuit detecting both overflow cases:

Layer 1:

  • N1: detects positive overflow (0,0,1) - weights [-1,-1,+1], bias -1
  • N2: detects negative overflow (1,1,0) - weights [+1,+1,-1], bias -2

Layer 2:

  • OR gate: weights [1,1], bias -1
Parameters
Inputs 3
Outputs 1
Neurons 3
Layers 2
Parameters 11
Magnitude 12
Usage
from safetensors.torch import load_file
import torch

w = load_file('model.safetensors')

def overflow_detect(a_sign, b_sign, sum_sign):
    inp = torch.tensor([float(a_sign), float(b_sign), float(sum_sign)])
    n1 = int((inp @ w['layer1.n1.weight'].T + w['layer1.n1.bias'] >= 0).item())
    n2 = int((inp @ w['layer1.n2.weight'].T + w['layer1.n2.bias'] >= 0).item())
    hidden = torch.tensor([float(n1), float(n2)])
    return int((hidden @ w['layer2.weight'].T + w['layer2.bias'] >= 0).item())

# Example: 5 + 4 = 9, but in 4-bit signed: 0101 + 0100 = 1001 = -7
print(overflow_detect(0, 0, 1))  # 1 (overflow!)

# Example: -3 + 2 = -1 (no overflow)
print(overflow_detect(1, 0, 1))  # 0 (ok)
License

MIT

Runs of phanerozoic threshold-overflowdetect on huggingface.co

4
Total runs
0
24-hour runs
0
3-day runs
0
7-day runs
-4
30-day runs

More Information About threshold-overflowdetect huggingface.co Model

More threshold-overflowdetect license Visit here:

https://choosealicense.com/licenses/mit

threshold-overflowdetect huggingface.co

threshold-overflowdetect huggingface.co is an AI model on huggingface.co that provides threshold-overflowdetect's model effect (), which can be used instantly with this phanerozoic threshold-overflowdetect model. huggingface.co supports a free trial of the threshold-overflowdetect model, and also provides paid use of the threshold-overflowdetect. Support call threshold-overflowdetect model through api, including Node.js, Python, http.

threshold-overflowdetect huggingface.co Url

https://huggingface.co/phanerozoic/threshold-overflowdetect

phanerozoic threshold-overflowdetect online free

threshold-overflowdetect huggingface.co is an online trial and call api platform, which integrates threshold-overflowdetect's modeling effects, including api services, and provides a free online trial of threshold-overflowdetect, you can try threshold-overflowdetect online for free by clicking the link below.

phanerozoic threshold-overflowdetect online free url in huggingface.co:

https://huggingface.co/phanerozoic/threshold-overflowdetect

threshold-overflowdetect install

threshold-overflowdetect is an open source model from GitHub that offers a free installation service, and any user can find threshold-overflowdetect on GitHub to install. At the same time, huggingface.co provides the effect of threshold-overflowdetect install, users can directly use threshold-overflowdetect installed effect in huggingface.co for debugging and trial. It also supports api for free installation.

threshold-overflowdetect install url in huggingface.co:

https://huggingface.co/phanerozoic/threshold-overflowdetect

Url of threshold-overflowdetect

threshold-overflowdetect huggingface.co Url

Provider of threshold-overflowdetect huggingface.co

phanerozoic
ORGANIZATIONS

Other API from phanerozoic

huggingface.co

Total runs: 1.2K
Run Growth: 1.1K
Growth Rate: 100.00%
Updated:April 25 2026