GE Lua Documentation

Press F to search!

floor

Definition


-- @/=[C]:-1
function floor(...)

Callers

@/inspector/Views/TreeOutline.js
        let extraRows = Math.max(numberVisible * 5, 50);
        let firstItem = Math.floor((this._virtualizedScrollContainer.scrollTop - offsetFromContainer) / this._virtualizedTreeItemHeight) - extraRows;
        let lastItem = firstItem + numberVisible + (extraRows * 2);
@/lua/ge/extensions/gameplay/sites/zone.lua
      local dist = (vec3(cur):z0() - vec3(nex):z0()):length()
      local steps = math.max(math.floor((dist-0.1) / (maxStep)), 1)
      --print("from: " .. dumps(cur) .. " to " .. dumps(nex))
@/lua/common/kdtreebox3d.lua
  self.itemCount = self.itemCount / 7
  local maxDepth = floor(log10(self.itemCount) / log10(2)) + 1 -- max depth that can accomodate all items while being full (root is depth 1)
  local treeNodeCount = 2 * ceil(self.itemCount / maxDepth) - 1 -- optimize node count so that tree depth ~ # of items in each node
  self.tree = table.new(4 * treeNodeCount, 0)
  self.nonLeafLimIdx = 4 * floor(treeNodeCount * 0.5)
  self:_build(1, 7, self.itemCount * 7, 4)
@/lua/ge/extensions/career/modules/milestones/generalMilestones/statistic.lua
      getDescription = function(step, current, target) return string.format("Play the game for %dh.", target/3600) end,
      getProgressLabel = function(step, current, target) return string.format("%dh %dm / %dh", math.floor(current / 3600),math.floor(((current % 3600) or 0) / 60),target/3600) end,
      getTarget = function(step) return step == 0 and 0 or math.max(1,(step)*5)*3600 end,
      getDescription = function(step, current, target) return string.format("Play the game for %dh.", target/3600) end,
      getProgressLabel = function(step, current, target) return string.format("%dh %dm / %dh", math.floor(current / 3600),math.floor(((current % 3600) or 0) / 60),target/3600) end,
      getTarget = function(step) return step == 0 and 0 or math.max(1,(step)*5)*3600 end,
      getProgressLabel = function(step, current, target) return string.format("%d / %d", current, target) end,
      getTarget = function(step) return step == 0 and 0 or math.max(1,math.floor(math.pow(step-1,1.5))*5) end,
      getRewards = milestones.majorLinear,
      getProgressLabel = function(step, current, target) return string.format("%dm %ds / %dm %ds", current/60, current%60, target/60, target%60) end,
      getTarget = function(step) return step == 0 and 0 or math.max(1,math.floor(math.pow(step,1.5)))*30 end,
      getRewards = milestones.majorLinear,
@/lua/vehicle/controller/drivingDynamics/supervisors/yawControl.lua
  M.isActing = isActiveSmoothed >= 1
  electrics.values.esc = floor(isActiveSmoothed) * CMU.warningLightPulse
  electrics.values.escActive = isActiveSmoothed >= 1
@/ui/modules/options/options.js
    precision = precision || 1
    var number = Math.floor(Math.log(bytes) / Math.log(1024))
    return (bytes / Math.pow(1024, number)).toFixed(precision)
@/ui/lib/ext/angular-ui-router.min.js
 */
