Difference between revisions of "Talk:LlRound"

From Second Life Wiki
Jump to: navigation, search
(Just asking...)
 
m (Rounding direction)
 
(7 intermediate revisions by 3 users not shown)
Line 2: Line 2:
 
https://wiki.secondlife.com/w/index.php?title=LlRound&diff=next&oldid=1187121
 
https://wiki.secondlife.com/w/index.php?title=LlRound&diff=next&oldid=1187121
 
fit in with the edit of https://wiki.secondlife.com/w/index.php?title=LlJsonSetValue&diff=prev&oldid=1181771 made for "...better readability on mobile screens..."??? [[User:LepreKhaun Resident|LepreKhaun Resident]] 20:47, 20 January 2014 (PST)
 
fit in with the edit of https://wiki.secondlife.com/w/index.php?title=LlJsonSetValue&diff=prev&oldid=1181771 made for "...better readability on mobile screens..."??? [[User:LepreKhaun Resident|LepreKhaun Resident]] 20:47, 20 January 2014 (PST)
 +
 +
==Rounding direction==
 +
I can see in retrospect of course that there's no problem in accurately holding -4.5 or -5 in a float. But as for rounding towards positive infinity, is the lslWiki page wrong too? http://lslwiki.net/lslwiki/wakka.php?wakka=llRound [[User:Omei Qunhua|Omei Qunhua]] 13:26, 14 June 2014 (PDT)
 +
:Check what LSO does, this may be a difference between LSO and Mono that was never caught... or nobody noticed that llRound is not [http://www.cplusplus.com/reference/cmath/round/ cmath roundf] -- '''[[User:Strife_Onizuka|Strife]]''' <sup><small>([[User talk:Strife_Onizuka|talk]]|[[Special:Contributions/Strife_Onizuka|contribs]])</small></sup> 18:54, 14 June 2014 (PDT)
 +
 +
Just checked ... LSO behaves the same as Mono.  And the Mozilla Java Script page says math.round behaves like LSL.  http://tinyurl.com/phsk5zy  [[User:Omei Qunhua|Omei Qunhua]] 00:22, 15 June 2014 (PDT)
 +
 +
:I checked what LSLEditor does and it does the same as Mono. -- '''[[User:Strife_Onizuka|Strife]]''' <sup><small>([[User talk:Strife_Onizuka|talk]]|[[Special:Contributions/Strife_Onizuka|contribs]])</small></sup> 12:13, 15 June 2014 (PDT)
 +
 +
:: Not for me .
 +
::I have 3 different comportements if i am on Second Life , on OpenSim , on LSL Editor
 +
<lsl>
 +
 +
default
 +
{
 +
 +
    touch_start(integer total_number)
 +
    {
 +
        llOwnerSay((string)(llRound(-23.5)));
 +
        llOwnerSay((string)(llRound(-22.5)));
 +
        llOwnerSay((string)(llRound(22.5)));
 +
        llOwnerSay((string)(llRound(23.5)));   
 +
    }
 +
}
 +
// see explanations here : http://en.wikipedia.org/wiki/Rounding
 +
 +
    // SL : (  round half up ( round half towards positive infinity))
 +
 +
    //[02:42] Object: -23
 +
    //[02:42] Object: -22
 +
    //[02:42] Object: 23
 +
    //[02:42] Object: 24
 +
 +
    // Opensim on Windows (  round half away from zero (round half towards infinity))
 +
 +
// [02:45] Primitive: -24
 +
// [02:45] Primitive: -23
 +
// [02:45] Primitive: 23
 +
// [02:45] Primitive: 24
 +
 +
// LSLEditor on Windows ( Round half to even ( IEEE754, the default mode ))
 +
//new: -24
 +
//new: -22
 +
//new: 22
 +
//new: 24
 +
</lsl>
 +
::I should test on LSLForge , but i have the strange intuition i will get a 4th different method of rounding
 +
::[[User:Miranda Umino|Miranda Umino]] 02:59, 16 June 2014 (PDT)
 +
 +
:::I was lazy and only tested -4.5 -> -4 I didn't remember the even rounding mode. -- '''[[User:Strife_Onizuka|Strife]]''' <sup><small>([[User talk:Strife_Onizuka|talk]]|[[Special:Contributions/Strife_Onizuka|contribs]])</small></sup> 09:18, 16 June 2014 (PDT)

Latest revision as of 08:22, 16 June 2014

In all seriousness, how does a "pretty table", which doubled the page width, https://wiki.secondlife.com/w/index.php?title=LlRound&diff=next&oldid=1187121 fit in with the edit of https://wiki.secondlife.com/w/index.php?title=LlJsonSetValue&diff=prev&oldid=1181771 made for "...better readability on mobile screens..."??? LepreKhaun Resident 20:47, 20 January 2014 (PST)

Rounding direction

I can see in retrospect of course that there's no problem in accurately holding -4.5 or -5 in a float. But as for rounding towards positive infinity, is the lslWiki page wrong too? http://lslwiki.net/lslwiki/wakka.php?wakka=llRound Omei Qunhua 13:26, 14 June 2014 (PDT)

Check what LSO does, this may be a difference between LSO and Mono that was never caught... or nobody noticed that llRound is not cmath roundf -- Strife (talk|contribs) 18:54, 14 June 2014 (PDT)

Just checked ... LSO behaves the same as Mono. And the Mozilla Java Script page says math.round behaves like LSL. http://tinyurl.com/phsk5zy Omei Qunhua 00:22, 15 June 2014 (PDT)

I checked what LSLEditor does and it does the same as Mono. -- Strife (talk|contribs) 12:13, 15 June 2014 (PDT)
Not for me .
I have 3 different comportements if i am on Second Life , on OpenSim , on LSL Editor

<lsl>

default {

   touch_start(integer total_number)
   {
       llOwnerSay((string)(llRound(-23.5)));
       llOwnerSay((string)(llRound(-22.5)));
       llOwnerSay((string)(llRound(22.5)));
       llOwnerSay((string)(llRound(23.5)));    
   }

} // see explanations here : http://en.wikipedia.org/wiki/Rounding

   // SL : (  round half up ( round half towards positive infinity))
   //[02:42] Object: -23
   //[02:42] Object: -22
   //[02:42] Object: 23
   //[02:42] Object: 24
   // Opensim on Windows (  round half away from zero (round half towards infinity))

// [02:45] Primitive: -24 // [02:45] Primitive: -23 // [02:45] Primitive: 23 // [02:45] Primitive: 24

// LSLEditor on Windows ( Round half to even ( IEEE754, the default mode )) //new: -24 //new: -22 //new: 22 //new: 24 </lsl>

I should test on LSLForge , but i have the strange intuition i will get a 4th different method of rounding
Miranda Umino 02:59, 16 June 2014 (PDT)
I was lazy and only tested -4.5 -> -4 I didn't remember the even rounding mode. -- Strife (talk|contribs) 09:18, 16 June 2014 (PDT)