# Difference between revisions of "Category talk:LSL Vector"

From Second Life Wiki

m |
m (+{{unsigned|Zohan Galewind|06:29, 29 April 2012}}) |
||

Line 34: | Line 34: | ||

} | } | ||

</lsl> | </lsl> | ||

− | + | {{unsigned|Zohan Galewind|06:29, 29 April 2012}} | |

---- | ---- | ||

The above is caused by how floating point math works. 0.1 does not fall on an exact boundary as a float, nor does 0.025. Furthermore the rounding on the two values do not exactly line up, so (4 * 0.025) != 0.1. This is not a bug but a caveat of using floating point math. -- '''[[User:Strife_Onizuka|Strife]]''' <sup><small>([[User talk:Strife_Onizuka|talk]]|[[Special:Contributions/Strife_Onizuka|contribs]])</small></sup> 11:00, 29 April 2012 (PDT) | The above is caused by how floating point math works. 0.1 does not fall on an exact boundary as a float, nor does 0.025. Furthermore the rounding on the two values do not exactly line up, so (4 * 0.025) != 0.1. This is not a bug but a caveat of using floating point math. -- '''[[User:Strife_Onizuka|Strife]]''' <sup><small>([[User talk:Strife_Onizuka|talk]]|[[Special:Contributions/Strife_Onizuka|contribs]])</small></sup> 11:00, 29 April 2012 (PDT) |

## Revision as of 14:04, 30 April 2012

<lsl> //******************************* //IMPOSSIBLE TO GET A ZERO_VECTOR //*******************************

vector c = <0.0, 0.0, 0.1>;

default {

touch_start(integer total_number) { c -= <0.0, 0.0, 0.025>; llSay(0, (string)c); if (c == ZERO_VECTOR) llSay(0, "ZERO_VECTOR"); // never c is a ZERO_VECTOR }

} </lsl> <lsl> //********************** //IN THIS WAY IT RUNS... //**********************

vector c = <0.0, 0.0, 0.1>;

default {

touch_start(integer total_number) { c -= <0.0, 0.0, 0.025>; llSay(0, (string)c); if ((string)c == "<0.00000, 0.00000, 0.00000>") llSay(0, "ZERO_VECTOR"); }

} </lsl> —The preceding unsigned comment was added on 06:29, 29 April 2012 by Zohan Galewind

The above is caused by how floating point math works. 0.1 does not fall on an exact boundary as a float, nor does 0.025. Furthermore the rounding on the two values do not exactly line up, so (4 * 0.025) != 0.1. This is not a bug but a caveat of using floating point math. -- **Strife** ^{(talk|contribs)} 11:00, 29 April 2012 (PDT)