PDA

View Full Version : Const Floats with Negative Values



CSD
07-25-2016, 06:43 PM
Seems like what's happening is that the decimal part is being added, rather than subtracted, by the compiler?
While -5.0 compiles to -5.0, -4.9 instead compiles to -3.1. (So it's -4 + 0.9 instead of -4 - 0.9.)
So if what you want really want is a const float of -4.9, you need ask for -5.1 instead.

ZoriaRPG
07-25-2016, 11:11 PM
Oh joy. They also truncate where they should not: As I recall, they were being read into the string impropery, because the sign was increasing the length of the value; and Saffith fixed them in the post 2.50.2 codebase, prior to the source release. (See: http://shardstorm.com)

Needs confirmation, and IDK if these returns were fixed at the same time as that issue. Saffith

This was in the old bugs database, that has been archived.
Gleeok, I think we need the last x-months of that revived.

Prior thread: http://armageddongames.net/showthread.php?97405-2-50-2-Negative-Max-Float-Error

Gleeok
07-25-2016, 11:17 PM
Fixed by changing the 'const' keyword to 'wacky'. From now on you can declare them as:



wacky int value = -4.9; //actually -3.1 according to wacky specification.



...Or possibly the negation can apply to the thing at the end n' stuff... that could also work. (I had thought this was fixed already for some reason)

CSD
07-25-2016, 11:18 PM
I lost a couple of very confused hours to this one. I had a legit logic error that was causing a variable controlling x speed to not retain its full significance, and this was a value I was using for terminal velocity on the y axis and I thought -4.9 being so much less than -5.0 was a related problem, but nope.

"* Fixed negative constants being read incorrectly."
Oh so maybe this one was fixed then...? If that turns out to be the case I have a back-up bug I could use for this thread I guess.

ZoriaRPG
07-25-2016, 11:20 PM
"* Fixed negative constants being read incorrectly."
Oh so maybe this one was fixed then...? If that turns out to be the case I have a back-up bug I could use for this thread I guess.


Back-up bug? Hahahah. We need to keep them in reserve, now, instead of just reporting them?

What I know was fixed, was improper truncation. Negative constants doing whatevery they please was overlooked for a very long while, it seems.

CSD
07-25-2016, 11:26 PM
Well I don't think it deserves a thread and I don't want to just lump it in with something else, so if this bug is fixed already it's the perfect time!

ZoriaRPG
07-26-2016, 03:35 AM
I'm going to state as a fact, that it's easier for us if all bugs are in their own threads, however minor. If someone wants to post 1000 threads with minor bug reports, it'd be easier to go through, do them one at a time, and tick them 'sick', than it is to handle one thread with more then one bug. That make sit much harder to categorise them, when we fix, verify, or otherwise handle them.

Pretty much, I'd end up manually splitting it into a new thread anyway. [/mod]


Fixed by changing the 'const' keyword to 'wacky'. From now on you can declare them as:



wacky int value = -4.9; //actually -3.1 according to wacky specification.



...Or possibly the negation can apply to the thing at the end n' stuff... that could also work. (I had thought this was fixed already for some reason)


Don't...tempt...me...