Jump to content

Is there an explanation for this strange behavior?


Triple Peccable
 Share

You are about to reply to a thread that has been inactive for 4799 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Please explain this script's output (when it is mono compiled):

 

default
{
    touch_start(integer total_number)
    {
        llOwnerSay((string)((float)"nan"));
        llOwnerSay((string)((float)"anything other than nan"));
    }
}

 Here is the output:

[14:05]  Object: NaN
[14:05]  Object: 0.000000

If I don't compile it in mono, I get a script error instead of the output:

[14:07]  Object: Object [script:New Script] Script run-time error
[14:07]  Object: Math Error

Unless "nan" has some numerical meaning that I am unaware of, this looks like a bug to me. Any comments?

 

  • Like 1
Link to comment
Share on other sites

Ok, but I still have an issue with this behavior. The string does not have to equal "nan", it only has to start with nan. If the string was Nantucket, I would get NaN instead of 0.00000, then when that result gets used in a calculation a fatal script error occurs (Math Error).

This causes obscure bugs. For example, I had a visitor who's first name was nana. My "working perfectly" script suddenly crashed with a Math Error. If this is not a bug, then i will have to test strings to make sure they do not start with "nan" before I typecast them. I should not have to do that.

 

Link to comment
Share on other sites

I agree that the behavior is stupid... it shouldn't truncate a string, in fact, since nan is no longer processable by MONO (a dumb move if you ask me) it shouldn't be processed at all....

it's also not the only value to do it.... Infinity (inf/iformation) exibits the exact same behavior.

 

but there you have it, that is the "reason".... now get thee over to jira, and complain.... bring up back the link so we can all go and support you.

personally I'd like to see them restore MONO's signalling behavior, and even expand on the NaN handling to give full signalling values..... then you could stuff keys inside of rotations. but at the very least this truncation nonsense needs to stop, and if they aren't going to fix extended values, then they shouldn't read them at all.

  • Like 1
Link to comment
Share on other sites

well.... known now =/

I didn't realize that it would truncate a string to pull the value out like that before this post (I did know you could typecast the three letter versions, because I TRIED to get it to report extended NaN signalling to make a key crusher)

Link to comment
Share on other sites

I tried to see if I could come up with a use for the current behavior....

there's one, purposely crashing a script compiled to LSO, and there could be more IF they tweaked MONO...

 

but since it's still broken on some level no matter what... SVC-6847

which has the workaround:

(float)llList2String( llParseStringKeepNulls( llToLower( llStringTrim( vStrDta, STRING_TRIM ) ), ["inf", "nan"], [] ), 0 )

 

ETA:
wiki has been updated to include a link to the issue and the workaround

  • Like 1
Link to comment
Share on other sites

yes, those and their variations....  for instance, any number of spaces in front, and/or a leading negation, and any trailing characters.

those are the only one specified in the IEEE-754(1985) standard and are used to handle all 5 exception cases in the 2008 version of the standard.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4799 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...