deterministic

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 functionality exactly and that the compiler is fully deterministic? To this question I ha...

What deterministic garbage collection algorithms are out there?

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 non-deterministic. However, I k...

User-Defined Functions SQL Server 2005 flagged incorrectly as non-deterministic?

Related to this question, I decided to check the UDFs in my data warehouse (which should largely have been deterministic), and I found several which aren't which should be. For instance: CREATE FUNCTION [udf_YearFromDataDtID] ( @DATA_DT_ID int ) RETURNS int AS BEGIN RETURN @DATA_DT_ID / 10000 END Shows up in this query: SELE...

SQL Server: Floor a date in SQL server, but stay deterministic

(This is related to Floor a date in SQL server.) Does a deterministic expression exist to floor a DATETIME? When I use this as a computed column formula: DATEADD(dd, DATEDIFF(dd, 0, [datetime_column]), 0) the I get an error when I place an index on that column: Cannot create index because the key column 'EffectiveDate' is non-det...

How to make conversions from varchar to datetime deterministic?

In the tradition of this question and in light of the documentation, how does one make this function deterministic: ALTER FUNCTION [udf_DateTimeFromDataDtID] ( @DATA_DT_ID int -- In form YYYYMMDD ) RETURNS datetime WITH SCHEMABINDING AS BEGIN RETURN CONVERT(datetime, CONVERT(varchar, @DATA_DT_ID)) END Or this one (because of t...

Why does SQL 2005 say this UDF is non-deterministic?

I have the following function: SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER FUNCTION [dbo].[IP4toBIGINT]( @ip4 varchar(15) ) RETURNS bigint WITH SCHEMABINDING AS BEGIN -- oc3 oc2 oc1 oc0 -- 255.255.255.255 -- Declared as BIGINTs to avoid overflows when multiplying later on DECLARE @oct0 bigint, @oct1 b...

What does it mean by "Non-deterministic User-Defined functions can be used in a deterministic manner"?

According to MSDN SQL BOL (Books Online) page on Deterministic and Nondeterministic Functions, non-deterministic functions can be used "in a deterministic manner" The following functions are not always deterministic, but can be used in indexed views or indexes on computed columns when they are specified in a deterministic manner. ...

In C++ and C# are multiple condition checks performed in a predetermined or random sequence?

Situation: condition check in C++ or C# with many criteria: if (condition1 && condition2 && condition3) { // Do something } I've always believed the sequence in which these checks are performed is not guaranteed. So it is not necessarily first condition1 then condition2 and only then condition3. I learned it in my times with C++. ...

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 + 1 Neither does concatination work. Eg "31" + "2" = 312 = "3" + "12" This combination operation...

What can cause non-deterministic output in a program?

I have a bug in a multi-processes program. The program receives input and instantly produces output, no network involved, and it doesn't have any time references. What makes the cause of this bug hard to track down is that it only happens sometimes. If I constantly run it, it produces both correct and incorrect output, with no discerni...

What could cause a deterministic process to generate floating point errors

Having already read this question I'm reasonably certain that a given process using floating point arithmatic with the same input (on the same hardware, compiled with the same compiler) should be deterministic. I'm looking at a case where this isn't true and trying to determine what could have caused this. I've compiled an executable an...

Ruby Parser

 I want to know whether it is possible to parse ruby language using just deterministic parser having no backtracking at all ?? ...

Avoiding Determinism with Markovian Logic

I just began reading more about Markov Chain Generators today, and am really intrigued by the whole process of building one. From my understanding, the future state is dependent upon the statistical past states to the present. Example: Hello World. Hello Dolly. Hello World. "World" follows "Hello" ~66% of the time in that sourc...

Java's Representation of Serialized Objects

I'm looking for the format that Java uses to serialize objects. The default serialization serializes the object in a binary format. In particular, I'm curious to know if two runs of a program can serialize the same object differently. ...

How to rewrite this nondeterministic XML Schema to deterministic?

Why this is non-deterministic and how to fix it? <xs:element name="activeyears"> <xs:complexType> <xs:sequence minOccurs="0" maxOccurs="1"> <xs:sequence minOccurs="0" maxOccurs="unbounded"> <xs:element ref="from" minOccurs="1" maxOccurs="1"/> <xs:element ref="t...

How to make a user function deterministic

I'm trying to achieve optimization based on deterministic behavior of a user defined function in SQL Server 2008. In my test code, i'm expecting no extra function calls dbo.expensive, since it's deterministic and called with same argument value. My concept does not work, please explain why. What could be done to achieve the expected op...

Is there any way to make this UDF deterministic?

I assume this is not deterministic simply because DB_NAME() is not deterministic? If DB_NAME() is not deterministic, why is it not deterministic? ALTER FUNCTION [TheSchema].[udf_IS_PRODUCTION] () RETURNS bit WITH SCHEMABINDING AS BEGIN RETURN CASE WHEN DB_NAME() = 'PRODUCTION' THEN CONVERT(bit, 1) ELSE CONVERT(bit, 0) ...

What is a Deterministic Quicksort?

I have been reading about Quicksort and found that sometimes it' s referred to as "Deterministic Quicksort". Is this an alternate version of the normal Quicksort ? What is the difference between a normal Quicksort and a Deterministic Quicksort ? ...

Deterministic floating point and .NET

How can I guarantee that floating point calculations in a .NET application (say in C#) always produce the same bit-exact result? Especially when using different versions of .NET and running on different platforms (x86 vs x86_64). Inaccuracies of floating point operations do not matter. In Java I'd use strictfp. In C/C++ and other low le...

Why is [date] + ([time] - [offset]) non-deterministic in SQL Server 2008?

I'm trying to do the following for my IIS logs table: ALTER TABLE [W3CLog] ADD [LogTime] AS [date] + ([time] - '1900-01-01') PERSISTED However, SQL Server 2008 tells me: Computed column 'LogTime' in table 'W3CLog' cannot be persisted because the column is non-deterministic. The table has this definition: CREATE TABLE [dbo].[W3CLog]...