"undefined"!=typeof module&&"undefined"!=typeof exports&&module.exports===exports&&(module.exports="ui.router"),function(a,b,c){"use strict";function d(a,b){return S(new(S(function(){},{prototype:a})),b)}function e(a){return R(arguments,function(b){b!==a&&R(b,function(b,c){a.hasOwnProperty(c)||(a[c]=b)})}),a}function f(a,b){var c=[];for(var d in a.path){if(a.path[d]!==b.path[d])break;c.push(a.path[d])}return c}function g(a){if(Object.keys)return Object.keys(a);var b=[];return R(a,function(a,c){b.push(c)}),b}function h(a,b){if(Array.prototype.indexOf)return a.indexOf(b,Number(arguments[2])||0);var c=a.length>>>0,d=Number(arguments[2])||0;for(d=d<0?Math.ceil(d):Math.floor(d),d<0&&(d+=c);d=0||(k.push(e[m]),j[e[m]]=a[e[m]]);return S({},j,b)}function j(a,b,c){if(!c){c=[];for(var d in a)c.push(d)}for(var e=0;e "));if(s[c]=d,O(a))q.push(c,[function(){return b.get(a)}],j);else{var e=b.annotate(a);R(e,function(a){a!==c&&i.hasOwnProperty(a)&&n(i[a],a)}),q.push(c,a,e)}r.pop(),s[c]=f}}function o(a){return P(a)&&a.then&&a.$$promises}if(!P(i))throw new Error("'invocables' must be an object");var p=g(i||{}),q=[],r=[],s={};return R(i,n),i=r=s=null,function(d,f,g){function h(){--u||(v||e(t,f.$$values),r.$$values=t,r.$$promises=r.$$promises||!0,delete r.$$inheritedValues,n.resolve(t))}function i(a){r.$$failure=a,n.reject(a)}function j(c,e,f){function j(a){l.reject(a),i(a)}function k(){if(!M(r.$$failure))try{l.resolve(b.invoke(e,g,t)),l.promise.then(function(a){t[c]=a,h()},j)}catch(a){j(a)}}var l=a.defer(),m=0;R(f,function(a){s.hasOwnProperty(a)&&!d.hasOwnProperty(a)&&(m++,s[a].then(function(b){t[a]=b,--m||k()},j))}),m||k(),s[c]=l.promise}if(o(d)&&g===c&&(g=f,f=d,d=null),d){if(!P(d))throw new Error("'locals' must be an object")}else d=k;if(f){if(!o(f))throw new Error("'parent' must be a promise returned by $resolve.resolve()")}else f=l;var n=a.defer(),r=n.promise,s=r.$$promises={},t=S({},d),u=1+q.length/3,v=!1;if(M(f.$$failure))return i(f.$$failure),r;f.$$inheritedValues&&e(t,m(f.$$inheritedValues,p)),S(s,f.$$promises),f.$$values?(v=e(t,m(f.$$values,p)),r.$$inheritedValues=m(f.$$values,p),h()):(f.$$inheritedValues&&(r.$$inheritedValues=m(f.$$inheritedValues,p)),f.then(h,i));for(var w=0,x=q.length;w=0));)s=f(r.id,r.type,r.cfg,"path"),l+=g(r.segment,s.type.pattern.source,s.squash,s.isOptional),n.push(r.segment),m=j.lastIndex;t=a.substring(m);var u=t.indexOf("?");if(u>=0){var v=this.sourceSearch=t.substring(u);if(t=t.substring(0,u),this.sourcePath=a.substring(0,m+u),v.length>0)for(m=0;i=k.exec(v);)r=h(i,!0),s=f(r.id,r.type,r.cfg,"search"),m=j.lastIndex}else this.sourcePath=a,this.sourceSearch="";l+=g(t)+(b.strict===!1?"/?":"")+"$",n.push(t),this.regexp=new RegExp(l,b.caseInsensitive?"i":c),this.prefix=n[0],this.$$paramNames=q}function t(a){S(this,a)}function u(){function a(a){return null!=a?a.toString().replace(/(~|\/)/g,function(a){return{"~":"~~","/":"~2F"}[a]}):a}function e(a){return null!=a?a.toString().replace(/(~~|~2F)/g,function(a){return{"~~":"~","~2F":"/"}[a]}):a}function f(){return{strict:p,caseInsensitive:m}}function i(a){return N(a)||Q(a)&&N(a[a.length-1])}function j(){for(;w.length;){var a=w.shift();if(a.pattern)throw new Error("You cannot override a type's .pattern at runtime.");b.extend(r[a.name],l.invoke(a.def))}}function k(a){S(this,a||{})}V=this;var l,m=!1,p=!0,q=!1,r={},v=!0,w=[],x={string:{encode:a,decode:e,is:function(a){return null==a||!M(a)||"string"==typeof a},pattern:/[^\/]*/},int:{encode:a,decode:function(a){return parseInt(a,10)},is:function(a){return M(a)&&this.decode(a.toString())===a},pattern:/\d+/},bool:{encode:function(a){return a?1:0},decode:function(a){return 0!==parseInt(a,10)},is:function(a){return a===!0||a===!1},pattern:/0|1/},date:{encode:function(a){return this.is(a)?[a.getFullYear(),("0"+(a.getMonth()+1)).slice(-2),("0"+a.getDate()).slice(-2)].join("-"):c},decode:function(a){if(this.is(a))return a;var b=this.capture.exec(a);return b?new Date(b[1],b[2]-1,b[3]):c},is:function(a){return a instanceof Date&&!isNaN(a.valueOf())},equals:function(a,b){return this.is(a)&&this.is(b)&&a.toISOString()===b.toISOString()},pattern:/[0-9]{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[1-2][0-9]|3[0-1])/,capture:/([0-9]{4})-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])/},json:{encode:b.toJson,decode:b.fromJson,is:b.isObject,equals:b.equals,pattern:/[^\/]*/},any:{encode:b.identity,decode:b.identity,equals:b.equals,pattern:/.*/}};u.$$getDefaultValue=function(a){if(!i(a.value))return a.value;if(!l)throw new Error("Injectable functions cannot be called at configuration time");return l.invoke(a.value)},this.caseInsensitive=function(a){return M(a)&&(m=a),m},this.strictMode=function(a){return M(a)&&(p=a),p},this.defaultSquashPolicy=function(a){if(!M(a))return q;if(a!==!0&&a!==!1&&!O(a))throw new Error("Invalid squash policy: "+a+". Valid policies: false, true, arbitrary-string");return q=a,a},this.compile=function(a,b){return new s(a,S(f(),b))},this.isMatcher=function(a){if(!P(a))return!1;var b=!0;return R(s.prototype,function(c,d){N(c)&&(b=b&&M(a[d])&&N(a[d]))}),b},this.type=function(a,b,c){if(!M(b))return r[a];if(r.hasOwnProperty(a))throw new Error("A type named '"+a+"' has already been defined.");return r[a]=new t(S({name:a},b)),c&&(w.push({name:a,def:c}),v||j()),this},R(x,function(a,b){r[b]=new t(S({name:b},a))}),r=d(r,{}),this.$get=["$injector",function(a){return l=a,v=!1,j(),R(x,function(a,b){r[b]||(r[b]=new t(a))}),this}],this.Param=function(a,d,e,f){function j(a){var b=P(a)?g(a):[],c=h(b,"value")===-1&&h(b,"type")===-1&&h(b,"squash")===-1&&h(b,"array")===-1;return c&&(a={value:a}),a.$$fn=i(a.value)?a.value:function(){return a.value},a}function k(c,d,e){if(c.type&&d)throw new Error("Param '"+a+"' has two type configurations.");return d?d:c.type?b.isString(c.type)?r[c.type]:c.type instanceof t?c.type:new t(c.type):"config"===e?r.any:r.string}function m(){var b={array:"search"===f&&"auto"},c=a.match(/\[\]$/)?{array:!0}:{};return S(b,c,e).array}function p(a,b){var c=a.squash;if(!b||c===!1)return!1;if(!M(c)||null==c)return q;if(c===!0||O(c))return c;throw new Error("Invalid squash policy: '"+c+"'. Valid policies: false, true, or arbitrary string")}function s(a,b,d,e){var f,g,i=[{from:"",to:d||b?c:""},{from:null,to:d||b?c:""}];return f=Q(a.replace)?a.replace:[],O(e)&&f.push({from:e,to:c}),g=o(f,function(a){return a.from}),n(i,function(a){return h(g,a.from)===-1}).concat(f)}function u(){if(!l)throw new Error("Injectable functions cannot be called at configuration time");var a=l.invoke(e.$$fn);if(null!==a&&a!==c&&!x.type.is(a))throw new Error("Default value ("+a+") for parameter '"+x.id+"' is not an instance of Type ("+x.type.name+")");return a}function v(a){function b(a){return function(b){return b.from===a}}function c(a){var c=o(n(x.replace,b(a)),function(a){return a.to});return c.length?c[0]:a}return a=c(a),M(a)?x.type.$normalize(a):u()}function w(){return"{Param:"+a+" "+d+" squash: '"+A+"' optional: "+z+"}"}var x=this;e=j(e),d=k(e,d,f);var y=m();d=y?d.$asArray(y,"search"===f):d,"string"!==d.name||y||"path"!==f||e.value!==c||(e.value="");var z=e.value!==c,A=p(e,z),B=s(e,y,z,A);S(this,{id:a,type:d,location:f,array:y,squash:A,replace:B,isOptional:z,value:v,dynamic:c,config:e,toString:w})},k.prototype={$$new:function(){return d(this,S(new k,{$$parent:this}))},$$keys:function(){for(var a=[],b=[],c=this,d=g(k.prototype);c;)b.push(c),c=c.$$parent;return b.reverse(),R(b,function(b){R(g(b),function(b){h(a,b)===-1&&h(d,b)===-1&&a.push(b)})}),a},$$values:function(a){var b={},c=this;return R(c.$$keys(),function(d){b[d]=c[d].value(a&&a[d])}),b},$$equals:function(a,b){var c=!0,d=this;return R(d.$$keys(),function(e){var f=a&&a[e],g=b&&b[e];d[e].type.equals(f,g)||(c=!1)}),c},$$validates:function(a){var d,e,f,g,h,i=this.$$keys();for(d=0;d=0)throw new Error("State must have a valid name");if(A.hasOwnProperty(c))throw new Error("State '"+c+"' is already defined");var e=c.indexOf(".")!==-1?c.substring(0,c.lastIndexOf(".")):O(b.parent)?b.parent:P(b.parent)&&O(b.parent.name)?b.parent.name:"";if(e&&!A[e])return n(e,b.self);for(var f in D)N(D[f])&&(b[f]=D[f](b,D.$delegates[f]));return A[c]=b,!b[C]&&b.url&&a.when(b.url,["$match","$stateParams",function(a,c){z.$current.navigable==b&&j(a,c)||z.transitionTo(b,a,{inherit:!0,location:!1})}]),q(c),b}function s(a){return a.indexOf("*")>-1}function t(a){for(var b=a.split("."),c=z.$current.name.split("."),d=0,e=b.length;d=A;d--)g=o[d],g.self.onExit&&h.invoke(g.self.onExit,g.self,g.locals.globals),g.locals=null;for(d=A;d2?k.enter(a,null,c).then(d):k.enter(a,null,c,d)},leave:function(a,c){b.version.minor>2?k.leave(a).then(c):k.leave(a,c)}};if(j){var e=j&&j(c,a);return{enter:function(a,b,c){e.enter(a,null,b),c()},leave:function(a,b){e.leave(a),b()}}}return d()}var i=g(),j=i("$animator"),k=i("$animate"),l={restrict:"ECA",terminal:!0,priority:400,transclude:"element",compile:function(c,g,i){return function(c,g,j){function k(){if(m&&(m.remove(),m=null),o&&(o.$destroy(),o=null),n){var a=n.data("$uiViewAnim");s.leave(n,function(){a.$$animLeave.resolve(),m=null}),m=n,n=null}}function l(h){var l,m=B(c,j,g,e),t=m&&a.$current&&a.$current.locals[m];if(h||t!==p){l=c.$new(),p=a.$current.locals[m],l.$emit("$viewContentLoading",m);var u=i(l,function(a){var e=f.defer(),h=f.defer(),i={$animEnter:e.promise,$animLeave:h.promise,$$animLeave:h};a.data("$uiViewAnim",i),s.enter(a,g,function(){e.resolve(),o&&o.$emit("$viewContentAnimationEnded"),(b.isDefined(r)&&!r||c.$eval(r))&&d(a)}),k()});n=u,o=l,o.$emit("$viewContentLoaded",m),o.$eval(q)}}var m,n,o,p,q=j.onload||"",r=j.autoscroll,s=h(j,c);g.inheritedData("$uiView");c.$on("$stateChangeSuccess",function(){l(!1)}),l(!0)}}};return l}function A(a,c,d,e){return{restrict:"ECA",priority:-400,compile:function(f){var g=f.html();return function(f,h,i){var j=d.$current,k=B(f,i,h,e),l=j&&j.locals[k];if(l){h.data("$uiView",{name:k,state:l.$$state}),h.html(l.$template?l.$template:g);var m=b.extend({},l);f[l.$$resolveAs]=m;var n=a(h.contents());if(l.$$controller){l.$scope=f,l.$element=h;var o=c(l.$$controller,l);l.$$controllerAs&&(f[l.$$controllerAs]=o,f[l.$$controllerAs][l.$$resolveAs]=m),N(o.$onInit)&&o.$onInit(),h.data("$ngControllerController",o),h.children().data("$ngControllerController",o)}n(f)}}}}}function B(a,b,c,d){var e=d(b.uiView||b.name||"")(a),f=c.inheritedData("$uiView");return e.indexOf("@")>=0?e:e+"@"+(f?f.state.name:"")}function C(a,b){var c,d=a.match(/^\s*({[^}]*})\s*$/);if(d&&(a=b+"("+d[1]+")"),c=a.replace(/\n/g," ").match(/^([^(]+?)\s*(\((.*)\))?$/),!c||4!==c.length)throw new Error("Invalid state ref '"+a+"'");return{state:c[1],paramExpr:c[3]||null}}function D(a){var b=a.parent().inheritedData("$uiView");if(b&&b.state&&b.state.name)return b.state}function E(a){var b="[object SVGAnimatedString]"===Object.prototype.toString.call(a.prop("href")),c="FORM"===a[0].nodeName;return{attr:c?"action":b?"xlink:href":"href",isAnchor:"A"===a.prop("tagName").toUpperCase(),clickable:!c}}function F(a,b,c,d,e){return function(f){var g=f.which||f.button,h=e();if(!(g>1||f.ctrlKey||f.metaKey||f.shiftKey||a.attr("target"))){var i=c(function(){b.go(h.state,h.params,h.options)});f.preventDefault();var j=d.isAnchor&&!h.href?1:0;f.preventDefault=function(){j--<=0&&c.cancel(i)}}}}function G(a,b){return{relative:D(a)||b.$current,inherit:!0}}function H(a,c){return{restrict:"A",require:["?^uiSrefActive","?^uiSrefActiveEq"],link:function(d,e,f,g){var h,i=C(f.uiSref,a.current.name),j={state:i.state,href:null,params:null},k=E(e),l=g[1]||g[0],m=null;j.options=S(G(e,a),f.uiSrefOpts?d.$eval(f.uiSrefOpts):{});var n=function(c){c&&(j.params=b.copy(c)),j.href=a.href(i.state,j.params,j.options),m&&m(),l&&(m=l.$$addStateInfo(i.state,j.params)),null!==j.href&&f.$set(k.attr,j.href)};i.paramExpr&&(d.$watch(i.paramExpr,function(a){a!==j.params&&n(a)},!0),j.params=b.copy(d.$eval(i.paramExpr))),n(),k.clickable&&(h=F(e,a,c,k,function(){return j}),e[e.on?"on":"bind"]("click",h),d.$on("$destroy",function(){e[e.off?"off":"unbind"]("click",h)}))}}}function I(a,b){return{restrict:"A",require:["?^uiSrefActive","?^uiSrefActiveEq"],link:function(c,d,e,f){function g(b){m.state=b[0],m.params=b[1],m.options=b[2],m.href=a.href(m.state,m.params,m.options),n&&n(),j&&(n=j.$$addStateInfo(m.state,m.params)),m.href&&e.$set(i.attr,m.href)}var h,i=E(d),j=f[1]||f[0],k=[e.uiState,e.uiStateParams||null,e.uiStateOpts||null],l="["+k.map(function(a){return a||"null"}).join(", ")+"]",m={state:null,params:null,options:null,href:null},n=null;c.$watch(l,g,!0),g(c.$eval(l)),i.clickable&&(h=F(d,a,b,i,function(){return m}),d[d.on?"on":"bind"]("click",h),c.$on("$destroy",function(){d[d.off?"off":"unbind"]("click",h)}))}}}function J(a,b,c){return{restrict:"A",controller:["$scope","$element","$attrs","$timeout",function(b,d,e,f){function g(b,c,e){var f=a.get(b,D(d)),g=h(b,c),i={state:f||{name:b},params:c,hash:g};return p.push(i),q[g]=e,function(){var a=p.indexOf(i);a!==-1&&p.splice(a,1)}}function h(a,c){if(!O(a))throw new Error("state should be a string");return P(c)?a+U(c):(c=b.$eval(c),P(c)?a+U(c):a)}function i(){for(var a=0;a0)){var c=g(a,b,o);return i(),c}},b.$on("$stateChangeSuccess",i),i()}]}}function K(a){var b=function(b,c){return a.is(b,c)};return b.$stateful=!0,b}function L(a){var b=function(b,c,d){return a.includes(b,c,d)};return b.$stateful=!0,b}var M=b.isDefined,N=b.isFunction,O=b.isString,P=b.isObject,Q=b.isArray,R=b.forEach,S=b.extend,T=b.copy,U=b.toJson;b.module("ui.router.util",["ng"]),b.module("ui.router.router",["ui.router.util"]),b.module("ui.router.state",["ui.router.router","ui.router.util"]),b.module("ui.router",["ui.router.state"]),b.module("ui.router.compat",["ui.router"]),q.$inject=["$q","$injector"],b.module("ui.router.util").service("$resolve",q),r.$inject=["$http","$templateCache","$injector"],b.module("ui.router.util").service("$templateFactory",r);var V;s.prototype.concat=function(a,b){var c={caseInsensitive:V.caseInsensitive(),strict:V.strictMode(),squash:V.defaultSquashPolicy()};return new s(this.sourcePath+a+this.sourceSearch,S(c,b),this)},s.prototype.toString=function(){return this.source},s.prototype.exec=function(a,b){function c(a){function b(a){return a.split("").reverse().join("")}function c(a){return a.replace(/\\-/g,"-")}var d=b(a).split(/-(?!\\)/),e=o(d,b);return o(e,c).reverse()}var d=this.regexp.exec(a);if(!d)return null;b=b||{};var e,f,g,h=this.parameters(),i=h.length,j=this.segments.length-1,k={};if(j!==d.length-1)throw new Error("Unbalanced capture group in route '"+this.source+"'");var l,m;for(e=0;e
@/ui/modules/lightrunner/lightrunner.js
              color: color,
              color2: config === 'powerglow' ? glowColors[Math.floor(Math.random() * glowColors.length)] : carObj.default_color_2,
              name: carObj.Name,
        var val = ['ui.scenarios.difficulty.easy', 'ui.scenarios.difficulty.medium', 'ui.scenarios.difficulty.hard', 'ui.scenarios.difficulty.veryHard']
        return val[Math.floor(parseFloat(num) / 25)]
      }
        if ($stateParams.level.previews.length > 0) {
          preview = $stateParams.level.previews[Math.floor(Math.random() * $stateParams.level.previews.length)]
        }
        var val = ['ui.scenarios.difficulty.easy', 'ui.scenarios.difficulty.medium', 'ui.scenarios.difficulty.hard', 'ui.scenarios.difficulty.veryHard']
        return val[Math.floor(parseFloat(num) / 25)]
      }
@/lua/ge/extensions/editor/tech/roadArchitect/geometry.lua
      end
      map[#map + 1] = ctr + floor(#pArc * 0.5)                                                      -- For the general case, add the arc midpoint to the map.
      for j = 1, #pArc do
      map[#map + 1] = ctr + 1                                                                       -- Use only a single point in the near-linear case (avoids rendering issues/folding).
      pDisc[ctr] = pArc[floor(#pArc * 0.5)]
      ctr = ctr + 1
@/lua/ge/extensions/editor/toolUtilities/geom.lua
    local segmentLength = p1:distance(p2)
    local numDivisions = max(minNumDivisionsFinal, floor(segmentLength / maxDivisionSpacing + 0.5))
    -- If minimum spacing is specified, limit the maximum number of divisions to prevent over-dense points
    if minSpacing and minSpacing > 0 then
      local maxDivisions = max(1, floor(segmentLength / minSpacing))
      numDivisions = min(numDivisions, maxDivisions)
    tmp3:set(p3.x, p3.y, w3)
    local numDivisions = max(minNumDivisionsFinal, floor(p1:distance(p2) / maxDivisionSpacing + 0.5))
    local step = 1.0 / numDivisions
    local w0, w1, w2, w3 = widths[i1], widths[i2], widths[i3], widths[i4]
    local numDivisions = max(minNumDivisionsFinal, floor(p1:distance(p2) / maxDivisionSpacing + 0.5))
    local step = 1.0 / numDivisions
    local w0, w1, w2, w3 = widths[i1], widths[i2], widths[i3], widths[i4]
    local numDivisions = max(minNumDivisionsFinal, floor(p1:distance(p2) / maxDivisionSpacing + 0.5))
    local step = 1.0 / numDivisions
@/lua/ge/extensions/editor/forestEditor.lua
        im.GetWindowDrawList(),
        im.ImVec2(windowPos.x + cPos.x - style.ItemSpacing.x/2, windowPos.y + cPos.y - math.floor(style.ItemSpacing.y/2) - scrollY),
        im.ImVec2(
@/lua/vehicle/extensions/dynamicVehicleData.lua
  if maxPower > 0 then
    maxPower = floor(maxPower)
    local powerMinRPM = ceil(minRPMPower / rpmRoundValue) * rpmRoundValue
    local powerMaxRPM = floor(maxRPMPower / rpmRoundValue) * rpmRoundValue
    local maxPowerRange = maxRPMPower - minRPMPower
    ["Top Speed"] = maxSpeed,
    ["0-100 km/h"] = time100kmh and (floor(time100kmh * 10) / 10) or nil,
    ["0-200 km/h"] = time200kmh and (floor(time200kmh * 10) / 10) or nil,
    ["0-100 km/h"] = time100kmh and (floor(time100kmh * 10) / 10) or nil,
    ["0-200 km/h"] = time200kmh and (floor(time200kmh * 10) / 10) or nil,
    ["0-300 km/h"] = time300kmh and (floor(time300kmh * 10) / 10) or nil,
    ["0-200 km/h"] = time200kmh and (floor(time200kmh * 10) / 10) or nil,
    ["0-300 km/h"] = time300kmh and (floor(time300kmh * 10) / 10) or nil,
    ["100-200 km/h"] = time100200kmh and (floor(time100200kmh * 10) / 10) or nil,
    ["0-300 km/h"] = time300kmh and (floor(time300kmh * 10) / 10) or nil,
    ["100-200 km/h"] = time100200kmh and (floor(time100200kmh * 10) / 10) or nil,
    ["0-60 mph"] = time60mph and (floor(time60mph * 10) / 10) or nil,
    ["100-200 km/h"] = time100200kmh and (floor(time100200kmh * 10) / 10) or nil,
    ["0-60 mph"] = time60mph and (floor(time60mph * 10) / 10) or nil,
    ["0-100 mph"] = time100mph and (floor(time100mph * 10) / 10) or nil,
    ["0-60 mph"] = time60mph and (floor(time60mph * 10) / 10) or nil,
    ["0-100 mph"] = time100mph and (floor(time100mph * 10) / 10) or nil,
    ["0-200 mph"] = time200mph and (floor(time200mph * 10) / 10) or nil,
    ["0-100 mph"] = time100mph and (floor(time100mph * 10) / 10) or nil,
    ["0-200 mph"] = time200mph and (floor(time200mph * 10) / 10) or nil,
    ["60-100 mph"] = time60100mph and (floor(time60100mph * 10) / 10) or nil
    ["0-200 mph"] = time200mph and (floor(time200mph * 10) / 10) or nil,
    ["60-100 mph"] = time60100mph and (floor(time60100mph * 10) / 10) or nil
  }
@/lua/ge/extensions/editor/toolUtilities/util.lua
  local t = max(0, min(1, (value - minValue) / (maxValue - minValue))) -- Clamp and normalise.
  return color(floor(t * 255 + 0.5), 0, floor((1.0 - t) * 255 + 0.5), 255)
end
  local t = max(0, min(1, (value - minValue) / (maxValue - minValue))) -- Clamp and normalise.
  return color(floor(t * 255 + 0.5), 0, floor((1.0 - t) * 255 + 0.5), 255)
end

  return floor((r + m) * 255 + 0.5), floor((g + m) * 255 + 0.5), floor((b + m) * 255 + 0.5)
end

  return floor((r + m) * 255 + 0.5), floor((g + m) * 255 + 0.5), floor((b + m) * 255 + 0.5)
end

  return floor((r + m) * 255 + 0.5), floor((g + m) * 255 + 0.5), floor((b + m) * 255 + 0.5)
end
  local r, g, b
  local i = floor(h * 6)
  local f = h * 6 - i
      local pt = path[j]
      local x, y = floor(pt.x + 0.5), floor(pt.y + 0.5)
      if x >= 0 and x < width and y >= 0 and y < height then
      local pt = path[j]
      local x, y = floor(pt.x + 0.5), floor(pt.y + 0.5)
      if x >= 0 and x < width and y >= 0 and y < height then
      local w = wPath[j] or 1
      local radius = max(1, floor(w * 0.5))
      -- Draw a filled circle centered at (p.x, p.y)
      local cx = floor(p.x + 0.5)
      local cy = floor(p.y + 0.5)
      local cx = floor(p.x + 0.5)
      local cy = floor(p.y + 0.5)
      for y = cy - radius, cy + radius do
@/lua/ge/simTimeAuthority.lua
      local times = 1/speed
      local rounded = math.floor(times+0.5)
      if times < 2 and times ~= rounded then
@/lua/ge/extensions/career/modules/marketplace.lua
    timestamp = os.time(),
    value = math.max(50, math.floor((finalOfferValue + 25) / 50) * 50),
    ttl = offerTTL + ((math.random() * offerTTLVariance*2) - offerTTLVariance) * offerTTL,
    local result = currentBuyerPosition + movement
    return math.max(theirOffer, math.floor(result / 50 + 0.5) * 50)  -- Round to nearest $50
  else
    local result = currentSellerPosition - movement
    return math.max(myOffer, math.floor(result / 50 + 0.5) * 50)  -- Round to nearest $50
  end

      -- Calculate absolute floor (won't go below this no matter what)
      local absoluteMinimum
          -- Low patience - jump straight to floor
          theirOfferCandidate = math.floor(minAcceptable / 50 + 0.5) * 50
        elseif myOffer >= minAcceptable then
            local counterAmount = myOffer + (gapToClose * movePercent)
            theirOfferCandidate = math.min(math.max(myOffer, math.floor(counterAmount / 50 + 0.5) * 50), theirOffer)
          else
          local counterAmount = myOffer + (gapToClose * movePercent)
          theirOfferCandidate = math.max(minAcceptable, math.floor(counterAmount / 50 + 0.5) * 50)
        end
        if patience <= 0.40 then
          theirOfferCandidate = math.floor(maxAcceptable / 50 + 0.5) * 50
        elseif myOffer <= maxAcceptable then
          local counterAmount = theirOffer + (gapToClose * movePercent)
          theirOfferCandidate = math.min(myOffer, math.floor(counterAmount / 50 + 0.5) * 50)
        else
          local counterAmount = theirOffer + (gapToClose * movePercent)
          theirOfferCandidate = math.min(maxAcceptable, math.floor(counterAmount / 50 + 0.5) * 50)
        end
@/lua/ge/extensions/career/modules/delivery/parcelManager.lua

  local secondsChanged = math.floor(dGeneral.time()) ~= math.floor(lastFrameTime)
  --if secondsChanged then print("SC") end

  local secondsChanged = math.floor(dGeneral.time()) ~= math.floor(lastFrameTime)
  --if secondsChanged then print("SC") end
@/lua/ge/extensions/editor/tech/roadArchitect/profiles.lua
      -- Add the patches decalroads across parts of the road.
      for _ = 1, floor(prof.condition[0] * 5 * #r.nodes * 0.5) do
        local pStart = max(1, util.randomInRange(1, #r.nodes - 1))
      if prof.condition[0] > 0.5 then
        for _ = 1, floor((prof.condition[0] - 0.5) * 10) do
          local pStart = max(1, util.randomInRange(1, #r.nodes - 1))
        local lastPos = 0.5
        for _ = 1, floor(prof.numPatches[0]) do
          local lIdx, lType = 0, 'none'
        -- Add pothole decal patches across the road, using 1D blue noise for spacing.
        for _ = 1, floor(prof.numPotholes[0]) do
          local lIdx, lType = 0, 'none'
@/ui/modules/apps/Hotlapping/app.js

            var minutes = Math.floor(sec_num / 60000)
            var seconds = Math.floor(sec_num/1000) - (minutes * 60)
            var minutes = Math.floor(sec_num / 60000)
            var seconds = Math.floor(sec_num/1000) - (minutes * 60)
            var millis = sec_num % 1000
@/lua/ge/extensions/editor/missionEditor.lua
            for _, mission in ipairs(missionList) do
              gameplay_missions_progress.generateAttempts(mission.id, 1 + math.floor(math.random()*4))
            end
              if math.random() < 0.5 then
                gameplay_missions_progress.generateAttempts(mission.id, 1 + math.floor(math.random()*4))
              end
@/lua/ge/extensions/gameplay/crashTest/crashTestScoring.lua
local function calculateTimeScore(timeGoal, timeElapsed)
  local roundedTime = math.floor(timeElapsed * 10 + 0.5) / 10 -- Round to one decimal place
  local score = scoreParameters.minTimeScore

  local roundedSpeed = math.floor(trSpeed + 0.5) -- Round to nearest integer
  local speedDiff = math.abs(roundedSpeed - trSpeedGoal)
@/lua/ge/extensions/editor/terraform/terraform.lua
  local noiseFreq = lerp(0.02, 0.2, scale) -- Frequency mapping: large bumps ~ 50m wavelength => freq ~= 0.02, small bumps ~ 5m wavelength => freq ~= 0.2.
  local fbmOctaves = floor(lerp(3, 6, scale) + 0.5) -- Octave mapping: avoid flickering patterns (three layers), richer detail (six layers).
  return noiseFreq, noiseStrength, fbmOctaves, defaultFbmLacunarity, defaultFbmGain
  -- Get the grid bounds of the union of sources.
  tmp1:set(floor(max(tXMin, box.xMin)), floor(max(tYMin, box.yMin)), 0)
  tmp2:set(ceil(min(tXMax, box.xMax)), ceil(min(tYMax, box.yMax)), 0)
  -- Get the grid bounds of the union of sources.
  tmp1:set(floor(max(tXMin, box.xMin)), floor(max(tYMin, box.yMin)), 0)
  tmp2:set(ceil(min(tXMax, box.xMax)), ceil(min(tYMax, box.yMax)), 0)
@/lua/common/libs/inspect/inspect.lua
     and k <= sequenceLength
     and math.floor(k) == k
end
@/lua/ge/extensions/scenario/damageGoal.lua
  local finalTime = scenario.timer
  local minutes = math.floor(finalTime / 60);
  local seconds = finalTime - (minutes * 60);
      if instance.value.damageLimit and instance.value.damageThreshold and fobjData.damage > 0 and fobjData.damage < instance.value.damageLimit then
        local progress = math.floor((fobjData.damage / instance.value.damageLimit) * 100)
        local thresholdPercentage = ((instance.value.damageThreshold / instance.value.damageLimit) * 100)
@/lua/common/mathlib.lua
  local k = abs(x) + 0.5
  k = k - floor(k)
  self.x, self.y, self.z = -y, x - k*z, k*y
local function fractPos(x)
  return x - floor(x)
end
function randomState(v)
  return max(floor(v * 5779561388494110) % 4294967291, 1) / 4294967290
end
function round(a)
  return floor(a+.5)
end
function roundNear(x, m)
  return floor(.5 + x/m)*m
end
@/lua/ge/extensions/statistics/statistics.lua
      instance.points = clamp(instance.points, -instance.maxPoints, instance.maxPoints)
      instance.points = math.floor(instance.points)
      points = (points or 0) + instance.points
@/lua/ge/extensions/editor/rallyEditor/measurementsTab.lua
  if diff > 3600*24 then
    im.Text(string.format("saved %dd ago", math.floor(diff / (3600*24))))
  elseif diff > 3600 then
  elseif diff > 3600 then
    im.Text(string.format("saved %dh ago", math.floor(diff / 3600)))
  elseif diff > 60 then
  elseif diff > 60 then
    im.Text(string.format("saved %dm ago", math.floor(diff / 60)))
  else
@/lua/ge/extensions/util/trackBuilder/basicCenters.lua
    if p.width and p.width < minWidth then
      minWidth = math.floor(p.width)
    end
      pointsCount = pointsCount +1
      LUTindex = math.floor(point.width * LUTDetail +0.5)
      vertexLUT = shape.vertexLUT[LUTindex]
@/lua/common/libs/binaryheap/binaryheap.lua
    while pos>1 do
      local parent = floor(pos/2)
      if not lt(values[pos], values[parent]) then
@/lua/ge/extensions/editor/missionEditor/setupModules.lua
  local seconds = ((val + 0.50001) % 1) * 86400
  local hours = math.floor(seconds / 3600)
  local mins = math.floor(seconds / 60 - (hours * 60))
  local hours = math.floor(seconds / 3600)
  local mins = math.floor(seconds / 60 - (hours * 60))
  local secs = math.floor(seconds - hours * 3600 - mins * 60)
  local mins = math.floor(seconds / 60 - (hours * 60))
  local secs = math.floor(seconds - hours * 3600 - mins * 60)
  return string.format("%02d:%02d:%02d", hours, mins, secs)
@/lua/ge/extensions/flowgraph/nodes/logic/sequencer.lua
  loop = function(t,c) return 1+((t-1)%c) end,
  random = function(t,c) return math.floor(math.random()*c)+1 end,
  once = function(t,c) return t end,
@/ui/lib/int/beamng-core.js
        min = Math.ceil(min)
        max = Math.floor(max)
        return Math.floor(Math.random() * (max - min) + min)
        max = Math.floor(max)
        return Math.floor(Math.random() * (max - min) + min)
      }
        if (randomStart)
          scope.index = Math.floor(Math.random() * scope.images.length);
        else
@/inspector/Base/URLUtilities.js
    const middleChunk = multiline ? `\n${ellipsis}\n` : ellipsis;
    const lastChunk = data.slice(-Math.floor(dataURIMaxSize / 2));
    return header + firstChunk + middleChunk + lastChunk;
@/lua/ge/extensions/ui/apps/minimap/minimap.lua
      if size.x ~= lastSize.x or size.y ~= lastSize.y then
        local texSize = Point2I(math.floor((size.x+bufferLeft+bufferRight) / dpi), math.floor((size.y+bufferTop+bufferBottom) / dpi))
        texSize.x = windowSize.x
      if size.x ~= lastSize.x or size.y ~= lastSize.y then
        local texSize = Point2I(math.floor((size.x+bufferLeft+bufferRight) / dpi), math.floor((size.y+bufferTop+bufferBottom) / dpi))
        texSize.x = windowSize.x
@/lua/ge/extensions/ui/console.lua
      -- local displayEnd = im.IntPtr(0)
      -- local lines_height = math.floor( im.GetFontSize() + im.GetStyle().ItemSpacing.y )
      -- local lines_count = logsTail - (logsHead+1)
  --     local displayEnd = im.IntPtr(0)
  --     -- local lines_height = im.GetTextLineHeightWithSpacing() --math.floor( im.GetFontSize() + im.GetStyle().ItemSpacing.y ) + 0--10px spacing table
  --     local lines_height = math.ceil(im.GetTextLineHeightWithSpacing())
@/ui/ui-vue/src/modules/apps/rallyLoop/utils/timeFormatters.js
export function format24hTime(wallClockSecs, showSeconds = true) {
  const hours = Math.floor(wallClockSecs / 3600)
  const minutes = Math.floor((wallClockSecs % 3600) / 60)
  const hours = Math.floor(wallClockSecs / 3600)
  const minutes = Math.floor((wallClockSecs % 3600) / 60)
  const secs = Math.floor(wallClockSecs % 60)
  const minutes = Math.floor((wallClockSecs % 3600) / 60)
  const secs = Math.floor(wallClockSecs % 60)
export function formatAmPm(wallClockSecs, showSeconds = true, shortenedPeriod = false) {
  const totalHours = Math.floor(wallClockSecs / 3600)
  const minutes = Math.floor((wallClockSecs % 3600) / 60)
  const totalHours = Math.floor(wallClockSecs / 3600)
  const minutes = Math.floor((wallClockSecs % 3600) / 60)
  const secs = Math.floor(wallClockSecs % 60)
  const minutes = Math.floor((wallClockSecs % 3600) / 60)
  const secs = Math.floor(wallClockSecs % 60)

  const hours = Math.floor(roundedSeconds / 3600)
  const minutes = Math.floor((roundedSeconds % 3600) / 60)
  const hours = Math.floor(roundedSeconds / 3600)
  const minutes = Math.floor((roundedSeconds % 3600) / 60)
  const secs = Math.floor(roundedSeconds % 60)
  const minutes = Math.floor((roundedSeconds % 3600) / 60)
  const secs = Math.floor(roundedSeconds % 60)
  const tenths = Math.round((roundedSeconds % 1) * 10) % 10
  const roundedSeconds = Math.round(Math.abs(seconds))
  const minutes = Math.floor(roundedSeconds / 60)
  const secs = roundedSeconds % 60
  const roundedTime = Math.round(Math.abs(epochTime))
  const hours = Math.floor(roundedTime / 3600)
  const minutes = Math.floor((roundedTime % 3600) / 60)
  const hours = Math.floor(roundedTime / 3600)
  const minutes = Math.floor((roundedTime % 3600) / 60)
  const secs = roundedTime % 60
@/lua/ge/extensions/scenario/timeLimit.lua
          instance.finish = true
          local countdown = math.floor(timeleft) + 1
          if countdown > 0 and instance.wait > countdown then
@/lua/ge/extensions/editor/rallyEditor.lua
        if diff > 3600*24 then
          im.Text(string.format("saved %dd ago", math.floor(diff / (3600*24))))
        elseif diff > 3600 then
        elseif diff > 3600 then
          im.Text(string.format("saved %dh ago", math.floor(diff / 3600)))
        elseif diff > 60 then
        elseif diff > 60 then
          im.Text(string.format("saved %dm ago", math.floor(diff / 60)))
        else
@/lua/vehicle/controller/gauges/customModules/dynamicRedlineData.lua
  local adjustedRedline = maxRedline * currentTempRedlineCoef
  local redlineOutput = floor(linearScale(adjustedRedline, minOutputRPM, maxOutputRPM, minOutput, maxOutput))
  local maxGearReached = (electrics.values.gearIndex or 0) >= (electrics.values.maxGearIndex or 0)
@/lua/ge/extensions/core/quickAccess.lua
      local seconds = ((currentTime + 0.5) % 1) * 86400
      local hours = math.floor(seconds / 3600)
      local mins = math.floor(seconds / 60 - (hours * 60))
      local hours = math.floor(seconds / 3600)
      local mins = math.floor(seconds / 60 - (hours * 60))
      local timeStr = string.format("%02d:%02d", hours, mins)
  -- Reverse the order so shortest paths come first
  for i = 1, math.floor(#paths / 2) do
    paths[i], paths[#paths - i + 1] = paths[#paths - i + 1], paths[i]
  if #callStack > 0 then
    local mid = math.floor(#currentMenuItems/2)+1
    backButtonIndex = mid
  for i, gap in ipairs(gaps) do
    local maxButtonsInGap = math.floor(gap.size / gapButtonSizes[i])
    gap.fittingButtonsAmount = math.min(maxButtonsInGap, buttonsToBePlaced)
@/lua/ge/extensions/editor/aiViz.lua
        local usableEdgeLength = edgeLength - arrowLength
        local k = math.max(1, math.floor(usableEdgeLength / 30) - 1) -- number of arrows per lane (30m between arrows). skip first and last.
        local dispVec = (usableEdgeLength / (k + 1)) * edgeDirVec
@/lua/ge/extensions/core/multiSpawn.lua
  while l <= n do
    m = floor((l + n) * 0.5)
    local range = tbl[m][key]
  raceGrid = function (data) -- race grid formation
    return getRoadPoint(data.path, data.dist + floor(data.idx / 2) * data.gap, data.laneSide * 0.5, 1, 1)
  end,
@/lua/vehicle/powertrain/turbocharger.lua
  local engAvRatio = min(engAV * invEngMaxAV, 1)
  local engineRPM = floor(max(assignedEngine.outputRPM or 0, 0))
  local turboRPM = curTurboAV * constants.avToRPM
  turboPressureRaw = assignedEngine.isStalled and 0 or ((turbo.turboPressureCurve[floor(turboRPM)] * constants.psiToPascal) or turboPressure)
  turboPressure = pressureSmoother:getUncapped(turboPressureRaw, dt)
    if type(k) == "number" and k < assignedEngine.maxRPM then
      local rpm = floor(k)
      local turboAV = sqrt(max((0.9 * rpm * constants.rpmToAV * invEngMaxAV * (turbo.turboExhaustCurve[rpm] or 1) * maxExhaustPower * damageExhaustPowerCoef - frictionCoef * wearFrictionCoef * damageFrictionCoef), 0) / backPressureCoef)
      turboAV = min(turboAV, maxTurboAV)
      local turboRPM = floor(turboAV * constants.avToRPM)
      local pressure = turbo.turboPressureCurve[turboRPM] or 0 --pressure without respecting the wastegate
@/lua/ge/extensions/editor/util/transformUtil.lua
  for i, btn in ipairs(buttons) do
    local row = math.floor((i - 1) / columnsNeeded)
    if row ~= prevRow then
@/ui/modules/campaignselect/campaignselect.js
      var val = ['ui.scenarios.difficulty.easy', 'ui.scenarios.difficulty.medium', 'ui.scenarios.difficulty.hard', 'ui.scenarios.difficulty.veryHard']
      return val[Math.floor(parseFloat(num)/25)]
    }
@/lua/ge/extensions/scenario/positionGoal.lua
  local finalTime = scenario.timer
  local minutes = math.floor(finalTime / 60);
  local seconds = finalTime - (minutes * 60);
@/lua/ge/extensions/gameplay/traffic/trafficUtils.lua

  local laneCount = math.max(1, math.floor(roadWidth / laneWidth)) -- estimated number of lanes (this will change when real lanes exist)
  if not link.oneWay and laneCount % 2 ~= 0 then -- two way roads currently have an even amount of expected lanes
      if options.legalDirection then
        local minLane = roadDir == -1 and 1 or math.max(1, math.floor(laneCount * 0.5) + 1)
        local maxLane = roadDir == -1 and math.max(1, math.floor(laneCount * 0.5)) or laneCount
        local minLane = roadDir == -1 and 1 or math.max(1, math.floor(laneCount * 0.5) + 1)
        local maxLane = roadDir == -1 and math.max(1, math.floor(laneCount * 0.5)) or laneCount
        laneChoice = math.random(math.max(minLane, options.minLane), math.min(maxLane, options.maxLane))
          if M.debugMode then
            log('I', logTag, string.format('Spawn point found at distance: %d', math.floor(spawnData.pos:distance(startPos))))
          end
          if M.debugMode then
            log('I', logTag, string.format('Spawn point found at distance: %d', math.floor(spawnData.pos:distance(startPos))))
          end
          if M.debugMode then
            log('I', logTag, string.format('Spawn point found at distance: %d', math.floor(spawnData.pos:distance(startPos))))
          end
@/lua/ge/extensions/editor/gen/world.lua
	lo('>>^^^^^^^^^^^^^^^^ toJSON:'..#asave)
	table.insert(asave, 1, {math.floor(socket.gettime()), deepcopy(desc)})
	if #asave > default.maxundo then
				-- winspace: distance betwween win centers
				local nwin = math.floor((aval - small_dist)/(winspace))
				if hasdoor then nwin = nwin + 1 end
				lo('??^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ mLeft:'..marginLeft..' marg:'..tostring(desc.pillar.margin)..' space:'..desc.pillar.space..' u:'..desc.u:length()..' dx:'..tostring(dpos)..':'..tostring(desc.pos)..' span:'..tostring(desc.pillar.span))
				local npillar = math.floor((desc.u:length() - 2*marginLeft)/desc.pillar.space)+1
				local step = desc.pillar.space
					local spaceAval = desc.u:length() - 2*marginLeft
					npillar = math.floor(spaceAval/desc.pillar.space)
					step = spaceAval/npillar
			toflip = toflip == nil and (math.abs(i1 - i2) > 1) or toflip
			local n = math.floor(u:length()/L)
			local scale = (u:length() + dC)/(n*L - (n-1)*dL)
			local u = dsc.av[i2] - dsc.av[i1]
			local n = math.floor(u:length()/L)
			local scale = (u:length() + 2*dC)/(n*L - (n-1)*dL - 0*dC)
	local doorbot, doorwidth, doorind = default.doorbot, 1.5, 2
	doorind = math.random(2, math.floor((base[2] - base[1]):length()/(winspace + 2)))
--    for i = 1,1 do
--            afloor[#afloor + 1] = {base = base, h = h, awall = awall}
		local dim = (base[1] - base[math.floor(#base/2)+1]):length()
		afloor[#afloor + 1] = {base = U.clone(cbase), h = ch, pos = vec3(0,0,0),
			local resY = 64*2
			local resX = math.floor(resY*w/h)
			local defaultRes = vec3(resX, resY, 0)
	local arc = coverUp(b1)
	local dim = (b1[1] - b1[math.floor(#b1/2)+1]):length()
	floor.top.achild = {{list = {}, shape = 'flat', istart = 1,
			end
			table.insert(asave, 1, {math.floor(socket.gettime()), deepcopy(desc)})
]]
			forBuilding(adesc[cedit.mesh], function(w)
				local nwin = math.floor((w.u:length() - 2*w.winleft)/w.winspace)
				w.winleft = (w.u:length() - (nwin - dir)*w.winspace)/2
--[[
		table.insert(asave, 1, {math.floor(socket.gettime()), deepcopy(desc)})
--        asave[#asave+1] = math.floor(socket.gettime())
		table.insert(asave, 1, {math.floor(socket.gettime()), deepcopy(desc)})
--        asave[#asave+1] = math.floor(socket.gettime())
			lo('?? for_JSON:'..#asave..':'..fsave) --..tostring(adesc[cedit.mesh]))
			else
				local nwin = math.floor((w.u:length() - 2*w.winleft)/w.winspace)
				if val > nwin then
@/lua/ge/extensions/flowgraph/nodes/ui/endScreen.lua
  if type(statsData.time) == 'number' then
    local minutes = math.floor(statsData.time / 60)
    local seconds = statsData.time - (minutes * 60)
@/lua/ge/extensions/editor/gen/network.lua
    if inanim and inanim.N and inanim.n < inanim.N+1 then
        local ctime = math.floor(socket.gettime()*1000)
        if not stime then
        if ctime - stime > 300 then
            lo('?? ani_STEP:'..inanim.n..':'..ctime) --..tostring(math.floor(socket.gettime()*1000)))
    --        inanim = {ain = ani, cb = roadAni}
                    if #U.index(apairskip, U.stamp({l[j-1], l[j]})) == 0 then
                        c = color(math.floor(255*j/#l),math.floor(255*(#l-j)/#l),0,255)
                        w = 2
                    if #U.index(apairskip, U.stamp({l[j-1], l[j]})) == 0 then
                        c = color(math.floor(255*j/#l),math.floor(255*(#l-j)/#l),0,255)
                        w = 2
@/inspector/Views/MemoryTimelineOverviewGraph.js
            if (lastRecord.startTime <= visibleEndTime) {
                let x = Math.floor(xScale(visibleEndTime));
                this._chart.addPointSet(x, pointSetForRecord(lastRecord));
@/lua/ge/extensions/editor/assetBrowser.lua
  elseif var.io.MouseWheel < 0 then
    var.scrollY = var.scrollY - math.floor(var.io.MouseWheel) * var.options.scrollSpeed
  end
@/lua/ge/extensions/scenario/scenarios.lua
local function timeToString(finalTime)
  local minutes = floor(finalTime / 60);
  local seconds = finalTime - (minutes * 60);
@/lua/ge/extensions/flowgraph/nodes/ui/cornerTimer.lua
      }
      data.txt = string.format("%02d:%02d", math.floor(self.pinIn.value.value / 60), math.floor(self.pinIn.value.value % 60))
      data.minutes = string.format("%02d", math.floor(self.pinIn.value.value / 60))
      }
      data.txt = string.format("%02d:%02d", math.floor(self.pinIn.value.value / 60), math.floor(self.pinIn.value.value % 60))
      data.minutes = string.format("%02d", math.floor(self.pinIn.value.value / 60))
      data.txt = string.format("%02d:%02d", math.floor(self.pinIn.value.value / 60), math.floor(self.pinIn.value.value % 60))
      data.minutes = string.format("%02d", math.floor(self.pinIn.value.value / 60))
      data.seconds = string.format("%02d", math.floor(self.pinIn.value.value % 60))
      data.minutes = string.format("%02d", math.floor(self.pinIn.value.value / 60))
      data.seconds = string.format("%02d", math.floor(self.pinIn.value.value % 60))
      data.style = "text"
@/lua/ge/extensions/flowgraph/modules/uiModule.lua
    local differenceText = isBest and "Best" or string.format("+%d:%02d:%03d",
      math.floor((lap.lapTime - bestLapTime) / 60),
      (lap.lapTime - bestLapTime) % 60,
      { format = "detailledTime", detailledTime = lap.lapTime, text = string.format("%d:%02d:%03d",
        math.floor(lap.lapTime / 60),
        lap.lapTime % 60,
@/lua/ge/extensions/gameplay/rally/rallyManager.lua
  local totalMinutes = math.ceil(timeSecs / 60)
  local hours = math.floor(totalMinutes / 60)
  local minutes = totalMinutes % 60
  -- Round to nearest tenth
  -- currentTime = math.floor(currentTime * 10 + 0.5) / 10
      -- Round to nearest tenth
      currentTime = math.floor(currentTime * 10 + 0.5) / 10
@/lua/ge/extensions/gameplay/race/race.lua
function C:raceTime(time)
  local minutes = math.floor(time/60)
  local seconds = math.floor(time - minutes*60)
  local minutes = math.floor(time/60)
  local seconds = math.floor(time - minutes*60)
  local millis = (time - minutes*60 - seconds)*1000
  local absTime = math.abs(timeDiff)
  local minutes = math.floor(absTime/60)
  local seconds = math.floor(absTime - minutes*60)
  local minutes = math.floor(absTime/60)
  local seconds = math.floor(absTime - minutes*60)
  local millis = (absTime - minutes*60 - seconds)*1000
@/ui/modules/rallyselect/rallyselect.js
    ]
    return val[Math.floor(parseFloat(num)/25)]
  }
@/lua/ge/extensions/gameplay/missions/progress.lua
  elseif fun == 'detailledTime' then
    return { format = "detailledTime", detailledTime = val or 0, text = string.format("%d:%02d:%03d", math.floor(val / 60), val % 60, 1000 * (val % 1)) }
  elseif fun == 'rallyTimeFormatter' or fun == 'rallyTimeFormatterWithDNF' then
    -- Round to nearest tenth of a second
    local roundedSeconds = math.floor((val or 0) * 10 + 0.5) / 10
    local hours = math.floor(roundedSeconds / 3600)
    local roundedSeconds = math.floor((val or 0) * 10 + 0.5) / 10
    local hours = math.floor(roundedSeconds / 3600)
    local minutes = math.floor((roundedSeconds % 3600) / 60)
    local hours = math.floor(roundedSeconds / 3600)
    local minutes = math.floor((roundedSeconds % 3600) / 60)
    local secs = math.floor(roundedSeconds % 60)
    local minutes = math.floor((roundedSeconds % 3600) / 60)
    local secs = math.floor(roundedSeconds % 60)
    local tenths = math.floor((roundedSeconds % 1) * 10 + 0.5) % 10
    local secs = math.floor(roundedSeconds % 60)
    local tenths = math.floor((roundedSeconds % 1) * 10 + 0.5) % 10
    else
      local roundedPenalty = math.floor(val + 0.5)
      return { format = "rallyPenaltyFormatter", penalty = val, text = string.format("+%ds", roundedPenalty) }
  randomAttemptType = function()
    return attempts[math.floor(math.random() * 6) + 1]
  end,
  randomMedal = function()
    return medals[math.floor(math.random() * 6) + 1]
  end,
@/lua/ge/extensions/editor/api/valueInspector.lua
      fieldValue =
        tostring(math.floor(self.input4FloatValue[0] * 255 + 0.5)) .. " " ..
        tostring(math.floor(self.input4FloatValue[1] * 255 + 0.5)) .. " " ..
        tostring(math.floor(self.input4FloatValue[0] * 255 + 0.5)) .. " " ..
        tostring(math.floor(self.input4FloatValue[1] * 255 + 0.5)) .. " " ..
        tostring(math.floor(self.input4FloatValue[2] * 255 + 0.5)) .. " " ..
        tostring(math.floor(self.input4FloatValue[1] * 255 + 0.5)) .. " " ..
        tostring(math.floor(self.input4FloatValue[2] * 255 + 0.5)) .. " " ..
        tostring(math.floor(self.input4FloatValue[3] * 255 + 0.5))
        tostring(math.floor(self.input4FloatValue[2] * 255 + 0.5)) .. " " ..
        tostring(math.floor(self.input4FloatValue[3] * 255 + 0.5))
@/lua/common/libs/ezSVG/EzSVG.lua
function EzSVG.rgb(r, g, b)
  return string.format("rgb(%d, %d, %d)", math.floor(r), math.floor(g), math.floor(b))
end
function EzSVG.rgb(r, g, b)
  return string.format("rgb(%d, %d, %d)", math.floor(r), math.floor(g), math.floor(b))
end
function EzSVG.rgb(r, g, b)
  return string.format("rgb(%d, %d, %d)", math.floor(r), math.floor(g), math.floor(b))
end

  h = h - math.floor(h)

  local hi = math.floor(h * 6.0)
  local f = (h * 6.0) - hi
@/lua/ge/extensions/editor/tech/roadArchitect/clothoid.lua
  -- Use recurrence in the stable part.
  local m = min(max(1, floor(2 * b)), 15)
  local mMinus1 = m - 1
@/lua/ge/extensions/flowgraph/nodes/util/hsvColor.lua
function C:HSVtoRGB(h,s,v)
  h = h - math.floor(h)
  return {HSVtoRGB(math.max(0, math.min(1, h)), math.max(0, math.min(1, s)), math.max(0, math.min(1, v)))}
@/lua/ge/extensions/gameplay/rally/snaproad/geoPacenotes.lua
    -- Find midpoint from pathPoints between CS and split
    local segment1MidPathIdx = math.max(2, math.min(splitIdx - 1, math.floor((1 + splitIdx) / 2)))
    local segment1Mid = vec3(pathPoints[segment1MidPathIdx])
    -- Find midpoint from pathPoints between split and CE
    local segment2MidPathIdx = math.max(splitIdx + 1, math.min(#pathPoints - 1, math.floor((splitIdx + #pathPoints) / 2)))
    local segment2Mid = vec3(pathPoints[segment2MidPathIdx])
@/inspector/Views/Popover.js
    {
        anchorPoint.x = Math.floor(anchorPoint.x);
        anchorPoint.y = Math.floor(anchorPoint.y);
        anchorPoint.x = Math.floor(anchorPoint.x);
        anchorPoint.y = Math.floor(anchorPoint.y);
        this._anchorPoint = anchorPoint;
@/lua/ge/extensions/editor/buildingEditor.lua
					if #U.index(apairskip, U.stamp({l[j-1], l[j]})) == 0 then
						c = color(math.floor(255*j/#l),math.floor(255*(#l-j)/#l),0,255)
						w = 2
					if #U.index(apairskip, U.stamp({l[j-1], l[j]})) == 0 then
						c = color(math.floor(255*j/#l),math.floor(255*(#l-j)/#l),0,255)
						w = 2
@/lua/ge/extensions/gameplay/rally/loop/penalties.lua
  -- Calculate minutes from epoch (integer division by 60)
  local actualMinute = math.floor(actualTime / 60)
  local scheduledMinute = math.floor(scheduledTime / 60)
  local actualMinute = math.floor(actualTime / 60)
  local scheduledMinute = math.floor(scheduledTime / 60)
@/lua/ge/extensions/editor/resourceChecker/resourceUtil.lua
  local lg = math.log(x) / math.log(2)
  return lg == math.floor(lg)
end
@/inspector/Views/CPUUsageView.js
        let lastDataPoint = dataPoints.lastValue;
        let lastX = Math.floor(xScale(visibleEndTime));
        let lastY = yScale(lastDataPoint[property]);
@/inspector/External/three.js/three.js

            return typeof value === 'number' && isFinite( value ) && Math.floor( value ) === value;

            return low + Math.floor( Math.random() * ( high - low + 1 ) );

            return Math.pow( 2, Math.floor( Math.log( value ) / Math.LN2 ) );

            this.x = Math.floor( this.x );
            this.y = Math.floor( this.y );
            this.x = Math.floor( this.x );
            this.y = Math.floor( this.y );

            this.x = ( this.x < 0 ) ? Math.ceil( this.x ) : Math.floor( this.x );
            this.y = ( this.y < 0 ) ? Math.ceil( this.y ) : Math.floor( this.y );
            this.x = ( this.x < 0 ) ? Math.ceil( this.x ) : Math.floor( this.x );
            this.y = ( this.y < 0 ) ? Math.ceil( this.y ) : Math.floor( this.y );

            this.x = Math.floor( this.x );
            this.y = Math.floor( this.y );
            this.x = Math.floor( this.x );
            this.y = Math.floor( this.y );
            this.z = Math.floor( this.z );
            this.y = Math.floor( this.y );
            this.z = Math.floor( this.z );

            this.x = ( this.x < 0 ) ? Math.ceil( this.x ) : Math.floor( this.x );
            this.y = ( this.y < 0 ) ? Math.ceil( this.y ) : Math.floor( this.y );
            this.x = ( this.x < 0 ) ? Math.ceil( this.x ) : Math.floor( this.x );
            this.y = ( this.y < 0 ) ? Math.ceil( this.y ) : Math.floor( this.y );
            this.z = ( this.z < 0 ) ? Math.ceil( this.z ) : Math.floor( this.z );
            this.y = ( this.y < 0 ) ? Math.ceil( this.y ) : Math.floor( this.y );
            this.z = ( this.z < 0 ) ? Math.ceil( this.z ) : Math.floor( this.z );

                        uv.x = uv.x - Math.floor( uv.x );
                        break;

                        if ( Math.abs( Math.floor( uv.x ) % 2 ) === 1 ) {

                            uv.x = uv.x - Math.floor( uv.x );

                        uv.y = uv.y - Math.floor( uv.y );
                        break;

                        if ( Math.abs( Math.floor( uv.y ) % 2 ) === 1 ) {

                            uv.y = uv.y - Math.floor( uv.y );

            this.x = Math.floor( this.x );
            this.y = Math.floor( this.y );
            this.x = Math.floor( this.x );
            this.y = Math.floor( this.y );
            this.z = Math.floor( this.z );
            this.y = Math.floor( this.y );
            this.z = Math.floor( this.z );
            this.w = Math.floor( this.w );
            this.z = Math.floor( this.z );
            this.w = Math.floor( this.w );

            this.x = ( this.x < 0 ) ? Math.ceil( this.x ) : Math.floor( this.x );
            this.y = ( this.y < 0 ) ? Math.ceil( this.y ) : Math.floor( this.y );
            this.x = ( this.x < 0 ) ? Math.ceil( this.x ) : Math.floor( this.x );
            this.y = ( this.y < 0 ) ? Math.ceil( this.y ) : Math.floor( this.y );
            this.z = ( this.z < 0 ) ? Math.ceil( this.z ) : Math.floor( this.z );
            this.y = ( this.y < 0 ) ? Math.ceil( this.y ) : Math.floor( this.y );
            this.z = ( this.z < 0 ) ? Math.ceil( this.z ) : Math.floor( this.z );
            this.w = ( this.w < 0 ) ? Math.ceil( this.w ) : Math.floor( this.w );
            this.z = ( this.z < 0 ) ? Math.ceil( this.z ) : Math.floor( this.z );
            this.w = ( this.w < 0 ) ? Math.ceil( this.w ) : Math.floor( this.w );

    var cube_uv_reflection_fragment = "#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_textureSize (1024.0)\nint getFaceFromDirection(vec3 direction) {\n\tvec3 absDirection = abs(direction);\n\tint face = -1;\n\tif( absDirection.x > absDirection.z ) {\n\t\tif(absDirection.x > absDirection.y )\n\t\t\tface = direction.x > 0.0 ? 0 : 3;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\telse {\n\t\tif(absDirection.z > absDirection.y )\n\t\t\tface = direction.z > 0.0 ? 2 : 5;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\treturn face;\n}\n#define cubeUV_maxLods1  (log2(cubeUV_textureSize*0.25) - 1.0)\n#define cubeUV_rangeClamp (exp2((6.0 - 1.0) * 2.0))\nvec2 MipLevelInfo( vec3 vec, float roughnessLevel, float roughness ) {\n\tfloat scale = exp2(cubeUV_maxLods1 - roughnessLevel);\n\tfloat dxRoughness = dFdx(roughness);\n\tfloat dyRoughness = dFdy(roughness);\n\tvec3 dx = dFdx( vec * scale * dxRoughness );\n\tvec3 dy = dFdy( vec * scale * dyRoughness );\n\tfloat d = max( dot( dx, dx ), dot( dy, dy ) );\n\td = clamp(d, 1.0, cubeUV_rangeClamp);\n\tfloat mipLevel = 0.5 * log2(d);\n\treturn vec2(floor(mipLevel), fract(mipLevel));\n}\n#define cubeUV_maxLods2 (log2(cubeUV_textureSize*0.25) - 2.0)\n#define cubeUV_rcpTextureSize (1.0 / cubeUV_textureSize)\nvec2 getCubeUV(vec3 direction, float roughnessLevel, float mipLevel) {\n\tmipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;\n\tfloat a = 16.0 * cubeUV_rcpTextureSize;\n\tvec2 exp2_packed = exp2( vec2( roughnessLevel, mipLevel ) );\n\tvec2 rcp_exp2_packed = vec2( 1.0 ) / exp2_packed;\n\tfloat powScale = exp2_packed.x * exp2_packed.y;\n\tfloat scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\n\tfloat mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\n\tbool bRes = mipLevel == 0.0;\n\tscale =  bRes && (scale < a) ? a : scale;\n\tvec3 r;\n\tvec2 offset;\n\tint face = getFaceFromDirection(direction);\n\tfloat rcpPowScale = 1.0 / powScale;\n\tif( face == 0) {\n\t\tr = vec3(direction.x, -direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 1) {\n\t\tr = vec3(direction.y, direction.x, direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 2) {\n\t\tr = vec3(direction.z, direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 3) {\n\t\tr = vec3(direction.x, direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse if( face == 4) {\n\t\tr = vec3(direction.y, direction.x, -direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse {\n\t\tr = vec3(direction.z, -direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\tr = normalize(r);\n\tfloat texelOffset = 0.5 * cubeUV_rcpTextureSize;\n\tvec2 s = ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5;\n\tvec2 base = offset + vec2( texelOffset );\n\treturn base + s * ( scale - 2.0 * texelOffset );\n}\n#define cubeUV_maxLods3 (log2(cubeUV_textureSize*0.25) - 3.0)\nvec4 textureCubeUV(vec3 reflectedDirection, float roughness ) {\n\tfloat roughnessVal = roughness* cubeUV_maxLods3;\n\tfloat r1 = floor(roughnessVal);\n\tfloat r2 = r1 + 1.0;\n\tfloat t = fract(roughnessVal);\n\tvec2 mipInfo = MipLevelInfo(reflectedDirection, r1, roughness);\n\tfloat s = mipInfo.y;\n\tfloat level0 = mipInfo.x;\n\tfloat level1 = level0 + 1.0;\n\tlevel1 = level1 > 5.0 ? 5.0 : level1;\n\tlevel0 += min( floor( s + 0.5 ), 5.0 );\n\tvec2 uv_10 = getCubeUV(reflectedDirection, r1, level0);\n\tvec4 color10 = envMapTexelToLinear(texture2D(envMap, uv_10));\n\tvec2 uv_20 = getCubeUV(reflectedDirection, r2, level0);\n\tvec4 color20 = envMapTexelToLinear(texture2D(envMap, uv_20));\n\tvec4 result = mix(color10, color20, t);\n\treturn vec4(result.rgb, 1.0);\n}\n#endif\n";

    var cube_uv_reflection_fragment = "#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_textureSize (1024.0)\nint getFaceFromDirection(vec3 direction) {\n\tvec3 absDirection = abs(direction);\n\tint face = -1;\n\tif( absDirection.x > absDirection.z ) {\n\t\tif(absDirection.x > absDirection.y )\n\t\t\tface = direction.x > 0.0 ? 0 : 3;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\telse {\n\t\tif(absDirection.z > absDirection.y )\n\t\t\tface = direction.z > 0.0 ? 2 : 5;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\treturn face;\n}\n#define cubeUV_maxLods1  (log2(cubeUV_textureSize*0.25) - 1.0)\n#define cubeUV_rangeClamp (exp2((6.0 - 1.0) * 2.0))\nvec2 MipLevelInfo( vec3 vec, float roughnessLevel, float roughness ) {\n\tfloat scale = exp2(cubeUV_maxLods1 - roughnessLevel);\n\tfloat dxRoughness = dFdx(roughness);\n\tfloat dyRoughness = dFdy(roughness);\n\tvec3 dx = dFdx( vec * scale * dxRoughness );\n\tvec3 dy = dFdy( vec * scale * dyRoughness );\n\tfloat d = max( dot( dx, dx ), dot( dy, dy ) );\n\td = clamp(d, 1.0, cubeUV_rangeClamp);\n\tfloat mipLevel = 0.5 * log2(d);\n\treturn vec2(floor(mipLevel), fract(mipLevel));\n}\n#define cubeUV_maxLods2 (log2(cubeUV_textureSize*0.25) - 2.0)\n#define cubeUV_rcpTextureSize (1.0 / cubeUV_textureSize)\nvec2 getCubeUV(vec3 direction, float roughnessLevel, float mipLevel) {\n\tmipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;\n\tfloat a = 16.0 * cubeUV_rcpTextureSize;\n\tvec2 exp2_packed = exp2( vec2( roughnessLevel, mipLevel ) );\n\tvec2 rcp_exp2_packed = vec2( 1.0 ) / exp2_packed;\n\tfloat powScale = exp2_packed.x * exp2_packed.y;\n\tfloat scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\n\tfloat mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\n\tbool bRes = mipLevel == 0.0;\n\tscale =  bRes && (scale < a) ? a : scale;\n\tvec3 r;\n\tvec2 offset;\n\tint face = getFaceFromDirection(direction);\n\tfloat rcpPowScale = 1.0 / powScale;\n\tif( face == 0) {\n\t\tr = vec3(direction.x, -direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 1) {\n\t\tr = vec3(direction.y, direction.x, direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 2) {\n\t\tr = vec3(direction.z, direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 3) {\n\t\tr = vec3(direction.x, direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse if( face == 4) {\n\t\tr = vec3(direction.y, direction.x, -direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse {\n\t\tr = vec3(direction.z, -direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\tr = normalize(r);\n\tfloat texelOffset = 0.5 * cubeUV_rcpTextureSize;\n\tvec2 s = ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5;\n\tvec2 base = offset + vec2( texelOffset );\n\treturn base + s * ( scale - 2.0 * texelOffset );\n}\n#define cubeUV_maxLods3 (log2(cubeUV_textureSize*0.25) - 3.0)\nvec4 textureCubeUV(vec3 reflectedDirection, float roughness ) {\n\tfloat roughnessVal = roughness* cubeUV_maxLods3;\n\tfloat r1 = floor(roughnessVal);\n\tfloat r2 = r1 + 1.0;\n\tfloat t = fract(roughnessVal);\n\tvec2 mipInfo = MipLevelInfo(reflectedDirection, r1, roughness);\n\tfloat s = mipInfo.y;\n\tfloat level0 = mipInfo.x;\n\tfloat level1 = level0 + 1.0;\n\tlevel1 = level1 > 5.0 ? 5.0 : level1;\n\tlevel0 += min( floor( s + 0.5 ), 5.0 );\n\tvec2 uv_10 = getCubeUV(reflectedDirection, r1, level0);\n\tvec4 color10 = envMapTexelToLinear(texture2D(envMap, uv_10));\n\tvec2 uv_20 = getCubeUV(reflectedDirection, r2, level0);\n\tvec4 color20 = envMapTexelToLinear(texture2D(envMap, uv_20));\n\tvec4 result = mix(color10, color20, t);\n\treturn vec4(result.rgb, 1.0);\n}\n#endif\n";

    var cube_uv_reflection_fragment = "#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_textureSize (1024.0)\nint getFaceFromDirection(vec3 direction) {\n\tvec3 absDirection = abs(direction);\n\tint face = -1;\n\tif( absDirection.x > absDirection.z ) {\n\t\tif(absDirection.x > absDirection.y )\n\t\t\tface = direction.x > 0.0 ? 0 : 3;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\telse {\n\t\tif(absDirection.z > absDirection.y )\n\t\t\tface = direction.z > 0.0 ? 2 : 5;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\treturn face;\n}\n#define cubeUV_maxLods1  (log2(cubeUV_textureSize*0.25) - 1.0)\n#define cubeUV_rangeClamp (exp2((6.0 - 1.0) * 2.0))\nvec2 MipLevelInfo( vec3 vec, float roughnessLevel, float roughness ) {\n\tfloat scale = exp2(cubeUV_maxLods1 - roughnessLevel);\n\tfloat dxRoughness = dFdx(roughness);\n\tfloat dyRoughness = dFdy(roughness);\n\tvec3 dx = dFdx( vec * scale * dxRoughness );\n\tvec3 dy = dFdy( vec * scale * dyRoughness );\n\tfloat d = max( dot( dx, dx ), dot( dy, dy ) );\n\td = clamp(d, 1.0, cubeUV_rangeClamp);\n\tfloat mipLevel = 0.5 * log2(d);\n\treturn vec2(floor(mipLevel), fract(mipLevel));\n}\n#define cubeUV_maxLods2 (log2(cubeUV_textureSize*0.25) - 2.0)\n#define cubeUV_rcpTextureSize (1.0 / cubeUV_textureSize)\nvec2 getCubeUV(vec3 direction, float roughnessLevel, float mipLevel) {\n\tmipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;\n\tfloat a = 16.0 * cubeUV_rcpTextureSize;\n\tvec2 exp2_packed = exp2( vec2( roughnessLevel, mipLevel ) );\n\tvec2 rcp_exp2_packed = vec2( 1.0 ) / exp2_packed;\n\tfloat powScale = exp2_packed.x * exp2_packed.y;\n\tfloat scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\n\tfloat mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\n\tbool bRes = mipLevel == 0.0;\n\tscale =  bRes && (scale < a) ? a : scale;\n\tvec3 r;\n\tvec2 offset;\n\tint face = getFaceFromDirection(direction);\n\tfloat rcpPowScale = 1.0 / powScale;\n\tif( face == 0) {\n\t\tr = vec3(direction.x, -direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 1) {\n\t\tr = vec3(direction.y, direction.x, direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 2) {\n\t\tr = vec3(direction.z, direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 3) {\n\t\tr = vec3(direction.x, direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse if( face == 4) {\n\t\tr = vec3(direction.y, direction.x, -direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse {\n\t\tr = vec3(direction.z, -direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\tr = normalize(r);\n\tfloat texelOffset = 0.5 * cubeUV_rcpTextureSize;\n\tvec2 s = ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5;\n\tvec2 base = offset + vec2( texelOffset );\n\treturn base + s * ( scale - 2.0 * texelOffset );\n}\n#define cubeUV_maxLods3 (log2(cubeUV_textureSize*0.25) - 3.0)\nvec4 textureCubeUV(vec3 reflectedDirection, float roughness ) {\n\tfloat roughnessVal = roughness* cubeUV_maxLods3;\n\tfloat r1 = floor(roughnessVal);\n\tfloat r2 = r1 + 1.0;\n\tfloat t = fract(roughnessVal);\n\tvec2 mipInfo = MipLevelInfo(reflectedDirection, r1, roughness);\n\tfloat s = mipInfo.y;\n\tfloat level0 = mipInfo.x;\n\tfloat level1 = level0 + 1.0;\n\tlevel1 = level1 > 5.0 ? 5.0 : level1;\n\tlevel0 += min( floor( s + 0.5 ), 5.0 );\n\tvec2 uv_10 = getCubeUV(reflectedDirection, r1, level0);\n\tvec4 color10 = envMapTexelToLinear(texture2D(envMap, uv_10));\n\tvec2 uv_20 = getCubeUV(reflectedDirection, r2, level0);\n\tvec4 color20 = envMapTexelToLinear(texture2D(envMap, uv_20));\n\tvec4 result = mix(color10, color20, t);\n\treturn vec4(result.rgb, 1.0);\n}\n#endif\n";

    var encodings_pars_fragment = "\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.w );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.xyz * value.w * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.x, max( value.g, value.b ) );\n\tfloat M      = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM            = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.x, max( value.g, value.b ) );\n\tfloat D      = max( maxRange / maxRGB, 1.0 );\n\tD            = min( floor( D ) / 255.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value )  {\n\tvec3 Xp_Y_XYZp = value.rgb * cLogLuvM;\n\tXp_Y_XYZp = max(Xp_Y_XYZp, vec3(1e-6, 1e-6, 1e-6));\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract(Le);\n\tvResult.z = (Le - (floor(vResult.w*255.0))/255.0)/255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2((Le - 127.0) / 2.0);\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = Xp_Y_XYZp.rgb * cLogLuvInverseM;\n\treturn vec4( max(vRGB, 0.0), 1.0 );\n}\n";

    var encodings_pars_fragment = "\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.w );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.xyz * value.w * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.x, max( value.g, value.b ) );\n\tfloat M      = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM            = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.x, max( value.g, value.b ) );\n\tfloat D      = max( maxRange / maxRGB, 1.0 );\n\tD            = min( floor( D ) / 255.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value )  {\n\tvec3 Xp_Y_XYZp = value.rgb * cLogLuvM;\n\tXp_Y_XYZp = max(Xp_Y_XYZp, vec3(1e-6, 1e-6, 1e-6));\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract(Le);\n\tvResult.z = (Le - (floor(vResult.w*255.0))/255.0)/255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2((Le - 127.0) / 2.0);\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = Xp_Y_XYZp.rgb * cLogLuvInverseM;\n\treturn vec4( max(vRGB, 0.0), 1.0 );\n}\n";

    var shadowmap_pars_fragment = "#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tfloat texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {\n\t\tconst vec2 offset = vec2( 0.0, 1.0 );\n\t\tvec2 texelSize = vec2( 1.0 ) / size;\n\t\tvec2 centroidUV = floor( uv * size + 0.5 ) / size;\n\t\tfloat lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );\n\t\tfloat lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );\n\t\tfloat rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );\n\t\tfloat rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );\n\t\tvec2 f = fract( uv * size + 0.5 );\n\t\tfloat a = mix( lb, lt, f.y );\n\t\tfloat b = mix( rb, rt, f.y );\n\t\tfloat c = mix( a, b, f.x );\n\t\treturn c;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tshadow = (\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif\n";

    var skinning_pars_vertex = "#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif\n";

            hex = Math.floor( hex );

        widthSegments = Math.floor( widthSegments ) || 1;
        heightSegments = Math.floor( heightSegments ) || 1;
        widthSegments = Math.floor( widthSegments ) || 1;
        heightSegments = Math.floor( heightSegments ) || 1;
        depthSegments = Math.floor( depthSegments ) || 1;
        heightSegments = Math.floor( heightSegments ) || 1;
        depthSegments = Math.floor( depthSegments ) || 1;

        var gridX = Math.floor( widthSegments ) || 1;
        var gridY = Math.floor( heightSegments ) || 1;
        var gridX = Math.floor( widthSegments ) || 1;
        var gridY = Math.floor( heightSegments ) || 1;

                                        intersection.faceIndex = Math.floor( i / 3 ); // triangle number in indexed buffer semantics
                                        intersects.push( intersection );

                                    intersection.faceIndex = Math.floor( i / 3 ); // triangle number in indexed buffer semantics
                                    intersects.push( intersection );

                                        intersection.faceIndex = Math.floor( i / 3 ); // triangle number in non-indexed buffer semantics
                                        intersects.push( intersection );

                                    intersection.faceIndex = Math.floor( i / 3 ); // triangle number in non-indexed buffer semantics
                                    intersects.push( intersection );
                var nVertexUniforms = capabilities.maxVertexUniforms;
                var nVertexMatrices = Math.floor( ( nVertexUniforms - 20 ) / 4 );
                var canvas = document.createElementNS( 'http://www.w3.org/1999/xhtml', 'canvas' );
                canvas.width = Math.floor( image.width * scale );
                canvas.height = Math.floor( image.height * scale );
                canvas.width = Math.floor( image.width * scale );
                canvas.height = Math.floor( image.height * scale );

                    var k = Math.floor( j / 2 );
        tube = tube || 0.4;
        tubularSegments = Math.floor( tubularSegments ) || 64;
        radialSegments = Math.floor( radialSegments ) || 8;
        tubularSegments = Math.floor( tubularSegments ) || 64;
        radialSegments = Math.floor( radialSegments ) || 8;
        p = p || 2;
        tube = tube || 0.4;
        radialSegments = Math.floor( radialSegments ) || 8;
        tubularSegments = Math.floor( tubularSegments ) || 6;
        radialSegments = Math.floor( radialSegments ) || 8;
        tubularSegments = Math.floor( tubularSegments ) || 6;
        arc = arc || Math.PI * 2;

        widthSegments = Math.max( 3, Math.floor( widthSegments ) || 8 );
        heightSegments = Math.max( 2, Math.floor( heightSegments ) || 6 );
        widthSegments = Math.max( 3, Math.floor( widthSegments ) || 8 );
        heightSegments = Math.max( 2, Math.floor( heightSegments ) || 6 );

        segments = Math.floor( segments ) || 12;
        phiStart = phiStart || 0;

        radialSegments = Math.floor( radialSegments ) || 8;
        heightSegments = Math.floor( heightSegments ) || 1;
        radialSegments = Math.floor( radialSegments ) || 8;
        heightSegments = Math.floor( heightSegments ) || 1;

                i = Math.floor( low + ( high - low ) / 2 ); // less likely to overflow, though probably not issue here, JS doesn't really have integers, all numbers are floats
        var p = ( l - ( this.closed ? 0 : 1 ) ) * t;
        var intPoint = Math.floor( p );
        var weight = p - intPoint;

            intPoint += intPoint > 0 ? 0 : ( Math.floor( Math.abs( intPoint ) / l ) + 1 ) * l;

        var intPoint = Math.floor( p );
        var weight = p - intPoint;
            var valueSize = this.getValueSize();
            if ( valueSize - Math.floor( valueSize ) !== 0 ) {

                    var loopDelta = Math.floor( time / duration ); // signed
                    time -= duration * loopDelta;
@/lua/vehicle/powertrain/supercharger.lua

  local boostControllerCoef = boostControllerCurve[math.floor(currentThrottle * 100)] or 1 --get the throttle vs max boost coef
  local rawPressure = (pressureCurve[math.floor(blowerRPM)] or lastDefinedPressure) * pulseCoef --calculate current pressure inlcuding pulse oscillations
  local boostControllerCoef = boostControllerCurve[math.floor(currentThrottle * 100)] or 1 --get the throttle vs max boost coef
  local rawPressure = (pressureCurve[math.floor(blowerRPM)] or lastDefinedPressure) * pulseCoef --calculate current pressure inlcuding pulse oscillations
  blowerPressure = (rawPressure * psiToPascal) * boostControllerCoef * damagePressureCoef * wearPressureCoef
      local currentBlowerRPM = k * blowerRatio * clutchRatio
      local pressure = pressureCurve[math.floor(currentBlowerRPM)] or 0
@/lua/ge/extensions/editor/tech/roadArchitect/junctions.lua
  end
  return floor(sum)
end
@/inspector/Views/CodeMirrorAdditions.js
                        }
                        var minX = Math.floor(coords.left);
                        var minY = Math.floor(coords.top);
                        var minX = Math.floor(coords.left);
                        var minY = Math.floor(coords.top);
                        maxY = Math.ceil(coords.bottom);
            } else {
                var minX = Math.floor(firstCharCoords.left);
                var minY = Math.floor(firstCharCoords.top);
                var minX = Math.floor(firstCharCoords.left);
                var minY = Math.floor(firstCharCoords.top);
                var maxX = Math.ceil(endCharCoords.right);
@/lua/ge/extensions/editor/scriptAIEditor.lua
      procNodes[i] = nodes[i]
      local sampleIdx = min(polyLen, max(1, floor(i * spacInv)))
      procNodes[i].v = im.FloatPtr(poly[sampleIdx].v[0])
@/lua/vehicle/controller/tech/roadsSensor.lua
local function numOfLanesFromRadius(rad1, rad2)
  return max(1, math.floor(min(rad1, rad2 or math.huge) * 2 / 3.45 + 0.5)) -- math.floor(min(rad1, rad2) / 2.7) + 1
end
local function numOfLanesFromRadius(rad1, rad2)
  return max(1, math.floor(min(rad1, rad2 or math.huge) * 2 / 3.45 + 0.5)) -- math.floor(min(rad1, rad2) / 2.7) + 1
end
    else
      local numOfLanes = max(1, math.floor(numOfLanesFromRadius(mapmgr.mapData.radius[inNode], mapmgr.mapData.radius[outNode]) * 0.5))
      if mapmgr.rules.rightHandDrive then
@/lua/ge/extensions/editor/toolUtilities/render.lua
  end
  local midIdx = floor(numArcSegments * 0.5)
  for i = 1, numArcSegments do
@/lua/common/libs/lunajson/lunajson/sax.lua
        elseif ucode < 0x800 then  -- 2bytes
          c1 = floor(ucode / 0x40)
          c2 = ucode - c1 * 0x40
        elseif ucode < 0xD800 or 0xE000 <= ucode then  -- 3bytes
          c1 = floor(ucode / 0x1000)
          ucode = ucode - c1 * 0x1000
          ucode = ucode - c1 * 0x1000
          c2 = floor(ucode / 0x40)
          c3 = ucode - c2 * 0x40
            f_str_surrogate_prev = 0
            c1 = floor(ucode / 0x40000)
            ucode = ucode - c1 * 0x40000
            ucode = ucode - c1 * 0x40000
            c2 = floor(ucode / 0x1000)
            ucode = ucode - c2 * 0x1000
            ucode = ucode - c2 * 0x1000
            c3 = floor(ucode / 0x40)
            c4 = ucode - c3 * 0x40
@/lua/ge/extensions/gameplay/drift/display.lua
  if score.cachedScore > 0 then
    --guihooks.trigger("setDriftRealtimeScore", math.floor(score.cachedScore), score.combo)
    guiData.realtimeCachedScoreFloored = math.floor(score.cachedScore)
    --guihooks.trigger("setDriftRealtimeScore", math.floor(score.cachedScore), score.combo)
    guiData.realtimeCachedScoreFloored = math.floor(score.cachedScore)
    guiData.realtimeCombo = score.combo
local function onDriftScoreWrappedUp(score)
  flashMessage(string.format("+ %i points for current drift", math.floor(score)))
end
@/inspector/Models/Geometry.js
        return new WI.Rect(
            Math.floor(this.origin.x),
            Math.floor(this.origin.y),
            Math.floor(this.origin.x),
            Math.floor(this.origin.y),
            Math.ceil(this.size.width),
@/lua/ge/extensions/gameplay/race/segment.lua
    local a = self:getCapsuleNode(clamp(math.ceil(self:getCapsuleCount()/2),1,self:getCapsuleCount())).pos
    local b = self:getCapsuleNode(clamp(math.floor(self:getCapsuleCount()/2),1,self:getCapsuleCount())).pos
    textPos = (a+b)/2
@/lua/vehicle/powertrain/electricMotor.lua
  local rpm = engineAV * avToRPM * motorDirection
  local torqueRPM = rpm >= 0 and floor(rpm) or 0
  local torqueCoef = clamp(device.torqueCoef, 0, 1) --can be used to externally reduce the available torque, for example to limit output power
  device.grossWorkPerUpdate = device.grossWorkPerUpdate + grossWork
  device.spentEnergy = device.spentEnergy + grossWork / device.electricalEfficiencyTable[floor(device.engineLoad * 100) * 0.01]
  device.frictionLossPerUpdate = device.frictionLossPerUpdate + dt * engineAV * (device.friction + device.dynamicFriction * engineAV)
  local rpm = engineAV * avToRPM * motorDirection
  local torqueRPM = abs(floor(rpm))
  device.grossWorkPerUpdate = device.grossWorkPerUpdate + grossWork
  device.spentEnergy = device.spentEnergy + grossWork / device.electricalEfficiencyTable[floor(abs(device.engineLoad) * 100) * 0.01]
  device.frictionLossPerUpdate = device.frictionLossPerUpdate + dt * engineAV * (friction + dynamicFriction * engineAV)
@/lua/ge/extensions/editor/util/vehicleFilterUtil.lua
    else
      vehiclesForThisSubFilter = math.floor(numberOfVehicles * proportion + 0.5) -- Round to nearest
    end
@/ui/modules/repository/repository.js
      for (var key in vm.downState) {
        vm.downState[key].progress = Math.floor(vm.downState[key].dlnow / vm.downState[key].dltotal * 100) > 0 ? Math.floor(vm.downState[key].dlnow / vm.downState[key].dltotal * 100) : 0
      for (var key in vm.downState) {
        vm.downState[key].progress = Math.floor(vm.downState[key].dlnow / vm.downState[key].dltotal * 100) > 0 ? Math.floor(vm.downState[key].dlnow / vm.downState[key].dltotal * 100) : 0
          vm.modData.dl = data[key]
          vm.modData.dl.progress = Math.floor(data[key].dlnow / data[key].dltotal * 100)
        }
@/ui/modules/automation/automation.js
      for (var key in vm.downState) {
        vm.downState[key].progress = Math.floor(vm.downState[key].dlnow / vm.downState[key].dltotal * 100) > 0 ? Math.floor(vm.downState[key].dlnow / vm.downState[key].dltotal * 100) : 0
      for (var key in vm.downState) {
        vm.downState[key].progress = Math.floor(vm.downState[key].dlnow / vm.downState[key].dltotal * 100) > 0 ? Math.floor(vm.downState[key].dlnow / vm.downState[key].dltotal * 100) : 0
          vm.modData.dl = data[key]
          vm.modData.dl.progress = Math.floor(data[key].dlnow / data[key].dltotal * 100)
        }
@/lua/ge/extensions/gameplay/rally/geometry.lua
local function temporaryColorI(color)
  ci.r, ci.g, ci.b, ci.a = floor(color.r*255), floor(color.g*255), floor(color.b*255), floor(color.a*255)
  return ci
local function temporaryColorI(color)
  ci.r, ci.g, ci.b, ci.a = floor(color.r*255), floor(color.g*255), floor(color.b*255), floor(color.a*255)
  return ci
local function temporaryColorI(color)
  ci.r, ci.g, ci.b, ci.a = floor(color.r*255), floor(color.g*255), floor(color.b*255), floor(color.a*255)
  return ci
local function temporaryColorI(color)
  ci.r, ci.g, ci.b, ci.a = floor(color.r*255), floor(color.g*255), floor(color.b*255), floor(color.a*255)
  return ci
    else
      pacenote.name = string.format("%i", floor(0.5+pacenote.length/10)*10)
    end
@/lua/ge/extensions/gameplay/rally/loop/rallyLoopManager.lua
  if not value then return nil end
  return math.floor(value * 10 + 0.5) / 10
end
    local speedMph = speedKmh * 0.621371
    local rounded = math.floor(speedMph / 5 + 0.5) * 5  -- Round to nearest 5
    return rounded, 'mph'
  local totalSecs = self.rallyStartTimeSecs + self.clock
  return math.floor(totalSecs / 86400) + 1  -- Day 1, Day 2, etc.
end
  local absSeconds = math.abs(seconds)
  local minutes = math.floor(absSeconds / 60)
  local secs = math.floor(absSeconds % 60)
  local minutes = math.floor(absSeconds / 60)
  local secs = math.floor(absSeconds % 60)
  -- Round to nearest tenth of a second
  local roundedSeconds = math.floor(seconds * 10 + 0.5) / 10

  local hours = math.floor(roundedSeconds / 3600)
  local minutes = math.floor((roundedSeconds % 3600) / 60)
  local hours = math.floor(roundedSeconds / 3600)
  local minutes = math.floor((roundedSeconds % 3600) / 60)
  local secs = math.floor(roundedSeconds % 60)
  local minutes = math.floor((roundedSeconds % 3600) / 60)
  local secs = math.floor(roundedSeconds % 60)
  local tenths = math.floor((roundedSeconds % 1) * 10) % 10
  local secs = math.floor(roundedSeconds % 60)
  local tenths = math.floor((roundedSeconds % 1) * 10) % 10
      local d = proximityData.distance
      proximityData.distance = math.floor(d * 100 + 0.5) / 100
    else
      local d = proximityData.distanceToPlane
      proximityData.distanceToPlane = math.floor(d * 100 + 0.5) / 100
    else
@/lua/ge/extensions/core/lapTimes.lua
  else
    local minutes = math.floor(timeInSeconds / 60)
    local secondsWhole = math.floor(timeInSeconds - minutes * 60)
    local minutes = math.floor(timeInSeconds / 60)
    local secondsWhole = math.floor(timeInSeconds - minutes * 60)
    local millis = math.floor((timeInSeconds - minutes * 60 - secondsWhole) * 1000 + 0.5)
    local secondsWhole = math.floor(timeInSeconds - minutes * 60)
    local millis = math.floor((timeInSeconds - minutes * 60 - secondsWhole) * 1000 + 0.5)
    return string.format("%.2d:%.2d.%.3d", minutes, secondsWhole, millis)
@/inspector/Views/Table.js
                    let remainingFlexibleWidth = flexibleWidth - bestFitWidth;
                    let flexWidth = Math.floor(remainingFlexibleWidth / remainingFlexibleColumnCount);

        let topHiddenRowCount = Math.max(0, Math.floor((scrollTop - overflowPadding) / rowHeight));
        let bottomHiddenRowCount = Math.max(0, this._previousRevealedRowCount - topHiddenRowCount - visibleRowCount);
@/lua/common/utils/pixellib.lua
function LuaPixelBuffer:init(width, height)
  self.width = math.floor(width)
  self.height = math.floor(height)
  self.width = math.floor(width)
  self.height = math.floor(height)
  self:_allocate_buffer(width * height)
  if x < 0 or y < 0 or x >= self.width or y >= self.height then return end
  local p = self.buf[math.floor(x) + math.floor(y) * self.width]
  p.r = color.r
  if x < 0 or y < 0 or x >= self.width or y >= self.height then return end
  local p = self.buf[math.floor(x) + math.floor(y) * self.width]
  p.r = color.r
  else
    local s1 = math.floor(size * 0.5)
    self:drawFilledCircle(vec3(x, y, 0), s1, color)
  if lineWidth == nil then lineWidth = 1 end
  lineWidth = math.floor(lineWidth)
  local diffx = pos2.x - pos1.x
    local y = pos1.y
    for x = math.floor(pos1.x), math.floor(pos2.x), pos2.x > pos1.x and 1 or -1 do
      self:drawPoint(x, math.floor(y), color, lineWidth)
    local y = pos1.y
    for x = math.floor(pos1.x), math.floor(pos2.x), pos2.x > pos1.x and 1 or -1 do
      self:drawPoint(x, math.floor(y), color, lineWidth)
    for x = math.floor(pos1.x), math.floor(pos2.x), pos2.x > pos1.x and 1 or -1 do
      self:drawPoint(x, math.floor(y), color, lineWidth)
      y = y + slope
    local x = pos1.x
    for y = math.floor(pos1.y), math.floor(pos2.y), pos2.y > pos1.y and 1 or -1 do
      self:drawPoint(math.floor(x), y, color, lineWidth)
    local x = pos1.x
    for y = math.floor(pos1.y), math.floor(pos2.y), pos2.y > pos1.y and 1 or -1 do
      self:drawPoint(math.floor(x), y, color, lineWidth)
    for y = math.floor(pos1.y), math.floor(pos2.y), pos2.y > pos1.y and 1 or -1 do
      self:drawPoint(math.floor(x), y, color, lineWidth)
      x = x + slope
@/lua/common/libs/lua-MessagePack/MessagePack.lua
  elseif n <= 0xFFFF then
    bufTmp:put(char(0xDA, floor(n / 0x100), n % 0x100)) -- str16
  else
  else
    bufTmp:put(char(0xDB, floor(n / 0x1000000), floor(n / 0x10000) % 0x100, floor(n / 0x100) % 0x100, n % 0x100)) -- str32
  end
  else
    bufTmp:put(char(0xDB, floor(n / 0x1000000), floor(n / 0x10000) % 0x100, floor(n / 0x100) % 0x100, n % 0x100)) -- str32
  end
  else
    bufTmp:put(char(0xDB, floor(n / 0x1000000), floor(n / 0x10000) % 0x100, floor(n / 0x100) % 0x100, n % 0x100)) -- str32
  end
  elseif n <= 0xFFFF then
    bufTmp:put(char(0xC5, floor(n / 0x100), n % 0x100)) -- bin16
  else
  else
    bufTmp:put(char(0xC6, floor(n / 0x1000000), floor(n / 0x10000) % 0x100, floor(n / 0x100) % 0x100, n % 0x100)) -- bin32
  end
  else
    bufTmp:put(char(0xC6, floor(n / 0x1000000), floor(n / 0x10000) % 0x100, floor(n / 0x100) % 0x100, n % 0x100)) -- bin32
  end
  else
    bufTmp:put(char(0xC6, floor(n / 0x1000000), floor(n / 0x10000) % 0x100, floor(n / 0x100) % 0x100, n % 0x100)) -- bin32
  end
  elseif n <= 0xFFFF then
    bufTmp:put(char(0xDE, floor(n / 0x100), n % 0x100)) -- map16
  else
  else
    bufTmp:put(char(0xDF, floor(n / 0x1000000), floor(n / 0x10000) % 0x100, floor(n / 0x100) % 0x100, n % 0x100)) -- map32
  end
  else
    bufTmp:put(char(0xDF, floor(n / 0x1000000), floor(n / 0x10000) % 0x100, floor(n / 0x100) % 0x100, n % 0x100)) -- map32
  end
  else
    bufTmp:put(char(0xDF, floor(n / 0x1000000), floor(n / 0x10000) % 0x100, floor(n / 0x100) % 0x100, n % 0x100)) -- map32
  end
  elseif n <= 0xFFFF then
    bufTmp:put(char(0xDC, floor(n / 0x100), n % 0x100)) -- array16
  else
  else
    bufTmp:put(char(0xDD, floor(n / 0x1000000), floor(n / 0x10000) % 0x100, floor(n / 0x100) % 0x100, n % 0x100)) -- array32
  end
  else
    bufTmp:put(char(0xDD, floor(n / 0x1000000), floor(n / 0x10000) % 0x100, floor(n / 0x100) % 0x100, n % 0x100)) -- array32
  end
  else
    bufTmp:put(char(0xDD, floor(n / 0x1000000), floor(n / 0x10000) % 0x100, floor(n / 0x100) % 0x100, n % 0x100)) -- array32
  end
    expo = expo + 0x3FE
    mant = floor((mant * 2.0 - 1.0) * ldexp(0.5, 53))
    bufTmp:put(char(0xCB, (n >= 0 and 0 or 0x80) + floor(expo / 0x10), (expo % 0x10) * 0x10 + floor(mant / 0x1000000000000),
    mant = floor((mant * 2.0 - 1.0) * ldexp(0.5, 53))
    bufTmp:put(char(0xCB, (n >= 0 and 0 or 0x80) + floor(expo / 0x10), (expo % 0x10) * 0x10 + floor(mant / 0x1000000000000),
      floor(mant / 0x10000000000) % 0x100, floor(mant / 0x100000000) % 0x100, floor(mant / 0x1000000) % 0x100, floor(mant / 0x10000) % 0x100,
    mant = floor((mant * 2.0 - 1.0) * ldexp(0.5, 53))
    bufTmp:put(char(0xCB, (n >= 0 and 0 or 0x80) + floor(expo / 0x10), (expo % 0x10) * 0x10 + floor(mant / 0x1000000000000),
      floor(mant / 0x10000000000) % 0x100, floor(mant / 0x100000000) % 0x100, floor(mant / 0x1000000) % 0x100, floor(mant / 0x10000) % 0x100,
    bufTmp:put(char(0xCB, (n >= 0 and 0 or 0x80) + floor(expo / 0x10), (expo % 0x10) * 0x10 + floor(mant / 0x1000000000000),
      floor(mant / 0x10000000000) % 0x100, floor(mant / 0x100000000) % 0x100, floor(mant / 0x1000000) % 0x100, floor(mant / 0x10000) % 0x100,
      floor(mant / 0x100) % 0x100, mant % 0x100))
    bufTmp:put(char(0xCB, (n >= 0 and 0 or 0x80) + floor(expo / 0x10), (expo % 0x10) * 0x10 + floor(mant / 0x1000000000000),
      floor(mant / 0x10000000000) % 0x100, floor(mant / 0x100000000) % 0x100, floor(mant / 0x1000000) % 0x100, floor(mant / 0x10000) % 0x100,
      floor(mant / 0x100) % 0x100, mant % 0x100))
    bufTmp:put(char(0xCB, (n >= 0 and 0 or 0x80) + floor(expo / 0x10), (expo % 0x10) * 0x10 + floor(mant / 0x1000000000000),
      floor(mant / 0x10000000000) % 0x100, floor(mant / 0x100000000) % 0x100, floor(mant / 0x1000000) % 0x100, floor(mant / 0x10000) % 0x100,
      floor(mant / 0x100) % 0x100, mant % 0x100))
    bufTmp:put(char(0xCB, (n >= 0 and 0 or 0x80) + floor(expo / 0x10), (expo % 0x10) * 0x10 + floor(mant / 0x1000000000000),
      floor(mant / 0x10000000000) % 0x100, floor(mant / 0x100000000) % 0x100, floor(mant / 0x1000000) % 0x100, floor(mant / 0x10000) % 0x100,
      floor(mant / 0x100) % 0x100, mant % 0x100))
      floor(mant / 0x10000000000) % 0x100, floor(mant / 0x100000000) % 0x100, floor(mant / 0x1000000) % 0x100, floor(mant / 0x10000) % 0x100,
      floor(mant / 0x100) % 0x100, mant % 0x100))
  end
for k = 0, 4 do
  local n = floor(2^k)
  local fixext = 0xD4 + k
  elseif n <= 0xFFFF then
    bufTmp:put(char(0xC8, floor(n / 0x100), n % 0x100, tag < 0 and tag + 0x100 or tag)) -- ext16
  elseif n <= 4294967295.0 then
  elseif n <= 4294967295.0 then
    bufTmp:put(char(0xC9, floor(n/0x1000000), floor(n/0x10000) % 0x100, floor(n/0x100) % 0x100, n % 0x100, tag<0 and tag+0x100 or tag)) -- ext&32
  else
  elseif n <= 4294967295.0 then
    bufTmp:put(char(0xC9, floor(n/0x1000000), floor(n/0x10000) % 0x100, floor(n/0x100) % 0x100, n % 0x100, tag<0 and tag+0x100 or tag)) -- ext&32
  else
  elseif n <= 4294967295.0 then
    bufTmp:put(char(0xC9, floor(n/0x1000000), floor(n/0x10000) % 0x100, floor(n/0x100) % 0x100, n % 0x100, tag<0 and tag+0x100 or tag)) -- ext&32
  else
  local sign = b1 > 0x7F and -1 or 1
  local expo = (b1 % 0x80) * 0x2 + floor(b2 / 0x80)
  local mant = ((b2 % 0x80) * 0x100 + b3) * 0x100 + b4
  local sign = b1 > 0x7F and -1 or 1
  local expo = (b1 % 0x80) * 0x10 + floor(b2 / 0x10)
  local mant = ((((((b2 % 0x10) * 0x100 + b3) * 0x100 + b4) * 0x100 + b5) * 0x100 + b6) * 0x100 + b7) * 0x100 + b8
@/lua/ge/extensions/gameplay/drift/scoring.lua

  local newCombo = driftScore.combo + math.floor(driftScore.comboCreepup / 100) * scoreOptions.comboOptions.increment
  local newCreepup = driftScore.comboCreepup % 100
  if driftScore.cachedScore then
    driftScore.potentialScore = math.floor(driftScore.cachedScore * driftScore.combo)
  end
local function onDriftThroughAccomplished(data)
  local score = math.floor(linearScale(data.currDegAngle, 0, 90, 0, data.zoneData.points))
  score = addCachedScore(score, true)
local function onHitPoleAccomplished(data)
  local score = math.floor(linearScale(data.currDegAngle + data.currAirSpeed, 0, 250, 0, data.zoneData.points))
  score = addCachedScore(score, true)
local function wrapUp()
  local addedScore = math.floor(driftScore.cachedScore * driftScore.combo)
  if addedScore < 1 then return false end
@/lua/ge/extensions/gameplay/drift/scoreboard.lua

  local hours = math.floor(seconds / 3600)
  seconds = seconds % 3600
  local minutes = math.floor(seconds / 60)
  seconds = seconds % 60
@/inspector/Views/RecordingContentView.js

        let snapshotIndex = Math.floor(index / WI.RecordingContentView.SnapshotInterval);
        let snapshot = this._snapshots[snapshotIndex];
@/lua/ge/extensions/editor/masterSpline/autoRoadGen.lua
  local cellInv = 1.0 / cellSize
  local xRes, yRes = floor(terrainX * cellInv + 1), floor(terrainY * cellInv + 1)
  local stride = xRes
  local cellInv = 1.0 / cellSize
  local xRes, yRes = floor(terrainX * cellInv + 1), floor(terrainY * cellInv + 1)
  local stride = xRes
  local numNodes = #path
  for i = 1, floor(numNodes * 0.5) do
    local idx = numNodes - i + 1
@/lua/ge/extensions/util/maptiles.lua
local function formatTime(seconds)
  local hours = math.floor(seconds / 3600)
  seconds = seconds % 3600
  seconds = seconds % 3600
  local minutes = math.floor(seconds / 60)
  seconds = seconds % 60
  if hours > 0 then
      return string.format("%dh %dm %ds", hours, minutes, math.floor(seconds))
  elseif minutes > 0 then
  elseif minutes > 0 then
      return string.format("%dm %ds", minutes, math.floor(seconds))
  else
  else
      return string.format("%ds", math.floor(seconds))
  end
  local margin = 250
  minX = math.floor(minX - margin - baseTileSize)
  minY = math.floor(minY - margin - baseTileSize)
  minX = math.floor(minX - margin - baseTileSize)
  minY = math.floor(minY - margin - baseTileSize)
  maxX = math.ceil( maxX + margin)
@/lua/vehicle/hydros.lua
        local clampedFrequency = clamp(detectedFrequency, 30, 2000)
        local safeFrequency = clamp(math.floor(clampedFrequency * 0.5), 30, 400) -- leave time for actual physics computation too
        local finalFrequency = safeFrequency
        end
        FFBperiod = M.enableFFBflood and 0 or (1 / math.floor(finalFrequency + 0.5)) -- allow unlimited update in case flood debugging
        log("D", "hydros.init", string.format("FFB update rate heuristics: potentially supported freq: %5.1f, clamped freq: %5.1f, safe freq: %5.1f", detectedFrequency, clampedFrequency, safeFrequency))
@/lua/ge/extensions/editor/gen/exp_meshexplorer.lua
        local oval = {
            beamStrength = math.floor(dparam.strength+0.5),
            beamDeform = math.floor(dparam.deform+0.5),
            beamStrength = math.floor(dparam.strength+0.5),
            beamDeform = math.floor(dparam.deform+0.5),
            beamSpring = math.floor(dparam.spring+0.5),
            beamDeform = math.floor(dparam.deform+0.5),
            beamSpring = math.floor(dparam.spring+0.5),
            beamDamp = math.floor(dparam.damp+0.5),
            beamSpring = math.floor(dparam.spring+0.5),
            beamDamp = math.floor(dparam.damp+0.5),
        }
@/lua/ge/extensions/flowgraph/nodes/gameplay/countdown.lua

  local old = math.floor(self.timer)
  self.timer = self.timer - self.mgr.dtSim
  else
    if old ~= math.floor(self.timer) then
      self.countdownMsg = self.pinIn.countdownMsg.value or "%d"
@/lua/ge/extensions/flowgraph/nodes/gameplay/rally/countdown.lua

  local old = math.floor(self.timer)
  self.timer = self.timer - self.mgr.dtSim
  else
    if old ~= math.floor(self.timer) and old <= self.maxAnnounced then
      self.countdownMsg = self.pinIn.countdownMsg.value or "%d"
@/lua/ge/extensions/trackbuilder/trackBuilder.lua
  else
    local m = math.floor(currentValue / normalStep)
    ret = m * normalStep + normalStep * sign
@/lua/common/utils.lua
  if (format or 255) == 255 then
    return {floor(r*255), floor(g*255), floor(b*255), 255}
  else
  if (format or 255) == 255 then
    return {floor(r*255), floor(g*255), floor(b*255), 255}
  else
  if (format or 255) == 255 then
    return {floor(r*255), floor(g*255), floor(b*255), 255}
  else
function color(r, g, b, a)
  return max(0, min(255, floor(r))) * 16777216 + max(0, min(255, floor(g))) * 65536 + max(0, min(255, floor(b))) * 256 + max(0, min(255, floor(a or 255)))
end
function color(r, g, b, a)
  return max(0, min(255, floor(r))) * 16777216 + max(0, min(255, floor(g))) * 65536 + max(0, min(255, floor(b))) * 256 + max(0, min(255, floor(a or 255)))
end
function color(r, g, b, a)
  return max(0, min(255, floor(r))) * 16777216 + max(0, min(255, floor(g))) * 65536 + max(0, min(255, floor(b))) * 256 + max(0, min(255, floor(a or 255)))
end
function color(r, g, b, a)
  return max(0, min(255, floor(r))) * 16777216 + max(0, min(255, floor(g))) * 65536 + max(0, min(255, floor(b))) * 256 + max(0, min(255, floor(a or 255)))
end
function colorGetRGBA(col)
  return floor(col / 16777216), floor(col / 65536) % 256, floor(col / 256) % 256, col % 256
end
function colorGetRGBA(col)
  return floor(col / 16777216), floor(col / 65536) % 256, floor(col / 256) % 256, col % 256
end
function colorGetRGBA(col)
  return floor(col / 16777216), floor(col / 65536) % 256, floor(col / 256) % 256, col % 256
end
function colorHex(rgbHex, a)
  return rgbHex * 256 + max(0, min(255, floor(a or 255)))
end
function graphs(v, len)
  local size = min(len, floor(abs(v)))
  return '['..string.rep(v>0 and "+" or "-", size) .. string.rep(' ', len - size)..']'
      else
        if v ~= floor(v) then
          return stringformat('%' .. numberPrecision .. '.' .. numberPrecision .. 'f', v)
@/ui/modules/apps/DrivingStrategy/app.js
        let smartRound = function (max, v) {
          return v >= max ? max : Math.floor(v + (1 - 1e-7 - v / max))
        }
@/lua/ge/extensions/gameplay/missions/missionTypes/editorHelper.lua
    local t = e.ptr[0]
    im.Text(string.format("%0.2f s = %d:%02d.%02d mm:ss.mmm",t,(t-(t%60))/60, math.floor(t%60), 100*(t%1)))
    im.EndDisabled()
@/lua/ge/extensions/tech/pythonExport.lua
  if type(value) == 'number' then
    if math.floor(value) ~= value then
      return string.format("%.4g", value)
@/lua/ge/extensions/career/modules/vehicleShopping.lua
    -- Always round up to a price ending in 495 or 995
    local thousands = math.floor(value / 1000)
    local candidate495 = thousands * 1000 + 495
  while true do
    shopId = math.floor(math.random() * 1000000)
    for _, vehInfo in ipairs(vehiclesInShop) do
      local adjustedTimeBetweenOffers = dealershipTimeBetweenOffers / (seller.vehicleGenerationMultiplier or 1)
      local maxVehicles = math.floor(vehicleOfferTimeToLive / adjustedTimeBetweenOffers)  -- Higher cap for lower time between offers
      local numberOfVehiclesToGenerate = math.min(math.floor((currentTime - sellersInfos[seller.id].lastGenerationTime) / adjustedTimeBetweenOffers), maxVehicles)
      local maxVehicles = math.floor(vehicleOfferTimeToLive / adjustedTimeBetweenOffers)  -- Higher cap for lower time between offers
      local numberOfVehiclesToGenerate = math.min(math.floor((currentTime - sellersInfos[seller.id].lastGenerationTime) / adjustedTimeBetweenOffers), maxVehicles)
      log("I", "Career", "Generating " .. numberOfVehiclesToGenerate .. " vehicles for " .. seller.id)
@/lua/ge/extensions/util/trackBuilder/ceilingMesh.lua
    if p.width and p.width < minWidth then
      minWidth = math.floor(p.width)
    end
      pointsCount = pointsCount +1
      LUTindex = math.floor(point.width * LUTDetail +0.5)
      vertexLUT = shape.vertexLUT[LUTindex]
@/ui/modules/environment/environment.js
    let seconds = ((timeValue + 0.5) % 1) * 86400
    let hours = Math.floor(seconds / 3600)
    let mins = Math.floor(seconds / 60 - (hours * 60))
    let hours = Math.floor(seconds / 3600)
    let mins = Math.floor(seconds / 60 - (hours * 60))
    let secs = Math.floor(seconds - hours * 3600 - mins * 60)
    let mins = Math.floor(seconds / 60 - (hours * 60))
    let secs = Math.floor(seconds - hours * 3600 - mins * 60)
    let res = String(hours).padStart(2, '0') + ':' + String(mins).padStart(2, '0')
@/lua/common/libs/lunajson/lunajson/decoder.lua
        elseif ucode < 0x800 then  -- 2bytes
          c1 = floor(ucode / 0x40)
          c2 = ucode - c1 * 0x40
        elseif ucode < 0xD800 or 0xE000 <= ucode then  -- 3bytes
          c1 = floor(ucode / 0x1000)
          ucode = ucode - c1 * 0x1000
          ucode = ucode - c1 * 0x1000
          c2 = floor(ucode / 0x40)
          c3 = ucode - c2 * 0x40
            f_str_surrogate_prev = 0
            c1 = floor(ucode / 0x40000)
            ucode = ucode - c1 * 0x40000
            ucode = ucode - c1 * 0x40000
            c2 = floor(ucode / 0x1000)
            ucode = ucode - c2 * 0x1000
            ucode = ucode - c2 * 0x1000
            c3 = floor(ucode / 0x40)
            c4 = ucode - c3 * 0x40
@/lua/ge/extensions/editor/rallyEditor/drivelineTab.lua
    local clr_binormal = ColorF(0, 1, 1, 1)  -- Cyan for binormal lines
    local sampleRate = math.max(1, math.floor(#self.bufferPoints / 100))  -- Show ~100 circles max
    local binormalLength = self.bufferRadius
@/lua/ge/extensions/util/screenshotCreator.lua
        end
        x = math.floor(x)
        y = math.floor(y)
        x = math.floor(x)
        y = math.floor(y)
@/ui/modules/apps/TorqueCurve/app.js
        var torqueTicks = Array(6).fill().map((x, i, a) => i * maxTorque / (a.length - 1))
        var rpmTicks    = Array( Math.floor(maxRpm/1000) + 1 ).fill().map((x, i) => i*1000)

        var rpmX = plotMargins.left + Math.floor(_rpm * xFactor)

        var rpmInd = Math.floor(_rpm)
        scope.$evalAsync(function () {
@/lua/ge/extensions/editor/toolUtilities/simplex.lua
  local s = (xin + yin) * 0.5 * (sqrt(3) - 1)
  local i = floor(xin + s)
  local j = floor(yin + s)
  local i = floor(xin + s)
  local j = floor(yin + s)
  local t = (i + j) * ((3 - sqrt(3)) / 6)
@/ui/modules/apps/EngineDynamometer/app.js
            scope.globalMax = Math.ceil(Math.max.apply(null, [scope.globalMax, torque, power]) / 100) * 100
            //scope.globalMin = Math.floor(Math.min.apply(null, [scope.globalMin, torque, power, rpm]) / 100) * 100
            // scope.globalMin = 0
@/lua/ge/map.lua
local function numOfLanesFromRadius(rad1, rad2)
  return max(1, math.floor(min(rad1, rad2 or math.huge) * 2 / 3.61 + 0.5)) -- math.floor(min(rad1, rad2) / 2.7) + 1
end
local function numOfLanesFromRadius(rad1, rad2)
  return max(1, math.floor(min(rad1, rad2 or math.huge) * 2 / 3.61 + 0.5)) -- math.floor(min(rad1, rad2) / 2.7) + 1
end
  else
    local numOfLanes = max(1, math.floor(numOfLanesFromRadius(rad1, rad2) * 0.5))
    if rules.rightHandDrive then
          local usableEdgeLength = edgeLength - arrowLength
          local k = max(1, math.floor(usableEdgeLength / 30) - 1) -- number of arrows per lane (30m between arrows). skip first and last.
          local dispVec = (usableEdgeLength / (k + 1)) * edgeDirVec
        local usableEdgeLength = edgeLength - arrowLength
        local k = max(1, math.floor(usableEdgeLength / 30) - 1) -- number of arrows per lane (30m between arrows). skip first and last.
        local dispVec = (usableEdgeLength / (k + 1)) * edgeDirVec
@/lua/ge/extensions/flowgraph/nodes/gameplay/rally/rallySuperCountdown.lua
      -- Send initial countdown value to UI
      -- local countdownValue = math.floor(self.timer)
      -- guihooks.trigger('RallyUIPerformCountdown', { countdown = countdownValue })

    local old = math.floor(self.timer)
    self.timer = self.timer - self.mgr.dtSim
      -- Countdown in progress - show numbers
      if old ~= math.floor(self.timer) then
        -- Send countdown value to UI (use old value, the one that just finished)
@/lua/ge/extensions/ui/liveryEditor/utils.lua
  local value = radians * (180 / math.pi)
  -- return math.floor(value + 0.5)
  -- local truncated = string.format("%.1f", value)
local roundAndTruncateDecimal = function(number, decimals)
  -- local rounded = math.floor(number * 10 + 0.5) / 10
  -- return math.floor(rounded * 10) / 10
  -- local rounded = math.floor(number * 10 + 0.5) / 10
  -- return math.floor(rounded * 10) / 10
  decimals = decimals or 1
@/lua/ge/extensions/scenario/speedGoal.lua
  local finalTime = scenario.timer
  local minutes = math.floor(finalTime / 60);
  local seconds = finalTime - (minutes * 60);
@/lua/ge/extensions/editor/tech/roadArchitect/tunnelMesh.lua
    local r1, c1, r2, c2 = pipe1.r, pipe1.cen, pipe2.r, pipe2.cen
    local xMin, xMax = floor(min(c1.x - r1, c2.x - r2)), ceil(max(c1.x + r1, c2.x + r2))            -- The 2D AABB of this section, with a radial margin included.
    local yMin, yMax = floor(min(c1.y - r1, c2.y - r2)), ceil(max(c1.y + r1, c2.y + r2))
    local xMin, xMax = floor(min(c1.x - r1, c2.x - r2)), ceil(max(c1.x + r1, c2.x + r2))            -- The 2D AABB of this section, with a radial margin included.
    local yMin, yMax = floor(min(c1.y - r1, c2.y - r2)), ceil(max(c1.y + r1, c2.y + r2))
    xMinG, xMaxG, yMinG, yMaxG = min(xMinG, xMin), max(xMaxG, xMax), min(yMinG, yMin), max(yMaxG, yMax)
      local xx = xMin + xxx * xFac
      local sx1, sx2 = floor(xx), ceil(xx)
      for yyy = 0, yGran do
        local yy = yMin + yyy * yFac
        local sy1, sy2 = floor(yy), ceil(yy)
        tmp0:set(sx1, sy1, 0)
@/lua/ge/extensions/gameplay/crashTest/scenarioManager.lua
  }
  data.txt = string.format("%d:%02d", math.floor(currentStepTimeLeft / 60), math.floor(currentStepTimeLeft % 60))
  data.minutes = string.format("%02d", math.floor(currentStepTimeLeft / 60))
  }
  data.txt = string.format("%d:%02d", math.floor(currentStepTimeLeft / 60), math.floor(currentStepTimeLeft % 60))
  data.minutes = string.format("%02d", math.floor(currentStepTimeLeft / 60))
  data.txt = string.format("%d:%02d", math.floor(currentStepTimeLeft / 60), math.floor(currentStepTimeLeft % 60))
  data.minutes = string.format("%02d", math.floor(currentStepTimeLeft / 60))
  data.seconds = string.format("%02d", math.floor(currentStepTimeLeft % 60))
  data.minutes = string.format("%02d", math.floor(currentStepTimeLeft / 60))
  data.seconds = string.format("%02d", math.floor(currentStepTimeLeft % 60))
  data.style = "text"
@/lua/ge/extensions/editor/raceEditor/timeTrials.lua
local function intDiffToString(iDiff)
  return difficulties[clamp(math.floor(iDiff / 25) + 1, 1, 4)]
end
@/lua/ge/extensions/editor/scriptAIManager.lua
                  local perc = vii.scriptTime / vii.endScriptTime
                  local x = math.floor(perc * cwGraph)
                  local gx = graphData[x] or 0
@/ui/modules/apps/app-service.js
          ctx.textAlign = 'left'
          ctx.fillText(Math.floor(container.clientWidth - rect.right), rect.right + 8, rect.top + rect.height/2 - 2)
          ctx.closePath()

      let winLength = Math.floor(inputArray.length / outLength)
      let outArray = new Array(outLength)
@/inspector/Views/RenderingFrameTimelineOverviewGraph.js
        // Set filtered style if the frame element is within the visible range.
        const startIndex = Math.floor(this.startTime);
        const endIndex = Math.min(Math.floor(this.endTime), this._renderingFrameTimeline.records.length - 1);
        const startIndex = Math.floor(this.startTime);
        const endIndex = Math.min(Math.floor(this.endTime), this._renderingFrameTimeline.records.length - 1);
        if (record.frameIndex < startIndex || record.frameIndex > endIndex)
        let records = this._renderingFrameTimeline.records;
        let startIndex = Math.floor(this.startTime);
        let endIndex = Math.min(Math.floor(this.endTime), records.length - 1);
        let startIndex = Math.floor(this.startTime);
        let endIndex = Math.min(Math.floor(this.endTime), records.length - 1);
        let recordFrameIndex = 0;
            if (!this._selectedTimelineRecordFrame || Math.abs(this._selectedTimelineRecordFrame.record.frameIndex - this.selectedRecord.frameIndex) > 1) {
                scrollStartTime -= Math.floor(visibleDuration / 2);
                scrollStartTime = Math.max(Math.min(scrollStartTime, this.timelineOverview.endTime), this.timelineOverview.startTime);

        var frameIndex = Math.floor(position * this.timelineOverview.secondsPerPixel + this.startTime);
        if (frameIndex < 0 || frameIndex >= this._renderingFrameTimeline.records.length)
@/lua/common/graphpath.lua
local function numOfLanesFromRadius(rad1, rad2)
  return max(1, math.floor(min(rad1, rad2 or math.huge) * 2 / 3.45 + 0.5))
end
    else
      inDirLanesN = max(1, math.floor(numOfLanesFromRadius(self.radius[inNode], self.radius[outNode]) * 0.5))
      lanesN = 2 * inDirLanesN -- same number of lanes in both directions
@/lua/ge/extensions/editor/toolUtilities/riverbed.lua
    local p = divPoints[i]
    local bx, by = floor(p.x * bucketSizeInv), floor(p.y * bucketSizeInv)
    local key = bx * 65536 + by
    local p = divPoints[i]
    local bx, by = floor(p.x * bucketSizeInv), floor(p.y * bucketSizeInv)
    local key = bx * 65536 + by
  -- Compute the bucket coordinates for the given point.
  local bx, by = floor(px * bucketSizeInv), floor(py * bucketSizeInv)
  -- Compute the bucket coordinates for the given point.
  local bx, by = floor(px * bucketSizeInv), floor(py * bucketSizeInv)
@/lua/ge/extensions/gameplay/crawl/debug.lua
  if not seconds then return "N/A" end
  local minutes = math.floor(seconds / 60)
  local secs = seconds % 60
@/lua/ge/extensions/gameplay/crashTest/crashTestCountdown.lua

  if math.floor(timer) ~= old then
    old = math.floor(timer)
  if math.floor(timer) ~= old then
    old = math.floor(timer)
    triggerDisplayUpdate()
@/lua/ge/extensions/editor/toolUtilities/perlin.lua
function M.noise(x, y)
  local X, Y = band(floor(x), 255), band(floor(y), 255)
  local xf, yf = x - floor(x), y - floor(y)
function M.noise(x, y)
  local X, Y = band(floor(x), 255), band(floor(y), 255)
  local xf, yf = x - floor(x), y - floor(y)
  local X, Y = band(floor(x), 255), band(floor(y), 255)
  local xf, yf = x - floor(x), y - floor(y)
  local u, v = fade(xf), fade(yf)
  local X, Y = band(floor(x), 255), band(floor(y), 255)
  local xf, yf = x - floor(x), y - floor(y)
  local u, v = fade(xf), fade(yf)
@/lua/common/lpack.lua
  local b8, b7, b6, b5, b4, b3, b2, b1 = str:byte(i, i+7)
  local expo = (b1%0x80)*0x10 + floor(b2*0.0625)
  local mant = b2 % 0x10 + b3 * 3.90625e-3 + b4 * 15.2587890625e-6 + b5 * 59.604644775390625e-9 + b6 * 232.830643653869628906e-12 + b7 * 909.494701772928237915e-15 + b8 * 3.55271367880050092936e-15
      local vlen = #v
      serTmp[seridx] = vlen < 10 and 'A' or (vlen < 100 and 'B' or string.char(65 + math.floor(math.log10(vlen))))
      serTmp[seridx + 1] = vlen
@/lua/ge/extensions/ui/vehicleSelector/tileGrouping.lua
    local decades = {}
    local startDecade = math.floor(years.min / 10) * 10
    local endDecade = math.floor(years.max / 10) * 10
    local startDecade = math.floor(years.min / 10) * 10
    local endDecade = math.floor(years.max / 10) * 10
@/lua/ge/extensions/editor/tech/roadArchitect/utilities.lua
-- Rounds the given floating-point number to two decimal places.
local function round2(num) return floor(num * 100 + 0.5) / 100.0 end
@/lua/ge/extensions/career/modules/delivery/cargoScreen.lua

    local maxAmount = math.floor(con.freeCargoSlots / group[1].slots)
    if maxAmount > 0 then
              enabled = otherCon.freeCargoSlots >= cargo.slots,
              maxAmount = math.min(math.floor(otherCon.freeCargoSlots / cargo.slots), #cargo.ids),
              containerVehicleInfo = {
@/lua/common/kdtreebox2d.lua
  self.itemCount = self.itemCount / 5
  local maxDepth = floor(log10(self.itemCount) / log10(2)) + 1 -- max depth that can accomodate all items while being full (0 indexed)
  local treeNodeCount = 2 * ceil(self.itemCount / maxDepth) - 1 -- optimize node count so that tree depth ~ # of items in each node
  self.tree = table.new(4 * treeNodeCount, 0)
  self.nonLeafLimIdx = 4 * floor(treeNodeCount * 0.5)
  self:_build(1, 5, self.itemCount * 5, 1)
@/lua/ge/extensions/tech/terrainImporter.lua
    for y = 0, ySize do
      local val = floor((dataX[y] - zMin) * uint16Scale)
      bmp:setTexel(x, y, val, val, val, 65535)
@/lua/ge/extensions/editor/slotTrafficEditor.lua
            local usableEdgeLength = edgeLength - arrowLength
            local k = math.max(1, math.floor(usableEdgeLength / 30) - 1)
            local dispVec = (usableEdgeLength / (k + 1)) * edgeDirVec
@/lua/ge/extensions/flowgraph/nodes/career/vehicleGroupByClass.lua
    local classArray = {"S", "A", "B", "C", "D"}
    class = classArray[clamp(math.floor(class), 1, 5)]
  end
@/ui/lib/ext/angular-material/angular-material.js
        left = (targetRect.left + centeredRect.left - centeredRect.paddingLeft) + 2;
        top = Math.floor(targetRect.top + targetRect.height / 2 - centeredRect.height / 2 -
          centeredRect.top + contentNode.scrollTop) + 2;

      var numSteps = Math.floor( (max - min) / step );
      if (!tickCanvas) {
      for (var i = 0; i <= numSteps; i++) {
        distance = Math.floor(dimensions.width * (i / numSteps));
        tickCtx.fillRect(distance - 1, 0, 2, dimensions.height);
    // Divide the total size we have to render into N max-size pieces.
    var numChildren = Math.floor(size / MAX_ELEMENT_SIZE);

  var numItems = Math.max(0, Math.floor(offset / itemSize) - NUM_EXTRA);
      itemsLength - containerLength,
      Math.floor(this.container.getScrollOffset() / this.itemSize)));
  this.newEndIndex = Math.min(itemsLength, this.newStartIndex + containerLength + NUM_EXTRA);
@/ui/entrypoints/main/main.js
      // $window.updateProgress = function(val, txt) {
      //   $rootScope.$broadcast('UpdateProgress', {value: Math.floor(100 * val), text: txt })
      // }
            if (dlinfo[data.id]) {
              dlinfo[data.id][1].scope.message = $sce.trustAsHtml(data.filename + ": " + Math.floor((data.dlnow / data.dltotal) * 100) + "%")
            }
@/ui/ui-vue/src/utils/datetime.js
    if (seconds < spanSeconds) continue
    const abs = length === 1 ? Math.round(seconds / spanSeconds) : Math.floor(seconds / spanSeconds)
    let cur
@/lua/common/jit/p.lua
    local v = count1[k]
    local pct = floor(v*100/samples + 0.5)
    if pct < prof_min then break end
  for k, v in pairs(count1) do
    local pct = floor(v*100/samples + 0.5)
    ms = math.max(ms, v)
@/ui/entrypoints/util_wsTest/script.js
    for ( var i = 0; i < length; i++ ) {
      result.push(characters.charAt(Math.floor(Math.random() * charactersLength)))
    }
@/lua/vehicle/beamstate.lua
  -- local numberOfBrokenBreakGroups = breakGroupCount * (1 - integrityValue)
  -- local wholeNumberOfBrokenBreakGroups = floor(numberOfBrokenBreakGroups)
  -- local shuffledBreakGroups = arrayShuffle(partBreakGroups)
    local breakNode2 = v.data.nodes[beam.id2].cid
    local particleType = 55 + math.floor(math.random(3)) --choose random particle number between 56 and 58 for plastic chunks
    local particleType_deformGroup1 = 68
  if not tableIsEmpty(inflatedTires) then
    deflateTire(inflatedTires[math.floor(math.random(tableSize(inflatedTires)))])
  end
@/lua/ge/extensions/gameplay/util/damageAssessment.lua
    -- convert linear index to 3D grid coordinates
    local x = math.floor((i % 9) / 3)
    local y = math.floor(i / 9)
    local x = math.floor((i % 9) / 3)
    local y = math.floor(i / 9)
    local z = i % 3
@/inspector/Views/CPUUsageCombinedView.js
        let lastDataPoint = dataPoints.lastValue;
        let lastX = Math.floor(xScale(visibleEndTime));
        let lastY1 = yScale(lastDataPoint.mainThreadUsage);
@/ui/modules/apps/TorqueCurve-v2/app.js
        var torqueTicks = Array(6).fill().map((x, i, a) => i * maxTorque / (a.length - 1))
        var rpmTicks    = Array( Math.floor(maxRpm/1000) + 1 ).fill().map((x, i) => i*1000)

        var rpmX = plotMargins.left + Math.floor(_rpm * xFactor)

        var rpmInd = Math.floor(_rpm)
        scope.$evalAsync(function () {
@/lua/ge/extensions/gameplay/rally/tools/loopToolbox.lua

  local hours = math.floor(seconds / 3600)
  local minutes = math.floor((seconds % 3600) / 60)
  local hours = math.floor(seconds / 3600)
  local minutes = math.floor((seconds % 3600) / 60)
  local secondsWithDecimal = seconds % 60  -- Keep the fractional part
  else
    local secs = math.floor(seconds % 60)
    if hours > 0 then
@/lua/ge/extensions/util/trackBuilder/proceduralPrimitives.lua
  thickness = thickness/2 or 0.5
  local outerSegments = math.floor(clamp((radius)*6,18,72))
  local innerSegments = math.floor(clamp((thickness)*12,8,24))
  local outerSegments = math.floor(clamp((radius)*6,18,72))
  local innerSegments = math.floor(clamp((thickness)*12,8,24))
  local uvFlip = false
  material = material or 'track_editor_A_border'
  local segments = math.floor(clamp(radius*8,12,72))
  local uvReps = math.ceil(height/2.5)
  material = material or 'track_editor_A_border'
  local segments = math.floor(clamp(radius*8,12,72))
  local uvReps = math.ceil(height/2.5)
@/lua/ge/extensions/editor/gen/decal.lua
--                nn = nn + 1
            local i,j = math.floor((n.y + L)/grid) + 1,math.floor((n.x + L)/grid) + 1
            if aref[i] == nil then
--                nn = nn + 1
            local i,j = math.floor((n.y + L)/grid) + 1,math.floor((n.x + L)/grid) + 1
            if aref[i] == nil then
--        local n = adec[231].list[1]
--        local i,j = math.floor((n.y + L)/grid) + 1,math.floor((n.x + L)/grid) + 1
--        U.dump(aref[526][355], '???*************** aref:'..tostring(aref[526])..':'..tostring(n)..':'..i..':'..j)
--        local n = adec[231].list[1]
--        local i,j = math.floor((n.y + L)/grid) + 1,math.floor((n.x + L)/grid) + 1
--        U.dump(aref[526][355], '???*************** aref:'..tostring(aref[526])..':'..tostring(n)..':'..i..':'..j)
                    local L,ne = D.roadLength({body=rd})
                    local nn = math.floor(L/5+0.5)
                    local step = L/nn
                    local L,ne = D.roadLength({body=rd})
                    local nn = math.floor(L/5+0.5)
                    local step = L/nn
local function p2grid(p)
--        local i = math.floor((p.y - tfr.y)/grid+0.5) + 1
    return math.floor((p.x - tfr.x)/grid+0.5) + 1,math.floor((p.y - tfr.y)/grid+0.5) + 1
--        local i = math.floor((p.y - tfr.y)/grid+0.5) + 1
    return math.floor((p.x - tfr.x)/grid+0.5) + 1,math.floor((p.y - tfr.y)/grid+0.5) + 1
end
--        local i = math.floor((p.y - tfr.y)/grid+0.5) + 1
    return math.floor((p.x - tfr.x)/grid+0.5) + 1,math.floor((p.y - tfr.y)/grid+0.5) + 1
end
    local jc,ic = p2grid(c)
    local ri = math.floor(r/grid+0.5)
    local arr = {}
        local l = math.abs(rd.apin[i+1].d - rd.apin[i].d)
--        local nstep = math.floor(l/pinstep+0.5)
        pinstep = math.min(l-0.1,pinstep)
        local sstep = 10
        local nsstep = math.floor(rd.L/sstep+0.5)
        sstep = rd.L/nsstep
        local d = 0
        local ri = math.floor(r/grid+0.5) -- integer stamp size
                        if d - e2d[i] < rma then
                                if dbg and math.floor(d/step+0.5) == dbg_step then
                                    lo('??+++++ dd:'..(d - e2d[i]-rma)..':'..(e2d[i-1]-e2d[i]))
                end
                    if dbg and math.floor(d/step+0.5) == dbg_step then
                        lo('??________________ for_AE:'..#ae)
]]
--                                    lo('?? mark:'..tostring(amark[#amark])..':'..math.floor(d/step)..':'..tostring(math.floor(d/step)==15))
                        if true then
]]
--                                    lo('?? mark:'..tostring(amark[#amark])..':'..math.floor(d/step)..':'..tostring(math.floor(d/step)==15))
                        if true then
                            local p = grid2p({i,j})
                                    if math.floor(d/step+0.5) then --== dbg_step and (not mask[ij] or mask[ij][3] ~= 0) then
--                                    if math.floor(d/step+0.5) == dbg_step and (not mask[ij]) then-- or mask[ij][3] ~= 0) then
                                    if math.floor(d/step+0.5) then --== dbg_step and (not mask[ij] or mask[ij][3] ~= 0) then
--                                    if math.floor(d/step+0.5) == dbg_step and (not mask[ij]) then-- or mask[ij][3] ~= 0) then
--                                    if math.floor(d/step+0.5) == dbg_step and (not mask[ij] or mask[ij][3] ~= 0) then
--                                    if math.floor(d/step+0.5) == dbg_step and (not mask[ij]) then-- or mask[ij][3] ~= 0) then
--                                    if math.floor(d/step+0.5) == dbg_step and (not mask[ij] or mask[ij][3] ~= 0) then
--                                    if math.floor(d/step+0.5) == dbg_step and (not mask[U.stamp(ij,true)] or mask[U.stamp(ij,true)][3] ~= 0) then
--                                    if math.floor(d/step+0.5) == dbg_step and (not mask[ij] or mask[ij][3] ~= 0) then
--                                    if math.floor(d/step+0.5) == dbg_step and (not mask[U.stamp(ij,true)] or mask[U.stamp(ij,true)][3] ~= 0) then
                                if not dbg then pdbg = false end
                            local crv = acp[math.floor(d/sstep+0.5)+1] and acp[math.floor(d/sstep+0.5)+1][2] or 0
--                                if p:distance(cp) < 3.5 then
                                if not dbg then pdbg = false end
                            local crv = acp[math.floor(d/sstep+0.5)+1] and acp[math.floor(d/sstep+0.5)+1][2] or 0
--                                if p:distance(cp) < 3.5 then
--                                if p:distance(cp) < 3.5 then
--                                    lo('?? for_crv:'..d..':'..math.floor(d/sstep+0.5)..':'..tostring(crv))
--                                end
                                            ---- spline
                                            local ips = math.floor(ds/sstep)+1
                                            local crv = ips < #cpar and D.spline(cpar, ips, ds, ds%sstep/sstep) or nil
                                                    local ds,ps = D.toSide(p, adec[rd.frto[1]], rd.frtoside[1])
--                                                        if dbg and math.floor(d/step+0.5)==dbg_step then
--                                                            lo('?? on_SIDE:'..tostring(ps)..':'..tostring(p))
--                                                    am1[#am1+1] = p
--                                            if dbg and math.floor(d/step+0.5)==dbg_step and (not mask[ij] or mask[ij][3] ~=0) then
--                                                    am4[#am4+1] = p
                                            else
                                                if dbg and math.floor(d/step+0.5)==dbg_step then -- and (mask[ij] and mask[ij][3]==0) then
                                                    am4[#am4+1] = p
                                            else
                                                if dbg and math.floor(d/step+0.5)==dbg_step then
--                                                    am4[#am4+1] = p

--                                            if dbg and math.floor(d/step+0.5)==dbg_step and (mask[ij] and mask[ij][3]==0) then
                                            if dbg and math.floor(d/step+0.5)==dbg_step and (not mask[ij] or mask[ij][3] ~=0) then
--                                            if dbg and math.floor(d/step+0.5)==dbg_step and (mask[ij] and mask[ij][3]==0) then
                                            if dbg and math.floor(d/step+0.5)==dbg_step and (not mask[ij] or mask[ij][3] ~=0) then
--                                                am4[#am4+1] = p
                                                if cjunc and (rd.L-ds)>12 then
                                                    if math.floor(d/step+0.5)==dbg_step then
--                                                        am4[#am4+1] = p
                                            -- far from start
                                            if dbg and math.floor(d/step+0.5)==dbg_step then
                                                if p:distance(cp) < 5 then
                                end
                                    if dbg and math.floor(d/step+0.5)==dbg_step then
--                                        am4[#am4+1] = p
                            else --if false then
                                if dbg and math.floor(d/step+0.5) == dbg_step then
                                        lo('?? no_proj:'..tostring(p)..':'..(i-ic)..':'..(j-jc))
        --                toMark(amark, 'yel', nil, 0.05, 0.6)
                    if dbg and math.floor(d/step+0.5)==dbg_step then
                            lo('?? to_MARK:'..#amark..':'..#am2..':'..#am4)
            local l = rd.apin[i+1].d - rd.apin[i].d
            local nstep = math.floor(l/pinstep+0.5)
            local step = l/nstep
        nn = nn + 1
    local i,j = math.floor((n.y + L)/grid) + 1,math.floor((n.x + L)/grid) + 1
    if aref[i] == nil then
        nn = nn + 1
    local i,j = math.floor((n.y + L)/grid) + 1,math.floor((n.x + L)/grid) + 1
    if aref[i] == nil then
    if de > rd.L then de = rd.L end
    local nstep = math.floor((de-db)/pinstep+0.5)
    pinstep = (de-db)/nstep
    if not jdesc.round then
        jdesc.round = {list = list, r=r, w = w, lane={math.floor(w/default.laneWidth+0.5),0}, aexo={}, aexi={}}
        decalUp(jdesc.round)
            e.w = edist
--            e.lane = {math.floor(e.w/default.laneWidth+0.5),0}
            e.lane = {2,0}
    if not jdesc.round then
        jdesc.round = {list = list, r=r, w = w, lane={math.floor(w/default.laneWidth+0.5),0}, aexo={}, aexi={}}
        decalUp(jdesc.round)
            e.w = edist
--            e.lane = {math.floor(e.w/default.laneWidth+0.5),0}
            e.lane = {2,0}

                local xfr,xto = math.floor(pth[1].x),math.ceil(pth[2].x)
                local yfr,yto = math.floor(pth[1].y),math.ceil(pth[4].y)
                local xfr,xto = math.floor(pth[1].x),math.ceil(pth[2].x)
                local yfr,yto = math.floor(pth[1].y),math.ceil(pth[4].y)
--                        local np = 0
            local d23 = n2e[ipre + 2].d - n2e[ipre + 1].d
            local en2 = math.floor((n2e[ipre + 2].e + iel)/2) - 1
--                lo('?? distL:'..tostring(ipre)..':'..n2e[2].e..':'..iel..' 12:'..d12..' 23:'..d23..':'..en2)
            local w = editor.getNodes(b.body)[1].width
            local nln = math.floor(w/default.laneWidth+0.5)
            lane[1] = math.random(1,nln-1)
            local s = toSide(car.pos,rd,dir>0 and 'right' or 'left')
            car.lane = math.floor(s/2/margin+1)
                lo('??+++++++ for_LANE:'..car.lane..' s:'..s..' marg:'..margin)
        local dspl = dto-dfr
        local nstep = math.floor(dspl/pinstep+0.5)
        local step = dspl/nstep
--        dbg = true
    local istep = math.max(math.floor(step/grid),1)
    local ir = math.ceil(r/grid)
--    local pfr,pto = U.proj2D(pth[1]),U.proj2D(pth[2])
--    local nstep = math.floor(pfr:distance(pto)/pinstep+0.5)
--        U.dump(pth, '>> decalPlot:'..#pth..':'..pfr:distance(pto))
        rd.L = roadLength(rd)
        local nstep = math.floor(rd.L/pinstep+0.5)
        local step = rd.L/nstep
                                    local dlen = pfr:distance(pto)
                                    local nstep = math.floor(dlen/pinstep+0.5)
                                    local step = dlen/nstep
@/lua/ge/extensions/core/hotlapping.lua
  else
    timeInMillis = math.floor(timeInMillis+ .5)
    return string.format("%.2d:%.2d.%.3d", (timeInMillis / 1000) / 60, (timeInMillis / 1000) % 60, timeInMillis % 1000)
@/ui/ui-vue/src/utils/format.js
  if (isNaN(parseFloat(num)) || !isFinite(+num)) return "n/a"
  let power = Math.floor(Math.log(Math.abs(+num)) / Math.log(1000))
  if (power >= units.length) power = units.length - 1
@/lua/ge/extensions/editor/gen/test.lua
			local l = L - (2*winleft+doorspace)
			local nwin = math.floor(l/winspace)
--				lo('?? for_PRE:'..L..':'..winspace*nwin..':'..(winspace*nwin + doorspace))
@/inspector/Views/DataGrid.js
        if (minPercent)
            minPercent = Math.min(minPercent, Math.floor(100 / this.orderedColumns.length));
        var widths = {};

        let topHiddenRowCount = Math.max(0, Math.floor((this._cachedScrollTop - overflowPadding) / rowHeight));
        let bottomHiddenRowCount = Math.max(0, this._previousRevealedRowCount - topHiddenRowCount - visibleRowCount);
@/lua/vehicle/ai.lua
    local tmpVec = vec3()
    local RRPicks = max(1, min(floor(150 * dt + 0.5), 8)) -- x * dt where x/fps is the numer of samples
    for k = 1, RRPicks do --the ray cast loop: each iteration scans one area and casts on the minimum
      if blueIndex < 3 then
        i = floor(1 + blueIndex)
      elseif blueIndex < 6 then
      elseif blueIndex < 6 then
        i = floor(1 + blueIndex) + 1
      elseif blueIndex < 6 + sizeRatio then
local function numOfLanesFromRadius(rad1, rad2)
  return max(1, math.floor(min(rad1, rad2 or math.huge) * 2 / 3.61 + 0.5)) -- math.floor(min(rad1, rad2) / 2.7) + 1
end
local function numOfLanesFromRadius(rad1, rad2)
  return max(1, math.floor(min(rad1, rad2 or math.huge) * 2 / 3.61 + 0.5)) -- math.floor(min(rad1, rad2) / 2.7) + 1
end
    else
      local numOfLanes = max(1, math.floor(numOfLanesFromRadius(mapData.radius[fromNode], mapData.radius[toNode]) * 0.5))
      if mapmgr.rules.rightHandDrive then
        local drivabilityRatio = min(1, edgeData.drivability * inEdgeDrivabilityInv)
        thisEdgeInLanes = math.floor(thisEdgeInLanes * dirRatio * drivabilityRatio + 0.5)
  --profilerPushEvent("ai_process_laneChange")
  if route.laneChanges[1] and math.floor(plan[2].rangeLaneCount + 0.5) > 1 and route.laneChanges[1].side ~= 0 then
    local exitNodeIdx = route.laneChanges[1].pathIdx
@/lua/ge/extensions/career/modules/fuel.lua
        local price = getPricePerUnit(data.energyType) * jouleToReadableUnit(fuelingData[index].fueledEnergy, data.energyType)
        fuelingData[index].price = math.floor((price * 100) + 0.5) / 100
        if data.currentEnergy > data.maxEnergy then
@/lua/ge/extensions/editor/gen/utils.lua
U.round = function(val, ndig)
	return math.floor(val*math.pow(10,ndig)+0.5)/math.pow(10,ndig)
end
		local ang = U.vang(base[i-1]-cspline.c,base[i]-cspline.c,true)
		local na = math.abs(math.floor(32*ang/math.pi+0.5))
		local da = ang/na
--			local L = cspline.r*U.vang(base[i]-cspline.c,base[i-1]-cspline.c)
--			local step = L/math.floor(3*L/cspline.r+0.5)
--			local step = cspline.r/3 --math.floor(3*U.vang(base[i]-cspline.c,base[i-1]-cspline.c)/cspline.r + 0.5)
--			local step = L/math.floor(3*L/cspline.r+0.5)
--			local step = cspline.r/3 --math.floor(3*U.vang(base[i]-cspline.c,base[i-1]-cspline.c)/cspline.r + 0.5)
--			step =
@/lua/ge/extensions/flowgraph/nodes/util/perlinNoise.lua
    -- Calculate the "unit cube" that the point asked will be located in
    local xi = bit32.band(math.floor(x),255)
    local yi = bit32.band(math.floor(y),255)
    local xi = bit32.band(math.floor(x),255)
    local yi = bit32.band(math.floor(y),255)
    local zi = bit32.band(math.floor(z),255)
    local yi = bit32.band(math.floor(y),255)
    local zi = bit32.band(math.floor(z),255)
    -- Next we calculate the location (from 0 to 1) in that cube
    x = x - math.floor(x)
    y = y - math.floor(y)
    x = x - math.floor(x)
    y = y - math.floor(y)
    z = z - math.floor(z)
    y = y - math.floor(y)
    z = z - math.floor(z)
@/inspector/Views/TimelineRecordFrame.js
        var frameIndex = this._record.frameIndex;
        var graphStartFrameIndex = Math.floor(graphDataSource.startTime);
        var graphEndFrameIndex = graphDataSource.endTime;
@/ui/entrypoints/main/perfrunner.js
    if (!arr.length) return NaN;
    const m = Math.floor(arr.length / 2);
    return arr.length % 2 ? arr[m] : (arr[m - 1] + arr[m]) / 2;
@/lua/vehicle/controller/vehicleController/vehicleController.lua
        local currentWheelTorque = torqueCurve[i] * currentGearRatio
        local nextGearRPM = min(max(floor(i * (nextGearRatio / currentGearRatio)), 1), engine.maxRPM)
        local previousGearRPM = min(max(floor(i * (previousGearRatio / currentGearRatio)), 1), engine.maxRPM)
        local nextGearRPM = min(max(floor(i * (nextGearRatio / currentGearRatio)), 1), engine.maxRPM)
        local previousGearRPM = min(max(floor(i * (previousGearRatio / currentGearRatio)), 1), engine.maxRPM)
        local nextWheelTorque = torqueCurve[nextGearRPM] * nextGearRatio
        local offsetCoef = shiftDownRPMOffsetCoef * (currentGearRatio / previousGearRatio)
        shiftDownRPM = min(shiftDownRPM, max(floor(shiftPoints[k - sign(k)].highShiftUpAV / previousGearRatio * currentGearRatio * offsetCoef * constants.avToRPM), (engine.idleRPM or 0) * 1.05))
      end
@/lua/vehicle/extensions/tech/LINBus/LINBusPeak.lua
    t[b] = fmod(num, 2)
    num = floor((num - t[b]) / 2)
  end
@/inspector/Views/CircleChart.js
        this._radius = (size / 2) - 1;
        this._innerRadius = innerRadiusRatio ? Math.floor(this._radius * innerRadiusRatio) : 0;
@/lua/common/jbeamWriter.lua
      else
        if v ~= floor(v) then
          return stringformat('%' .. numberPrecision .. '.' .. numberPrecision .. 'f', v)
@/lua/ge/extensions/editor/gen/mesh.lua
	local l = a:distance(b)
	local n = math.floor(l/daedesc.len + 0.5)
--		if dbg then lo('??^^^^^^^^^^^^^ fS:'..tostring(daedesc.len)..' n:'..n) end
	end
--	math.floor(l/)d
	return out
	local L = #aiv
--    local N = math.floor(L/2)
--        U.dump(aiv, '>> zip:'..#af..' N='..N)

	local N = math.floor(#aiv/2)
--        U.dump(aiv, '>> zip:'..#af..' N='..N)

	local N = math.floor(#base/2) - 1
	for i = 1,N do
	M.text2node(nda, sav)
	M.ofNode(ndass, {count=tostring(math.floor(#m.verts))})
]]
	M.text2node(nda, sv)
	M.ofNode(ndass, {count=tostring(math.floor(#av/3))})
	-- normals info
	M.text2node(nda, sn)
	M.ofNode(ndass, {count=tostring(math.floor(#an/3))})
	-- UV info
	M.text2node(nda, suv)
	M.ofNode(ndass, {count=tostring(math.floor(#auv/2))})
	-- triangles
--								lo('?? for_V:'..ii..':'..j..':'..tostring(w.pos))
			local ind = math.floor(#av/3)
			local inorm = math.floor(#an/3)
			local ind = math.floor(#av/3)
			local inorm = math.floor(#an/3)
			uvo = {arc[ii][j].fr[1], arc[ii][j].fr[2]}
	M.text2node(nda, sv)
	M.ofNode(ndass, {count=tostring(math.floor(#av/3))})
	-- normals info
	M.text2node(nda, sn)
	M.ofNode(ndass, {count=tostring(math.floor(#an/3))})
	-- UV info
	M.text2node(nda, suv)
	M.ofNode(ndass, {count=tostring(math.floor(#auv/2))})
	-- triangles
	local w = (pma-pmi):dot(u)
--	step = w/math.floor(w/step+0.5)
	local aline = {}
@/lua/ge/extensions/flowgraph/nodes/vehicle/randomConfigProvider.lua
function C:workOnce()
  local opt = self.options[math.floor(#self.options * math.random())+1]
  local cnf = opt.configs[math.floor(#opt.configs * math.random())+1]
  local opt = self.options[math.floor(#self.options * math.random())+1]
  local cnf = opt.configs[math.floor(#opt.configs * math.random())+1]
  self.pinOut.config.value = cnf.config
  if opt.paints and #opt.paints > 0 then
    self.pinOut.color.value = opt.paints[math.floor(#opt.paints * math.random())+1]
  else
@/lua/common/libs/lua-websockets/websocket/tools.lua
  -- append 64 big endian length
  local high = math.floor(bits/2^32)
  local low = bits - high*2^32
@/lua/vehicle/electricsCustomValueParser.lua
  elseif selectorType == "number" then
    index = math.floor(selector) --make sure we have an int for table access
  else
@/lua/vehicle/controller/inputOutputDemo.lua
  --headers: "time", "throttle", "brake", "batteryCapacity", "motorPower"
  local time = floor(timer * 1000) / 1000 --Make sure time doesn't have dozen of digits
  local throttle = electrics.values.throttle --throttle input
@/lua/ge/extensions/editor/iconOverview.lua
  local itemSize = ((size.x * imgui.uiscale[0]  + style.ItemSpacing.x))
  local itemsPerRow = math.floor(availableWidth / itemSize)
  if editor.uiInputSearchTextFilter("##iconFilter", filter, imgui.GetContentRegionAvailWidth(), nil, editEnded) then
@/ui/modules/busRoute/busRoute.js
    var val = ['ui.scenarios.difficulty.easy', 'ui.scenarios.difficulty.medium', 'ui.scenarios.difficulty.hard', 'ui.scenarios.difficulty.veryHard']
    return val[Math.floor(parseFloat(num)/25)]
  }
    if($stateParams.level.previews.length > 0) {
      preview = $stateParams.level.previews[Math.floor(Math.random() * $stateParams.level.previews.length)]
    }
    if(scenario.previews.length > 0) {
      preview = scenario.previews[Math.floor(Math.random() * scenario.previews.length)]
    }
    var val = ['ui.scenarios.difficulty.easy', 'ui.scenarios.difficulty.medium', 'ui.scenarios.difficulty.hard', 'ui.scenarios.difficulty.veryHard']
    return val[Math.floor(parseFloat(num)/25)]
  }
@/lua/common/luaProfiler.lua
  local factor = 10^decimals
  local result = math.floor(value*factor + 0.5) / factor
  local k
@/lua/ge/extensions/editor/util/plotHelperUtil.lua

  return floor(num * multiple + 0.5) / multiple
end
function C:getOrderOfMagnitude(num)
  return floor(log10(abs(num)))
end
@/lua/vehicle/extensions/tech/platooning.lua

  if math.floor(distanceToLeadCar) > math.floor(targetDistance) and targetSpeedIn > 0 then --add a condition for targetspeed==0?
    targetSpeed = targetSpeedIn + distanceError/targetDistance*targetSpeedIn

  if math.floor(distanceToLeadCar) > math.floor(targetDistance) and targetSpeedIn > 0 then --add a condition for targetspeed==0?
    targetSpeed = targetSpeedIn + distanceError/targetDistance*targetSpeedIn
  
  elseif math.floor(distanceToLeadCar) > math.floor(targetDistance) and targetSpeedIn == 0 then --brakes onn and off issue still on --edittied check if problems occur, removed targetSpeedIn == 0 from conition, was anded
   
  
  elseif math.floor(distanceToLeadCar) > math.floor(targetDistance) and targetSpeedIn == 0 then --brakes onn and off issue still on --edittied check if problems occur, removed targetSpeedIn == 0 from conition, was anded
   
  if debug then
    local time = math.floor(timer * 1000) / 1000 -- Make sure time doesn't have dozen of digits
    csvData:add(time, velocityy, targetSpeed, u) timer = timer + dtSim
         
          if velocityRelay >= math.floor(velocity*0.90) then
           

    if (velocities == #relayVehiclesVel and updatedSpeed < platoonsSpeed and velocity>= math.floor(updatedSpeed*0.90) ) or (simTime > 5 and updatedSpeed < platoonsSpeed) then
      
@/lua/ge/extensions/flowgraph/nodes/scene/sevensegmentDisplay.lua
        local m = math.pow(10, (self.data.count - self.data.decimals) - i)
        local n = math.floor(self.oldNumber / m)
        if i == self.data.count then
        if i == self.data.count then
            n = math.floor(self.oldNumber / m + 0.5)
        end
@/lua/ge/extensions/editor/roadSpline/layerMgr.lua
  local currentHalfWidthOfRoad = currentWidth * 0.5
  local numLeftLanes = max(1, floor(currentHalfWidthOfRoad / 5.0)) -- Ensure at least 1 lane
  local numRightLanes = numLeftLanes
  local minHalfWidthOfRoad = util.getMinMaxWidth(group) * 0.5
  local numLeftLanes = floor(minHalfWidthOfRoad / 5.0) - 1
  local numRightLanes = numLeftLanes
@/lua/ge/extensions/editor/gen/region.lua
--        out.apick = {adec[rmi].list[nmi]}
--        local i,j = math.floor((n.y + L)/grid) + 1,math.floor((n.x + L)/grid) + 1
--        lo('?? ij:'..i..':'..j..':'..tostring(across[i]))
--        out.apick = {adec[rmi].list[nmi]}
--        local i,j = math.floor((n.y + L)/grid) + 1,math.floor((n.x + L)/grid) + 1
--        lo('?? ij:'..i..':'..j..':'..tostring(across[i]))
--        out.apick = {adec[rmi].list[nmi]}
--        local i,j = math.floor((n.y + L)/grid) + 1,math.floor((n.x + L)/grid) + 1
--        lo('?? ij:'..i..':'..j..':'..tostring(across[i]))
--        out.apick = {adec[rmi].list[nmi]}
--        local i,j = math.floor((n.y + L)/grid) + 1,math.floor((n.x + L)/grid) + 1
--        lo('?? ij:'..i..':'..j..':'..tostring(across[i]))
	local xmima, ymima = {math.huge, 0},{math.huge, 0}
			lo('?? X_lim:'..tostring(math.floor(c.x - r))..':'..tostring(math.ceil(c.x + r)), true)
			lo('?? Y_lim:'..math.floor(c.y - r)..':'..math.ceil(c.y + r), true)
			lo('?? X_lim:'..tostring(math.floor(c.x - r))..':'..tostring(math.ceil(c.x + r)), true)
			lo('?? Y_lim:'..math.floor(c.y - r)..':'..math.ceil(c.y + r), true)
	local block = terrainBackup({math.floor(c.x - r), math.ceil(c.x + r)}, {math.floor(c.y - r), math.ceil(c.y + r)})
			lo('?? Y_lim:'..math.floor(c.y - r)..':'..math.ceil(c.y + r), true)
	local block = terrainBackup({math.floor(c.x - r), math.ceil(c.x + r)}, {math.floor(c.y - r), math.ceil(c.y + r)})
	for x = math.floor(c.x - r), math.ceil(c.x + r) do
			lo('?? Y_lim:'..math.floor(c.y - r)..':'..math.ceil(c.y + r), true)
	local block = terrainBackup({math.floor(c.x - r), math.ceil(c.x + r)}, {math.floor(c.y - r), math.ceil(c.y + r)})
	for x = math.floor(c.x - r), math.ceil(c.x + r) do
	local block = terrainBackup({math.floor(c.x - r), math.ceil(c.x + r)}, {math.floor(c.y - r), math.ceil(c.y + r)})
	for x = math.floor(c.x - r), math.ceil(c.x + r) do
		for y = math.floor(c.y - r), math.ceil(c.y + r) do
	for x = math.floor(c.x - r), math.ceil(c.x + r) do
		for y = math.floor(c.y - r), math.ceil(c.y + r) do
--                lo('?? for_H:'..x..':'..y..':'..core_terrain.getTerrainHeight(vec3(x,y)), true)
					-- check decals
					local i,j = math.floor((y + L)/grid),math.floor((x + L)/grid)
--                                lo('?? for_IJ:'..i..':'..j)
					-- check decals
					local i,j = math.floor((y + L)/grid),math.floor((x + L)/grid)
--                                lo('?? for_IJ:'..i..':'..j)
@/lua/ge/extensions/editor/visualization.lua
local function _ensureGradTD(w, h)
  w = math.max(1, math.floor(w))
  h = math.max(1, math.floor(h))
  w = math.max(1, math.floor(w))
  h = math.max(1, math.floor(h))
  if not tdGrad or gradTexSize.x ~= w or gradTexSize.y ~= h then
  return color(
    math.floor((r or 0) * 255 + 0.5),
    math.floor((g or 0) * 255 + 0.5),
    math.floor((r or 0) * 255 + 0.5),
    math.floor((g or 0) * 255 + 0.5),
    math.floor((b or 0) * 255 + 0.5),
    math.floor((g or 0) * 255 + 0.5),
    math.floor((b or 0) * 255 + 0.5),
    math.floor((a or 1) * 255 + 0.5)
    math.floor((b or 0) * 255 + 0.5),
    math.floor((a or 1) * 255 + 0.5)
  )
local function _packColor(r, g, b, a)
  local function to8(x) return math.floor((x or 0) * 255 + 0.5) end
  return bit.bor(bit.lshift(to8(a or 1), 24), bit.lshift(to8(b), 16), bit.lshift(to8(g), 8), to8(r))
  segments = segments or 64
  w = math.max(1, math.floor(w))
  h = math.max(1, math.floor(h))
  w = math.max(1, math.floor(w))
  h = math.max(1, math.floor(h))
  local td = _ensureGradTD(w, h)
  "Tile size = 0.25",
  "Shows parity of floor(U/size) + floor(V/size)"
}
  "Tile size = 0.25",
  "Shows parity of floor(U/size) + floor(V/size)"
}
@/gameplay/missionTypes/cannon/customNodes/MarkersNode.lua
      if not veh:getDynDataFieldbyName('static',0) then
        local dist = math.floor(pl:getPosition():distance(vehPos))
        debugDrawer:drawTextAdvanced(vehPos, tostring(dist).." m", whiteF, true, false, blackI, false, false)
@/lua/vehicle/powertrain/combustionEngine.lua
  local rpm = device.soundRPMSmoother:get(abs(device.outputAV1 * avToRPM), dt)
  local maxCurrentTorque = (device.torqueCurve[floor(rpm)] or 1) * device.intakeAirDensityCoef
  local engineLoad = device.soundLoadSmoother:get(device.instantEngineLoad, dt)
  -- we compute the flooding percentage in steps of 10%...
  local currPercent = floor(0.5 + device.floodLevel * 10) * 10
  -- ...and use that to check when to perform UI updates
  local idleThrottle = device.maxIdleThrottle
  local idleTorque = (device.torqueCurve[floor(abs(device.idleAV) * avToRPM)] or 0) * device.intakeAirDensityCoef
  local idleThrottleMap = min(max(idleThrottle + idleThrottle * device.maxPowerThrottleMap / (idleTorque * device.forcedInductionCoef * abs(device.outputAV1) + 1e-30) * (1 - idleThrottle), 0), 1)

  local tableRPM = floor(engineAV * avToRPM) or 0
  local torque = (device.torqueCurve[tableRPM] or 0) * device.intakeAirDensityCoef
  device.pumpingLossPerUpdate = device.pumpingLossPerUpdate + finalDynamicFriction * engineAV * engineAV * dt
  local invBurnEfficiency = device.invBurnEfficiencyTable[floor(device.instantEngineLoad * 100)] * device.invBurnEfficiencyCoef
  device.spentEnergy = device.spentEnergy + burnEnergy * invBurnEfficiency

  device.idleTorque = device.torqueCurve[floor(device.idleRPM)] or 0
@/ui/modules/quickrace/quickrace.js
    var val = ['ui.scenarios.difficulty.easy', 'ui.scenarios.difficulty.medium', 'ui.scenarios.difficulty.hard', 'ui.scenarios.difficulty.veryHard']
    return val[Math.floor(parseFloat(num)/25)]
  }
    if($stateParams.level.previews.length > 0) {
      preview = $stateParams.level.previews[Math.floor(Math.random() * $stateParams.level.previews.length)]
    }
    if(scenario.previews.length > 0) {
      preview = scenario.previews[Math.floor(Math.random() * scenario.previews.length)]
    }
    var val = ['ui.scenarios.difficulty.easy', 'ui.scenarios.difficulty.medium', 'ui.scenarios.difficulty.hard', 'ui.scenarios.difficulty.veryHard']
    return val[Math.floor(parseFloat(num)/25)]
  }
@/lua/vehicle/controller/pneumatics/airbrakes.lua
  -- need to convert pressure to kPa and floor it before indexing curve
  local lookupPressure = floor(min(max(relativeActuatorPressure, minBrakePressure), maxBrakePressure) * 0.001)
  -- need to convert pressure to kPa and floor it before indexing curve
  local lookupPressure = floor(min(max(relativeActuatorPressure, minSpringBrakePressure), maxSpringBrakePressure) * 0.001)
    -- pressure is stored in kPa in the curve (but defined as Pa in jbeam)
    table.insert(rawPoints, {floor(v.pressure / 1000), v.torqueCoef})
  end
    -- pressure is stored in kPa in the curve (but defined as Pa in jbeam)
    table.insert(rawPoints, {floor(v.pressure / 1000), v.torqueCoef})
  end
@/lua/ge/suspensionFrequencyTester.lua
      local availWidth = imgui.GetContentRegionAvailWidth()
      local contentWidth = math.floor(availWidth)
      imgui.PushItemWidth(100)
            local pixelAmpl = 0
            local freqStart = math.floor(pixel * numFreqs / numPixels) + 1
            local freqEnd = math.floor((pixel + 1) * numFreqs / numPixels)
            local freqStart = math.floor(pixel * numFreqs / numPixels) + 1
            local freqEnd = math.floor((pixel + 1) * numFreqs / numPixels)
            else
              local closestFreqIdx = math.floor(pixel * numFreqs / numPixels + 0.5) + 1
              closestFreqIdx = math.max(1, math.min(closestFreqIdx, numFreqs))

           local numLabels = math.max(2, math.floor(contentWidth / 50))
           local labelFreqStep = (maxFreq - minFreq) / (numLabels - 1)
@/lua/ge/extensions/scenario/driftGoal.lua

      local angleBonus = math.floor(math.sqrt(vecDifx * vecDifx + vecDify * vecDify) * 10)    --distance between speed and rotation vectors
      local speedBonus = fobjData.vel:length() * 0.15

      local driftBonus = math.floor(angleBonus * speedBonus) --combine speed and angle to make a score
      if driftBonus > 0 then      --If a drift is happening
          lastDriftPoints = driftPoints   --remember what the score was
          displayMessage = driftDescription[math.min(math.floor(math.sqrt(lastDriftPoints/30))+1, 8)] --pick an adjective to describe the drift
          driftPoints = 0      --no more points from this drift
@/ui/modules/apps/SimplePedals/app.js
      let smartRound = function(max, v) {
        return v>=max? max : Math.floor(v+(1-1e-7-v/max))
      }
@/ui/modules/loading/loading.js
  let vm = this
  $scope.hintTranslationKey = Hints[Math.floor(Math.random() * Hints.length)]
@/lua/ge/extensions/util/trackBuilder/basicBorders.lua
      pointsCount = pointsCount +1
      cappedWidth = side * math.floor(point.width * LUTDetail + 0.5) / (LUTDetail*2)
@/lua/ge/extensions/flowgraph/nodes/math/math.lua
  elseif selectorType == "number" then
    index = math.floor(selector) --make sure we have an int for table access
  else
@/inspector/Views/MemoryCategoryView.js
        let lastDataPoint = dataPoints.lastValue;
        let lastX = Math.floor(xScale(visibleEndTime));
        let lastY = yScale(lastDataPoint.size);
@/lua/vehicle/extensions/tech/CANBus/CANBusPeak.lua
    t[b] = fmod(num, 2)
    num = floor((num - t[b]) / 2)
  end
@/ui/lib/ext/spine-canvas.js
        constraint.mix += (frames[frames.length + IkConstraintTimeline.PREV_MIX] - constraint.mix) * alpha;
        constraint.bendDirection = Math.floor(frames[frames.length + IkConstraintTimeline.PREV_BEND_DIRECTION]);
        return;
      constraint.mix += (mix + (frames[frame + IkConstraintTimeline.MIX] - mix) * percent - constraint.mix) * alpha;
      constraint.bendDirection = Math.floor(frames[frame + IkConstraintTimeline.PREV_BEND_DIRECTION]);
    };
    MathUtils.toInt = function (x) {
      return x > 0 ? Math.floor(x) : Math.ceil(x);
    };
@/lua/common/extensions/ui/improfiler.lua
    local v = count1[k]
    local pct = floor(v*100/samples + 0.5)
    if pct < prof_min then break end
  for k, v in pairs(count1) do
    local pct = floor(v*100/samples + 0.5)
    ms = math.max(ms, v)
@/lua/common/jsonPrettyEncoderCustom.lua
      else
        if v ~= math.floor(v) then
          return string.format('%' .. numberPrecision .. '.' .. numberPrecision .. 'f', v)
@/lua/ge/extensions/editor/sidewalkSpline/populate.lua
  while low < high do
    local mid = math.floor((low + high) * 0.5)
    if arcLengths[mid] < s then
@/lua/common/tech/techCommunication.lua
local function packUnsignedInt32Network(n)
  headerBuffer[0] = math.floor(n / 0x1000000)
  headerBuffer[1] = math.floor(n / 0x10000) % 0x100
  headerBuffer[0] = math.floor(n / 0x1000000)
  headerBuffer[1] = math.floor(n / 0x10000) % 0x100
  headerBuffer[2] = math.floor(n / 0x100) % 0x100
  headerBuffer[1] = math.floor(n / 0x10000) % 0x100
  headerBuffer[2] = math.floor(n / 0x100) % 0x100
  headerBuffer[3] = n % 0x100
@/lua/ge/extensions/gameplay/traffic.lua
          -- weaker probability curve with fewer vehicles (encourages spawning on lesser roads)
          local power = clamp(math.floor(math.log10(auxiliaryData.activeAmount) * 4), 1, 10) -- power affects the probability curve
          params.minDrivability = clamp(1 - math.pow(random(), power) * 0.7, min(1, traffic[id].drivability), 1)
      if veh.debugText then
        debugDrawer:drawTextAdvanced(veh.pos, string.format('[%d]: %d m, %d km/h', veh.id, math.floor(veh.focusDist), math.floor((veh.speed or 0) * 3.6)), txtColor, true, false, bgColor)
      end
      if veh.debugText then
        debugDrawer:drawTextAdvanced(veh.pos, string.format('[%d]: %d m, %d km/h', veh.id, math.floor(veh.focusDist), math.floor((veh.speed or 0) * 3.6)), txtColor, true, false, bgColor)
      end
@/lua/ge/extensions/editor/gen/render.lua
		end
		local c = color(math.floor(c[1]*255),math.floor(c[2]*255),math.floor(c[3]*255))
		pathUp(buf, n/6, c, w, z)
		end
		local c = color(math.floor(c[1]*255),math.floor(c[2]*255),math.floor(c[3]*255))
		pathUp(buf, n/6, c, w, z)
		end
		local c = color(math.floor(c[1]*255),math.floor(c[2]*255),math.floor(c[3]*255))
		pathUp(buf, n/6, c, w, z)
@/lua/ge/extensions/gameplay/util/crashDetection.lua
    newFrameDamage.touchedVehIds = vehData.objectCollisions
    newFrameDamage.speed = math.floor(vehData.vel:length() * 3.6 + 0.5)
    newFrameDamage.isAboveDamageThreshold = newDamage > minFrameDamageThreshold or newDamageSum > minFrameDamageThreshold
@/lua/ge/extensions/ui/apps/minimap/utils.lua
  -- Calculate grid line positions
  local startX = math.floor(minX / gridSpacing) * gridSpacing
  local endX = math.ceil(maxX / gridSpacing) * gridSpacing
  local endX = math.ceil(maxX / gridSpacing) * gridSpacing
  local startY = math.floor(minY / gridSpacing) * gridSpacing
  local endY = math.ceil(maxY / gridSpacing) * gridSpacing
@/lua/ge/extensions/flowgraph/nodes/ui/genericMissionDataText.lua
    if self.pinIn.style.value == "time" then
      data.txt = string.format("%02d:%02d", math.floor(self.pinIn.txt.value / 60), math.floor(self.pinIn.txt.value % 60))
      data.minutes = string.format("%02d", math.floor(self.pinIn.txt.value / 60))
    if self.pinIn.style.value == "time" then
      data.txt = string.format("%02d:%02d", math.floor(self.pinIn.txt.value / 60), math.floor(self.pinIn.txt.value % 60))
      data.minutes = string.format("%02d", math.floor(self.pinIn.txt.value / 60))
      data.txt = string.format("%02d:%02d", math.floor(self.pinIn.txt.value / 60), math.floor(self.pinIn.txt.value % 60))
      data.minutes = string.format("%02d", math.floor(self.pinIn.txt.value / 60))
      data.seconds = string.format("%02d", math.floor(self.pinIn.txt.value % 60))
      data.minutes = string.format("%02d", math.floor(self.pinIn.txt.value / 60))
      data.seconds = string.format("%02d", math.floor(self.pinIn.txt.value % 60))
      data.style = "text"
    elseif self.pinIn.style.value == "timemillis" then
      data.txt = string.format("%02d:%02d.%03d", math.floor(self.pinIn.txt.value / 60), math.floor(self.pinIn.txt.value % 60), math.floor((self.pinIn.txt.value % 1) * 1000))
      data.minutes = string.format("%02d", math.floor(self.pinIn.txt.value / 60))
    elseif self.pinIn.style.value == "timemillis" then
      data.txt = string.format("%02d:%02d.%03d", math.floor(self.pinIn.txt.value / 60), math.floor(self.pinIn.txt.value % 60), math.floor((self.pinIn.txt.value % 1) * 1000))
      data.minutes = string.format("%02d", math.floor(self.pinIn.txt.value / 60))
    elseif self.pinIn.style.value == "timemillis" then
      data.txt = string.format("%02d:%02d.%03d", math.floor(self.pinIn.txt.value / 60), math.floor(self.pinIn.txt.value % 60), math.floor((self.pinIn.txt.value % 1) * 1000))
      data.minutes = string.format("%02d", math.floor(self.pinIn.txt.value / 60))
      data.txt = string.format("%02d:%02d.%03d", math.floor(self.pinIn.txt.value / 60), math.floor(self.pinIn.txt.value % 60), math.floor((self.pinIn.txt.value % 1) * 1000))
      data.minutes = string.format("%02d", math.floor(self.pinIn.txt.value / 60))
      data.seconds = string.format("%02d", math.floor(self.pinIn.txt.value % 60))
      data.minutes = string.format("%02d", math.floor(self.pinIn.txt.value / 60))
      data.seconds = string.format("%02d", math.floor(self.pinIn.txt.value % 60))
      data.milliseconds = string.format("%03d", math.floor((self.pinIn.txt.value % 1) * 1000))
      data.seconds = string.format("%02d", math.floor(self.pinIn.txt.value % 60))
      data.milliseconds = string.format("%03d", math.floor((self.pinIn.txt.value % 1) * 1000))
      data.style = "text"
@/lua/ge/extensions/editor/api/gui.lua
  local uiScaling = editor.getPreference("ui.general.scale") or defaultUiScale
  local mHeight = math.floor(lineHeight + mStyle.ItemSpacing.y * uiScaling / 2)
  -- Calculates rows area
  local scrollOffsetV = imgui.GetScrollY()
  local scrolledOutLines = math.floor(scrollOffsetV / mHeight)
  scrollOffsetV = scrollOffsetV - mHeight * scrolledOutLines
@/ui/modules/apps/SimpleBrakeThermals/app.js

            svgPadType[i].attr({ x: 60 * ((i % 2) + 0.037), y: 70 * Math.floor((i / 2)), })
            svgBrakes[i].attr({ x: 60 * (i % 2), y: 70 * Math.floor((i / 2)), }); //i%2 ensures columns are only 2 wide
            svgPadType[i].attr({ x: 60 * ((i % 2) + 0.037), y: 70 * Math.floor((i / 2)), })
            svgBrakes[i].attr({ x: 60 * (i % 2), y: 70 * Math.floor((i / 2)), }); //i%2 ensures columns are only 2 wide
            svgText[i].attr({ x: 60 * ((i % 2) + 0.3), y: 70 * (Math.floor(((i) / 2)) + 1) })
            svgBrakes[i].attr({ x: 60 * (i % 2), y: 70 * Math.floor((i / 2)), }); //i%2 ensures columns are only 2 wide
            svgText[i].attr({ x: 60 * ((i % 2) + 0.3), y: 70 * (Math.floor(((i) / 2)) + 1) })
            svgBrakeType[i].attr({ x: 60 * ((i % 2) + 0.037), y: 70 * Math.floor((i / 2)), })
            svgText[i].attr({ x: 60 * ((i % 2) + 0.3), y: 70 * (Math.floor(((i) / 2)) + 1) })
            svgBrakeType[i].attr({ x: 60 * ((i % 2) + 0.037), y: 70 * Math.floor((i / 2)), })
              svgBrakes[i].attr({ stroke: "rgba(" + red + ", " + green + ", " + blue + ", 0.7)" })
              svgText[i].text(Math.floor(UiUnits.temperature(data.wheelThermalData.wheels[brakes[i]].brakeSurfaceTemperature).val)
                + UiUnits.temperature(data.wheelThermalData.wheels[brakes[i]].brakeSurfaceTemperature).unit)
@/lua/ge/extensions/gameplay/rally/util.lua
local function customRound(dist, round_to)
  return math.floor(dist / round_to + 0.5) * round_to
end

  local hours24 = math.floor(timeSecs / 3600) % 24
  local minutes = math.floor((timeSecs % 3600) / 60)
  local hours24 = math.floor(timeSecs / 3600) % 24
  local minutes = math.floor((timeSecs % 3600) / 60)
  local seconds = math.floor(timeSecs % 60)
  local minutes = math.floor((timeSecs % 3600) / 60)
  local seconds = math.floor(timeSecs % 60)
  local tenths = math.floor((timeSecs % 1) * 10)
  local seconds = math.floor(timeSecs % 60)
  local tenths = math.floor((timeSecs % 1) * 10)

  local hours24 = math.floor(timeSecs / 3600) % 24
  local minutes = math.floor((timeSecs % 3600) / 60)
  local hours24 = math.floor(timeSecs / 3600) % 24
  local minutes = math.floor((timeSecs % 3600) / 60)
  local seconds = math.floor(timeSecs % 60)
  local minutes = math.floor((timeSecs % 3600) / 60)
  local seconds = math.floor(timeSecs % 60)
  local tenths = math.floor((timeSecs % 1) * 10)
  local seconds = math.floor(timeSecs % 60)
  local tenths = math.floor((timeSecs % 1) * 10)
@/lua/ge/extensions/core/ropeVisualTest.lua
    local t = time * speed
    local phase = math.floor(t / 4) % 4
    if phase == 0 then
    -- Simple pseudo-random walk using time-based seed
    local seed1 = math.floor(time * 10) % 100
    local seed2 = math.floor(time * 8) % 100
    local seed1 = math.floor(time * 10) % 100
    local seed2 = math.floor(time * 8) % 100
    local seed3 = math.floor(time * 6) % 100
    local seed2 = math.floor(time * 8) % 100
    local seed3 = math.floor(time * 6) % 100
    return vec3((seed1 / 100 - 0.5) * 0.8, (seed2 / 100 - 0.5) * 0.8, (seed3 / 100 - 0.5) * 0.8)
@/ui/lib/ext/chartist.min.js

!function(a,b){"function"==typeof define&&define.amd?define("Chartist",[],function(){return a.Chartist=b()}):"object"==typeof module&&module.exports?module.exports=b():a.Chartist=b()}(this,function(){var a={version:"0.11.0"};return function(a,b,c){"use strict";c.namespaces={svg:"http://www.w3.org/2000/svg",xmlns:"http://www.w3.org/2000/xmlns/",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",ct:"http://gionkunz.github.com/chartist-js/ct"},c.noop=function(a){return a},c.alphaNumerate=function(a){return String.fromCharCode(97+a%26)},c.extend=function(a){var b,d,e;for(a=a||{},b=1;b":">",'"':""","'":"'"},c.serialize=function(a){return null===a||void 0===a?a:("number"==typeof a?a=""+a:"object"==typeof a&&(a=JSON.stringify({data:a})),Object.keys(c.escapingMap).reduce(function(a,b){return c.replaceAll(a,b,c.escapingMap[b])},a))},c.deserialize=function(a){if("string"!=typeof a)return a;a=Object.keys(c.escapingMap).reduce(function(a,b){return c.replaceAll(a,c.escapingMap[b],b)},a);try{a=JSON.parse(a),a=void 0!==a.data?a.data:a}catch(b){}return a},c.createSvg=function(a,b,d,e){var f;return b=b||"100%",d=d||"100%",Array.prototype.slice.call(a.querySelectorAll("svg")).filter(function(a){return a.getAttributeNS(c.namespaces.xmlns,"ct")}).forEach(function(b){a.removeChild(b)}),f=new c.Svg("svg").attr({width:b,height:d}).addClass(e),f._node.style.width=b,f._node.style.height=d,a.appendChild(f._node),f},c.normalizeData=function(a,b,d){var e,f={raw:a,normalized:{}};return f.normalized.series=c.getDataArray({series:a.series||[]},b,d),e=f.normalized.series.every(function(a){return a instanceof Array})?Math.max.apply(null,f.normalized.series.map(function(a){return a.length})):f.normalized.series.length,f.normalized.labels=(a.labels||[]).slice(),Array.prototype.push.apply(f.normalized.labels,c.times(Math.max(0,e-f.normalized.labels.length)).map(function(){return""})),b&&c.reverseData(f.normalized),f},c.safeHasProperty=function(a,b){return null!==a&&"object"==typeof a&&a.hasOwnProperty(b)},c.isDataHoleValue=function(a){return null===a||void 0===a||"number"==typeof a&&isNaN(a)},c.reverseData=function(a){a.labels.reverse(),a.series.reverse();for(var b=0;bf.high&&(f.high=c),h&&c0?f.low=0:(f.high=1,f.low=0)),f},c.isNumeric=function(a){return null!==a&&isFinite(a)},c.isFalseyButZero=function(a){return!a&&0!==a},c.getNumberOrUndefined=function(a){return c.isNumeric(a)?+a:void 0},c.isMultiValue=function(a){return"object"==typeof a&&("x"in a||"y"in a)},c.getMultiValue=function(a,b){return c.isMultiValue(a)?c.getNumberOrUndefined(a[b||"y"]):c.getNumberOrUndefined(a)},c.rho=function(a){function b(a,c){return a%c===0?c:b(c,a%c)}function c(a){return a*a+1}if(1===a)return a;var d,e=2,f=2;if(a%2===0)return 2;do e=c(e)%a,f=c(c(f))%a,d=b(Math.abs(e-f),a);while(1===d);return d},c.getBounds=function(a,b,d,e){function f(a,b){return a===(a+=b)&&(a*=1+(b>0?o:-o)),a}var g,h,i,j=0,k={high:b.high,low:b.low};k.valueRange=k.high-k.low,k.oom=c.orderOfMagnitude(k.valueRange),k.step=Math.pow(10,k.oom),k.min=Math.floor(k.low/k.step)*k.step,k.max=Math.ceil(k.high/k.step)*k.step,k.range=k.max-k.min,k.numberOfSteps=Math.round(k.range/k.step);var l=c.projectLength(a,k.step,k),m=l=d)k.step=1;else if(e&&n=d)k.step=n;else for(;;){if(m&&c.projectLength(a,k.step,k)<=d)k.step*=2;else{if(m||!(c.projectLength(a,k.step/2,k)>=d))break;if(k.step/=2,e&&k.step%1!==0){k.step*=2;break}}if(j++>1e3)throw new Error("Exceeded maximum number of iterations while optimizing scale step!")}var o=2.221e-16;for(k.step=Math.max(k.step,o),h=k.min,i=k.max;h+k.step<=k.low;)h=f(h,k.step);for(;i-k.step>=k.high;)i=f(i,-k.step);k.min=h,k.max=i,k.range=k.max-k.min;var p=[];for(g=k.min;g<=k.max;g=f(g,k.step)){var q=c.roundWithPrecision(g);q!==p[p.length-1]&&p.push(q)}return k.values=p,k},c.polarToCartesian=function(a,b,c,d){var e=(d-90)*Math.PI/180;return{x:a+c*Math.cos(e),y:b+c*Math.sin(e)}},c.createChartRect=function(a,b,d){var e=!(!b.axisX&&!b.axisY),f=e?b.axisY.offset:0,g=e?b.axisX.offset:0,h=a.width()||c.quantity(b.width).value||0,i=a.height()||c.quantity(b.height).value||0,j=c.normalizePadding(b.chartPadding,d);h=Math.max(h,f+j.left+j.right),i=Math.max(i,g+j.top+j.bottom);var k={padding:j,width:function(){return this.x2-this.x1},height:function(){return this.y1-this.y2}};return e?("start"===b.axisX.position?(k.y2=j.top+g,k.y1=Math.max(i-j.bottom,k.y2+1)):(k.y2=j.top,k.y1=Math.max(i-j.bottom-g,k.y2+1)),"start"===b.axisY.position?(k.x1=j.left+f,k.x2=Math.max(h-j.right,k.x1+1)):(k.x1=j.left,k.x2=Math.max(h-j.right-f,k.x1+1))):(k.x1=j.left,k.x2=Math.max(h-j.right,k.x1+1),k.y2=j.top,k.y1=Math.max(i-j.bottom,k.y2+1)),k},c.createGrid=function(a,b,d,e,f,g,h,i){var j={};j[d.units.pos+"1"]=a,j[d.units.pos+"2"]=a,j[d.counterUnits.pos+"1"]=e,j[d.counterUnits.pos+"2"]=e+f;var k=g.elem("line",j,h.join(" "));i.emit("draw",c.extend({type:"grid",axis:d,index:b,group:g,element:k},j))},c.createGridBackground=function(a,b,c,d){var e=a.elem("rect",{x:b.x1,y:b.y2,width:b.width(),height:b.height()},c,!0);d.emit("draw",{type:"gridBackground",group:a,element:e})},c.createLabel=function(a,d,e,f,g,h,i,j,k,l,m){var n,o={};if(o[g.units.pos]=a+i[g.units.pos],o[g.counterUnits.pos]=i[g.counterUnits.pos],o[g.units.len]=d,o[g.counterUnits.len]=Math.max(0,h-10),l){var p=b.createElement("span");p.className=k.join(" "),p.setAttribute("xmlns",c.namespaces.xhtml),p.innerText=f[e],p.style[g.units.len]=Math.round(o[g.units.len])+"px",p.style[g.counterUnits.len]=Math.round(o[g.counterUnits.len])+"px",n=j.foreignObject(p,c.extend({style:"overflow: visible;"},o))}else n=j.elem("text",o,k.join(" ")).text(f[e]);m.emit("draw",c.extend({type:"label",axis:g,index:e,group:j,element:n,text:f[e]},o))},c.getSeriesOption=function(a,b,c){if(a.name&&b.series&&b.series[a.name]){var d=b.series[a.name];return d.hasOwnProperty(c)?d[c]:b[c]}return b[c]},c.optionsProvider=function(b,d,e){function f(b){var f=h;if(h=c.extend({},j),d)for(i=0;i=2&&a[h]<=a[h-2]&&(g=!0),g&&(f.push({pathCoordinates:[],valueData:[]}),g=!1),f[f.length-1].pathCoordinates.push(a[h],a[h+1]),f[f.length-1].valueData.push(b[h/2]));return f}}(window,document,a),function(a,b,c){"use strict";c.Interpolation={},c.Interpolation.none=function(a){var b={fillHoles:!1};return a=c.extend({},b,a),function(b,d){for(var e=new c.Svg.Path,f=!0,g=0;g1){var i=[];return h.forEach(function(a){i.push(f(a.pathCoordinates,a.valueData))}),c.Svg.Path.join(i)}if(b=h[0].pathCoordinates,g=h[0].valueData,b.length<=4)return c.Interpolation.none()(b,g);for(var j,k=(new c.Svg.Path).move(b[0],b[1],!1,g[0]),l=0,m=b.length;m-2*!j>l;l+=2){var n=[{x:+b[l-2],y:+b[l-1]},{x:+b[l],y:+b[l+1]},{x:+b[l+2],y:+b[l+3]},{x:+b[l+4],y:+b[l+5]}];j?l?m-4===l?n[3]={x:+b[0],y:+b[1]}:m-2===l&&(n[2]={x:+b[0],y:+b[1]},n[3]={x:+b[2],y:+b[3]}):n[0]={x:+b[m-2],y:+b[m-1]}:m-4===l?n[3]=n[2]:l||(n[0]={x:+b[l],y:+b[l+1]}),k.curve(d*(-n[0].x+6*n[1].x+n[2].x)/6+e*n[2].x,d*(-n[0].y+6*n[1].y+n[2].y)/6+e*n[2].y,d*(n[1].x+6*n[2].x-n[3].x)/6+e*n[2].x,d*(n[1].y+6*n[2].y-n[3].y)/6+e*n[2].y,n[2].x,n[2].y,!1,g[(l+2)/2])}return k}return c.Interpolation.none()([])}},c.Interpolation.monotoneCubic=function(a){var b={fillHoles:!1};return a=c.extend({},b,a),function d(b,e){var f=c.splitIntoSegments(b,e,{fillHoles:a.fillHoles,increasingX:!0});if(f.length){if(f.length>1){var g=[];return f.forEach(function(a){g.push(d(a.pathCoordinates,a.valueData))}),c.Svg.Path.join(g)}if(b=f[0].pathCoordinates,e=f[0].valueData,b.length<=4)return c.Interpolation.none()(b,e);var h,i,j=[],k=[],l=b.length/2,m=[],n=[],o=[],p=[];for(h=0;h0!=n[h]>0?m[h]=0:(m[h]=3*(p[h-1]+p[h])/((2*p[h]+p[h-1])/n[h-1]+(p[h]+2*p[h-1])/n[h]),isFinite(m[h])||(m[h]=0));for(i=(new c.Svg.Path).move(j[0],k[0],!1,e[0]),h=0;h1}).map(function(a){var b=a.pathElements[0],c=a.pathElements[a.pathElements.length-1];return a.clone(!0).position(0).remove(1).move(b.x,r).line(b.x,b.y).position(a.pathElements.length+1).line(c.x,r)}).forEach(function(c){var h=i.elem("path",{d:c.stringify()},a.classNames.area,!0);this.eventEmitter.emit("draw",{type:"area",values:b.normalized.series[g],path:c.clone(),series:f,seriesIndex:g,axisX:d,axisY:e,chartRect:j,index:g,group:i,element:h})}.bind(this))}}.bind(this)),this.eventEmitter.emit("created",{bounds:e.bounds,chartRect:j,axisX:d,axisY:e,svg:this.svg,options:a})}function e(a,b,d,e){c.Line["super"].constructor.call(this,a,b,f,c.extend({},f,d),e)}var f={axisX:{offset:30,position:"end",labelOffset:{x:0,y:0},showLabel:!0,showGrid:!0,labelInterpolationFnc:c.noop,type:void 0},axisY:{offset:40,position:"start",labelOffset:{x:0,y:0},showLabel:!0,showGrid:!0,labelInterpolationFnc:c.noop,type:void 0,scaleMinSpace:20,onlyInteger:!1},width:void 0,height:void 0,showLine:!0,showPoint:!0,showArea:!1,areaBase:0,lineSmooth:!0,showGridBackground:!1,low:void 0,high:void 0,chartPadding:{top:15,right:15,bottom:5,left:10},fullWidth:!1,reverseData:!1,classNames:{chart:"ct-chart-line",label:"ct-label",labelGroup:"ct-labels",series:"ct-series",line:"ct-line",point:"ct-point",area:"ct-area",grid:"ct-grid",gridGroup:"ct-grids",gridBackground:"ct-grid-background",vertical:"ct-vertical",horizontal:"ct-horizontal",start:"ct-start",end:"ct-end"}};c.Line=c.Base.extend({constructor:e,createChart:d})}(window,document,a),function(a,b,c){"use strict";function d(a){var b,d;a.distributeSeries?(b=c.normalizeData(this.data,a.reverseData,a.horizontalBars?"x":"y"),b.normalized.series=b.normalized.series.map(function(a){return[a]})):b=c.normalizeData(this.data,a.reverseData,a.horizontalBars?"x":"y"),this.svg=c.createSvg(this.container,a.width,a.height,a.classNames.chart+(a.horizontalBars?" "+a.classNames.horizontalBars:""));var e=this.svg.elem("g").addClass(a.classNames.gridGroup),g=this.svg.elem("g"),h=this.svg.elem("g").addClass(a.classNames.labelGroup);if(a.stackBars&&0!==b.normalized.series.length){var i=c.serialMap(b.normalized.series,function(){
return Array.prototype.slice.call(arguments).map(function(a){return a}).reduce(function(a,b){return{x:a.x+(b&&b.x)||0,y:a.y+(b&&b.y)||0}},{x:0,y:0})});d=c.getHighLow([i],a,a.horizontalBars?"x":"y")}else d=c.getHighLow(b.normalized.series,a,a.horizontalBars?"x":"y");d.high=+a.high||(0===a.high?0:d.high),d.low=+a.low||(0===a.low?0:d.low);var j,k,l,m,n,o=c.createChartRect(this.svg,a,f.padding);k=a.distributeSeries&&a.stackBars?b.normalized.labels.slice(0,1):b.normalized.labels,a.horizontalBars?(j=m=void 0===a.axisX.type?new c.AutoScaleAxis(c.Axis.units.x,b.normalized.series,o,c.extend({},a.axisX,{highLow:d,referenceValue:0})):a.axisX.type.call(c,c.Axis.units.x,b.normalized.series,o,c.extend({},a.axisX,{highLow:d,referenceValue:0})),l=n=void 0===a.axisY.type?new c.StepAxis(c.Axis.units.y,b.normalized.series,o,{ticks:k}):a.axisY.type.call(c,c.Axis.units.y,b.normalized.series,o,a.axisY)):(l=m=void 0===a.axisX.type?new c.StepAxis(c.Axis.units.x,b.normalized.series,o,{ticks:k}):a.axisX.type.call(c,c.Axis.units.x,b.normalized.series,o,a.axisX),j=n=void 0===a.axisY.type?new c.AutoScaleAxis(c.Axis.units.y,b.normalized.series,o,c.extend({},a.axisY,{highLow:d,referenceValue:0})):a.axisY.type.call(c,c.Axis.units.y,b.normalized.series,o,c.extend({},a.axisY,{highLow:d,referenceValue:0})));var p=a.horizontalBars?o.x1+j.projectValue(0):o.y1-j.projectValue(0),q=[];l.createGridAndLabels(e,h,this.supportsForeignObject,a,this.eventEmitter),j.createGridAndLabels(e,h,this.supportsForeignObject,a,this.eventEmitter),a.showGridBackground&&c.createGridBackground(e,o,a.classNames.gridBackground,this.eventEmitter),b.raw.series.forEach(function(d,e){var f,h,i=e-(b.raw.series.length-1)/2;f=a.distributeSeries&&!a.stackBars?l.axisLength/b.normalized.series.length/2:a.distributeSeries&&a.stackBars?l.axisLength/2:l.axisLength/b.normalized.series[e].length/2,h=g.elem("g"),h.attr({"ct:series-name":d.name,"ct:meta":c.serialize(d.meta)}),h.addClass([a.classNames.series,d.className||a.classNames.series+"-"+c.alphaNumerate(e)].join(" ")),b.normalized.series[e].forEach(function(g,k){var r,s,t,u;if(u=a.distributeSeries&&!a.stackBars?e:a.distributeSeries&&a.stackBars?0:k,r=a.horizontalBars?{x:o.x1+j.projectValue(g&&g.x?g.x:0,k,b.normalized.series[e]),y:o.y1-l.projectValue(g&&g.y?g.y:0,u,b.normalized.series[e])}:{x:o.x1+l.projectValue(g&&g.x?g.x:0,u,b.normalized.series[e]),y:o.y1-j.projectValue(g&&g.y?g.y:0,k,b.normalized.series[e])},l instanceof c.StepAxis&&(l.options.stretch||(r[l.units.pos]+=f*(a.horizontalBars?-1:1)),r[l.units.pos]+=a.stackBars||a.distributeSeries?0:i*a.seriesBarDistance*(a.horizontalBars?-1:1)),t=q[k]||p,q[k]=t-(p-r[l.counterUnits.pos]),void 0!==g){var v={};v[l.units.pos+"1"]=r[l.units.pos],v[l.units.pos+"2"]=r[l.units.pos],!a.stackBars||"accumulate"!==a.stackMode&&a.stackMode?(v[l.counterUnits.pos+"1"]=p,v[l.counterUnits.pos+"2"]=r[l.counterUnits.pos]):(v[l.counterUnits.pos+"1"]=t,v[l.counterUnits.pos+"2"]=q[k]),v.x1=Math.min(Math.max(v.x1,o.x1),o.x2),v.x2=Math.min(Math.max(v.x2,o.x1),o.x2),v.y1=Math.min(Math.max(v.y1,o.y2),o.y1),v.y2=Math.min(Math.max(v.y2,o.y2),o.y1);var w=c.getMetaData(d,k);s=h.elem("line",v,a.classNames.bar).attr({"ct:value":[g.x,g.y].filter(c.isNumeric).join(","),"ct:meta":c.serialize(w)}),this.eventEmitter.emit("draw",c.extend({type:"bar",value:g,index:k,meta:w,series:d,seriesIndex:e,axisX:m,axisY:n,chartRect:o,group:h,element:s},v))}}.bind(this))}.bind(this)),this.eventEmitter.emit("created",{bounds:j.bounds,chartRect:o,axisX:m,axisY:n,svg:this.svg,options:a})}function e(a,b,d,e){c.Bar["super"].constructor.call(this,a,b,f,c.extend({},f,d),e)}var f={axisX:{offset:30,position:"end",labelOffset:{x:0,y:0},showLabel:!0,showGrid:!0,labelInterpolationFnc:c.noop,scaleMinSpace:30,onlyInteger:!1},axisY:{offset:40,position:"start",labelOffset:{x:0,y:0},showLabel:!0,showGrid:!0,labelInterpolationFnc:c.noop,scaleMinSpace:20,onlyInteger:!1},width:void 0,height:void 0,high:void 0,low:void 0,referenceValue:0,chartPadding:{top:15,right:15,bottom:5,left:10},seriesBarDistance:15,stackBars:!1,stackMode:"accumulate",horizontalBars:!1,distributeSeries:!1,reverseData:!1,showGridBackground:!1,classNames:{chart:"ct-chart-bar",horizontalBars:"ct-horizontal-bars",label:"ct-label",labelGroup:"ct-labels",series:"ct-series",bar:"ct-bar",grid:"ct-grid",gridGroup:"ct-grids",gridBackground:"ct-grid-background",vertical:"ct-vertical",horizontal:"ct-horizontal",start:"ct-start",end:"ct-end"}};c.Bar=c.Base.extend({constructor:e,createChart:d})}(window,document,a),function(a,b,c){"use strict";function d(a,b,c){var d=b.x>a.x;return d&&"explode"===c||!d&&"implode"===c?"start":d&&"implode"===c||!d&&"explode"===c?"end":"middle"}function e(a){var b,e,f,h,i,j=c.normalizeData(this.data),k=[],l=a.startAngle;this.svg=c.createSvg(this.container,a.width,a.height,a.donut?a.classNames.chartDonut:a.classNames.chartPie),e=c.createChartRect(this.svg,a,g.padding),f=Math.min(e.width()/2,e.height()/2),i=a.total||j.normalized.series.reduce(function(a,b){return a+b},0);var m=c.quantity(a.donutWidth);"%"===m.unit&&(m.value*=f/100),f-=a.donut&&!a.donutSolid?m.value/2:0,h="outside"===a.labelPosition||a.donut&&!a.donutSolid?f:"center"===a.labelPosition?0:a.donutSolid?f-m.value/2:f/2,h+=a.labelOffset;var n={x:e.x1+e.width()/2,y:e.y2+e.height()/2},o=1===j.raw.series.filter(function(a){return a.hasOwnProperty("value")?0!==a.value:0!==a}).length;j.raw.series.forEach(function(a,b){k[b]=this.svg.elem("g",null,null)}.bind(this)),a.showLabel&&(b=this.svg.elem("g",null,null)),j.raw.series.forEach(function(e,g){if(0!==j.normalized.series[g]||!a.ignoreEmptyValues){k[g].attr({"ct:series-name":e.name}),k[g].addClass([a.classNames.series,e.className||a.classNames.series+"-"+c.alphaNumerate(g)].join(" "));var p=i>0?l+j.normalized.series[g]/i*360:0,q=Math.max(0,l-(0===g||o?0:.2));p-q>=359.99&&(p=q+359.99);var r,s,t,u=c.polarToCartesian(n.x,n.y,f,q),v=c.polarToCartesian(n.x,n.y,f,p),w=new c.Svg.Path(!a.donut||a.donutSolid).move(v.x,v.y).arc(f,f,0,p-l>180,0,u.x,u.y);a.donut?a.donutSolid&&(t=f-m.value,r=c.polarToCartesian(n.x,n.y,t,l-(0===g||o?0:.2)),s=c.polarToCartesian(n.x,n.y,t,p),w.line(r.x,r.y),w.arc(t,t,0,p-l>180,1,s.x,s.y)):w.line(n.x,n.y);var x=a.classNames.slicePie;a.donut&&(x=a.classNames.sliceDonut,a.donutSolid&&(x=a.classNames.sliceDonutSolid));var y=k[g].elem("path",{d:w.stringify()},x);if(y.attr({"ct:value":j.normalized.series[g],"ct:meta":c.serialize(e.meta)}),a.donut&&!a.donutSolid&&(y._node.style.strokeWidth=m.value+"px"),this.eventEmitter.emit("draw",{type:"slice",value:j.normalized.series[g],totalDataSum:i,index:g,meta:e.meta,series:e,group:k[g],element:y,path:w.clone(),center:n,radius:f,startAngle:l,endAngle:p}),a.showLabel){var z;z=1===j.raw.series.length?{x:n.x,y:n.y}:c.polarToCartesian(n.x,n.y,h,l+(p-l)/2);var A;A=j.normalized.labels&&!c.isFalseyButZero(j.normalized.labels[g])?j.normalized.labels[g]:j.normalized.series[g];var B=a.labelInterpolationFnc(A,g);if(B||0===B){var C=b.elem("text",{dx:z.x,dy:z.y,"text-anchor":d(n,z,a.labelDirection)},a.classNames.label).text(""+B);this.eventEmitter.emit("draw",{type:"label",index:g,group:b,element:C,text:""+B,x:z.x,y:z.y})}}l=p}}.bind(this)),this.eventEmitter.emit("created",{chartRect:e,svg:this.svg,options:a})}function f(a,b,d,e){c.Pie["super"].constructor.call(this,a,b,g,c.extend({},g,d),e)}var g={width:void 0,height:void 0,chartPadding:5,classNames:{chartPie:"ct-chart-pie",chartDonut:"ct-chart-donut",series:"ct-series",slicePie:"ct-slice-pie",sliceDonut:"ct-slice-donut",sliceDonutSolid:"ct-slice-donut-solid",label:"ct-label"},startAngle:0,total:void 0,donut:!1,donutSolid:!1,donutWidth:60,showLabel:!0,labelOffset:0,labelPosition:"inside",labelInterpolationFnc:c.noop,labelDirection:"neutral",reverseData:!1,ignoreEmptyValues:!1};c.Pie=c.Base.extend({constructor:f,createChart:e,determineAnchorPosition:d})}(window,document,a),a});

!function(a,b){"function"==typeof define&&define.amd?define("Chartist",[],function(){return a.Chartist=b()}):"object"==typeof module&&module.exports?module.exports=b():a.Chartist=b()}(this,function(){var a={version:"0.11.0"};return function(a,b,c){"use strict";c.namespaces={svg:"http://www.w3.org/2000/svg",xmlns:"http://www.w3.org/2000/xmlns/",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",ct:"http://gionkunz.github.com/chartist-js/ct"},c.noop=function(a){return a},c.alphaNumerate=function(a){return String.fromCharCode(97+a%26)},c.extend=function(a){var b,d,e;for(a=a||{},b=1;b":">",'"':""","'":"'"},c.serialize=function(a){return null===a||void 0===a?a:("number"==typeof a?a=""+a:"object"==typeof a&&(a=JSON.stringify({data:a})),Object.keys(c.escapingMap).reduce(function(a,b){return c.replaceAll(a,b,c.escapingMap[b])},a))},c.deserialize=function(a){if("string"!=typeof a)return a;a=Object.keys(c.escapingMap).reduce(function(a,b){return c.replaceAll(a,c.escapingMap[b],b)},a);try{a=JSON.parse(a),a=void 0!==a.data?a.data:a}catch(b){}return a},c.createSvg=function(a,b,d,e){var f;return b=b||"100%",d=d||"100%",Array.prototype.slice.call(a.querySelectorAll("svg")).filter(function(a){return a.getAttributeNS(c.namespaces.xmlns,"ct")}).forEach(function(b){a.removeChild(b)}),f=new c.Svg("svg").attr({width:b,height:d}).addClass(e),f._node.style.width=b,f._node.style.height=d,a.appendChild(f._node),f},c.normalizeData=function(a,b,d){var e,f={raw:a,normalized:{}};return f.normalized.series=c.getDataArray({series:a.series||[]},b,d),e=f.normalized.series.every(function(a){return a instanceof Array})?Math.max.apply(null,f.normalized.series.map(function(a){return a.length})):f.normalized.series.length,f.normalized.labels=(a.labels||[]).slice(),Array.prototype.push.apply(f.normalized.labels,c.times(Math.max(0,e-f.normalized.labels.length)).map(function(){return""})),b&&c.reverseData(f.normalized),f},c.safeHasProperty=function(a,b){return null!==a&&"object"==typeof a&&a.hasOwnProperty(b)},c.isDataHoleValue=function(a){return null===a||void 0===a||"number"==typeof a&&isNaN(a)},c.reverseData=function(a){a.labels.reverse(),a.series.reverse();for(var b=0;bf.high&&(f.high=c),h&&c0?f.low=0:(f.high=1,f.low=0)),f},c.isNumeric=function(a){return null!==a&&isFinite(a)},c.isFalseyButZero=function(a){return!a&&0!==a},c.getNumberOrUndefined=function(a){return c.isNumeric(a)?+a:void 0},c.isMultiValue=function(a){return"object"==typeof a&&("x"in a||"y"in a)},c.getMultiValue=function(a,b){return c.isMultiValue(a)?c.getNumberOrUndefined(a[b||"y"]):c.getNumberOrUndefined(a)},c.rho=function(a){function b(a,c){return a%c===0?c:b(c,a%c)}function c(a){return a*a+1}if(1===a)return a;var d,e=2,f=2;if(a%2===0)return 2;do e=c(e)%a,f=c(c(f))%a,d=b(Math.abs(e-f),a);while(1===d);return d},c.getBounds=function(a,b,d,e){function f(a,b){return a===(a+=b)&&(a*=1+(b>0?o:-o)),a}var g,h,i,j=0,k={high:b.high,low:b.low};k.valueRange=k.high-k.low,k.oom=c.orderOfMagnitude(k.valueRange),k.step=Math.pow(10,k.oom),k.min=Math.floor(k.low/k.step)*k.step,k.max=Math.ceil(k.high/k.step)*k.step,k.range=k.max-k.min,k.numberOfSteps=Math.round(k.range/k.step);var l=c.projectLength(a,k.step,k),m=l=d)k.step=1;else if(e&&n=d)k.step=n;else for(;;){if(m&&c.projectLength(a,k.step,k)<=d)k.step*=2;else{if(m||!(c.projectLength(a,k.step/2,k)>=d))break;if(k.step/=2,e&&k.step%1!==0){k.step*=2;break}}if(j++>1e3)throw new Error("Exceeded maximum number of iterations while optimizing scale step!")}var o=2.221e-16;for(k.step=Math.max(k.step,o),h=k.min,i=k.max;h+k.step<=k.low;)h=f(h,k.step);for(;i-k.step>=k.high;)i=f(i,-k.step);k.min=h,k.max=i,k.range=k.max-k.min;var p=[];for(g=k.min;g<=k.max;g=f(g,k.step)){var q=c.roundWithPrecision(g);q!==p[p.length-1]&&p.push(q)}return k.values=p,k},c.polarToCartesian=function(a,b,c,d){var e=(d-90)*Math.PI/180;return{x:a+c*Math.cos(e),y:b+c*Math.sin(e)}},c.createChartRect=function(a,b,d){var e=!(!b.axisX&&!b.axisY),f=e?b.axisY.offset:0,g=e?b.axisX.offset:0,h=a.width()||c.quantity(b.width).value||0,i=a.height()||c.quantity(b.height).value||0,j=c.normalizePadding(b.chartPadding,d);h=Math.max(h,f+j.left+j.right),i=Math.max(i,g+j.top+j.bottom);var k={padding:j,width:function(){return this.x2-this.x1},height:function(){return this.y1-this.y2}};return e?("start"===b.axisX.position?(k.y2=j.top+g,k.y1=Math.max(i-j.bottom,k.y2+1)):(k.y2=j.top,k.y1=Math.max(i-j.bottom-g,k.y2+1)),"start"===b.axisY.position?(k.x1=j.left+f,k.x2=Math.max(h-j.right,k.x1+1)):(k.x1=j.left,k.x2=Math.max(h-j.right-f,k.x1+1))):(k.x1=j.left,k.x2=Math.max(h-j.right,k.x1+1),k.y2=j.top,k.y1=Math.max(i-j.bottom,k.y2+1)),k},c.createGrid=function(a,b,d,e,f,g,h,i){var j={};j[d.units.pos+"1"]=a,j[d.units.pos+"2"]=a,j[d.counterUnits.pos+"1"]=e,j[d.counterUnits.pos+"2"]=e+f;var k=g.elem("line",j,h.join(" "));i.emit("draw",c.extend({type:"grid",axis:d,index:b,group:g,element:k},j))},c.createGridBackground=function(a,b,c,d){var e=a.elem("rect",{x:b.x1,y:b.y2,width:b.width(),height:b.height()},c,!0);d.emit("draw",{type:"gridBackground",group:a,element:e})},c.createLabel=function(a,d,e,f,g,h,i,j,k,l,m){var n,o={};if(o[g.units.pos]=a+i[g.units.pos],o[g.counterUnits.pos]=i[g.counterUnits.pos],o[g.units.len]=d,o[g.counterUnits.len]=Math.max(0,h-10),l){var p=b.createElement("span");p.className=k.join(" "),p.setAttribute("xmlns",c.namespaces.xhtml),p.innerText=f[e],p.style[g.units.len]=Math.round(o[g.units.len])+"px",p.style[g.counterUnits.len]=Math.round(o[g.counterUnits.len])+"px",n=j.foreignObject(p,c.extend({style:"overflow: visible;"},o))}else n=j.elem("text",o,k.join(" ")).text(f[e]);m.emit("draw",c.extend({type:"label",axis:g,index:e,group:j,element:n,text:f[e]},o))},c.getSeriesOption=function(a,b,c){if(a.name&&b.series&&b.series[a.name]){var d=b.series[a.name];return d.hasOwnProperty(c)?d[c]:b[c]}return b[c]},c.optionsProvider=function(b,d,e){function f(b){var f=h;if(h=c.extend({},j),d)for(i=0;i=2&&a[h]<=a[h-2]&&(g=!0),g&&(f.push({pathCoordinates:[],valueData:[]}),g=!1),f[f.length-1].pathCoordinates.push(a[h],a[h+1]),f[f.length-1].valueData.push(b[h/2]));return f}}(window,document,a),function(a,b,c){"use strict";c.Interpolation={},c.Interpolation.none=function(a){var b={fillHoles:!1};return a=c.extend({},b,a),function(b,d){for(var e=new c.Svg.Path,f=!0,g=0;g1){var i=[];return h.forEach(function(a){i.push(f(a.pathCoordinates,a.valueData))}),c.Svg.Path.join(i)}if(b=h[0].pathCoordinates,g=h[0].valueData,b.length<=4)return c.Interpolation.none()(b,g);for(var j,k=(new c.Svg.Path).move(b[0],b[1],!1,g[0]),l=0,m=b.length;m-2*!j>l;l+=2){var n=[{x:+b[l-2],y:+b[l-1]},{x:+b[l],y:+b[l+1]},{x:+b[l+2],y:+b[l+3]},{x:+b[l+4],y:+b[l+5]}];j?l?m-4===l?n[3]={x:+b[0],y:+b[1]}:m-2===l&&(n[2]={x:+b[0],y:+b[1]},n[3]={x:+b[2],y:+b[3]}):n[0]={x:+b[m-2],y:+b[m-1]}:m-4===l?n[3]=n[2]:l||(n[0]={x:+b[l],y:+b[l+1]}),k.curve(d*(-n[0].x+6*n[1].x+n[2].x)/6+e*n[2].x,d*(-n[0].y+6*n[1].y+n[2].y)/6+e*n[2].y,d*(n[1].x+6*n[2].x-n[3].x)/6+e*n[2].x,d*(n[1].y+6*n[2].y-n[3].y)/6+e*n[2].y,n[2].x,n[2].y,!1,g[(l+2)/2])}return k}return c.Interpolation.none()([])}},c.Interpolation.monotoneCubic=function(a){var b={fillHoles:!1};return a=c.extend({},b,a),function d(b,e){var f=c.splitIntoSegments(b,e,{fillHoles:a.fillHoles,increasingX:!0});if(f.length){if(f.length>1){var g=[];return f.forEach(function(a){g.push(d(a.pathCoordinates,a.valueData))}),c.Svg.Path.join(g)}if(b=f[0].pathCoordinates,e=f[0].valueData,b.length<=4)return c.Interpolation.none()(b,e);var h,i,j=[],k=[],l=b.length/2,m=[],n=[],o=[],p=[];for(h=0;h0!=n[h]>0?m[h]=0:(m[h]=3*(p[h-1]+p[h])/((2*p[h]+p[h-1])/n[h-1]+(p[h]+2*p[h-1])/n[h]),isFinite(m[h])||(m[h]=0));for(i=(new c.Svg.Path).move(j[0],k[0],!1,e[0]),h=0;h1}).map(function(a){var b=a.pathElements[0],c=a.pathElements[a.pathElements.length-1];return a.clone(!0).position(0).remove(1).move(b.x,r).line(b.x,b.y).position(a.pathElements.length+1).line(c.x,r)}).forEach(function(c){var h=i.elem("path",{d:c.stringify()},a.classNames.area,!0);this.eventEmitter.emit("draw",{type:"area",values:b.normalized.series[g],path:c.clone(),series:f,seriesIndex:g,axisX:d,axisY:e,chartRect:j,index:g,group:i,element:h})}.bind(this))}}.bind(this)),this.eventEmitter.emit("created",{bounds:e.bounds,chartRect:j,axisX:d,axisY:e,svg:this.svg,options:a})}function e(a,b,d,e){c.Line["super"].constructor.call(this,a,b,f,c.extend({},f,d),e)}var f={axisX:{offset:30,position:"end",labelOffset:{x:0,y:0},showLabel:!0,showGrid:!0,labelInterpolationFnc:c.noop,type:void 0},axisY:{offset:40,position:"start",labelOffset:{x:0,y:0},showLabel:!0,showGrid:!0,labelInterpolationFnc:c.noop,type:void 0,scaleMinSpace:20,onlyInteger:!1},width:void 0,height:void 0,showLine:!0,showPoint:!0,showArea:!1,areaBase:0,lineSmooth:!0,showGridBackground:!1,low:void 0,high:void 0,chartPadding:{top:15,right:15,bottom:5,left:10},fullWidth:!1,reverseData:!1,classNames:{chart:"ct-chart-line",label:"ct-label",labelGroup:"ct-labels",series:"ct-series",line:"ct-line",point:"ct-point",area:"ct-area",grid:"ct-grid",gridGroup:"ct-grids",gridBackground:"ct-grid-background",vertical:"ct-vertical",horizontal:"ct-horizontal",start:"ct-start",end:"ct-end"}};c.Line=c.Base.extend({constructor:e,createChart:d})}(window,document,a),function(a,b,c){"use strict";function d(a){var b,d;a.distributeSeries?(b=c.normalizeData(this.data,a.reverseData,a.horizontalBars?"x":"y"),b.normalized.series=b.normalized.series.map(function(a){return[a]})):b=c.normalizeData(this.data,a.reverseData,a.horizontalBars?"x":"y"),this.svg=c.createSvg(this.container,a.width,a.height,a.classNames.chart+(a.horizontalBars?" "+a.classNames.horizontalBars:""));var e=this.svg.elem("g").addClass(a.classNames.gridGroup),g=this.svg.elem("g"),h=this.svg.elem("g").addClass(a.classNames.labelGroup);if(a.stackBars&&0!==b.normalized.series.length){var i=c.serialMap(b.normalized.series,function(){
return Array.prototype.slice.call(arguments).map(function(a){return a}).reduce(function(a,b){return{x:a.x+(b&&b.x)||0,y:a.y+(b&&b.y)||0}},{x:0,y:0})});d=c.getHighLow([i],a,a.horizontalBars?"x":"y")}else d=c.getHighLow(b.normalized.series,a,a.horizontalBars?"x":"y");d.high=+a.high||(0===a.high?0:d.high),d.low=+a.low||(0===a.low?0:d.low);var j,k,l,m,n,o=c.createChartRect(this.svg,a,f.padding);k=a.distributeSeries&&a.stackBars?b.normalized.labels.slice(0,1):b.normalized.labels,a.horizontalBars?(j=m=void 0===a.axisX.type?new c.AutoScaleAxis(c.Axis.units.x,b.normalized.series,o,c.extend({},a.axisX,{highLow:d,referenceValue:0})):a.axisX.type.call(c,c.Axis.units.x,b.normalized.series,o,c.extend({},a.axisX,{highLow:d,referenceValue:0})),l=n=void 0===a.axisY.type?new c.StepAxis(c.Axis.units.y,b.normalized.series,o,{ticks:k}):a.axisY.type.call(c,c.Axis.units.y,b.normalized.series,o,a.axisY)):(l=m=void 0===a.axisX.type?new c.StepAxis(c.Axis.units.x,b.normalized.series,o,{ticks:k}):a.axisX.type.call(c,c.Axis.units.x,b.normalized.series,o,a.axisX),j=n=void 0===a.axisY.type?new c.AutoScaleAxis(c.Axis.units.y,b.normalized.series,o,c.extend({},a.axisY,{highLow:d,referenceValue:0})):a.axisY.type.call(c,c.Axis.units.y,b.normalized.series,o,c.extend({},a.axisY,{highLow:d,referenceValue:0})));var p=a.horizontalBars?o.x1+j.projectValue(0):o.y1-j.projectValue(0),q=[];l.createGridAndLabels(e,h,this.supportsForeignObject,a,this.eventEmitter),j.createGridAndLabels(e,h,this.supportsForeignObject,a,this.eventEmitter),a.showGridBackground&&c.createGridBackground(e,o,a.classNames.gridBackground,this.eventEmitter),b.raw.series.forEach(function(d,e){var f,h,i=e-(b.raw.series.length-1)/2;f=a.distributeSeries&&!a.stackBars?l.axisLength/b.normalized.series.length/2:a.distributeSeries&&a.stackBars?l.axisLength/2:l.axisLength/b.normalized.series[e].length/2,h=g.elem("g"),h.attr({"ct:series-name":d.name,"ct:meta":c.serialize(d.meta)}),h.addClass([a.classNames.series,d.className||a.classNames.series+"-"+c.alphaNumerate(e)].join(" ")),b.normalized.series[e].forEach(function(g,k){var r,s,t,u;if(u=a.distributeSeries&&!a.stackBars?e:a.distributeSeries&&a.stackBars?0:k,r=a.horizontalBars?{x:o.x1+j.projectValue(g&&g.x?g.x:0,k,b.normalized.series[e]),y:o.y1-l.projectValue(g&&g.y?g.y:0,u,b.normalized.series[e])}:{x:o.x1+l.projectValue(g&&g.x?g.x:0,u,b.normalized.series[e]),y:o.y1-j.projectValue(g&&g.y?g.y:0,k,b.normalized.series[e])},l instanceof c.StepAxis&&(l.options.stretch||(r[l.units.pos]+=f*(a.horizontalBars?-1:1)),r[l.units.pos]+=a.stackBars||a.distributeSeries?0:i*a.seriesBarDistance*(a.horizontalBars?-1:1)),t=q[k]||p,q[k]=t-(p-r[l.counterUnits.pos]),void 0!==g){var v={};v[l.units.pos+"1"]=r[l.units.pos],v[l.units.pos+"2"]=r[l.units.pos],!a.stackBars||"accumulate"!==a.stackMode&&a.stackMode?(v[l.counterUnits.pos+"1"]=p,v[l.counterUnits.pos+"2"]=r[l.counterUnits.pos]):(v[l.counterUnits.pos+"1"]=t,v[l.counterUnits.pos+"2"]=q[k]),v.x1=Math.min(Math.max(v.x1,o.x1),o.x2),v.x2=Math.min(Math.max(v.x2,o.x1),o.x2),v.y1=Math.min(Math.max(v.y1,o.y2),o.y1),v.y2=Math.min(Math.max(v.y2,o.y2),o.y1);var w=c.getMetaData(d,k);s=h.elem("line",v,a.classNames.bar).attr({"ct:value":[g.x,g.y].filter(c.isNumeric).join(","),"ct:meta":c.serialize(w)}),this.eventEmitter.emit("draw",c.extend({type:"bar",value:g,index:k,meta:w,series:d,seriesIndex:e,axisX:m,axisY:n,chartRect:o,group:h,element:s},v))}}.bind(this))}.bind(this)),this.eventEmitter.emit("created",{bounds:j.bounds,chartRect:o,axisX:m,axisY:n,svg:this.svg,options:a})}function e(a,b,d,e){c.Bar["super"].constructor.call(this,a,b,f,c.extend({},f,d),e)}var f={axisX:{offset:30,position:"end",labelOffset:{x:0,y:0},showLabel:!0,showGrid:!0,labelInterpolationFnc:c.noop,scaleMinSpace:30,onlyInteger:!1},axisY:{offset:40,position:"start",labelOffset:{x:0,y:0},showLabel:!0,showGrid:!0,labelInterpolationFnc:c.noop,scaleMinSpace:20,onlyInteger:!1},width:void 0,height:void 0,high:void 0,low:void 0,referenceValue:0,chartPadding:{top:15,right:15,bottom:5,left:10},seriesBarDistance:15,stackBars:!1,stackMode:"accumulate",horizontalBars:!1,distributeSeries:!1,reverseData:!1,showGridBackground:!1,classNames:{chart:"ct-chart-bar",horizontalBars:"ct-horizontal-bars",label:"ct-label",labelGroup:"ct-labels",series:"ct-series",bar:"ct-bar",grid:"ct-grid",gridGroup:"ct-grids",gridBackground:"ct-grid-background",vertical:"ct-vertical",horizontal:"ct-horizontal",start:"ct-start",end:"ct-end"}};c.Bar=c.Base.extend({constructor:e,createChart:d})}(window,document,a),function(a,b,c){"use strict";function d(a,b,c){var d=b.x>a.x;return d&&"explode"===c||!d&&"implode"===c?"start":d&&"implode"===c||!d&&"explode"===c?"end":"middle"}function e(a){var b,e,f,h,i,j=c.normalizeData(this.data),k=[],l=a.startAngle;this.svg=c.createSvg(this.container,a.width,a.height,a.donut?a.classNames.chartDonut:a.classNames.chartPie),e=c.createChartRect(this.svg,a,g.padding),f=Math.min(e.width()/2,e.height()/2),i=a.total||j.normalized.series.reduce(function(a,b){return a+b},0);var m=c.quantity(a.donutWidth);"%"===m.unit&&(m.value*=f/100),f-=a.donut&&!a.donutSolid?m.value/2:0,h="outside"===a.labelPosition||a.donut&&!a.donutSolid?f:"center"===a.labelPosition?0:a.donutSolid?f-m.value/2:f/2,h+=a.labelOffset;var n={x:e.x1+e.width()/2,y:e.y2+e.height()/2},o=1===j.raw.series.filter(function(a){return a.hasOwnProperty("value")?0!==a.value:0!==a}).length;j.raw.series.forEach(function(a,b){k[b]=this.svg.elem("g",null,null)}.bind(this)),a.showLabel&&(b=this.svg.elem("g",null,null)),j.raw.series.forEach(function(e,g){if(0!==j.normalized.series[g]||!a.ignoreEmptyValues){k[g].attr({"ct:series-name":e.name}),k[g].addClass([a.classNames.series,e.className||a.classNames.series+"-"+c.alphaNumerate(g)].join(" "));var p=i>0?l+j.normalized.series[g]/i*360:0,q=Math.max(0,l-(0===g||o?0:.2));p-q>=359.99&&(p=q+359.99);var r,s,t,u=c.polarToCartesian(n.x,n.y,f,q),v=c.polarToCartesian(n.x,n.y,f,p),w=new c.Svg.Path(!a.donut||a.donutSolid).move(v.x,v.y).arc(f,f,0,p-l>180,0,u.x,u.y);a.donut?a.donutSolid&&(t=f-m.value,r=c.polarToCartesian(n.x,n.y,t,l-(0===g||o?0:.2)),s=c.polarToCartesian(n.x,n.y,t,p),w.line(r.x,r.y),w.arc(t,t,0,p-l>180,1,s.x,s.y)):w.line(n.x,n.y);var x=a.classNames.slicePie;a.donut&&(x=a.classNames.sliceDonut,a.donutSolid&&(x=a.classNames.sliceDonutSolid));var y=k[g].elem("path",{d:w.stringify()},x);if(y.attr({"ct:value":j.normalized.series[g],"ct:meta":c.serialize(e.meta)}),a.donut&&!a.donutSolid&&(y._node.style.strokeWidth=m.value+"px"),this.eventEmitter.emit("draw",{type:"slice",value:j.normalized.series[g],totalDataSum:i,index:g,meta:e.meta,series:e,group:k[g],element:y,path:w.clone(),center:n,radius:f,startAngle:l,endAngle:p}),a.showLabel){var z;z=1===j.raw.series.length?{x:n.x,y:n.y}:c.polarToCartesian(n.x,n.y,h,l+(p-l)/2);var A;A=j.normalized.labels&&!c.isFalseyButZero(j.normalized.labels[g])?j.normalized.labels[g]:j.normalized.series[g];var B=a.labelInterpolationFnc(A,g);if(B||0===B){var C=b.elem("text",{dx:z.x,dy:z.y,"text-anchor":d(n,z,a.labelDirection)},a.classNames.label).text(""+B);this.eventEmitter.emit("draw",{type:"label",index:g,group:b,element:C,text:""+B,x:z.x,y:z.y})}}l=p}}.bind(this)),this.eventEmitter.emit("created",{chartRect:e,svg:this.svg,options:a})}function f(a,b,d,e){c.Pie["super"].constructor.call(this,a,b,g,c.extend({},g,d),e)}var g={width:void 0,height:void 0,chartPadding:5,classNames:{chartPie:"ct-chart-pie",chartDonut:"ct-chart-donut",series:"ct-series",slicePie:"ct-slice-pie",sliceDonut:"ct-slice-donut",sliceDonutSolid:"ct-slice-donut-solid",label:"ct-label"},startAngle:0,total:void 0,donut:!1,donutSolid:!1,donutWidth:60,showLabel:!0,labelOffset:0,labelPosition:"inside",labelInterpolationFnc:c.noop,labelDirection:"neutral",reverseData:!1,ignoreEmptyValues:!1};c.Pie=c.Base.extend({constructor:f,createChart:e,determineAnchorPosition:d})}(window,document,a),a});
@/ui/modules/modmanager/modmanager.js
      data[k].packed = (data[k].unpackedPath === undefined)
      data[k].dateAdded = Math.floor(data[k].dateAdded / (60 * 60 * 24))  * -1000 * 60 * 60 * 24
      // the minus is a hack to sort the last added first but added on same dates alphabetically
      for (var key in vm.downState) {
        vm.updateList[key].progress = Math.floor(vm.downState[key].dlnow / vm.downState[key].dltotal * 100) > 0 ? Math.floor(vm.downState[key].dlnow / vm.downState[key].dltotal * 100) : 0
      }
      for (var key in vm.downState) {
        vm.updateList[key].progress = Math.floor(vm.downState[key].dlnow / vm.downState[key].dltotal * 100) > 0 ? Math.floor(vm.downState[key].dlnow / vm.downState[key].dltotal * 100) : 0
      }
@/lua/ge/extensions/editor/gen/terrain.lua
            -- frequency seed
            local nw = math.floor(dw2[f][1]/ama*amp2n+0.5)
            local list = {}
local function waveUp(f, p)
    local r = math.floor(f2r*(fma-f)/(fma-fmi)*tersize.x + 0.5)
        U.dump(p, '?? waveUp:'..f..':'..r)
    local R = 1.5*ravg + dma/2
    iR = math.floor(R/grid+0.5)
    for i = 1,2*iR do
            local W = math.abs((cb-ce):dot(dnorm))
            local nstep = math.floor(W/space)
            local step = W/nstep
--                lo('??^^^^^^^ TO_EXIT1:'..desc.w)
            local desc = aslice[math.floor(#aslice/2+0.5)]
            desc.w = (default.WMI_TOMERGE + 0.05)*D.default.laneWidth
--                lo('??^^^^^^^ TO_EXIT2:')
            local desc = aslice[math.floor(#aslice/2+0.5)]
            desc.w = (default.WMI_TOMERGE + 0.05)*D.default.laneWidth
@/lua/ge/extensions/editor/mainToolbar.lua
    if widthLeftToolBar >= iconButtonWidth then
      maxNumEditModesToShow = math.floor(widthLeftToolBar/iconButtonWidth)
    end
@/lua/ge/extensions/flowgraph/nodes/environment/randomTimeOfDay.lua

  local hour = math.floor(hourDecimal)
  local minute = math.floor((hourDecimal - hour) * 60)
  local hour = math.floor(hourDecimal)
  local minute = math.floor((hourDecimal - hour) * 60)
  return hour, minute
function C:work()
  local fromHour = math.floor(self.pinIn.fromHour.value or 9)
  local toHour = math.floor(self.pinIn.toHour.value or 17)
  local fromHour = math.floor(self.pinIn.fromHour.value or 9)
  local toHour = math.floor(self.pinIn.toHour.value or 17)
@/lua/ge/extensions/c2/panelPlugins/tileManager.lua
local function getTileIndices(x, y, tileSize)
  return math.floor(x / tileSize), math.floor(y / tileSize)
end
local function getTileIndices(x, y, tileSize)
  return math.floor(x / tileSize), math.floor(y / tileSize)
end
                   local arrowLength = 2
                   local k = math.max(1, math.floor((edgeLength - arrowLength) / 30) - 1)
                   local dispVec = ((edgeLength - arrowLength) / (k + 1)) * edgeDirVec
@/lua/ge/extensions/util/trackBuilder/pieces.lua

    local subdivisions = math.max(150,math.floor(d*400))
    if subs then
@/lua/common/kdtreepoint3d.lua
  self.itemCount = self.itemCount / 4
  local maxDepth = floor(log10(self.itemCount) / log10(2)) + 1 -- max depth that can accomodate all items while being full (root is depth 1)
  local treeNodeCount = 2 * ceil(self.itemCount / maxDepth) - 1 -- optimize node count so that tree depth ~ # of items in each node
  self.tree = table.new(4 * treeNodeCount, 0)
  self.nonLeafLimIdx = 4 * floor(treeNodeCount * 0.5)
  self:_build(1, 4, self.itemCount * 4, 4)
      local childIdx = tableRemove(stack)
      if square(tree[floor(childIdx*0.125)*4-1] - point[axis]) < bestDist then -- floor(childIdx * 0.125) * 4 is the idx of the parent of childIdx
        nodeIdx = childIdx
      local childIdx = tableRemove(stack)
      if square(tree[floor(childIdx*0.125)*4-1] - point[axis]) < bestDist then -- floor(childIdx * 0.125) * 4 is the idx of the parent of childIdx
        nodeIdx = childIdx
@/inspector/Views/ChartDetailsSectionRow.js
        this._radius = (this._chartSize / 2) - 1; // Subtract one to accomodate chart stroke width.
        this._innerRadius = innerRadiusRatio ? Math.floor(this._radius * innerRadiusRatio) : 0;
        this._total = 0;
@/lua/common/jbeam/expressionParser.lua
  elseif selectorType == "number" then
    index = math.floor(selector) --make sure we have an int for table access
  else
@/lua/vehicle/bdebugImpl.lua
      if mode.rangeMinCap == mode.rangeMaxCap then
        local magnitude = math.floor(math.log10(abs(mode.rangeMaxCap)))
      if mode.rangeMinCap == mode.rangeMaxCap then
        local magnitude = math.floor(math.log10(abs(mode.rangeMaxCap)))
      if mode.rangeMinCap == mode.rangeMaxCap then
        local magnitude = math.floor(math.log10(abs(mode.rangeMaxCap)))
@/lua/ge/extensions/gameplay/rally/notebook/structured/textCompositor.lua

  dist = math.floor(dist)
  local roundedDist, unit = self:roundDistance(dist)
@/lua/ge/extensions/editor/missionPlaybook.lua
    while next(choiceBook) and counter > 0 do
      local idx = math.floor(math.random()*#choiceBook)+1
      local entry = choiceBook[idx]
@/lua/ge/extensions/flowgraph/basenode.lua
function C:HSVtoRGB(h,s,v)
  h = h - math.floor(h)
  return {HSVtoRGB(math.max(0, math.min(1, h)), math.max(0, math.min(1, s)), math.max(0, math.min(1, v)))}
@/lua/ge/extensions/ui/policeInfo.lua
        if type(v.txt) == 'number' and v.key == 'duration' then
          local minutes = math.floor(v.txt / 60)
          local seconds = math.floor(v.txt - minutes * 60)
          local minutes = math.floor(v.txt / 60)
          local seconds = math.floor(v.txt - minutes * 60)
          v.txt = string.format("%02d:%02d", minutes, seconds)
@/lua/vehicle/mapmgr.lua

  buf:reset():putf('map.objectData(%s,%s,%s,', objectId, playerInfo.anyPlayerSeated, math.floor(beamstate.damage))
@/lua/ge/extensions/util/procTrack.lua
  if not params.seed then
    params.seed =  math.floor(os.time())
    math.randomseed(params.seed)
    ret = ret .. wordList[(int%(#wordList))+1]
    int = math.floor(int / #wordList)
  end
@/inspector/Views/TextEditor.js
        var lineHeight = Math.ceil(this._codeMirror.defaultTextHeight());
        var margin = Math.floor((scrollInfo.clientHeight - lineHeight) / 2);
        this._codeMirror.scrollIntoView(position, margin);
@/lua/ge/extensions/util/trackBuilder/borderWallMesh.lua
      pointsCount = pointsCount +1
      cappedWidth = side * math.floor(point.width * LUTDetail + 0.5) / (LUTDetail*2)
@/lua/ge/extensions/editor/util/editorElementHelper.lua
    local t = e.ptr[0]
    im.Text(string.format("%0.2f s = %d:%02d.%02d mm:ss.mmm",t,(t-(t%60))/60, math.floor(t%60), 100*(t%1)))
    im.EndDisabled()
@/ui/lib/ext/smoothie.min.js
!function(e){function t(e){this.options=a.extend({},t.defaultOptions,e),this.clear()}function i(e){this.options=a.extend({},i.defaultChartOptions,e),this.seriesSet=[],this.currentValueRange=1,this.currentVisMinValue=0,this.lastRenderTimeMillis=0}var a={extend:function(){arguments[0]=arguments[0]||{};for(var e=1;ethis.maxValue&&(this.maxValue=t),t=0&&this.data[a][0]>e;)a--;-1===a?this.data.splice(0,0,[e,t]):this.data.length>0&&this.data[a][0]===e?i?(this.data[a][1]+=t,t=this.data[a][1]):this.data[a][1]=t:a=t&&this.data[i+1][0]0&&(e.resetBoundsTimerId=setInterval(function(){e.resetBounds()},e.options.resetBoundsInterval))},i.prototype.removeTimeSeries=function(e){for(var t=this.seriesSet.length,i=0;t>i;i++)if(this.seriesSet[i].timeSeries===e){this.seriesSet.splice(i,1);break}e.resetBoundsTimerId&&clearInterval(e.resetBoundsTimerId)},i.prototype.getTimeSeriesOptions=function(e){for(var t=this.seriesSet.length,i=0;t>i;i++)if(this.seriesSet[i].timeSeries===e)return this.seriesSet[i].options},i.prototype.bringToFront=function(e){for(var t=this.seriesSet.length,i=0;t>i;i++)if(this.seriesSet[i].timeSeries===e){var a=this.seriesSet.splice(i,1);this.seriesSet.push(a[0]);break}},i.prototype.streamTo=function(e,t){this.canvas=e,this.delay=t,this.start()},i.prototype.resize=function(){if(this.options.enableDpiScaling&&window&&1!==window.devicePixelRatio){var e=window.devicePixelRatio,t=parseInt(this.canvas.getAttribute("width")),i=parseInt(this.canvas.getAttribute("height"));this.originalWidth&&Math.floor(this.originalWidth*e)===t||(this.originalWidth=t,this.canvas.setAttribute("width",Math.floor(t*e).toString()),this.canvas.style.width=t+"px",this.canvas.getContext("2d").scale(e,e)),this.originalHeight&&Math.floor(this.originalHeight*e)===i||(this.originalHeight=i,this.canvas.setAttribute("height",Math.floor(i*e).toString()),this.canvas.style.height=i+"px",this.canvas.getContext("2d").scale(e,e))}},i.prototype.start=function(){if(!this.frame){var e=function(){this.frame=i.AnimateCompatibility.requestAnimationFrame(function(){this.render(),e()}.bind(this))}.bind(this);e()}},i.prototype.stop=function(){this.frame&&(i.AnimateCompatibility.cancelAnimationFrame(this.frame),delete this.frame)},i.prototype.updateValueRange=function(){for(var e=this.options,t=Number.NaN,i=Number.NaN,a=0;a.1||Math.abs(o)>.1,this.currentValueRange+=e.scaleSmoothing*l,this.currentVisMinValue+=e.scaleSmoothing*o}this.valueRange={min:i,max:t}},i.prototype.render=function(e,t){var i=(new Date).getTime();if(!this.isAnimatingScale){var a=Math.min(1e3/6,this.options.millisPerPixel);if(i-this.lastRenderTimeMillis0){s.beginPath();for(var u=t-t%n.grid.millisPerLine;u>=l;u-=n.grid.millisPerLine){var m=h(u);n.grid.sharpLines&&(m-=.5),s.moveTo(m,0),s.lineTo(m,r.height)}s.stroke(),s.closePath()}for(var d=1;d1&&(x.fillStyle&&(s.lineTo(r.width+x.lineWidth+1,V),s.lineTo(r.width+x.lineWidth+1,r.height+x.lineWidth+1),s.lineTo(y,r.height+x.lineWidth),s.fillStyle=x.fillStyle,s.fill()),x.strokeStyle&&"none"!==x.strokeStyle&&s.stroke(),s.closePath()),s.restore()}if(!n.labels.disabled&&!isNaN(this.valueRange.min)&&!isNaN(this.valueRange.max)){var M=n.yMaxFormatter(this.valueRange.max,n.labels.precision),k=n.yMinFormatter(this.valueRange.min,n.labels.precision),F=n.scrollBackwards?0:r.width-s.measureText(M).width-2;s.fillStyle=n.labels.fillStyle,s.fillText(M,F,n.labels.fontSize),s.fillText(k,F,r.height-2)}if(n.timestampFormatter&&n.grid.millisPerLine>0)for(var R=n.scrollBackwards?s.measureText(k).width:r.width-s.measureText(k).width+4,u=t-t%n.grid.millisPerLine;u>=l;u-=n.grid.millisPerLine){var m=h(u);if(!n.scrollBackwards&&R>m||n.scrollBackwards&&m>R){var A=new Date(u),B=n.timestampFormatter(A),L=s.measureText(B).width;R=n.scrollBackwards?m+L+2:m-L-2,s.fillStyle=n.labels.fillStyle,n.scrollBackwards?s.fillText(B,m,r.height-2):s.fillText(B,m-L,r.height-2)}}s.restore()},i.timeFormatter=function(e){function t(e){return(10>e?"0":"")+e}return t(e.getHours())+":"+t(e.getMinutes())+":"+t(e.getSeconds())},e.TimeSeries=t,e.SmoothieChart=i}("undefined"==typeof exports?this:exports);
!function(e){function t(e){this.options=a.extend({},t.defaultOptions,e),this.clear()}function i(e){this.options=a.extend({},i.defaultChartOptions,e),this.seriesSet=[],this.currentValueRange=1,this.currentVisMinValue=0,this.lastRenderTimeMillis=0}var a={extend:function(){arguments[0]=arguments[0]||{};for(var e=1;ethis.maxValue&&(this.maxValue=t),t=0&&this.data[a][0]>e;)a--;-1===a?this.data.splice(0,0,[e,t]):this.data.length>0&&this.data[a][0]===e?i?(this.data[a][1]+=t,t=this.data[a][1]):this.data[a][1]=t:a=t&&this.data[i+1][0]0&&(e.resetBoundsTimerId=setInterval(function(){e.resetBounds()},e.options.resetBoundsInterval))},i.prototype.removeTimeSeries=function(e){for(var t=this.seriesSet.length,i=0;t>i;i++)if(this.seriesSet[i].timeSeries===e){this.seriesSet.splice(i,1);break}e.resetBoundsTimerId&&clearInterval(e.resetBoundsTimerId)},i.prototype.getTimeSeriesOptions=function(e){for(var t=this.seriesSet.length,i=0;t>i;i++)if(this.seriesSet[i].timeSeries===e)return this.seriesSet[i].options},i.prototype.bringToFront=function(e){for(var t=this.seriesSet.length,i=0;t>i;i++)if(this.seriesSet[i].timeSeries===e){var a=this.seriesSet.splice(i,1);this.seriesSet.push(a[0]);break}},i.prototype.streamTo=function(e,t){this.canvas=e,this.delay=t,this.start()},i.prototype.resize=function(){if(this.options.enableDpiScaling&&window&&1!==window.devicePixelRatio){var e=window.devicePixelRatio,t=parseInt(this.canvas.getAttribute("width")),i=parseInt(this.canvas.getAttribute("height"));this.originalWidth&&Math.floor(this.originalWidth*e)===t||(this.originalWidth=t,this.canvas.setAttribute("width",Math.floor(t*e).toString()),this.canvas.style.width=t+"px",this.canvas.getContext("2d").scale(e,e)),this.originalHeight&&Math.floor(this.originalHeight*e)===i||(this.originalHeight=i,this.canvas.setAttribute("height",Math.floor(i*e).toString()),this.canvas.style.height=i+"px",this.canvas.getContext("2d").scale(e,e))}},i.prototype.start=function(){if(!this.frame){var e=function(){this.frame=i.AnimateCompatibility.requestAnimationFrame(function(){this.render(),e()}.bind(this))}.bind(this);e()}},i.prototype.stop=function(){this.frame&&(i.AnimateCompatibility.cancelAnimationFrame(this.frame),delete this.frame)},i.prototype.updateValueRange=function(){for(var e=this.options,t=Number.NaN,i=Number.NaN,a=0;a.1||Math.abs(o)>.1,this.currentValueRange+=e.scaleSmoothing*l,this.currentVisMinValue+=e.scaleSmoothing*o}this.valueRange={min:i,max:t}},i.prototype.render=function(e,t){var i=(new Date).getTime();if(!this.isAnimatingScale){var a=Math.min(1e3/6,this.options.millisPerPixel);if(i-this.lastRenderTimeMillis0){s.beginPath();for(var u=t-t%n.grid.millisPerLine;u>=l;u-=n.grid.millisPerLine){var m=h(u);n.grid.sharpLines&&(m-=.5),s.moveTo(m,0),s.lineTo(m,r.height)}s.stroke(),s.closePath()}for(var d=1;d1&&(x.fillStyle&&(s.lineTo(r.width+x.lineWidth+1,V),s.lineTo(r.width+x.lineWidth+1,r.height+x.lineWidth+1),s.lineTo(y,r.height+x.lineWidth),s.fillStyle=x.fillStyle,s.fill()),x.strokeStyle&&"none"!==x.strokeStyle&&s.stroke(),s.closePath()),s.restore()}if(!n.labels.disabled&&!isNaN(this.valueRange.min)&&!isNaN(this.valueRange.max)){var M=n.yMaxFormatter(this.valueRange.max,n.labels.precision),k=n.yMinFormatter(this.valueRange.min,n.labels.precision),F=n.scrollBackwards?0:r.width-s.measureText(M).width-2;s.fillStyle=n.labels.fillStyle,s.fillText(M,F,n.labels.fontSize),s.fillText(k,F,r.height-2)}if(n.timestampFormatter&&n.grid.millisPerLine>0)for(var R=n.scrollBackwards?s.measureText(k).width:r.width-s.measureText(k).width+4,u=t-t%n.grid.millisPerLine;u>=l;u-=n.grid.millisPerLine){var m=h(u);if(!n.scrollBackwards&&R>m||n.scrollBackwards&&m>R){var A=new Date(u),B=n.timestampFormatter(A),L=s.measureText(B).width;R=n.scrollBackwards?m+L+2:m-L-2,s.fillStyle=n.labels.fillStyle,n.scrollBackwards?s.fillText(B,m,r.height-2):s.fillText(B,m-L,r.height-2)}}s.restore()},i.timeFormatter=function(e){function t(e){return(10>e?"0":"")+e}return t(e.getHours())+":"+t(e.getMinutes())+":"+t(e.getSeconds())},e.TimeSeries=t,e.SmoothieChart=i}("undefined"==typeof exports?this:exports);
!function(e){function t(e){this.options=a.extend({},t.defaultOptions,e),this.clear()}function i(e){this.options=a.extend({},i.defaultChartOptions,e),this.seriesSet=[],this.currentValueRange=1,this.currentVisMinValue=0,this.lastRenderTimeMillis=0}var a={extend:function(){arguments[0]=arguments[0]||{};for(var e=1;ethis.maxValue&&(this.maxValue=t),t=0&&this.data[a][0]>e;)a--;-1===a?this.data.splice(0,0,[e,t]):this.data.length>0&&this.data[a][0]===e?i?(this.data[a][1]+=t,t=this.data[a][1]):this.data[a][1]=t:a=t&&this.data[i+1][0]0&&(e.resetBoundsTimerId=setInterval(function(){e.resetBounds()},e.options.resetBoundsInterval))},i.prototype.removeTimeSeries=function(e){for(var t=this.seriesSet.length,i=0;t>i;i++)if(this.seriesSet[i].timeSeries===e){this.seriesSet.splice(i,1);break}e.resetBoundsTimerId&&clearInterval(e.resetBoundsTimerId)},i.prototype.getTimeSeriesOptions=function(e){for(var t=this.seriesSet.length,i=0;t>i;i++)if(this.seriesSet[i].timeSeries===e)return this.seriesSet[i].options},i.prototype.bringToFront=function(e){for(var t=this.seriesSet.length,i=0;t>i;i++)if(this.seriesSet[i].timeSeries===e){var a=this.seriesSet.splice(i,1);this.seriesSet.push(a[0]);break}},i.prototype.streamTo=function(e,t){this.canvas=e,this.delay=t,this.start()},i.prototype.resize=function(){if(this.options.enableDpiScaling&&window&&1!==window.devicePixelRatio){var e=window.devicePixelRatio,t=parseInt(this.canvas.getAttribute("width")),i=parseInt(this.canvas.getAttribute("height"));this.originalWidth&&Math.floor(this.originalWidth*e)===t||(this.originalWidth=t,this.canvas.setAttribute("width",Math.floor(t*e).toString()),this.canvas.style.width=t+"px",this.canvas.getContext("2d").scale(e,e)),this.originalHeight&&Math.floor(this.originalHeight*e)===i||(this.originalHeight=i,this.canvas.setAttribute("height",Math.floor(i*e).toString()),this.canvas.style.height=i+"px",this.canvas.getContext("2d").scale(e,e))}},i.prototype.start=function(){if(!this.frame){var e=function(){this.frame=i.AnimateCompatibility.requestAnimationFrame(function(){this.render(),e()}.bind(this))}.bind(this);e()}},i.prototype.stop=function(){this.frame&&(i.AnimateCompatibility.cancelAnimationFrame(this.frame),delete this.frame)},i.prototype.updateValueRange=function(){for(var e=this.options,t=Number.NaN,i=Number.NaN,a=0;a.1||Math.abs(o)>.1,this.currentValueRange+=e.scaleSmoothing*l,this.currentVisMinValue+=e.scaleSmoothing*o}this.valueRange={min:i,max:t}},i.prototype.render=function(e,t){var i=(new Date).getTime();if(!this.isAnimatingScale){var a=Math.min(1e3/6,this.options.millisPerPixel);if(i-this.lastRenderTimeMillis0){s.beginPath();for(var u=t-t%n.grid.millisPerLine;u>=l;u-=n.grid.millisPerLine){var m=h(u);n.grid.sharpLines&&(m-=.5),s.moveTo(m,0),s.lineTo(m,r.height)}s.stroke(),s.closePath()}for(var d=1;d1&&(x.fillStyle&&(s.lineTo(r.width+x.lineWidth+1,V),s.lineTo(r.width+x.lineWidth+1,r.height+x.lineWidth+1),s.lineTo(y,r.height+x.lineWidth),s.fillStyle=x.fillStyle,s.fill()),x.strokeStyle&&"none"!==x.strokeStyle&&s.stroke(),s.closePath()),s.restore()}if(!n.labels.disabled&&!isNaN(this.valueRange.min)&&!isNaN(this.valueRange.max)){var M=n.yMaxFormatter(this.valueRange.max,n.labels.precision),k=n.yMinFormatter(this.valueRange.min,n.labels.precision),F=n.scrollBackwards?0:r.width-s.measureText(M).width-2;s.fillStyle=n.labels.fillStyle,s.fillText(M,F,n.labels.fontSize),s.fillText(k,F,r.height-2)}if(n.timestampFormatter&&n.grid.millisPerLine>0)for(var R=n.scrollBackwards?s.measureText(k).width:r.width-s.measureText(k).width+4,u=t-t%n.grid.millisPerLine;u>=l;u-=n.grid.millisPerLine){var m=h(u);if(!n.scrollBackwards&&R>m||n.scrollBackwards&&m>R){var A=new Date(u),B=n.timestampFormatter(A),L=s.measureText(B).width;R=n.scrollBackwards?m+L+2:m-L-2,s.fillStyle=n.labels.fillStyle,n.scrollBackwards?s.fillText(B,m,r.height-2):s.fillText(B,m-L,r.height-2)}}s.restore()},i.timeFormatter=function(e){function t(e){return(10>e?"0":"")+e}return t(e.getHours())+":"+t(e.getMinutes())+":"+t(e.getSeconds())},e.TimeSeries=t,e.SmoothieChart=i}("undefined"==typeof exports?this:exports);
!function(e){function t(e){this.options=a.extend({},t.defaultOptions,e),this.clear()}function i(e){this.options=a.extend({},i.defaultChartOptions,e),this.seriesSet=[],this.currentValueRange=1,this.currentVisMinValue=0,this.lastRenderTimeMillis=0}var a={extend:function(){arguments[0]=arguments[0]||{};for(var e=1;ethis.maxValue&&(this.maxValue=t),t=0&&this.data[a][0]>e;)a--;-1===a?this.data.splice(0,0,[e,t]):this.data.length>0&&this.data[a][0]===e?i?(this.data[a][1]+=t,t=this.data[a][1]):this.data[a][1]=t:a=t&&this.data[i+1][0]0&&(e.resetBoundsTimerId=setInterval(function(){e.resetBounds()},e.options.resetBoundsInterval))},i.prototype.removeTimeSeries=function(e){for(var t=this.seriesSet.length,i=0;t>i;i++)if(this.seriesSet[i].timeSeries===e){this.seriesSet.splice(i,1);break}e.resetBoundsTimerId&&clearInterval(e.resetBoundsTimerId)},i.prototype.getTimeSeriesOptions=function(e){for(var t=this.seriesSet.length,i=0;t>i;i++)if(this.seriesSet[i].timeSeries===e)return this.seriesSet[i].options},i.prototype.bringToFront=function(e){for(var t=this.seriesSet.length,i=0;t>i;i++)if(this.seriesSet[i].timeSeries===e){var a=this.seriesSet.splice(i,1);this.seriesSet.push(a[0]);break}},i.prototype.streamTo=function(e,t){this.canvas=e,this.delay=t,this.start()},i.prototype.resize=function(){if(this.options.enableDpiScaling&&window&&1!==window.devicePixelRatio){var e=window.devicePixelRatio,t=parseInt(this.canvas.getAttribute("width")),i=parseInt(this.canvas.getAttribute("height"));this.originalWidth&&Math.floor(this.originalWidth*e)===t||(this.originalWidth=t,this.canvas.setAttribute("width",Math.floor(t*e).toString()),this.canvas.style.width=t+"px",this.canvas.getContext("2d").scale(e,e)),this.originalHeight&&Math.floor(this.originalHeight*e)===i||(this.originalHeight=i,this.canvas.setAttribute("height",Math.floor(i*e).toString()),this.canvas.style.height=i+"px",this.canvas.getContext("2d").scale(e,e))}},i.prototype.start=function(){if(!this.frame){var e=function(){this.frame=i.AnimateCompatibility.requestAnimationFrame(function(){this.render(),e()}.bind(this))}.bind(this);e()}},i.prototype.stop=function(){this.frame&&(i.AnimateCompatibility.cancelAnimationFrame(this.frame),delete this.frame)},i.prototype.updateValueRange=function(){for(var e=this.options,t=Number.NaN,i=Number.NaN,a=0;a.1||Math.abs(o)>.1,this.currentValueRange+=e.scaleSmoothing*l,this.currentVisMinValue+=e.scaleSmoothing*o}this.valueRange={min:i,max:t}},i.prototype.render=function(e,t){var i=(new Date).getTime();if(!this.isAnimatingScale){var a=Math.min(1e3/6,this.options.millisPerPixel);if(i-this.lastRenderTimeMillis0){s.beginPath();for(var u=t-t%n.grid.millisPerLine;u>=l;u-=n.grid.millisPerLine){var m=h(u);n.grid.sharpLines&&(m-=.5),s.moveTo(m,0),s.lineTo(m,r.height)}s.stroke(),s.closePath()}for(var d=1;d1&&(x.fillStyle&&(s.lineTo(r.width+x.lineWidth+1,V),s.lineTo(r.width+x.lineWidth+1,r.height+x.lineWidth+1),s.lineTo(y,r.height+x.lineWidth),s.fillStyle=x.fillStyle,s.fill()),x.strokeStyle&&"none"!==x.strokeStyle&&s.stroke(),s.closePath()),s.restore()}if(!n.labels.disabled&&!isNaN(this.valueRange.min)&&!isNaN(this.valueRange.max)){var M=n.yMaxFormatter(this.valueRange.max,n.labels.precision),k=n.yMinFormatter(this.valueRange.min,n.labels.precision),F=n.scrollBackwards?0:r.width-s.measureText(M).width-2;s.fillStyle=n.labels.fillStyle,s.fillText(M,F,n.labels.fontSize),s.fillText(k,F,r.height-2)}if(n.timestampFormatter&&n.grid.millisPerLine>0)for(var R=n.scrollBackwards?s.measureText(k).width:r.width-s.measureText(k).width+4,u=t-t%n.grid.millisPerLine;u>=l;u-=n.grid.millisPerLine){var m=h(u);if(!n.scrollBackwards&&R>m||n.scrollBackwards&&m>R){var A=new Date(u),B=n.timestampFormatter(A),L=s.measureText(B).width;R=n.scrollBackwards?m+L+2:m-L-2,s.fillStyle=n.labels.fillStyle,n.scrollBackwards?s.fillText(B,m,r.height-2):s.fillText(B,m-L,r.height-2)}}s.restore()},i.timeFormatter=function(e){function t(e){return(10>e?"0":"")+e}return t(e.getHours())+":"+t(e.getMinutes())+":"+t(e.getSeconds())},e.TimeSeries=t,e.SmoothieChart=i}("undefined"==typeof exports?this:exports);
@/lua/ge/extensions/career/modules/delivery/precisionParking.lua
  -- Apply money reward
  taskData.adjustedRewards.money = taskData.adjustedRewards.money + math.floor(moneyReward)
  if logisticsReward ~= 0 then
    taskData.adjustedRewards["logistics-vehicleDelivery"] = (taskData.adjustedRewards["logistics-vehicleDelivery"] or 0) + math.floor(logisticsReward)
  end
  if skillReward ~= 0 then
    taskData.adjustedRewards["logistics-vehicleDelivery"] = (taskData.adjustedRewards["logistics-vehicleDelivery"] or 0) + math.floor(skillReward)
  end
  if reputationReward ~= 0 and taskData.offer.organization then
    taskData.adjustedRewards[taskData.offer.organization.."Reputation"] = (taskData.adjustedRewards[taskData.offer.organization.."Reputation"] or 0) + math.floor(reputationReward)
  end
  -- Apply money reward
  cargo.rewards.money = cargo.rewards.money + math.floor(moneyReward)
  if logisticsReward ~= 0 then
    cargo.rewards["logistics-delivery"] = (cargo.rewards["logistics-delivery"] or 0) + math.floor(logisticsReward)
  end
  if skillReward ~= 0 then
    cargo.rewards["logistics-delivery"] = (cargo.rewards["logistics-delivery"] or 0) + math.floor(skillReward)
  end
  if reputationReward ~= 0 and cargo.organization then
    cargo.rewards[cargo.organization.."Reputation"] = (cargo.rewards[cargo.organization.."Reputation"] or 0) + math.floor(reputationReward)
  end
@/lua/ge/extensions/editor/decalEditor.lua
  local s = gridCellSize
  local ix = math.floor(inst.position.x / s)
  local iy = math.floor(inst.position.y / s)
  local ix = math.floor(inst.position.x / s)
  local iy = math.floor(inst.position.y / s)
  local iz = math.floor(inst.position.z / s)
  local iy = math.floor(inst.position.y / s)
  local iz = math.floor(inst.position.z / s)
  local key = cellKey(ix, iy, iz)
  local s = gridCellSize
  local minx = math.floor((campos.x - radius) / s)
  local maxx = math.floor((campos.x + radius) / s)
  local minx = math.floor((campos.x - radius) / s)
  local maxx = math.floor((campos.x + radius) / s)
  local miny = math.floor((campos.y - radius) / s)
  local maxx = math.floor((campos.x + radius) / s)
  local miny = math.floor((campos.y - radius) / s)
  local maxy = math.floor((campos.y + radius) / s)
  local miny = math.floor((campos.y - radius) / s)
  local maxy = math.floor((campos.y + radius) / s)
  local minz = math.floor((campos.z - radius) / s)
  local maxy = math.floor((campos.y + radius) / s)
  local minz = math.floor((campos.z - radius) / s)
  local maxz = math.floor((campos.z + radius) / s)
  local minz = math.floor((campos.z - radius) / s)
  local maxz = math.floor((campos.z + radius) / s)
  for ix = minx, maxx do
@/lua/ge/extensions/editor/preferences.lua
        imgui.GetWindowDrawList(),
        imgui.ImVec2(windowPos.x + cPos.x - style.ItemSpacing.x/2, windowPos.y + cPos.y - math.floor(style.ItemSpacing.y/2) - scrollY),
        imgui.ImVec2(
@/lua/ge/extensions/flowgraph/nodes/gameplay/rally/countdownSynced.lua

  local hours24 = math.floor(timeSecs / 3600) % 24
  local minutes = math.floor((timeSecs % 3600) / 60)
  local hours24 = math.floor(timeSecs / 3600) % 24
  local minutes = math.floor((timeSecs % 3600) / 60)
  local seconds = math.floor(timeSecs % 60)
  local minutes = math.floor((timeSecs % 3600) / 60)
  local seconds = math.floor(timeSecs % 60)

  local old = math.floor(self.timer)
  self.timer = self.timer - self.mgr.dtSim
  else
    if old ~= math.floor(self.timer) and old <= self.maxAnnounced then
      self.countdownMsg = self.pinIn.countdownMsg.value or "%d"
@/lua/ge/extensions/gameplay/crawl/utils.lua

      local numSteps = math.max(1, math.floor(segmentLength / stepDistance))
      local stepSize = segmentLength / numSteps
@/lua/ge/extensions/ui/apps/minimap/vehicles.lua

    local borderWidth = math.max(1, math.floor(2 * dpi))
    td:triangle(f.x, f.y, bl.x, bl.y, br.x, br.y, borderWidth, 0, currentStyleColorSet.navBg, currentStyleColorSet.navBg, currentStyleColorSet.navBg, currentStyleColorSet.navBg, 0, layer)

    local border = math.max(1, math.floor(2 * dpi))

    local strokeWidth = math.max(1, math.floor(2 * dpi))
    td:line(tmp3.x, tmp3.y, tmp2.x, tmp2.y, 0, 4*dpi, strokeWidth, strokeWidth, currentStyleColorSet.navBg, currentStyleColorSet.navBg, currentStyleColorSet.navBg, currentStyleColorSet.navBg, 0, layers.VEHICLE_PLAYER)
@/inspector/External/CodeMirror/codemirror.js
  var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop
  top = Math.floor(top - paddingTop(display))
  var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight
  catch(e) { return false }
  if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) { return false }
  if (prevent) { e_preventDefault(e) }
  if (cm.options.indentWithTabs)
    { for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += "\t"} }
  if (pos < indentation) { indentString += spaceStr(indentation - pos) }
@/inspector/Views/AuditTestGroupContentView.js
        let totalCount = Object.values(levelCounts).reduce((accumulator, current) => accumulator + current);
        this._percentageTextElement.textContent = Math.floor(100 * levelCounts[WI.AuditTestCaseResult.Level.Pass] / totalCount);
        this._percentageContainer.hidden = false;
@/lua/ge/extensions/editor/autoSave.lua
  if autoSaveTimer <= editor.getPreference("files.autoSave.noticeInterval") then
    editor.setStatusBar("AutoSaving in " .. math.floor(autoSaveTimer) .. " seconds...")
  end
@/ui/lib/ext/angular/angular.js
          // for each tuples
          var nbrUrisWith2parts = Math.floor(rawUris.length / 2);
          for (var i = 0; i < nbrUrisWith2parts; i++) {
      digits[i] = d % 10;
      return Math.floor(d / 10);
    }, 0);
@/lua/ge/extensions/editor/toolUtilities/ribbonInput.lua
    cursorBN = getBlueNoise1d(cursorBN)
    local segSample = max(1, floor(cursorBN * numSegs))
    local pClosest, dSq = geom.closestRibbonSegPointToPoint(segSample, ribbon, p)
@/lua/vehicle/controller/hydraulicSuspension.lua
    if beam.bleedCoef > 0 then
      local currentLength = math.floor(obj:getBeamCurLengthRefRatio(beam.cid) * 100) / 100
      if currentLength < lastFrameBeamLengths[beam.cid] then
@/lua/vehicle/powertrain/combustionEngineThermals.lua
  --Step 1: Calculate the "forces" with our "spring" k values
  local currentEngineEfficiency = burnEfficiencyCoef[math.floor(parentEngine.engineLoad * 100)]
  local burnEnergyPerUpdate = parentEngine.engineWorkPerUpdate * currentEngineEfficiency
  --Step 1: Calculate the "forces" with our "spring" k values
  local currentEngineEfficiency = burnEfficiencyCoef[math.floor(parentEngine.engineLoad * 100)]
  local burnEnergyPerUpdate = parentEngine.engineWorkPerUpdate * currentEngineEfficiency
@/lua/ge/extensions/editor/vehicleEditor/staticEditor/veStaticRenderView.lua

  local numLines = math.floor(gridSize / blockSize)
@/ui/modules/scenarioselect/scenarioselect.js
    ]
    return val[Math.floor(parseFloat(num)/25)]
  }
@/lua/common/libs/luaqrcode/qrencode.lua
      if local_mode == 1 then -- numeric
        c = math.floor(modebits * 3 / 10)
      elseif local_mode == 2 then -- alphanumeric
      elseif local_mode == 2 then -- alphanumeric
        c = math.floor(modebits * 2 / 11)
      elseif local_mode == 3 then -- binary
      elseif local_mode == 3 then -- binary
        c = math.floor(modebits * 1 / 8)
      else
      else
        c = math.floor(modebits * 1 / 13)
      end
--   end
--   return math.floor(size/8),math.fmod(size,8)
-- end
    x = start_x + math.fmod(i - 1,3)
    y = start_y + math.floor( (i - 1) / 3 )
    fill_matrix_position(matrix,bit,x,y)
    bit = string.sub(bitstring,i,i)
    x = start_x + math.floor( (i - 1) / 3 )
    y = start_y + math.fmod(i - 1,3)
  elseif mask == 4 then
    if math.fmod(math.floor(y / 2) + math.floor(x / 3),2) == 0 then invert = true end
  elseif mask == 5 then
  elseif mask == 4 then
    if math.fmod(math.floor(y / 2) + math.floor(x / 3),2) == 0 then invert = true end
  elseif mask == 5 then
  local dark_ratio = number_of_dark_cells / ( size * size )
  penalty4 = math.floor(math.abs(dark_ratio * 100 - 50)) * 2
  return penalty1 + penalty2 + penalty3 + penalty4
@/lua/ge/extensions/scenario/distanceGoal.lua
  local finalTime = scenario.timer
  local minutes = math.floor(finalTime / 60);
  local seconds = finalTime - (minutes * 60);
@/lua/ge/extensions/editor/missionEditor/additionalAttributes.lua
  local seconds = ((val + 0.50001) % 1) * 86400
  local hours = math.floor(seconds / 3600)
  local mins = math.floor(seconds / 60 - (hours * 60))
  local hours = math.floor(seconds / 3600)
  local mins = math.floor(seconds / 60 - (hours * 60))
  local secs = math.floor(seconds - hours * 3600 - mins * 60)
  local mins = math.floor(seconds / 60 - (hours * 60))
  local secs = math.floor(seconds - hours * 3600 - mins * 60)
  return string.format("%02d:%02d:%02d", hours, mins, secs)
@/lua/ge/extensions/ui/apps/minimap/topomap.lua
  local levelStep = 2.5
  for level = math.floor(minHeight / levelStep) * levelStep, maxHeight, levelStep do
    if level >= minHeight and level <= maxHeight then
@/lua/vehicle/controller/loggerTemplate.lua
  -- headers: "time", "throttle", "brake", "batteryCapacity", "motorPower"
  local time = floor(timer * 1000) / 1000 -- Make sure time doesn't have dozen of digits
  local throttle = electrics.values.throttle -- throttle input
@/ui/lib/ext/angular-material/angular-material.min.js
scope:{mdOnLayout:"&"},link:a}}function n(e){this.layoutInvalidated=!1,this.tilesInvalidated=!1,this.$timeout_=e.nextTick,this.layoutDelegate=t.noop}function o(e){function n(t,n){var o,a,d,c,l,m;return c=e.time(function(){a=r(t,n)}),o={layoutInfo:function(){return a},map:function(t){return l=e.time(function(){var e=o.layoutInfo();d=t(e.positioning,e.rowCount)}),o},reflow:function(t){return m=e.time(function(){var e=t||i;e(d.grid,d.tiles)}),o},performance:function(){return{tileCount:n.length,layoutTime:c,mapTime:l,reflowTime:m,totalTime:c+l+m}}}}function o(e,t){e.element.css(e.style),t.forEach(function(e){e.element.css(e.style)})}function r(e,t){function n(t,n){if(t.col>e)throw"md-grid-list: Tile at position "+n+" has a colspan ("+t.col+") that exceeds the column count ("+e+")";for(var a=0,m=0;m-a=e?o():(a=l.indexOf(0,d),-1!==a&&-1!==(m=i(a+1))?d=m+1:(a=m=0,o()));return r(a,t.col,t.row),d=a+t.col,{col:a,row:c}}function o(){d=0,c++,r(0,e,-1)}function r(e,t,n){for(var o=e;e+t>o;o++)l[o]=Math.max(l[o]+n,0)}function i(e){var t;for(t=e;tn;n++)t.push(0);return t}var d=0,c=0,l=a();return{positioning:t.map(function(e,t){return{spans:e,position:n(e,t)}}),rowCount:c+Math.max.apply(Math,l)}}var i=o;return n.animateWith=function(e){i=t.isFunction(e)?e:o},n}function r(e){function n(n,o,r,i){o.attr("role","listitem");var a=e.watchResponsiveAttributes(["md-colspan","md-rowspan"],r,t.bind(i,i.invalidateLayout));i.invalidateTiles(),n.$on("$destroy",function(){a(),i.invalidateLayout()}),t.isDefined(n.$parent.$index)&&n.$watch(function(){return n.$parent.$index},function(e,t){e!==t&&i.invalidateTiles()})}return{restrict:"E",require:"^mdGridList",template:"
",transclude:!0,scope:{},controller:["$attrs",function(e){this.$attrs=e}],link:n}}function i(){return{template:"
",transclude:!0}}t.module("material.components.gridList",["material.core"]).directive("mdGridList",e).directive("mdGridTile",r).directive("mdGridTileFooter",i).directive("mdGridTileHeader",i).factory("$mdGridLayout",o),e.$inject=["$interpolate","$mdConstant","$mdGridLayout","$mdMedia"],n.$inject=["$mdUtil"],n.prototype={invalidateTiles:function(){this.tilesInvalidated=!0,this.invalidateLayout()},invalidateLayout:function(){this.layoutInvalidated||(this.layoutInvalidated=!0,this.$timeout_(t.bind(this,this.layout)))},layout:function(){try{this.layoutDelegate(this.tilesInvalidated)}finally{this.layoutInvalidated=!1,this.tilesInvalidated=!1}}},o.$inject=["$mdUtil"],r.$inject=["$mdMedia"]}(),function(){function e(e,t,n){function o(o,r,i){function a(){var e=r.parent();return e.attr("aria-label")||e.text()?!0:e.parent().attr("aria-label")||e.parent().text()?!0:!1}function d(){function t(){return!o.fontIcon&&!o.fontSet&&!i.hasOwnProperty("class")}o.svgIcon||o.svgSrc||(o.fontIcon&&r.addClass("md-font "+o.fontIcon),o.fontSet&&r.addClass(e.fontSet(o.fontSet)),t()&&r.addClass(e.fontSet()))}t(r),d();var c=i.alt||o.fontIcon||o.svgIcon||r.text(),l=i.$normalize(i.$attr.mdSvgIcon||i.$attr.mdSvgSrc||"");i["aria-label"]||(""==c||a()?r.text()||n.expect(r,"aria-hidden","true"):(n.expect(r,"aria-label",c),n.expect(r,"role","img"))),l&&i.$observe(l,function(t){r.empty(),t&&e(t).then(function(e){r.append(e)})})}return{scope:{fontSet:"@mdFontSet",fontIcon:"@mdFontIcon",svgIcon:"@mdSvgIcon",svgSrc:"@mdSvgSrc"},restrict:"E",link:o}}t.module("material.components.icon",["material.core"]).directive("mdIcon",e),e.$inject=["$mdIcon","$mdTheming","$mdAria"]}(),function(){function e(){}function n(e,t){this.url=e,this.viewBoxSize=t||r.defaultViewBoxSize}function o(e,n,o,r,i){function a(e){return e=e||"",E[e]?o.when(E[e].clone()):v.test(e)?s(e).then(c(e)):(-1==e.indexOf(":")&&(e="$default:"+e),l(e)["catch"](m)["catch"](u)["catch"](p).then(c(e)))}function d(n){var o=t.isUndefined(n)||!(n&&n.length);if(o)return e.defaultFontSet;var r=n;return t.forEach(e.fontSets,function(e){e.alias==n&&(r=e.fontSet||r)}),r}function c(t){return function(n){return E[t]=f(n)?n:new h(n,e[t]),E[t].clone()}}function l(t){var n=e[t];return n?s(n.url).then(function(e){return new h(e,n)}):o.reject(t)}function m(t){function n(e){var n=t.slice(t.lastIndexOf(":")+1),r=e.querySelector("#"+n);return r?new h(r,i):o.reject(t)}var r=t.substring(0,t.lastIndexOf(":"))||"$default",i=e[r];return i?s(i.url).then(n):o.reject(t)}function s(e){return n.get(e,{cache:i}).then(function(e){return t.element("
").append(e.data).find("svg")[0]})}function u(e){var n;return t.isString(e)&&(n="icon "+e+" not found",r.warn(n)),o.reject(n||e)}function p(e){var n=t.isString(e)?e:e.message||e.data||e.statusText;return r.warn(n),o.reject(n)}function f(e){return t.isDefined(e.element)&&t.isDefined(e.config)}function h(e,n){"svg"!=e.tagName&&(e=t.element('').append(e)[0]),e.getAttribute("xmlns")||e.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.element=e,this.config=n,this.prepare()}function b(){var n=this.config?this.config.viewBoxSize:e.defaultViewBoxSize;t.forEach({fit:"",height:"100%",width:"100%",preserveAspectRatio:"xMidYMid meet",viewBox:this.element.getAttribute("viewBox")||"0 0 "+n+" "+n},function(e,t){this.element.setAttribute(t,e)},this),t.forEach({"pointer-events":"none",display:"block"},function(e,t){this.element.style[t]=e},this)}function g(){return this.element.cloneNode(!0)}var E={},v=/[-a-zA-Z0-9@:%_\+.~#?&//=]{2,256}\.[a-z]{2,4}\b(\/[-a-zA-Z0-9@:%_\+.~#?&//=]*)?/i;return h.prototype={clone:g,prepare:b},a.fontSet=d,a}t.module("material.components.icon").provider("$mdIcon",e);var r={defaultViewBoxSize:24,defaultFontSet:"material-icons",fontSets:[]};e.prototype={icon:function(e,t,o){return-1==e.indexOf(":")&&(e="$default:"+e),r[e]=new n(t,o),this},iconSet:function(e,t,o){return r[e]=new n(t,o),this},defaultIconSet:function(e,t){var o="$default";return r[o]||(r[o]=new n(e,t)),r[o].viewBoxSize=t||r.defaultViewBoxSize,this},defaultViewBoxSize:function(e){return r.defaultViewBoxSize=e,this},fontSet:function(e,t){return r.fontSets.push({alias:e,fontSet:t||e}),this},defaultFontSet:function(e){return r.defaultFontSet=e?e:"",this},defaultIconSize:function(e){return r.defaultIconSize=e,this},preloadIcons:function(e){var t=this,n=[{id:"md-tabs-arrow",url:"md-tabs-arrow.svg",svg:''},{id:"md-close",url:"md-close.svg",svg:''},{id:"md-cancel",url:"md-cancel.svg",svg:''},{id:"md-menu",url:"md-menu.svg",svg:''},{id:"md-toggle-arrow",url:"md-toggle-arrow-svg",svg:''}];n.forEach(function(n){t.icon(n.id,n.url),e.put(n.url,n.svg)})},$get:["$http","$q","$log","$templateCache",function(e,t,n,i){return this.preloadIcons(i),o(r,e,t,n,i)}]}}(),function(){function e(e,t){function n(t,n,o){e(n)}function o(e,n,o){var r=this;r.isErrorGetter=o.mdIsError&&t(o.mdIsError),r.delegateClick=function(){r.input.focus()},r.element=n,r.setFocused=function(e){n.toggleClass("md-input-focused",!!e)},r.setHasValue=function(e){n.toggleClass("md-input-has-value",!!e)},r.setInvalid=function(e){n.toggleClass("md-input-invalid",!!e)},e.$watch(function(){return r.label&&r.input},function(e){e&&!r.label.attr("for")&&r.label.attr("for",r.input.attr("id"))})}return o.$inject=["$scope","$element","$attrs"],{restrict:"E",link:n,controller:o}}function n(){return{restrict:"E",require:"^?mdInputContainer",link:function(e,t,n,o){o&&!n.mdNoFloat&&(o.label=t,e.$on("$destroy",function(){o.label=null}))}}}function o(e,n,o){function r(r,i,a,d){function c(e){return s.setHasValue(!u.$isEmpty(e)),e}function l(){s.setHasValue(i.val().length>0||(i[0].validity||{}).badInput)}function m(){function o(e){return h(),e}function a(){if(m.style.height=m.offsetHeight+"px",i.addClass("md-no-flex"),isNaN(p)){l.style.height="auto",l.scrollTop=0;var e=d();e&&(l.style.height=e+"px")}else{l.setAttribute("rows",1),f||(l.style.minHeight="0",f=i.prop("clientHeight"),l.style.minHeight=null);var t=Math.max(p,Math.round(l.scrollHeight/f));l.setAttribute("rows",t)}i.removeClass("md-no-flex"),m.style.height="auto"}function d(){var e=l.scrollHeight-l.offsetHeight;return l.offsetHeight+(e>0?e:0)}function c(e){l.scrollTop=0;var t=l.scrollHeight-l.offsetHeight,n=l.offsetHeight+t;l.style.height=n+"px"}if(!t.isDefined(i.attr("md-no-autogrow"))){var l=i[0],m=s.element[0],p=0/0,f=null;l.hasAttribute("rows")&&(p=parseInt(l.getAttribute("rows")));var h=e.debounce(a,1);u?(u.$formatters.push(o),u.$viewChangeListeners.push(o)):h(),i.on("keydown input",h),isNaN(p)&&(i.attr("rows","1"),i.on("scroll",c)),t.element(n).on("resize",h),r.$on("$destroy",function(){t.element(n).off("resize",h)})}}var s=d[0],u=d[1]||e.fakeNgModel(),p=t.isDefined(a.readonly);if(s){if(s.input)throw new Error(" can only have *one*
');r.$set("ngTrim","false"),l.element.append(m),c.$formatters.push(a),c.$viewChangeListeners.push(a),o.on("input keydown",function(){a()}),n.$watch(r.mdMaxlength,function(n){d=n,t.isNumber(n)&&n>0?(m.parent().length||e.enter(m,l.element,t.element(l.element[0].lastElementChild)),a()):e.leave(m)}),c.$validators["md-maxlength"]=function(e,n){return!t.isNumber(d)||0>d?!0:(e||o.val()||n||"").length<=d}}return{restrict:"A",require:["ngModel","^mdInputContainer"],link:n}}function i(e){function n(n,o,r,i){if(i&&!t.isDefined(i.element.attr("md-no-float"))){var a=r.placeholder;if(o.removeAttr("placeholder"),0==i.element.find("label").length){if(i.input&&"MD-SELECT"!=i.input[0].nodeName){var d='";i.element.addClass("md-icon-float"),i.element.prepend(d)}}else"MD-SELECT"!=o[0].nodeName&&e.warn("The placeholder='"+a+"' will be ignored since this md-input-container has a child label element.")}}return{restrict:"A",require:"^^?mdInputContainer",priority:200,link:n}}t.module("material.components.input",["material.core"]).directive("mdInputContainer",e).directive("label",n).directive("input",o).directive("textarea",o).directive("mdMaxlength",r).directive("placeholder",i),e.$inject=["$mdTheming","$parse"],o.$inject=["$mdUtil","$window","$mdAria"],r.$inject=["$animate"],i.$inject=["$log"]}(),function(){function e(e){return{restrict:"E",compile:function(t){return t[0].setAttribute("role","list"),e}}}function n(e,n,o){var r=["md-checkbox","md-switch"];return{restrict:"E",controller:"MdListController",compile:function(i,a){function d(){for(var e,t,n=["md-switch","md-checkbox"],o=0;t=n[o];++o)if((e=i.find(t)[0])&&!e.hasAttribute("aria-label")){var r=i.find("p")[0];if(!r)return;e.setAttribute("aria-label","Toggle "+r.textContent)}}function c(n){var o;if("div"==n)o=t.element('
'),o.append(i.contents()),i.addClass("md-proxy-focus");else{o=t.element('
');var r=["ng-click","aria-label","ng-disabled"];t.forEach(r,function(e){i[0].hasAttribute(e)&&(o[0].setAttribute(e,i[0].getAttribute(e)),i[0].removeAttribute(e))}),o.children().eq(0).append(i.contents())}if(i[0].setAttribute("tabindex","-1"),i.append(o),p&&p.hasAttribute("ng-click")){e.expect(p,"aria-label");var d=t.element('');d.attr("ng-click",p.getAttribute("ng-click")),p.removeAttribute("ng-click"),p.setAttribute("tabindex","-1"),p.classList.remove("md-secondary"),d.append(p),p=d[0]}p&&(p.hasAttribute("ng-click")||a.ngClick&&l(p))&&(i.addClass("md-with-secondary"),i.append(p))}function l(e){return-1!=r.indexOf(e.nodeName.toLowerCase())}function m(e,i,a,d){function c(){var e=i.children();e.length&&!e[0].hasAttribute("ng-click")&&t.forEach(r,function(e){t.forEach(s.querySelectorAll(e),function(e){m.push(e)})})}function l(){(m.length||u)&&(i.addClass("md-clickable"),d.attachRipple(e,t.element(i[0].querySelector(".md-no-style"))))}var m=[],s=i[0].firstElementChild,u=s&&s.hasAttribute("ng-click");c(),l(),i.hasClass("md-proxy-focus")&&m.length&&t.forEach(m,function(n){n=t.element(n),e.mouseActive=!1,n.on("mousedown",function(){e.mouseActive=!0,o(function(){e.mouseActive=!1},100)}).on("focus",function(){e.mouseActive===!1&&i.addClass("md-focused"),n.on("blur",function t(){i.removeClass("md-focused"),n.off("blur",t)})})}),u||m.length||s&&s.addEventListener("keypress",function(e){if("INPUT"!=e.target.nodeName&&"TEXTAREA"!=e.target.nodeName){var t=e.which||e.keyCode;t==n.KEY_CODE.SPACE&&s&&(s.click(),e.preventDefault(),e.stopPropagation())}}),i.off("click"),i.off("keypress"),m.length&&s&&i.children().eq(0).on("click",function(e){s.contains(e.target)&&t.forEach(m,function(n){e.target===n||n.contains(e.target)||t.element(n).triggerHandler("click")})})}var s,u,p=i[0].querySelector(".md-secondary");if(i[0].setAttribute("role","listitem"),a.ngClick)c("button");else{for(var f,h=0;f=r[h];++h)if(u=i[0].querySelector(f)){s=!0;break}s?c("div"):i[0].querySelector("md-button")||i.addClass("md-no-proxy")}return d(),m}}}function o(e,t,n){function o(e,t){var o={};n.attach(e,t,o)}var r=this;r.attachRipple=o}t.module("material.components.list",["material.core"]).controller("MdListController",o).directive("mdList",e).directive("mdListItem",n),e.$inject=["$mdTheming"],n.$inject=["$mdAria","$mdConstant","$timeout"],o.$inject=["$scope","$element","$mdListInkRipple"]}(),function(){function e(e){function n(e){e.addClass("md-menu");var t=e.children()[0];if(t.hasAttribute("ng-click")||(t=t.querySelector("[ng-click]")),t&&t.setAttribute("aria-haspopup","true"),2!=e.children().length)throw Error("Invalid HTML for md-menu. Expected two children elements.");return o}function o(e,n,o,r){var i=t.element('
'),a=n.children()[1];i.append(a),r.init(i),e.$on("$destroy",function(){i.remove(),r.close()})}return{restrict:"E",require:"mdMenu",controller:"mdMenuCtrl",scope:!0,compile:n}}function n(e,t,n,o){var r,i,a=this;this.init=function(e){r=e,i=n[0].querySelector("[ng-click]")},this.open=function(t){t&&t.stopPropagation(),a.isOpen=!0,i.setAttribute("aria-expanded","true"),e.show({scope:o,mdMenuCtrl:a,element:r,target:n[0]})},o.$mdOpenMenu=this.open,this.close=function(t){a.isOpen&&(a.isOpen=!1,i.setAttribute("aria-expanded","false"),e.hide(),t||n.children()[0].focus())},this.positionMode=function(){var e=(t.mdPositionMode||"target").split(" ");return 1==e.length&&e.push(e[0]),{left:e[0],top:e[1]}},this.offsets=function(){var e=(t.mdOffset||"0 0").split(" ").map(parseFloat);if(2==e.length)return{left:e[0],top:e[1]};if(1==e.length)return{top:e[0],left:e[0]};throw Error("Invalid offsets specified. Please follow format or ")}}t.module("material.components.menu",["material.core","material.components.backdrop"]).directive("mdMenu",e).controller("mdMenuCtrl",n),e.$inject=["$mdMenu"],n.$inject=["$mdMenu","$attrs","$element","$scope"]}(),function(){function o(o){function r(o,r,a,d,c,l){function m(e,n,i){function l(){if(!i.target)throw Error("$mdMenu.show() expected a target to animate from in options.target");t.extend(i,{alreadyOpen:!1,isRemoved:!1,target:t.element(i.target),parent:t.element(i.parent),menuContentEl:t.element(n[0].querySelector("md-menu-content")),backdrop:i.hasBackdrop&&a.createBackdrop(e,"md-menu-backdrop md-click-catcher")})}function m(){i.resizeFn=function(){f(n,i)},t.element(r).on("resize",i.resizeFn),t.element(r).on("orientationchange",i.resizeFn)}function u(){i.parent.append(n),n.removeClass("md-leave"),o(function(){o(function(){f(n,i),o(function(){n.addClass("md-active"),i.alreadyOpen=!0,n[0].style[c.CSS.TRANSFORM]=""})})})}function p(){n.addClass("md-clickable"),i.backdrop&&i.backdrop.on("click",function(t){t.preventDefault(),t.stopPropagation(),e.$apply(function(){i.mdMenuCtrl.close(!0)})}),i.menuContentEl.on("keydown",function(t){e.$apply(function(){switch(t.keyCode){case c.KEY_CODE.ESCAPE:i.mdMenuCtrl.close();break;case c.KEY_CODE.UP_ARROW:s(t,i.menuContentEl,i,-1);break;case c.KEY_CODE.DOWN_ARROW:s(t,i.menuContentEl,i,1)}})});var t=function(t){function n(){e.$apply(function(){i.mdMenuCtrl.close()})}function o(e,t){if(!e)return!1;for(var n,o=0;n=t[o];++o)for(var r,i=[n,"data-"+n,"x-"+n],a=0;r=i[a];++a)if(e.hasAttribute(r))return!0;return!1}var r=t.target;do{if(r==i.menuContentEl[0])return;if(o(r,["ng-click","ng-href","ui-sref"])){r.hasAttribute("disabled")||n();break}}while(r=r.parentNode)};i.menuContentEl[0].addEventListener("click",t,!0);var o=i.menuContentEl[0].querySelector("[md-menu-focus-target]");return o||(o=i.menuContentEl[0].firstElementChild.firstElementChild),o.focus(),function(){n.removeClass("md-clickable"),i.backdrop.off("click"),i.menuContentEl.off("keydown"),i.menuContentEl[0].removeEventListener("click",t,!0)}}return l(i),d.inherit(i.menuContentEl,i.target),m(),i.disableParentScroll&&(i.restoreScroll=a.disableScrollAround(i.element)),i.backdrop&&(d.inherit(i.backdrop,i.parent),i.parent.append(i.backdrop)),u(),h.waitTransitionEnd(n,{timeout:370})["finally"](function(e){return i.cleanupInteraction=p(),e})}function s(e,t,n,o){for(var r=a.getClosest(e.target,"MD-MENU-ITEM"),i=a.nodesToArray(t[0].children),d=i.indexOf(r),c=d+o;c>=0&&c
',compile:n}}t.module("material.components.progressCircular",["material.core"]).directive("mdProgressCircular",e),e.$inject=["$mdConstant","$mdTheming"]}(),function(){function e(e,o,r){function i(e,t,n){return e.attr("aria-valuemin",0),e.attr("aria-valuemax",100),e.attr("role","progressbar"),a}function a(i,a,c){r(a);var l=a[0].querySelector(".md-bar1").style,m=a[0].querySelector(".md-bar2").style,s=t.element(a[0].querySelector(".md-container"));c.$observe("value",function(e){if("query"!=c.mdMode){var t=d(e);a.attr("aria-valuenow",t),m[o.CSS.TRANSFORM]=n[t]}}),c.$observe("mdBufferValue",function(e){l[o.CSS.TRANSFORM]=n[d(e)]}),e(function(){s.addClass("md-ready")})}function d(e){return e>100?100:0>e?0:Math.ceil(e||0)}return{restrict:"E",template:'
',compile:i}}t.module("material.components.progressLinear",["material.core"]).directive("mdProgressLinear",e),e.$inject=["$$rAF","$mdConstant","$mdTheming"];var n=function(){function e(e){var t=e/100,n=(e-100)/2;return"translateX("+n.toString()+"%) scale("+t.toString()+", 1)"}for(var t=new Array(101),n=0;101>n;n++)t[n]=e(n);return t}()}(),function(){function e(e,n,o,r){function i(i,a,d,c){function l(){a.hasClass("md-focused")||a.addClass("md-focused")}function m(o){var r=o.which||o.keyCode;switch(r){case n.KEY_CODE.LEFT_ARROW:case n.KEY_CODE.UP_ARROW:o.preventDefault(),s.selectPrevious(),l();break;case n.KEY_CODE.RIGHT_ARROW:case n.KEY_CODE.DOWN_ARROW:o.preventDefault(),s.selectNext(),l();break;case n.KEY_CODE.ENTER:var i=t.element(e.getClosest(a[0],"form"));i.length>0&&i.triggerHandler("submit")}}o(a);var s=c[0],u=c[1]||e.fakeNgModel();s.init(u),i.mouseActive=!1,a.attr({role:"radiogroup",tabIndex:a.attr("tabindex")||"0"}).on("keydown",m).on("mousedown",function(e){i.mouseActive=!0,r(function(){i.mouseActive=!1},100)}).on("focus",function(){i.mouseActive===!1&&s.$element.addClass("md-focused")}).on("blur",function(){s.$element.removeClass("md-focused")})}function a(e){this._radioButtonRenderFns=[],this.$element=e}function d(){return{init:function(e){this._ngModelCtrl=e,this._ngModelCtrl.$render=t.bind(this,this.render)},add:function(e){this._radioButtonRenderFns.push(e)},remove:function(e){var t=this._radioButtonRenderFns.indexOf(e);-1!==t&&this._radioButtonRenderFns.splice(t,1)},render:function(){this._radioButtonRenderFns.forEach(function(e){e()})},setViewValue:function(e,t){this._ngModelCtrl.$setViewValue(e,t),this.render()},getViewValue:function(){return this._ngModelCtrl.$viewValue},selectNext:function(){return c(this.$element,1)},selectPrevious:function(){return c(this.$element,-1)},setActiveDescendant:function(e){this.$element.attr("aria-activedescendant",e)}}}function c(n,o){var r=e.iterator(n[0].querySelectorAll("md-radio-button"),!0);if(r.count()){var i=function(e){return!t.element(e).attr("disabled")},a=n[0].querySelector("md-radio-button.md-checked"),d=r[0>o?"previous":"next"](a,i)||r.first();t.element(d).triggerHandler("click")}}return a.prototype=d(),{restrict:"E",controller:["$element",a],require:["mdRadioGroup","?ngModel"],link:{pre:i}}}function n(e,t,n){function o(o,i,a,d){function c(e){i[0].hasAttribute("disabled")||o.$apply(function(){d.setViewValue(a.value,e&&e.type)})}function l(){var e=d.getViewValue()==a.value;e!==s&&(s=e,i.attr("aria-checked",e),e?(i.addClass(r),d.setActiveDescendant(i.attr("id"))):i.removeClass(r))}function m(n,o){function r(){return a.id||"radio_"+t.nextUid()}o.ariaId=r(),n.attr({id:o.ariaId,role:"radio","aria-checked":"false"}),e.expectWithText(n,"aria-label")}var s;n(i),m(i,o),d.add(l),a.$observe("value",l),i.on("click",c).on("$destroy",function(){d.remove(l)})}var r="md-checked";return{restrict:"E",require:"^mdRadioGroup",transclude:!0,template:'
',link:o}}t.module("material.components.radioButton",["material.core"]).directive("mdRadioGroup",e).directive("mdRadioButton",n),e.$inject=["$mdUtil","$mdConstant","$mdTheming","$timeout"],n.$inject=["$mdAria","$mdUtil","$mdTheming"]}(),function(){function e(e,o,r,i,a,d,c){function l(a,l){var m=t.element("");if(m.append(''),m.addClass("md-select-value"),m[0].hasAttribute("id")||m.attr("id","select_value_label_"+o.nextUid()),a.find("md-content").length||a.append(t.element("").append(a.contents())),l.mdOnOpen&&a.find("md-content").prepend(t.element("").attr("md-mode","indeterminate").attr("ng-hide","$$loadingAsyncDone").wrap("
").parent()),l.name){var s=t.element(',