News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

FPU bugs

Started by Yoshi, June 22, 2005, 11:53:15 PM

Previous topic - Next topic

Yoshi

    I've only just recently obtained MASM32 and am intrested in 3D programming as I started to do in DOS. I will need to use FPU functions but am concerned of the bugs concerning the FPU. I understand this depends on the processor, does any one know of a simple assembler program that checks and reports your processor type?

    Thanks for any help,
                                 James.

hutch--

James,

Welcome on board. From memory the only Pentium that had the floatig point bug was a very old one and it cashed out to being a minor rounding error so its not like its worth losing much sleep over. It looks like you come from a MIPS background from your coments so it is worth having a good look at Ray Filiatreaults floating point tute and you can get the latest version of his work at the link in the top right corner under Code Site.

Also keep in mind that on the later hardware from Intel that SSE(2) performs floating point operations as well and with an eye to the future with the coming 64 bit hardware, this is probably the direction to go in. Just note that the version of ML in the MASM32 project will not build SSE(2 or 3) and you need to get a later version to do that. Update VC, get a DDK or similar.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

MichaelW

James,

I posted a (still unfinished) CPU identification procedure here:

http://www.masmforum.com/simple/index.php?topic=1909.0

The only FPU bug that I know of was in some models of the original Pentium. The bug was due to some missing values in a lookup table, and under some circumstances it would cause an error starting at the fifth decimal place in the result. I doubt that this could have much of an effect on 3D graphics. This is a MASM port of a C program that I wrote at the time to check for the bug:

; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
    include \masm32\include\masm32rt.inc
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
    .data
    .code
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
start:
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
    call  fdiv_test
    mov   eax, input(13,10,"Press enter to exit...")
    exit
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
fdiv_test proc
    LOCAL double:REAL8

    fld8  4195835.0
    fld8  3145727.0
    fdiv
    fstp  double

    invoke crt_printf, chr$(10,"Testing for the original Pentium FDIV bug by performing",10)
    invoke crt_printf, chr$("the division 4195835 / 3145727, which was the worst case",10)
    invoke crt_printf, chr$("observed per Dr.Dobb's Developers Update, February 1995:",10)
    invoke crt_printf, chr$(10,"Result should be 1.333820449136241",10)
    invoke crt_printf, chr$("Actual result is %.15f",10),double

    ret
fdiv_test endp
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

end start

eschew obfuscation

RuiLoureiro

Hi,
    In my PIII, the result is correct.

Testing for the original Pentium FDIV bug by performing
the division 4195835 / 3145727, which was the worst case
observed per Dr.Dobb's Developers Update, February 1995:

Result should be   1.333 820 449 136 241
Actual result is   1.333 820 449 136 241