什么学习机好| 文武双全是什么意思| 中规中矩什么意思| 万圣节为什么要送糖果| 低聚果糖是什么东西| 蛋糕裙搭配什么上衣| ad吃到什么时候| 眼睛oct检查主要检查什么| 铁公鸡是什么意思| 夕火念什么| 喝冰美式有什么好处| 100分能上什么大学| 深水炸弹什么意思| 独守空房是什么意思| 任达华是什么生肖| 眼睛干涩发痒用什么药| 念珠菌用什么药| 硬脂酸镁是什么东西| 王八蛋是什么意思| 五行中什么生水| 蛋疼是什么原因引起的| 女人什么时候绝经| 三楼属于五行属什么| 引什么大叫| tiamo是什么意思| 恒牙是什么牙| 8月30号什么星座| 什么品牌的床好| 蜕变是什么意思| 1905年属什么生肖| 上半身皮肤痒什么原因| 白细胞和淋巴细胞偏高是什么原因| 2009年属什么生肖| mlf操作是什么意思| 舌头热灼是什么原因| 男人经常熬夜炖什么汤| 金牛座是什么星座| 水晶眼镜对眼睛有什么好处| kbs是什么意思| 滋阴补肾是什么意思| 颅内缺血灶是什么病症| 三和大神是什么意思| 沐五行属性是什么| 眼睛浮肿是什么原因| 甲状腺五类是什么意思| 失眠挂什么科| 飞机杯是什么意思| 什么叫有机蔬菜| 野趣是什么意思| 甲胎蛋白是什么| pet-ct主要检查什么| 有湿热吃什么中成药| 什么水果消炎| 苏醒是什么意思| 长期喝豆浆有什么好处和坏处| 起水泡痒是什么原因| 宫颈hsil是什么意思| 治疗呼吸道感染用什么药最好| 月经淋漓不尽什么原因| 地图舌吃什么好得快| 燕子每年从什么方飞往什么方过冬| 戒指上的s925是什么意思| 吃什么可以长胖| 退行性改变是什么意思| 富氢水是什么| 春天什么花会开| 日文上下结构念什么| 肠易激综合征是什么原因造成的| 林彪为什么叛变| 热伤风吃什么感冒药| 石斛起什么作用| 甲状腺低回声结节是什么意思| 爱的反义词是什么| 肯尼亚说什么语言| 上午8点是什么时辰| 睡觉出汗是什么原因| 血小板分布宽度低是什么原因| 蒲公英什么时候开花| 脚筋膜炎什么办法恢复的最快| 肛裂用什么药膏| 1985属什么| 孩子说话晚是什么原因是什么情况| 佛法是什么意思| 肾精亏虚是什么意思| 什么食物补肾| 乡长是什么级别| 焱字五行属什么| 白细胞介素是什么| 肌瘤是什么| 小孩头疼是什么原因| 喝水多尿多是什么原因| 剥皮实草是什么意思| ps医学上是什么意思| 双侧卵巢多囊样改变是什么意思| 孕囊是什么样的图片| 打火机的气体是什么| 女人绝经一般在什么年龄段| 吃维生素b1有什么好处和副作用| 暗送秋波是什么意思| 眼白发蓝是什么原因| 蚊虫叮咬过敏用什么药| 阳卦代表什么意思| 杨枝甘露是什么| 黄疸偏高有什么危害| 短效避孕药什么牌子好| 空调多少匹什么意思| 房产证和土地证有什么区别| 伊始什么意思| covu是什么药| 吃什么增加卵泡| 钱代表什么生肖| 梦见肉是什么意思| 绯闻是什么意思| 淡定从容是什么意思| 月经安全期是什么时候| 备孕要检查什么项目| 扁桃体发炎吃什么| 受凉感冒吃什么药| 牛油果是什么味道的| 乌龟代表什么数字| 地藏经适合什么人念| 印堂发黑是什么征兆| 两个夫一个车是什么字| la帽子是什么牌子| 腰间盘突出压迫神经腿疼吃什么药| 爱是什么歌曲| 什么生木| 骷髅头是什么牌子| 早孕什么意思| 葱长什么样| hpv疫苗是什么疫苗| 脖子长痘痘是因为什么原因| 人缺钾有什么症状| 郑声是什么意思| 白细胞低是什么意思| 发腮是什么意思| 凤雏是什么意思| 再三的意思是什么| 流鼻血看病挂什么科| 煞科什么意思| 立秋是什么时候| 脂肪肝吃什么药最好| 军长什么级别| 骨刺挂什么科| 炙子是什么意思| hospital是什么意思| 脚气用什么药膏效果好| 岁月无痕是什么意思| 一什么绳子| 下缘达宫颈内口是什么意思| 莹字五行属什么| 外援是什么意思| 西瓜不可以和什么同食| 前途是什么意思| 睡觉为什么磨牙| 眼睛干涩用什么眼药水| 口是什么意思| 祭坛是什么意思| 青岛有什么山| 拼图用什么软件| 漏斗胸是什么原因造成的| 梦见吃花生是什么意思| 婚姻宫是什么意思| 尿路感染是什么原因造成的| 准备要孩子需要注意什么| 促排药什么时候开始吃| 鹅蛋孕妇吃有什么好处| 离婚要什么手续和证件| 暴跳如雷是什么意思| 天秤座是什么星象| 颈椎病有什么特效药| 中图分类号是什么| 月底是什么时候| 梦见猫咪会有什么预兆| 什么是无期徒刑| 什么是色弱| 9月21号是什么日子| 法克油是什么意思| 人为什么有两个鼻孔| 低密度脂蛋白高是什么意思| 鳞状上皮增生是什么意思| 肾结石可以吃什么食物| 肾五行属什么| 谷氨酸高是什么原因| 规格是什么意思| 一箭双雕是指什么生肖| 康膜的功效是什么| 强身之道的强是什么意思| 拉烂屎是什么原因| 称谓是什么意思| 身体出现小红点是什么原因| 胆结石挂号挂什么科| 笑气是什么东西| 芒果过敏吃什么药| 清鱼是什么鱼| guou是什么牌子的手表| 男人有美人尖代表什么| 孕妇嗓子疼可以吃什么药| 梦到女儿丢了什么预兆| 澳门买什么最便宜| 埋汰什么意思| 肾积水吃什么药最好| 水平是什么意思| 害怕的近义词是什么| 头部麻木是什么征兆| 冰箱什么品牌最好| 色盲色弱是什么意思| 聚首一堂是指什么生肖| 撑台脚是什么意思| 11.24是什么星座| 嘴上起泡是什么原因| 猪肝吃多了有什么坏处| 疏肝解郁是什么意思| 十一月二十六是什么星座| 甲状腺有什么功能| 虾和什么相克| 金达克宁和达克宁有什么区别| 感冒有黄痰是什么原因| 狮子座什么性格| 肚子疼是什么原因| 湿疹是什么样子的| 一个月大的小狗吃什么| 成功是什么| 做梦梦到水是什么征兆| dvf是什么品牌| 孕妇吃什么好对胎儿好三个月前期| 2008年是属什么| 母亲节送什么花| 两面派是什么意思| 奔头是什么意思| 扁桃体发炎不能吃什么| 九牛一毛指什么生肖| 覆水难收什么意思| 屈光参差是什么意思| 去迪拜打工需要什么条件| 玻璃人是什么意思| 口若什么| 吃汉堡为什么要配可乐| 骨感是什么意思| 每天吃一个西红柿有什么好处| 去医院检查是否怀孕挂什么科| 吃什么水果对肺好| 下雨为什么会打雷闪电| 3m是什么意思| 巴扎是什么意思| 7月11号什么星座| 鹤膝风是什么病| 羊胡子疮用什么药膏| 老是肚子饿是什么原因| 压抑什么意思| 错构瘤是什么病| 胃窦炎吃什么药效果最好| 2018属什么生肖| 苍苍什么| 农历7月21日是什么星座| 兜底是什么意思| 脾胃虚寒吃什么药| 内痔用什么药治最好效果最快| 为什么睡觉总是做梦| 心脏变大是什么原因| 甲状腺是什么| 天妒英才是什么意思| 戒指中指代表什么意思| 心脏不大是什么意思| 百度Fara í innihald

