M2S Strings + Reals Prob
11 messages in this thread
I'm having LOADS of trouble with the M2S floating point and string
routines.
The Real and LongReal conversions to strings are universally off by 4.99.
The TRUNC routine is off by 1 (e.g truncates 6.6E1 to 65!). Anyway, I tried
to build my own conversion routines in M2S and found many difficulties with
string processing. To look like the existin libary routines, I pass an
ARRAY OF CHAR VAR to a routine, load it CHR by CHR and then try to
terminate it with a null or linefeed. Whatever I put at the end of the
string using InsertSubString causes the machine to crash when run
eventhough the compiler lets both of those characters go by for inserting
into the substring.
Each time I try to use Modula 2 I find the restrictions driving me to C.
Very disappointing since I don't have a C compiler. You can't write printer
drivers in Modula 2, can't link M2 to other language object modules, and
the string processing is very cumbersome. Its just very frustrating to sit
down to write a quicky routine to patch some Desktop Budget files (Gold
DIsk can't seem to ballance accounts very well, and they don't give you the
lattitude to change it in the application) and end up spendind weeks trying
to work around both problems in the compiler and unreasonable restrictions
in the language. Seems like Modula2 is good for the basic "hello world"
stuff you do in school, but so far I've not been able to complete one
project with it. Always end up having to use C, assem of sometimes even
BASIC!
Am I the only one having these trouble with M2S/Modula 2?
wmc
Wayne, you obviously don't have the latest REAL modules. If I remember
well, the corrected version is in the M2S lib in AmigaVend. As too the
strings I'm not sure what it is you're trying to do, but I don't have any
problems with them. I find M2Sprint provides a good range of string
manipulation routines, including some C style ones in the CStrings module.
Sylvain
Sylvain,
I'm building a string representation of a real character by character as a
replacement for the real and long real conversion routines.
I DL'd the routines you mentioned and tried to compile the new RTR.mod that
was in there but it had compiler swithches that my version (1.10) of the
compiler doesn't support. Also, string indexing appears off. Try to put a
CHAR in the xth potiont of a string (array [0..n] of char) and it ends up
in postion x + 1.
TRUNC not only truncates, it also subtracts a little (6.6E1 truncs to 65).
All these little gotchas and the fact that M2S is now under ownership of a
hostile managment (to the product, not to people) mean that I'll give up
until Martin's new project comes out or I get impatient and go for Lattice
C. (I refuse to get Benchmark after finding out out how they played in the
demise of M2S… good business manuever, but I think it shows that the
customers of M2S – the "barely 300" of us – were way down on Benchmarks
list of priorities in the take-over. So I put them low on my list of
companies I'll support with my dough…)
wmc
I'm sorry to hear that M2Sprint is not working out for you. Personnaly I
really like it, but I can't wait to see what Martin will come up with next!
*** SLY ***
Sylvain,
I like the editor; Its better than the TopSpeed editor even. The "feel"of
the environment is nice. It just suffers from two bugs and two features
that make it essentially unuseable for most of the projects I had in mind:
inaccurated real arithmetic; innaccurate string operations; inability to
link to other language object modules; debugger that changes the value
reported for enumerated types when the variable's position on the debugger
window changes.
If the product were supported by the nwe owners the way it was when Martin
was around, I wouldn't be so down on it, but since it is unlikely that we
will see updates/bug fixes I'll just have to can it.
I guess since no one else has these problems that I just missed some
update after 1.10 compiler (I got 1.11 libs — I seem to recall that was
the $25 – $35 update everyone grumbled about — but no compiler update. SO
I can't compile the "fixes" that users have U'Led to the Vendor forum.)
wmc
That's too bad Wayne. I wish we hadn't been left in the dust when the
company changed hands. From what I heard here, Martin is about to come out
with an other Modula-2, probably based on the V2.0 he was working on when
he left. I hope we'll get an upgrade offer, since the present owners don't
care about us, I will surely buy Martin's stuff, his support was truly
outstanding.
*** SLY ***
Sly –
My information is that Martin is definitely working on a new Modula-2,
and it will have the features listed as being worked on for M2Sprint 2.0.
He is also definitely considering a special deal for M2Sprint owners. I
called him and spoke with him for a few minutes about it, and he put me on
his mailing list for notification when the product was ready and pricing
had been decided. Unfortunately, I can't remember what I did with the
number, but Robert Salesas (here in the Amiga fora) gave it to me; perhaps
he'd be nice enough to do the same for you.
Harry
This is great news Harry, I'll see if I can get his number, I just changed
address, so it would definitely be nice to call Martin and get on his
mailing list.
*** SLY ***
SLY,
I talked to Martin on the phone a couple months back on a steer from R.
Salesas (sp?). There's more cooking then M2. And it is pretty exciting (at
least for the things I'd like to learn about).
BTW, I did some experimenting and narrowed the floating point problems down
to the LongRealConversions module. There is a line that reads:
num:=num + PowerOfTen(-D)*0.5D;
that should read:
num:=num + PowerOfTen(-D-exp)*0.5;
I haven't check the RealConversions yet, but I suspect a similar fix needs
to be made there. Note that these are in the official 1.11 library
release.
wmc
Hi Wayne, sounds good, I can't wait to see what he comes up with. I already
applied your fix to the LongRealConversions and the RealConversions
modules, works like a charm. Thanks!
*** SLY ***
Sylvain,
I'm just gald it turned out to be tha simple. At first I thought it was in
the LongMathLib0 routines 'cause the debugger output aggreed with the
LongRealCOnversion output from the program. I think I need to look at the
debugger a little closer…
If you have made any other lib fixes since 1.11, I'd be most appreciative
if you could post them. Maybe twixt the two of us we can keep going on M2
until Martin's next project hits the streets.
wmc