The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 4,262 other subscribers

Archive for May 6th, 2009

Delphi – class helper to get SourceFileName from an EAssertionFailed

Posted by jpluimers on 2009/05/06

In one of our applications, we have a default Config.xml file that is in our source tree, but it can be overridden by a Config.xml file relative to the application’s .EXE file.
So we have a two step process looking for the Config.xml, and we’d like to have the full path to the source file where the sources were build.
It seems the only way to get that, is by looking inside the Message of an EAssertionFailed exception.

So I wrote yet another class helper to get this code to work:
Read the rest of this entry »

Posted in Delphi, Development, Software Development | 1 Comment »

Delphi – Michael Justin had strange floating point results when his 8087 FPU Control Word got hosed

Posted by jpluimers on 2009/05/06

Two days ago, [Wayback] Michael Justin (who just released version 1.7 of the [Wayback] Habari Active MQ Client components) posted a blog entry about a strange circumstance [Wayback] when 1.99 would not compare equally to 1.99.
He tracked it down to the [Wayback] 8087 (more formally: Intel [Wayback] FPU) Control Word being hosed on his system.

I could not reproduce his particular case, but since I have seen similar issues in the past, I wrote the DUnit test case below which shows you what can happen by manually setting the 8087 Control Word.

The difference between the 8087 Control Word values $1372 (default) and $1272 (failure) is the internal mantissa precision (see the [Wayback] “Art of Assembly Language” and the [Wayback] Intel FPU Control Word documentation on this).
Edit: Found a [Wayback] much more complete description of the bits in the FPU Control word.

It changes from 64 bits to 53 bits, which is enough to make 1.99 not equal to 1.99.

I have seen behaviour like this in the past with some networking stacks in the Turbo Pascal 7 era, with some C++ DLL’s in the Delphi 1-3 era, and some printer drivers in the Delphi 5-7 era.
Let me know in the comments (or using the contact form) where you have bumped into this.

The code below makes use of the Jcl8087 unit which is part of the JCL ([Wayback] JEDI Code Library) at [Wayback] SourceForge.
Add the unit to any DUnit test project you created and observe the results.
Read the rest of this entry »

Posted in 8087, Algorithms, Delphi, Development, Floating point handling, Software Development | 8 Comments »

Delphi / .NET interop – Atozed announced Crosstalk

Posted by jpluimers on 2009/05/06

On 20090504, Atozed announced Crosstalk: a technology that allows native Delphi code to consume .NET assemblies in a really intuitive and transparent way.atozed-logobig-white-bg

The announcement contains a FAQ.

It is a promising technology, not only because it is dead easy to use, but also because it is backed by Atozed: a team of people that have made complex technology like Web Apps easy to use by creating IntraWeb.

Expect demos soon (maybe even at Delphi Live!).
Here is a short example:

Read the rest of this entry »

Posted in .NET, Delphi, Development, Software Development | 3 Comments »