realbasic-nug
[Top] [All Lists]

Intel vs. PPC math gotcha

To: RBNUG <realbasic-nug at lists dot realsoftware dot com>
Subject: Intel vs. PPC math gotcha
From: "Dennis Birch" <dennisbirch at gmail dot com>
Date: Wed, 30 May 2007 15:33:24 -0700
Delivered-to: listarchive at realsoftware dot com
Delivered-to: realbasic-nug at lists dot realsoftware dot com
I just got stung by a gotcha that I thought I'd share for the sake of
the community.

I've been working on a project on my Intel iMac. One bit of code
compares a file version number constant (kFileVersion) with a version
number stored in a data file's database table.

The code looks like this:

    dim vers As Single = rs.Field("fi_Version").DoubleValue
    if vers < kFileVersion Then
      // update the data file -- omitted
    end if

This works fine on my Intel Mac. On PPC machines, the "vers <
kFileVersion" comparison was failing, even when the numbers appeared
to be identical in the debugger. Changing the declaration of vers to a
Double fixed the problem.

Hope this helps somebody from pulling out some hair.
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>


<Prev in Thread] Current Thread [Next in Thread>