# Is Zig deterministic across different targets?

**URL:** <https://ziggit.dev/t/is-zig-deterministic-across-different-targets/8371>\
**Category:** Explain\
**Created:** [February 5, 2025, 6:25am UTC](https://ziggit.dev/t/is-zig-deterministic-across-different-targets/8371 "2025-02-05T06:25:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![inspired](https://ziggit.dev/letter_avatar_proxy/v4/letter/i/e5b9ba/32.png) [@inspired](https://ziggit.dev/u/inspired)\
**Post date:** [February 5, 2025, 6:25am UTC](https://ziggit.dev/t/is-zig-deterministic-across-different-targets/8371/1 "2025-02-05T06:25:43Z")

</div>

I am considering using Zig in a project where servers and clients that run on different architectures and operating systems need to produce the same output given same input (i.e. files on disk, network data, etc.).

What can I expect from Zig cross-compilation in this regard? How does Zig handle floating-point determinism across different platforms and hardware?

---

<div class="post-metadata">

**Author:** ![vulpesx](https://ziggit.dev/user_avatar/ziggit.dev/vulpesx/32/3989_2.png) [@vulpesx](https://ziggit.dev/u/vulpesx)\
**Post date:** [February 5, 2025, 8:43am UTC](https://ziggit.dev/t/is-zig-deterministic-across-different-targets/8371/2 "2025-02-05T08:43:12Z")

</div>

i dont think zig can realisticaly provide that since its up to the architecture regarding the behaviour of oporations. however most modern hardware abides by the [IEEE 754](https://en.wikipedia.org/wiki/IEEE_754) standard, on such hardware the behaviour should be the same, ie x86, arm, riscv should behave the same.

---

<div class="post-metadata">

**Author:** ![Cloudef](https://ziggit.dev/user_avatar/ziggit.dev/cloudef/32/1370_2.png) [@Cloudef](https://ziggit.dev/u/Cloudef)\
**Post date:** [February 5, 2025, 11:43am UTC](https://ziggit.dev/t/is-zig-deterministic-across-different-targets/8371/3 "2025-02-05T11:43:58Z")

</div>

You need to use fixed point. I would personally avoid the rabbit hole of determinism with hardware floating points [1], but some people may find success with `@setFloatMode(.Strict)`

It would be cool if zig had fixed point types.

1: [Floating Point Determinism | Gaffer On Games](https://gafferongames.com/post/floating_point_determinism/)
