PDA

View Full Version : [2.50.2] Negative Max Float Error?



ZoriaRPG
12-09-2015, 05:36 AM
Apparently, the negative max constant is -021473.0001

I checked, and negative max int is -214747, negative max float is -214747.9999. This only affects constants.

This apparently is true in 2.50.2, 2.50.1, and 2.50.0.

Tamamo
12-09-2015, 10:31 AM
Not a bug, just the way things work.

ZoriaRPG
12-12-2015, 03:34 AM
Not a bug, just the way things work.

Well, one way or another, it's something that deserves correction, as max signed type constant should always match max signed type variable.

These values sum 236221.0, which doesn't seem to indicate anything.. Signed, or unsigned, long or fixed, that value doesn't make any sense.

21473.0001 is derived, how?
Gleeok : Confirmation requested.

Gleeok
12-12-2015, 04:46 AM
Probably a bug.

ZoriaRPG
12-12-2015, 08:05 AM
Probably a bug.

that's what I'm feeling here. The value to handle them should be a signed long, and thus identical in both directions. Technically, it could extend in one direction by .0001, which might have been the intent, and how we got this screwy value.

I have no idea why Tamamo flagged it 'not a bug', but then again, I can't find this in the [ ... ] material.

I think the value is simply input improperly, but I'm having a fun time trying to find where this is handled... I swear, this shyte is going to drive me doubly out of my flipping mind. I say just make it 214747.9999 in both directions, and be done...if I can ever locate it. Then again, waiting a week, would be better.

Tamamo
12-12-2015, 10:26 AM
The reason I didn't think it was a bug is because they use a custom type (fix) don't they? If not then...
From what saffith told me all numbers in zscript are the same thing.

http://wp.production.patheos.com/blogs/christandpopculture/files/2013/08/x240-qzI.jpg

ZoriaRPG
12-12-2015, 11:26 AM
I'm pretty sure those are just for Allegro things, using the Fix class. I don't even see the fix.h file anywhere, or know where the defs, and related functions are being loaded. I skimmed to find that in the past, but it isn't among my files, so ...

Either way, a fixed width integer can be 32b signed. If the values aren't 32b signed longs, they're 32b wide signed fixed ints. I'm pretty sure they are signed longs though... I'll probably wait for the 'promised day' to do anything more about this, but I did again glance through the lexer, and now need more alcohol. We should probably unflag this topic for now.

For what it's worth, the lexer also has a bug that allows compilation of a script with a ? token i it. It gives a lexical error warning, but compiles it anyhow; which, as was reported to me, can be a problem if a user hits ? instead of / in a calculation. It's because the lexer defines ? and ^ as %token SINGLECHAR, and is set up to report a lexical error for them, but not to halt compilation. :/

That's more of an oversight than a true bug, but it feels as if it'll be mad easy to correct.

Tamamo
12-14-2015, 09:52 AM
it seems to be 18 bits but doesn't use all of them, weird.
The fraction is separate of course and is truncated to 62 bit.

Definitely a bug.

ZoriaRPG
12-17-2015, 12:20 AM
it seems to be 18 bits but doesn't use all of them, weird.
The fraction is separate of course and is truncated to 62 bit.

Definitely a bug.

Please send me a PM with the filenames, and line number (the latter, if possible) for where you saw it, so that I can find it readily.

Tamamo
12-19-2015, 06:18 AM
I didn't, I took the numbers you gave us, and plugged them into my brain which outputs binary anyways.
WHere are you Saffith, if your there get your ass in here.

Saffith
12-19-2015, 05:20 PM
I get a truncation warning on -100000, but not -99999. Perhaps it truncates the integer part to six digits and is including the minus in that.
It used to be that constants couldn't be negative. It could be related to that; that truncation would have been safe originally.

ZoriaRPG
12-19-2015, 09:00 PM
I get a truncation warning on -100000, but not -99999. Perhaps it truncates the integer part to six digits and is including the minus in that.
It used to be that constants couldn't be negative. It could be related to that; that truncation would have been safe originally.

Add a decimal portion to it. It will error on:

const float NN = -999998.9999;

Any negative integer smaller than 999999. and any negative float smaller than -21473.0001 is truncated.

Saffith
12-19-2015, 09:41 PM
Do you mean -99998.9999? -999999.9999 is much too low. I don't see any errors on -99999.9999 or -99998.9999.
I noticed this, however:
const float ASDF=-100.9999;

Trace(ASDF);
Trace(-100.9999);

That prints
-99.0001
-100.9999

That seems to support the hypothesis that it's simply dropping a digit. It only checks six characters before the decimal point, then adds everything after that.
In any case, I can probably figure out how to fix it.

Edit: Yep. Fixed.

ZoriaRPG
12-20-2015, 06:51 AM
Do you mean -99998.9999? -999999.9999 is much too low. I don't see any errors on -99999.9999 or -99998.9999.
I noticed this, however:
const float ASDF=-100.9999;

Trace(ASDF);
Trace(-100.9999);

That prints
-99.0001
-100.9999

That seems to support the hypothesis that it's simply dropping a digit. It only checks six characters before the decimal point, then adds everything after that.
In any case, I can probably figure out how to fix it.

Edit: Yep. Fixed.


Oh, yes, I did mean that. Typed an extra 9 there; didn't I?

The sign as a string char...that figures. Good to know that it's fixed for the future.

Does it now support MIN_FLOAT of -214747.9999 ? or some other value?

Saffith
12-20-2015, 12:56 PM
Yes, it's -214747.9999.

ZoriaRPG
12-23-2015, 04:38 PM
Yes, it's -214747.9999.

Good, very very good. Thank you.

As a side- note, this just created an blindingly easy 2.50.3 versus 'earlier versions' validation. At least I will be sure of completing all the std update and zscript docs files before that is ready. :p

Seriously though, I truly am almost done with everything except the std.txt docs. Those are on my list. I'm rewording some thing sin zscript.txt now, and adding some sections. I added a heading on system timing, that you might want to verify, and I'll send you that as a PM.