Solution to Extended Precision Natural Log (ELN) Issue

18 views
Skip to first unread message

Steven Zoppi

unread,
Jul 31, 2016, 12:06:08 AM7/31/16
to ibm...@googlegroups.com

I figured out what is going on and am looking forward to getting the clean build sources from Brian when he has time for sim and the patches he knows are “good”.

 

In the meantime …

 

Root Cause

 

The issue is an apparent overflow problem in the assembler in the XFLC instruction which I will debug when I have a proper build environment.

 

The algorithm requires the largest EP constant CLOSE to 1 without actually BEING 1.  This means that the assembly of the following should work just fine:

 

XFLC    0.9999999999

 

But it does not.  The assembler generates: 0080 0000 0000

 

Modifying the operand to 0.9999999994 causes the assembler to generate the proper constant: 0080 1FFF FFFF

 

 

Solution

 

For anyone who needs to build DMS from “scratch” … the problem can be easily fixed by modifying ONE line in s2eln.asm

 

Line 162 (ID:S2E01620) in Source s2eln.asm:

 

                   FONE  XFLC    0.9999999999  FLT PT ONE              S2E01620

 

Needs to be changed to this:

 

                    FONE  XFLC    0.9999999994  FLT PT ONE              S2E01620

 

Full System Test/Verification

 

Run:

1.       Mkdms

2.       Ibm1130 loaddms

3.       exit sim

4.       Run ibm1130

5.       Submit this job:

// JOB

// FOR

*ONE WORD INTEGERS

*LIST ALL

*EXTENDED PRECISION

*IOCS (TYPEWRITER)

C

C TEST OF FLOATING POINT PRECISION

C---------------------------------

C

      X = 3.0

      Y = ALOG(X)

      WRITE(1,1000) X,Y

1000  FORMAT('1 X=',F16.9,' LN(X)=',F16.9)

      CALL EXIT

      END

// XEQ       L

6.       Enjoy the result:

1 X=     3.000000001 LN(X)=     1.098612289

Wait, IAR: 0000002A (4c80 BSC  I  ,0028   )

 

Thanks to Carl and Brian for some hints and helping me dust off some rusty brain cells.

 

Regards,

Steve

 

Eddy Quicksall

unread,
Jul 31, 2016, 11:08:54 AM7/31/16
to ibm...@googlegroups.com

Hmm … in my run, which gave the correct answer, I used the EMU compiler with its library. I don’t see S2ELN in the map so maybe EMU made a correction there.

 

Here is the map for that:

 

The FORTRAN program

*ONE WORD INTEGERS

*EXTENDED PRECISION

*LIST ALL

*IOCS(TYPEWRITER)

C

C TEST OF FLOATING POINT PRECISION

C---------------------------------

C

      PAUSE 1234

      X = 3.0

      Y = ALOG(X)

      WRITE(1,1000) X,Y

1000 FORMAT('X=',F16.9,' LN(X)=',F16.9)

      CALL EXIT

      END

 

Here is the map:

R 41  6AE8 (HEX) WDS UNUSED BY CORE  LOAD

TYPE  NAME  ENADR  LOAD  CIDN  LNTH  TVADR

ILS   ILS02  00B3  00B3  0002

ILS   ILS04  00C4  00C4  0002

LIBF  SWRT   026F  0244  0002        7FD3

LIBF  SIOF   0358  0244  0002        7FD0

LIBF  SCOMP  038F  0244  0002        7FCD

LIBF  SFIO   0425  0244  0002  06B8  7FE2

LIBF  WRTYZ  08FC  08FC  0003  00EA  7FDF

LIBF  ESTO   09EA  09E6  0002        7FD9

LIBF  ELD    0A00  09E6  0002  0030  7FDC

CALL  INIT$  0A1D  0A16  0002  0122  7FFF

LIBF  PAUSE  0B38  0B38  0003  0016  7FD6

CALL  EALOG  0B4E  0B4E  0002  0094  7FFE

LIBF  IFIX4  0BEC  0BE2  0002  002A  7FCA

LIBF  IFIX   0C0C  0C0C  0002  002C  7FC7

LIBF  FLOT4  0C38  0C38  0002  000C  7FC4

LIBF  FLOAT  0C44  0C44  0002  000C  7FC1

CALL  IOCS2  0C5D  0C50  0002  000E  7FFD

CALL  CXCLR  0C5E  0C5E  0002  0008  7FFC

CALL  NOIRQ  0C66  0C66  0003  0088  7FFB

CALL  LKIRQ  0CC0  0C66  0003        7FF5

CALL  MASK   0CEE  0CEE  0003  001A  7FFA

CALL  UNMK   0CF3  0CEE  0003        7FF8

