Discussion:
does anyone have corrected ISO library LongStr, compatible with Stony Brook?
(too old to reply)
m***@gmail.com
2016-08-22 06:47:52 UTC
Permalink
Raw Message
I recently was doing a bunch of double precision floating point conversions to string, using the ISO routines, from the library LongStr, and found that the code form 1992 has bugs in it, particularly related to large numbers. I have their source code, but their algorithm was weak.

they have accumulated rounding errors due to repeated by 10. The easiest way on an intel box is to use the floating point to BCD instructions, but am a little rusty on the old Macro Assembler, wondering if anyone out there has a more recent version of the LongStr code.

thanks

edward
Martin Brown
2016-08-22 13:00:19 UTC
Permalink
Raw Message
Post by m***@gmail.com
I recently was doing a bunch of double precision floating point conversions to string,
using the ISO routines, from the library LongStr, and found that the
code form 1992 has
Post by m***@gmail.com
bugs in it, particularly related to large numbers. I have their
source code, but their
Post by m***@gmail.com
algorithm was weak.
What sorts of numbers does it fail on?

It seems more likely to me that it is due to an error in how the binary
exponent is being handled in extremely large numbers.

Hard to comment further without seeing input, output and source code.
Post by m***@gmail.com
they have accumulated rounding errors due to repeated by 10. The easiest way on an intel
box is to use the floating point to BCD instructions, but am a little
rusty on the old
Post by m***@gmail.com
Macro Assembler, wondering if anyone out there has a more recent
version of the LongStr code.

If the number you want is in variable x and the destination is d.

FLD x
FRNDINT
FBSTP d

d will contain the BDC representation of the integer part of x
(provided that it will fit in the available space)

Beware that the rounding flag can cause trouble on some compilers.
--
Regards,
Martin Brown
Chris Burrows
2016-08-23 07:59:07 UTC
Permalink
Raw Message
Post by m***@gmail.com
wondering if anyone out there has a more recent version of the LongStr code.
v2.28 of ADW Modula-2 included the source of LongStr with a copyright date of 2004. Unfortunately, the release notes of later versions of ADW include this statement:

"Because of copyright issues, the source code of the implementation modules (MOD files) of the runtime libraries (RTL) has been removed from the package."

Regards,
Chris

Chris Burrows
CFB Software
http://www.cfbsoftware.com/modula2
j***@gmail.com
2016-08-24 10:11:33 UTC
Permalink
Raw Message
Post by m***@gmail.com
I recently was doing a bunch of double precision floating point conversions
Some time ago I found the ULM Modula-2 package in a deserted directory. On it was RealConv.m2 I put it online. Not sure if you may copy it but it sure will be an inspiration for your own new modules....

Get it on http://verhoeven272.nl/etc/RealConv.m2 while it lasts.

It came from the tarball modula-src-3.0b8.tar.gz which should be out there on the web someplace.
Loading...