About Store Forum Documentation Contact



Post Reply 
TextReal strange behaviour
Author Message
Houge Offline
Member

Post: #1
TextReal strange behaviour
   

I have Dbl = 29.95, when i do
Code:
TextReal(num, 1)
I get 30.9!

Code:
TextReal(num, 2)
works as expected.

It doesn't work if I do "num = 29.95" actually, and that is very strange; It works only when I read this Dbl from database.
Here is the complete working example, you don't need any DB to test it, as i made this Dbl through fileMem()

Code:
/******************************************************************************/
Dbl num = 0;
void InitPre()
{
   EE_INIT();
}
/******************************************************************************/
bool Init()
{
   File f; f.writeMem();
   f.putByte(0x33)
    .putByte(0x33)
    .putByte(0x33)
    .putByte(0x33)
    .putByte(0x33)
    .putByte(0xF3)
    .putByte(0x3D)
    .putByte(0x40)
    .pos(0);
   num = f.getDbl();
  
   D.mode(320, 240);
  
   return true;
}
/******************************************************************************/
void Shut()
{ }
/******************************************************************************/
bool Update()
{ return true; }
/******************************************************************************/
void Draw()
{
   D.scale(3);

   D.clear(TURQ); // clear screen to turquoise color
   D.text (0,  0.1f, S + "num: " + num);
   D.text (0,  0.0f, S + "TextReal(num, 1): " + TextReal(num, 1));
   D.text (0, -0.1f, S + "TextReal(num, 2): " + TextReal(num, 2));
}
/******************************************************************************/

P.S. if you do "num = num * -1;" it will be -30.9 smile
P.P.S. Both debug and release, both x32 and x64, i have latest Engine.
(This post was last modified: 10-18-2017 12:32 AM by Houge.)
10-18-2017 12:25 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: TextReal strange behaviour
Thank you for reporting this, let me check..
10-18-2017 12:53 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #3
RE: TextReal strange behaviour
Thank you, this commit:
https://github.com/Esenthel/EsenthelEngi...c2000c842a
should fix the problem.
If you experience any other issues, please let me know.
10-18-2017 01:25 AM
Find all posts by this user Quote this message in a reply
Houge Offline
Member

Post: #4
RE: TextReal strange behaviour
Thank you very much, it was very fast smile
Everything is OK for now smile
10-18-2017 01:28 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply