Non-deterministic Fixed-Point Division Output in Field Mode
Describe the bug
When running a simple fixed-point division program in MP-SPDZ with -F flag (field prime), the output of the division 100 / 10 sometimes produces slight precision variation. Specifically, the revealed value fluctuates between 10 and 9.9998 across different runs, even though the IR does not contain any explicit truncation instructions (e.g., trunc_pr).
This non-deterministic behavior suggests possible protocol-level precision loss or probabilistic effects that are not reflected in the IR.
Is this a bug?
To Reproduce Source code (test.mpc):
sfix.set_precision(f=16, k=40)
a = sfix(100) / sfix(10)
print_ln('a: %s', a.reveal())
Compilation command: python3 compile.py -F 64 test
Execution command: ./Scripts/atlas.sh test
Protocols tested:
- MASCOT
- Other MPC protocols over Mod prime
Expected behavior The revealed output of a should be deterministic and consistently equal to 10.0000, without fluctuations across different executions.
Error message Full Python backtrace or virtual machine outputs
MP-SPDZ version v4.0.1
MP-SPDZ uses probabilistic truncation by default for all protocols, but the trunc_pr instruction is only used with protocols that have a protocol-specific variant. For other protocols, it is implemented in the high-level using random bits via the bit instruction: https://mp-spdz.readthedocs.io/en/latest/instructions.html#Compiler.instructions.bit
Do you think something is confusing or missing in the documentation?
Thanks your reply. I understand now.