I have the following code that at first sight should return a value of zero but does not always. What

can be done about this. The following code works as expected and will return a value of zero.

myVar2=-.25;

myVar=0;

mid=0;

button.onRelease = function(){

myVar=myVar+.05;

mid=myVar2+myVar;

integer=Math.floor(mid);

};

Can anyone tell me why the following code produces a result like 1.38777878078145e-17 instead of zero.

myVar2=-.1;

myVar=0;

mid=0;

button.onRelease = function(){

myVar=myVar+.01;

mid=myVar2+myVar;

integer=Math.floor(mid);

};

This problems seems to be beyond my knowledge. Any help so deeply appreciated. Thanks in advance.

1.38777878078145e-17 is zero to an accuracy of over 16 decimal places. integer of course, cannot be non-integer value, so i'm not sure what variable you found that has the decimal expression above.

Thanks so much for the reply. I simply did not know that was a form of zero.

I would not have know that for years without your reply.

I am more hopeful now. I

have a function that looked at the integer value to see if it is zero and if it is some movie clips will be displayed. The following code has work well for me for quite some time, It was not until last night that I realized that it was not working for some possibilities.

_root.equalsign.onEnterFrame = function(){

if (integer==0){

this._visible=1;

_root.next_but._visible=1;

_root.Great_work._visible=1;

}

}

This function, seems to want to have the value of 0.

I tried the following but it did not work. Obviously I need to know more about these math functions

as this is completely foreign to me.

_root.equalsign.onEnterFrame = function(){

if (correct==0 || correct==1.38777878078145e-17){

this._visible=1;

_root.next_but._visible=1;

_root.Great_work._visible=1;

}

}

I would not have know that for years without your reply.

I am more hopeful now. I

have a function that looked at the integer value to see if it is zero and if it is some movie clips will be displayed. The following code has work well for me for quite some time, It was not until last night that I realized that it was not working for some possibilities.

_root.equalsign.onEnterFrame = function(){

if (integer==0){

this._visible=1;

_root.next_but._visible=1;

_root.Great_work._visible=1;

}

}

This function, seems to want to have the value of 0.

I tried the following but it did not work. Obviously I need to know more about these math functions

as this is completely foreign to me.

_root.equalsign.onEnterFrame = function(){

if (correct==0 || correct==1.38777878078145e-17){

this._visible=1;

_root.next_but._visible=1;

_root.Great_work._visible=1;

}

}

Tuesday, February 03, 2004 4:00 PM

(New!)

sorry there is a mistake in my explanation as given before

if (correct==0 || correct==1.38777878078145e-17){

should have been

if (integer==0 || integer==1.38777878078145e-17){

(the code using correct is what I am using in my program, I changed it to integer here

so that it would be more clear.

The code I supplied should have read.

_root.equalsign.onEnterFrame = function(){

if (integer==0){

this._visible=1;

_root.next_but._visible=1;

_root.Great_work._visible=1;

}

}

This function, seems to want to have the value of 0.

I tried the following but it did not work. Obviously I need to know more about these math functions

as this is completely foreign to me.

_root.equalsign.onEnterFrame = function(){

if (integer==0 || integer==1.38777878078145e-17){

this._visible=1;

_root.next_but._visible=1;

_root.Great_work._visible=1;

}

}

Many many thanks to kglad for help with this issue. You are truly a great blessing to this forum and have

been a real help to me personally in the past.

I wish that there was something that I could do for you in return.

I had to abandon the approach that I was taking and produced the result that I needed by a different

method.

There was something of a panic here as the program was about to be released in its Beta form

and then this problem showed up.

Once again many thanks from javman and his family.

been a real help to me personally in the past.

I wish that there was something that I could do for you in return.

I had to abandon the approach that I was taking and produced the result that I needed by a different

method.

There was something of a panic here as the program was about to be released in its Beta form

and then this problem showed up.

Once again many thanks from javman and his family.

oh, you're very welcome javaman (and family). i'm glad you were able to find a work-around.

1. Math.random() and Math.round(Math.random()) and Math.floor(Math.random()*2)

2. Math.random() and Math.round(Math.random()) and Math.floor(Math.random()*2)

3. Is there a way to have math that is not "display math" look like display math?

4. Is there a way to have math that is not "display math" look like display math?

5. FA: 1-Day-Left: 6 Math Books - 4 Math CDROMs - Algebra, Discrete Math, Calculus, more...

6. Is there a way to have math that is not "display math" look like ?display math?

7. (Not limited to integer) math problem [was: Integer math problem]

8. reflecting math operator in math mode help

9. XML::Simple + Math::Currency / Math::BigInt problem

10. [PHP] Math problems (No not high school math!)

11. Math problems (No not high school math!)

12. [PHP] Math problems (No not high school math!)

13. Math::Infinity and Math::NaN

14. matlab math to c++ math conversion

15. FA: 4 Math CDROM's & Discrete Math, Calculus, Algebra (etc) Books...

6 post • Page:**1** of **1**