473,395 Members | 2,437 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

IEEE floating point numbers

I read some place that for performance reasons, IEEE floating point
standard has not been implemented by .NET and that different machine
architectures may produce different results.. but what if our
requirements is to produce the same results using the IEEE standard on
different machines? Is there no way of doing this (like the strictfp
construct in Java)? Thanks
-Andre

Nov 15 '05 #1
2 3048
Simon Trew <ten.egnaro@werts> wrote:
OK gotcha. Yes, there is that limitation. I vaguely recall there is a
setting for this, but I am just back from a short holiday so the old noggin
is not up to full speed yet.

I suppose you could try to get round it by putting the intermediate results
of calculations back into variables, so that the 80-to-64 truncation will
occur each time. Of course I realise this particular problem was just a
f'rinstance, & also that you'd probably have to do some horrible stuff to
stop it being optimized away by the C# compiler or the JITter.


No, temporary variables won't help - I *suspect* (although I don't
know) that each result *is* truncated to 64 bits. The point is that the
CPU is effectively converting each 64 bit operand into 80 bits, then
doing the operation, then converting the result back into 64 bits. That
will sometimes give a different result from doing the whole thing in 64
bits. I'll try to come up with a specific example if you like. (It'll
take a while though!)

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet/
If replying to the group, please do not mail me too
Nov 15 '05 #2
Exactly. The CPU is operating on 80 bits while the result gets truncated
to 64 bits. This could give different results on architectures that
perform floating point operations on 64-bits or even 128 bits. I was
wondering if there's a 'cleaner' way of stopping this, but I suspect
there isn't. Thanks anyways guys.

-Andre
Jon Skeet wrote:
Simon Trew <ten.egnaro@werts> wrote:
OK gotcha. Yes, there is that limitation. I vaguely recall there is a
setting for this, but I am just back from a short holiday so the old noggin
is not up to full speed yet.

I suppose you could try to get round it by putting the intermediate results
of calculations back into variables, so that the 80-to-64 truncation will
occur each time. Of course I realise this particular problem was just a
f'rinstance, & also that you'd probably have to do some horrible stuff to
stop it being optimized away by the C# compiler or the JITter.

No, temporary variables won't help - I *suspect* (although I don't
know) that each result *is* truncated to 64 bits. The point is that the
CPU is effectively converting each 64 bit operand into 80 bits, then
doing the operation, then converting the result back into 64 bits. That
will sometimes give a different result from doing the whole thing in 64
bits. I'll try to come up with a specific example if you like. (It'll
take a while though!)


Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Grant Edwards | last post by:
I've read over and over that Python leaves floating point issues up to the underlying platform. This seems to be largely true, but not always. My underlying platform (IA32 Linux) correctly...
2
by: Madhusudan Singh | last post by:
I am querying an instrument in a measurement application. The values are returned as IEEE format binary floating point numbers. There are 4 bytes per point. Multiple points are not separated by...
4
by: ej | last post by:
I ran into something today I don't quite understand and I don't know all the nitty gritty details about how Python stores and handles data internally. (I think) I understand why, when you type in...
54
by: Andy | last post by:
Hi, I don't know if this is the correct group to post this, but when I multiply a huge floating point value by a really small (non-zero) floating point value, I get 0 (zero) for the result. This...
2
by: Benjamin Rutt | last post by:
Does anyone have C code laying around to do this? I have to read in some binary data files that contains some 4-byte IBM/370 floating point values. I would like a function to convert 4-byte...
33
by: Nick Maclaren | last post by:
The numerical robustness of Python is very poor - this is not its fault, but that of IEEE 754 and (even more) C99. In particular, erroneous numerical operations often create apparently valid...
13
by: revuesbio | last post by:
Hi Does anyone have the python version of the conversion from msbin to ieee? Thank u
5
by: ms292606 | last post by:
Hi, I am currently working on a program to decode data that is collected on a gps receiver and i've ran into a problem. Some of the data is encoded in IEEE 754. I wrote the following functions to...
5
by: =?ISO-8859-1?Q?Roman_T=F6ngi?= | last post by:
IEEE-754 Arithmetic: Most real numbers can't be stored exactly on the computer, but there can be stated the range within which a machine number lies. For the following example, I assume double...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.