共享电动车出现南航前湖校区,目前只在高校投放

úr Wikipediu, frjálsa alfr?eiritinu
百度 如果说一个人身无分文地来到纽约生活个几年就能练出一身的生存技能,那么一个想成功留在这里的实习生几个月就能被逼出一套纯粹的职业素养。

H?gt er ae búa til leiebeiningar fyrir tessa skriftu á Module:Math/doc

--[[

This module provides a number of basic mathematical operations.

]]

local yesno, getArgs -- lazily initialized

local p = {} -- Holds functions to be returned from #invoke, and functions to make available to other Lua modules.
local wrap = {} -- Holds wrapper functions that process arguments from #invoke. These act as intemediary between functions meant for #invoke and functions meant for Lua.

--[[
Helper functions used to avoid redundant code.
]]

local function err(msg)
	-- Generates wikitext error messages.
	return mw.ustring.format('<strong class="error">Formatting error: %s</strong>', msg)
end

local function unpackNumberArgs(args)
	-- Returns an unpacked list of arguments specified with numerical keys.
	local ret = {}
	for k, v in pairs(args) do
		if type(k) == 'number' then
			table.insert(ret, v)
		end
	end
	return unpack(ret)
end

local function makeArgArray(...)
	-- Makes an array of arguments from a list of arguments that might include nils.
	local args = {...} -- Table of arguments. It might contain nils or non-number values, so we can't use ipairs.
	local nums = {} -- Stores the numbers of valid numerical arguments.
	local ret = {}
	for k, v in pairs(args) do
		v = p._cleanNumber(v)
		if v then
			nums[#nums + 1] = k
			args[k] = v
		end
	end
	table.sort(nums)
	for i, num in ipairs(nums) do
		ret[#ret + 1] = args[num]
	end
	return ret
end

local function fold(func, ...)
	-- Use a function on all supplied arguments, and return the result. The function must accept two numbers as parameters,
	-- and must return a number as an output. This number is then supplied as input to the next function call.
	local vals = makeArgArray(...)
	local count = #vals -- The number of valid arguments
	if count == 0 then return
		-- Exit if we have no valid args, otherwise removing the first arg would cause an error.
		nil, 0
	end
	local ret = table.remove(vals, 1)
	for _, val in ipairs(vals) do
		ret = func(ret, val)
	end
	return ret, count
end

--[[
Fold arguments by selectively choosing values (func should return when to choose the current "dominant" value).
]]
local function binary_fold(func, ...)
	local value = fold((function(a, b) if func(a, b) then return a else return b end end), ...)
	return value
end

--[[
random

Generate a random number

Usage:
{{#invoke: Math | random }}
{{#invoke: Math | random | maximum value }}
{{#invoke: Math | random | minimum value | maximum value }}
]]

function wrap.random(args)
	local first = p._cleanNumber(args[1])
	local second = p._cleanNumber(args[2])
	return p._random(first, second)
end

function p._random(first, second)
	math.randomseed(mw.site.stats.edits + mw.site.stats.pages + os.time() + math.floor(os.clock() * 1000000000))
	-- math.random will throw an error if given an explicit nil parameter, so we need to use if statements to check the params.
	if first and second then
		if first <= second then -- math.random doesn't allow the first number to be greater than the second.
			return math.random(first, second)
		end
	elseif first then
		return math.random(first)
	else
		return math.random()
	end
end

--[[
order

Determine order of magnitude of a number

Usage:
{{#invoke: Math | order | value }}
]]

function wrap.order(args)
	local input_string = (args[1] or args.x or '0');
	local input_number = p._cleanNumber(input_string);
	if input_number == nil then
		return err('order of magnitude input appears non-numeric')
	else
		return p._order(input_number)
	end
end

function p._order(x)
	if x == 0 then return 0 end
	return math.floor(math.log10(math.abs(x)))
end

--[[
precision

Detemines the precision of a number using the string representation

Usage:
{{ #invoke: Math | precision | value }}
]]

function wrap.precision(args)
	local input_string = (args[1] or args.x or '0');
	local trap_fraction = args.check_fraction;
	local input_number;

	if not yesno then
		yesno = require('Module:Yesno')
	end
	if yesno(trap_fraction, true) then -- Returns true for all input except nil, false, "no", "n", "0" and a few others. See [[Module:Yesno]].
		local pos = string.find(input_string, '/', 1, true);
		if pos ~= nil then
			if string.find(input_string, '/', pos + 1, true) == nil then
				local denominator = string.sub(input_string, pos+1, -1);
				local denom_value = tonumber(denominator);
				if denom_value ~= nil then
					return math.log10(denom_value);
				end
			end
		end
	end

	input_number, input_string = p._cleanNumber(input_string);
	if input_string == nil then
		return err('precision input appears non-numeric')
	else
		return p._precision(input_string)
	end
end

function p._precision(x)
	if type(x) == 'number' then
		x = tostring(x)
	end
	x = string.upper(x)

	local decimal = x:find('%.')
	local exponent_pos = x:find('E')
	local result = 0;

	if exponent_pos ~= nil then
		local exponent = string.sub(x, exponent_pos + 1)
		x = string.sub(x, 1, exponent_pos - 1)
		result = result - tonumber(exponent)
	end

	if decimal ~= nil then
		result = result + string.len(x) - decimal
		return result
	end

	local pos = string.len(x);
	while x:byte(pos) == string.byte('0') do
		pos = pos - 1
		result = result - 1
		if pos <= 0 then
			return 0
		end
	end

	return result
end


--[[
max

Finds the maximum argument

Usage:
{{#invoke:Math| max | value1 | value2 | ... }}

Note, any values that do not evaluate to numbers are ignored.
]]

function wrap.max(args)
	return p._max(unpackNumberArgs(args))
end

function p._max(...)
	local max_value = binary_fold((function(a, b) return a > b end), ...)
	if max_value then
		return max_value
	end
end

--[[
median

Find the median of set of numbers

Usage:
{{#invoke:Math | median | number1 | number2 | ...}}
OR
{{#invoke:Math | median }}
]]

function wrap.median(args)
	return p._median(unpackNumberArgs(args))
end

function p._median(...)
	local vals = makeArgArray(...)
	local count = #vals
	table.sort(vals)

	if count == 0 then
		return 0
	end

	if p._mod(count, 2) == 0 then
		return (vals[count/2] + vals[count/2+1])/2
	else
		return vals[math.ceil(count/2)]
	end
end

--[[
min

Finds the minimum argument

Usage:
{{#invoke:Math| min | value1 | value2 | ... }}
OR
{{#invoke:Math| min }}

When used with no arguments, it takes its input from the parent
frame.  Note, any values that do not evaluate to numbers are ignored.
]]

function wrap.min(args)
	return p._min(unpackNumberArgs(args))
end

function p._min(...)
	local min_value = binary_fold((function(a, b) return a < b end), ...)
	if min_value then
		return min_value
	end
end

--[[
sum

Finds the sum

Usage:
{{#invoke:Math| sum | value1 | value2 | ... }}
OR
{{#invoke:Math| sum }}

Note, any values that do not evaluate to numbers are ignored.
]]

function wrap.sum(args)
	return p._sum(unpackNumberArgs(args))
end

function p._sum(...)
	local sums, count = fold((function(a, b) return a + b end), ...)
	if not sums then
		return 0
	else
		return sums
	end
end

--[[
average

Finds the average

Usage:
{{#invoke:Math| average | value1 | value2 | ... }}
OR
{{#invoke:Math| average }}

Note, any values that do not evaluate to numbers are ignored.
]]

function wrap.average(args)
	return p._average(unpackNumberArgs(args))
end

function p._average(...)
	local sum, count = fold((function(a, b) return a + b end), ...)
	if not sum then
		return 0
	else
		return sum / count
	end
end

--[[
round

Rounds a number to specified precision

Usage:
{{#invoke:Math | round | value | precision }}

--]]

function wrap.round(args)
	local value = p._cleanNumber(args[1] or args.value or 0)
	local precision = p._cleanNumber(args[2] or args.precision or 0)
	if value == nil or precision == nil then
		return err('round input appears non-numeric')
	else
		return p._round(value, precision)
	end
end

function p._round(value, precision)
	local rescale = math.pow(10, precision or 0);
	return math.floor(value * rescale + 0.5) / rescale;
end

--[[
log10

returns the log (base 10) of a number

Usage:
{{#invoke:Math | log10 | x }}
]]

function wrap.log10(args)
	return math.log10(args[1])
end

--[[
mod

Implements the modulo operator

Usage:
{{#invoke:Math | mod | x | y }}

--]]

function wrap.mod(args)
	local x = p._cleanNumber(args[1])
	local y = p._cleanNumber(args[2])
	if not x then
		return err('first argument to mod appears non-numeric')
	elseif not y then
		return err('second argument to mod appears non-numeric')
	else
		return p._mod(x, y)
	end
end

function p._mod(x, y)
	local ret = x % y
	if not (0 <= ret and ret < y) then
		ret = 0
	end
	return ret
end

--[[
gcd

Calculates the greatest common divisor of multiple numbers

Usage:
{{#invoke:Math | gcd | value 1 | value 2 | value 3 | ... }}
--]]

function wrap.gcd(args)
	return p._gcd(unpackNumberArgs(args))
end

function p._gcd(...)
	local function findGcd(a, b)
		local r = b
		local oldr = a
		while r ~= 0 do
			local quotient = math.floor(oldr / r)
			oldr, r = r, oldr - quotient * r
		end
		if oldr < 0 then
			oldr = oldr * -1
		end
		return oldr
	end
	local result, count = fold(findGcd, ...)
	return result
end

--[[
precision_format

Rounds a number to the specified precision and formats according to rules
originally used for {{template:Rnd}}.  Output is a string.

Usage:
{{#invoke: Math | precision_format | number | precision }}
]]

function wrap.precision_format(args)
	local value_string = args[1] or 0
	local precision = args[2] or 0
	return p._precision_format(value_string, precision)
end

function p._precision_format(value_string, precision)
	-- For access to Mediawiki built-in formatter.
	local lang = mw.getContentLanguage();

	local value
	value, value_string = p._cleanNumber(value_string)
	precision = p._cleanNumber(precision)

	-- Check for non-numeric input
	if value == nil or precision == nil then
		return err('invalid input when rounding')
	end

	local current_precision = p._precision(value)
	local order = p._order(value)

	-- Due to round-off effects it is neccesary to limit the returned precision under
	-- some circumstances because the terminal digits will be inaccurately reported.
	if order + precision >= 14 then
		if order + p._precision(value_string) >= 14 then
			precision = 13 - order;
		end
	end

	-- If rounding off, truncate extra digits
	if precision < current_precision then
		value = p._round(value, precision)
		current_precision = p._precision(value)
	end

	local formatted_num = lang:formatNum(math.abs(value))
	local sign

	-- Use proper unary minus sign rather than ASCII default
	if value < 0 then
		sign = '?'
	else
		sign = ''
	end

	-- Handle cases requiring scientific notation
	if string.find(formatted_num, 'E', 1, true) ~= nil or math.abs(order) >= 9 then
		value = value * math.pow(10, -order)
		current_precision = current_precision + order
		precision = precision + order
		formatted_num = lang:formatNum(math.abs(value))
	else
		order = 0;
	end
	formatted_num = sign .. formatted_num

	-- Pad with zeros, if needed
	if current_precision < precision then
		local padding
		if current_precision <= 0 then
			if precision > 0 then
				local zero_sep = lang:formatNum(1.1)
				formatted_num = formatted_num .. zero_sep:sub(2,2)

				padding = precision
				if padding > 20 then
					padding = 20
				end

				formatted_num = formatted_num .. string.rep('0', padding)
			end
		else
			padding = precision - current_precision
			if padding > 20 then
				padding = 20
			end
			formatted_num = formatted_num .. string.rep('0', padding)
		end
	end

	-- Add exponential notation, if necessary.
	if order ~= 0 then
		-- Use proper unary minus sign rather than ASCII default
		if order < 0 then
			order = '?' .. lang:formatNum(math.abs(order))
		else
			order = lang:formatNum(order)
		end

		formatted_num = formatted_num .. '<span style="margin:0 .15em 0 .25em">×</span>10<sup>' .. order .. '</sup>'
	end

	return formatted_num
end

--[[
divide

Implements the division operator

Usage:
{{#invoke:Math | divide | x | y | round= | precision= }}

--]]
function wrap.divide(args)
	local x = args[1]
	local y = args[2]
	local round = args.round
	local precision =  args.precision
	if not yesno then
		yesno = require('Module:Yesno')
	end
	return p._divide(x, y, yesno(round), precision)
end

function p._divide(x, y, round, precision)
	if y == nil or y == "" then
		return err("Empty divisor")
	elseif not tonumber(y) then
		if type(y) == 'string' and string.sub(y, 1, 1) == '<' then
			return y
		else
			return err("Not a number: " .. y)
		end
	elseif x == nil or x == "" then
		return err("Empty dividend")
	elseif not tonumber(x) then
		if type(x) == 'string' and string.sub(x, 1, 1) == '<' then
			return x
		else
			return err("Not a number: " .. x)
		end
	else
		local z = x / y
		if round then
			return p._round(z, 0)
		elseif precision then
			return p._round(z, precision)
		else
			return z	
		end
	end
end

--[[
Helper function that interprets the input numerically.  If the
input does not appear to be a number, attempts evaluating it as
a parser functions expression.
]]

function p._cleanNumber(number_string)
	if type(number_string) == 'number' then
		-- We were passed a number, so we don't need to do any processing.
		return number_string, tostring(number_string)
	elseif type(number_string) ~= 'string' or not number_string:find('%S') then
		-- We were passed a non-string or a blank string, so exit.
		return nil, nil;
	end

	-- Attempt basic conversion
	local number = tonumber(number_string)

	-- If failed, attempt to evaluate input as an expression
	if number == nil then
		local success, result = pcall(mw.ext.ParserFunctions.expr, number_string)
		if success then
			number = tonumber(result)
			number_string = tostring(number)
		else
			number = nil
			number_string = nil
		end
	else
		number_string = number_string:match("^%s*(.-)%s*$") -- String is valid but may contain padding, clean it.
		number_string = number_string:match("^%+(.*)$") or number_string -- Trim any leading + signs.
		if number_string:find('^%-?0[xX]') then
			-- Number is using 0xnnn notation to indicate base 16; use the number that Lua detected instead.
			number_string = tostring(number)
		end
	end

	return number, number_string
end

--[[
Wrapper function that does basic argument processing. This ensures that all functions from #invoke can use either the current
frame or the parent frame, and it also trims whitespace for all arguments and removes blank arguments.
]]

local mt = { __index = function(t, k)
	return function(frame)
		if not getArgs then
			getArgs = require('Module:Arguments').getArgs
		end
		return wrap[k](getArgs(frame))  -- Argument processing is left to Module:Arguments. Whitespace is trimmed and blank arguments are removed.
	end
end }

return setmetatable(p, mt)
什么情况下需要切除子宫 免疫力下降吃什么好 肩袖损伤吃什么药效果最好 7月11日什么星座 ercp是什么
啤酒花是什么东西 九头鸟是什么意思 药店属于什么单位性质 下午六点多是什么时辰 三岁宝宝喝什么奶粉比较好
投诉医院打什么电话 喇叭裤配什么上衣 生化是什么原因引起的 子宫腺肌症吃什么药 精分是什么意思
长痔疮有什么症状 尿酸520属于什么水平 桃胶和什么相克 玄青色是什么颜色 南昌有什么好玩的地方
rsl是什么意思hcv9jop5ns3r.cn 梦见情人是什么意思啊hcv8jop9ns5r.cn 火钳刘明什么意思hcv7jop6ns0r.cn 成双成对是什么数字hcv8jop7ns1r.cn 来大姨妈喝红糖水有什么作用wzqsfys.com
对药物过敏是什么症状hcv7jop9ns8r.cn 心塞是什么意思hcv8jop4ns9r.cn 湿疹是什么病的前兆hcv8jop0ns8r.cn 春天有什么动物hcv9jop2ns7r.cn 爱而不得是什么意思hcv8jop8ns9r.cn
外阴溃烂用什么药hcv9jop5ns8r.cn 电动轮椅什么牌子质量好1949doufunao.com 乳房疼挂什么科室hcv9jop3ns1r.cn 肛门疼是什么原因mmeoe.com 为什么不建议光子嫩肤kuyehao.com
精液是什么味道的hcv9jop2ns2r.cn 止血芳酸又叫什么名hcv8jop3ns4r.cn 金目念什么hcv9jop4ns8r.cn 肚脐下三寸是什么位置hcv8jop3ns6r.cn 头汗多是什么原因引起的hcv9jop5ns4r.cn
百度