CALL  JCLOK  0D08  0D08  0002  003A  7FF9

CALL  ZCOR$  0D42  0D42  0003  0034  7FF7

CALL  LADSI  0D76  0D76  0002  001A  7FF6

CALL  $TRJC  0D90  0D90  0002  0070  7FF4

CALL  $TRND  0DEA  0D90  0002        7FF1

LIBF  DIV4   0E1B  0E00  0002  008E  7FBE

CALL  RSVDR  0E8E  0E8E  0002  00BA  7FF3

CALL  RELDR  0ED8  0E8E  0002        7FF2

CALL  $FILE  0F48  0F48  0002  0282  7FF0

LIBF  EGETP  11CA  11CA  0002  0012  7FBB

LIBF  EADD   11E7  11DC  0002  0062  7FB8

LIBF  NORM   123E  123E  0003  002A  7FB5

LIBF  EDIV   126C  1268  0002  005C  7FB2

LIBF  XMD    12C4  12C4  0003  0042  7FAF

LIBF  EMPY   130A  1306  0002  0082  7FAC

CALL  IGAUX  1388  1388  0002  0056  7FEF

LIBF  TRAP$  13DE  13DE  0002  005E  7FA9

LIBF  FARC   143C  143C  0002  0022  7FA6

LIBF  XDD    145E  145E  0003  004A  7FA3

CALL  CXCHN  14A8  14A8  0002  0012  7FEE

CORE LOAD NAME IS- T2

      7F6E (HEX) IS $XR3X TR VCTR ADDR

      0214 (HEX) IS THE EXECUTION ADDR

 

X=     3.000000001 LN(X)=     1.098612289

 

Eddy

Brian Knittel

unread,
Jul 31, 2016, 11:54:35 AM7/31/16
to ibm...@googlegroups.com
The issue would not shown up on any "real" disk images. The bug was in the cross assembler I write to bring up DMS from source code back around 2001. We found the bug last week. A full updated source code distro will go out this coming week.
--
You received this message because you are subscribed to the Google Groups "IBM1130" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ibm1130+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Steven Zoppi

unread,
Jul 31, 2016, 12:18:04 PM7/31/16
to ibm...@googlegroups.com

Thank you Brian! Looking forward to the new distro.

 

-Steve

 

 

From: ibm...@googlegroups.com [mailto:ibm...@googlegroups.com] On Behalf Of Brian Knittel
Sent: Sunday, July 31, 2016 8:55 AM
To: ibm...@googlegroups.com
Subject: Re: [IBM1130] Solution to Extended Precision Natural Log (ELN) Issue

 

The issue would not shown up on any "real" disk images. The bug was in the cross assembler I write to bring up DMS from source code back around 2001. We found the bug last week. A full updated source code distro will go out this coming week.

 




Avast logo

This email has been checked for viruses by Avast antivirus software.
www.avast.com


Eddy Quicksall

unread,
Jul 31, 2016, 12:43:22 PM7/31/16
to ibm...@googlegroups.com

Once you get the new distro, can someone please send me the DCI so I can try it on my emulation?

--

Eddy Quicksall

unread,
Jul 31, 2016, 1:15:20 PM7/31/16
to ibm...@googlegroups.com

Actually, can you please send me the DCI for both?

Eddy Quicksall

unread,
Aug 3, 2016, 9:02:30 AM8/3/16
to ibm...@googlegroups.com

Regarding this … I did not have to change any IBM code and someone already said my disassembly matched your code. I did have a bug in the early days when Intel came out with the 486 and that was because the 486 treated a shift left on the 8086 differently. And my, if I remember correctly, my bug showed up in one of the extended precision routines.

 

Eddy

 

From: ibm...@googlegroups.com [mailto:ibm...@googlegroups.com] On Behalf Of Steven Zoppi


Sent: Sunday, July 31, 2016 12:06 AM
To: ibm...@googlegroups.com

--

Steven Zoppi

unread,
Aug 3, 2016, 9:23:25 AM8/3/16
to ibm...@googlegroups.com

The disassembly of the instruction sequence matched.  The constant generated by the cross-assembler (at label FONE) did not … and it turns out, it was kind of an important one.

Brian Knittel

unread,
Aug 3, 2016, 1:00:43 PM8/3/16
to ibm...@googlegroups.com
As I noted in a previous email, there was a bug in the 1130 cross assembler I wrote to build the DMS disk distributed on ibm1130.org. It generated an invalid bit pattern for XFLT 0.9999999 in the several places it occurred. This was not an IBM bug nor an emulator bug nor would it ever be found in any other DMS distribution.

I attached a corrected dms.dsk to that earlier email. I'll try to put the code fixes up on ibm1130.org this week.
--
Reply all
Reply to author
Forward
0 new messages