![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hellos to those not at Spectrum....I'm stuck in a port here and can't get up. Help? On D3 (and probably other "Picks"), this program: 1 PRECISION 0 2 X = 2.25 3 Y = 9 4 X = MOD(X,Y)-2 5 IF X THEN PRINT "X TRUE" ELSE PRINT "X FALSE" prints "X false", because the result of the line 4 calculation is zero ("precision 0" means no decimal places are stored, ever, at all). That's what I'd expect to happen. However, on Universe (10.x), the same code produces "X true", apparently because on Universe the "precision 0" only affects the only the *output* of the decimal places, not its internal representation - the result of the line 4 calculation is ".25" and therefore X is non-zero for the purposes of the IF statement. 1) Do I have this right? 2) Is there any way to get Universe to act like Pick in this particular case? (I'm already compiling the program on a Pick flavor account, btw). Thanks. ---jon--- |
#3
| |||
| |||
|
|
Works this way on 9.6. Assume that's just how it is. You can say IF X 'R0' THEN or IF INT(X) THEN to get your desired result, but I suspect you;re talking about not changing existing programs? Chandru "Jonathan Rogers" <thatseattleguy (AT) gmail (DOT) com> wrote in message news:1141756596.545843.158050 (AT) j33g2000cwa (DOT) googlegroups.com... Hellos to those not at Spectrum....I'm stuck in a port here and can't get up. Help? On D3 (and probably other "Picks"), this program: 1 PRECISION 0 2 X = 2.25 3 Y = 9 4 X = MOD(X,Y)-2 5 IF X THEN PRINT "X TRUE" ELSE PRINT "X FALSE" prints "X false", because the result of the line 4 calculation is zero ("precision 0" means no decimal places are stored, ever, at all). That's what I'd expect to happen. However, on Universe (10.x), the same code produces "X true", apparently because on Universe the "precision 0" only affects the only the *output* of the decimal places, not its internal representation - the result of the line 4 calculation is ".25" and therefore X is non-zero for the purposes of the IF statement. 1) Do I have this right? 2) Is there any way to get Universe to act like Pick in this particular case? (I'm already compiling the program on a Pick flavor account, btw). Thanks. ---jon--- |
#4
| |||
| |||
|
#5
| |||
| |||
|
|
"Wide zero"? That must be one of those signs of the End Days...back when I was a lad, when dinosaurs roamed the earth and computers had toggle switches to change bits in memory and dammit, 64k was enough memory for 16 or more users, you could count on zero *meaning* ZERO. Jeesh. ![]() Anyways, that's a new one for me. Though even if it was the source of the problem, changing the wide-zero value won't help because it looks like you can only set it on a SYSTEM-wide basis, not for an individual user or program. Talk about major impacts. ("Sorry, Mr. CFO, but we decided to run all our Universe programs with no decimals at all...hope that still works for the payroll and GL...") Well, if that's the way "PRECISION n" functions on Universe, I'm not happy, and I think it's a bug, but I doubt I'm going to get anyone to change anything. Looks like I need to recode these routines unless someone comes up with another idea.... thanks -jon- Regards, |
#6
| |||
| |||
|
#7
| |||
| |||
|
|
Goo'day, Back in our early UniVerse days (9.3....), some of our users in NT4 struck the zero not equal to zero problem and we were advised to change wide zero from "3dc" to "3eb", which we did, and never fell into that particular hole in the floor again.... In spite of it "being a system-wide" thing, I'd highly recommend a permanent change - you're only worring about squidgets of a decimal point - there is "Wide Zero" documentation within UniVerse........ If your problem is "wide zero" - read about the UniVerse condition before climbing too highly up the "bug tree" .... Zero ain't always zero. On 7 Mar 2006 16:03:14 -0800, "Jonathan Rogers" thatseattleguy (AT) gmail (DOT) com> wrote: "Wide zero"? That must be one of those signs of the End Days...back when I was a lad, when dinosaurs roamed the earth and computers had toggle switches to change bits in memory and dammit, 64k was enough memory for 16 or more users, you could count on zero *meaning* ZERO. Jeesh. ![]() Anyways, that's a new one for me. Though even if it was the source of the problem, changing the wide-zero value won't help because it looks like you can only set it on a SYSTEM-wide basis, not for an individual user or program. Talk about major impacts. ("Sorry, Mr. CFO, but we decided to run all our Universe programs with no decimals at all...hope that still works for the payroll and GL...") Well, if that's the way "PRECISION n" functions on Universe, I'm not happy, and I think it's a bug, but I doubt I'm going to get anyone to change anything. Looks like I need to recode these routines unless someone comes up with another idea.... thanks -jon- Regards, Bruce Nichol Talon Computer Services ALBURY NSW Australia http://www.taloncs.com.au If it ain't broke, fix it until it is.... |
#8
| |||
| |||
|
|
It's the fact that PRECISION on universe is only affecting the display of a variable; it seemlingly doesn't affect internal calculations at all (or inconsistently). That's what I mean by "bug". |
#9
| |||
| |||
|
#10
| |||
| |||
|
|
And you can avoid the whole precision problem by doing all calculations without a decimal and without using MR2 until you are presenting the results to a human. Even then you will get better presentations with a little coding. Hi |
![]() |
| Thread Tools | |
| Display Modes | |
| |