Questions tagged [deterministic]

The system or program exhibits the same behavior in different runs.

The system or program exhibits the same behavior on different runs. This is opposed to .

353 questions
296
votes
20 answers

Mapping two integers to one, in a unique and deterministic way

Imagine two positive integers A and B. I want to combine these two into a single integer C. There can be no other integers D and E which combine to C. So combining them with the addition operator doesn't work. Eg 30 + 10 = 40 = 40 + 0 = 39 +…
harm
  • 10,045
  • 10
  • 36
  • 41
79
votes
12 answers

Does using heap memory (malloc/new) create a non-deterministic program?

I started developing software for real-time systems a few months ago in C for space applications, and also for microcontrollers with C++. There's a rule of thumb in such systems that one should never create heap objects (so no malloc/new), because…
The Quantum Physicist
  • 24,987
  • 19
  • 103
  • 189
49
votes
4 answers

Is the order of static class initialization in C# deterministic?

I've done some searching and I think the following code is guaranteed to produce output: B.X = 7 B.X = 0 A.X = 1 A = 1, B = 0 static class B { public static int X = 7; static B() { Console.WriteLine("B.X = " + X); X =…
Jess
  • 2,991
  • 3
  • 27
  • 40
48
votes
3 answers

What is the difference between an Idempotent and a Deterministic function?

Are idempotent and deterministic functions both just functions that return the same result given the same inputs? Or is there a distinction that I'm missing? (And if there is a distinction, could you please help me understand what it is)
sfletche
  • 47,248
  • 30
  • 103
  • 119
39
votes
7 answers

Deterministic function in mysql

I got confused with a seemingly simple concept. Mysql defines deterministic function as a function that always produces the same result for the same input parameters So in my understanding, functions like CREATE FUNCTION foo (val INT) READS SQL…
a1ex07
  • 36,826
  • 12
  • 90
  • 103
36
votes
11 answers

What does deterministic mean?

I am reading the Java Hashmap documentation but I don't understand this sentence. Note that the iteration order for HashMap is non-deterministic. If you want deterministic iteration, use LinkedHashMap. What does deterministic mean?
Nathan Schwermann
  • 31,285
  • 16
  • 80
  • 91
31
votes
10 answers

How deterministic is floating point inaccuracy?

I understand that floating point calculations have accuracy issues and there are plenty of questions explaining why. My question is if I run the same calculation twice, can I always rely on it to produce the same result? What factors might affect…
Generic Error
  • 4,437
  • 6
  • 28
  • 26
23
votes
3 answers

How to control whether C math uses SSE2?

I stepped into the assembly of the transcendental math functions of the C library with MSVC in fp:strict mode. They all seem to follow the same pattern, here's what happens for sin. First there is a dispatch routine from a file called…
Asik
  • 21,506
  • 6
  • 72
  • 131
21
votes
6 answers

How can floating point calculations be made deterministic?

Floating point calculation is neither associative nor distributive on processors. So, (a + b) + c is not equal to a + (b + c) and a * (b + c) is not equal to a * b + a * c Is there any way to perform deterministic floating point calculation that do…
MetallicPriest
  • 29,191
  • 52
  • 200
  • 356
20
votes
3 answers

How to produce deterministic binary output with g++?

I work in a very regulated environment where we need to be able to produce identical binary input give the same source code every time be build out products. We currently use an ancient version of g++ that has been patched to not write anything…
Steven Behnke
  • 3,336
  • 3
  • 26
  • 34
19
votes
2 answers

Why is concurrent haskell non deterministic while parallel haskell primitives (par and pseq) deterministic?

Don't quite understand determinism in the context of concurrency and parallelism in Haskell. Some examples would be helpful. Thanks
19
votes
2 answers

Reproducibility and performance in PyTorch

The documentation states: Deterministic mode can have a performance impact, depending on your model. My question is, what is meant by performance here. Processing speed or model quality (i.e. minimal loss)? In other words, when setting manual…
Bram Vanroy
  • 27,032
  • 24
  • 137
  • 239
19
votes
10 answers

What deterministic garbage collection algorithms are out there?

By deterministic I vaguely mean that can be used in critical real-time software like aerospace flight software. Garbage collectors (and dynamic memory allocation for that matter) are big no-no's in flight software because they are considered…
ian
18
votes
22 answers

C (or any) compilers deterministic performance

Whilst working on a recent project, I was visited by a customer QA representitive, who asked me a question that I hadn't really considered before: How do you know that the compiler you are using generates machine code that matches the c code's…
TK.
  • 46,577
  • 46
  • 119
  • 147
15
votes
2 answers

Has the notion of 'semidet' in Prolog been settled?

Being new to Prolog, I came across a very interesting discussion that happened in late 2012. What I noticed was that there were, at the time, two notions of 'semidet' in Prolog community, namely: A computation that succeeds at most once. A…
1
2 3
23 24