白细胞异常是什么原因| 猫咪结膜炎用什么药好| 铜绿假单胞菌用什么抗生素| 什么是花胶| 疼痛科属于什么科| 经血粉红色是什么原因| 地主之谊是什么意思| 梦见别人家盖房子是什么意思| 什么原因导致荨麻疹| 月经结束一周后又出血是什么原因| 八格牙路是什么意思| 焦糖是什么糖| 肾结石要注意什么| 胎心不稳定是什么原因| 中药什么时间喝效果最好| 腹泻拉水是什么原因| 右边肋骨疼是什么原因| 北加田加共是什么字| 滚球是什么意思| 感冒是什么原因引起的| 脑电图是检查什么的| 思密达韩语是什么意思| hpv81低危型阳性是什么意思| 什么是舒张压和收缩压| 六角龙鱼吃什么| 喝柠檬茶有什么好处| 河豚是什么| 被马蜂蛰了用什么药| 唐卡是什么材料做的| 12五行属什么| 嘴苦是什么原因造成的| 肝掌是什么样子| 什么是偏财| 医生说宝宝趴着在暗示着什么| 喝什么降尿酸| 不什么而什么| 干黄酱是什么酱| lof是什么基金| 下眼睑肿胀是什么原因| 锻练与锻炼有什么区别| 笙字五行属什么| 下巴脱臼是什么感觉| 鸽子不能和什么一起吃| 肚子疼是什么原因引起的| 该说不说的是什么意思| 心如所愿的意思是什么| 什么是水象星座| 静谧是什么意思| 钾高吃什么可以降下来| 胃不舒服可以吃什么水果| 十二月二号是什么星座| 普工是什么| 提携是什么意思| 本命年犯太岁什么意思| 后天是什么日子| 小孩下半夜咳嗽是什么原因| 囊肿是什么病| 婆婆妈妈什么意思| 裂孔疝是什么病| 疤痕增生是什么样子| px是什么| palace是什么牌子| 砖茶是什么茶| 眼睛吹风就流泪是什么原因| 鸡汤放什么调料| 心肌梗塞是什么原因造成的| 阑尾炎属于什么科室| 什么的城楼| 为什么晚上血压比白天高| 什么是顺时针| 戒指中指代表什么意思| 高烧吃什么药退烧快| 不10是什么意思| 感冒咳嗽吃什么药好| 11月13日什么星座| 血瘀吃什么药| 肠易激综合征吃什么中成药| 什么样的水果| 西米是什么做成的| 绞丝旁一个奇念什么| 属狗是什么命| 勾践属什么生肖| 顺遂是什么意思| 农历十月是什么月| 支气管炎吃什么药好得快| 小马是什么牌子| 妊娠囊是什么| 蛋白质是什么| 包拯属什么生肖| 逸五行属什么| epa是什么营养物质| 梦见被追杀是什么预兆| 病理性骨折是什么意思| 酒酿蛋什么时候吃效果最好| 房奴什么意思| 扑街是什么意思| 阙是什么意思| 羊水穿刺是查什么的| 天德合是什么意思| 3月26日是什么节日| 什么叫克隆| 正月初一是什么节日| 什么地点头| 什么叫npc| 庚日是什么意思啊| 吃猪心有什么好处和坏处| 温饱是什么意思| 革兰阴性杆菌是什么| 梦见别人过生日是什么意思| 梦见男朋友出轨了是什么意思| 12月出生是什么星座| 怀孕可以喝什么饮料| 降调针什么时候打| 马岱字什么| 皮肤痒有什么特效药| hp代表什么意思| 承认是什么意思| 7月30日是什么日子| 唯利是图是什么生肖| palladium是什么牌子| 经期吃什么让血量增加| 衬衫配什么裤子好看| iga是什么| 乳糖不耐受可以喝什么奶| 唇红是什么原因| 什么功高| g1p1是什么意思| notice是什么意思| 晚上睡不着是什么原因引起的| 绿豆不能跟什么一起吃| 治甲沟炎用什么药膏好| 农历3月3是什么节日| 蓝桉什么意思| 气虚吃什么| 小狗需要打什么疫苗| 2月20是什么星座| 喜大普奔是什么意思| 3月16号是什么星座的| 良性反应性改变是什么意思| 什么是三焦| 血糖高可以吃什么零食| 高就是什么意思| 副县长是什么级别| 急性呼吸道感染是什么引起的| 炮烙之刑是什么意思| 南北杏和什么煲汤止咳化痰| 中东是什么意思| 葛根主治什么病| 什么粉一沾就痒还看不出来| 社康是什么| 六月种什么菜| 梦见牙掉了一颗是什么意思| 肾是干什么用的| 氨水是什么东西| 牡丹花是什么颜色的| ufo是什么意思| 睡觉一直做梦是什么原因| 木耳菜不能和什么一起吃| 摘胆对身体有什么影响| 阳暑吃什么药| 蛞蝓是什么动物| 红斑狼疮是一种什么病| 占便宜是什么意思| 不硬的原因是什么| 金卡有什么好处和坏处| 夹腿综合症是什么| 非甾体抗炎药是什么意思| 熬夜喝什么好| 新房开火有什么讲究| 因为我们没有什么不同| 今年是什么年庚| 六味地黄丸有什么副作用吗| 惠五行属什么| 诺氟沙星胶囊治什么病| 节育环嵌顿是什么意思| 阴虱长什么样子| 什么叫县级以上的医院| 做乳腺彩超挂什么科| 无痛人流后吃什么对身体恢复比较好| 什么是黑色素肿瘤| 脐橙什么意思| 类风湿吃什么药最有效| 疏肝理气是什么意思| 腰穿是什么意思| 来月经有异味什么原因| 肝疼是什么原因| 脂溢性皮炎是什么引起的| 任督二脉是什么意思| 布洛芬吃多了有什么后果| 痛风喝什么茶最好| 锡兵是什么意思| 吃什么药怀孕最快| 月建是什么意思| 试管婴儿什么价格| 无事不登三宝殿什么意思| 云南有什么好吃的| 青茶是什么茶| 面肌痉挛是什么原因引起的| 什么潭什么穴| 咳嗽打什么点滴效果好| 惨绿少年什么意思| 子宫前倾是什么意思| 一级甲等医院是什么意思| 耳鸣用什么药| 金蝉脱壳比喻什么| peg是什么意思| 牛皮癣用什么药膏最好| 银为什么会变黑| 7.31什么星座| lst是什么意思| 红烧肉是什么肉| 圣罗兰属于什么档次| 胆固醇高有什么症状| 银屑病是什么| 今年天热的原因是什么| 田园生活是什么意思| 神经官能症是什么| 雪花秀属于什么档次| 鳖吃什么食物| 什么是m属性| 老是想咳嗽是什么原因| 国防部长什么级别| 肠镜前一天吃什么| 孕期便秘吃什么通便快| 黑裙配什么颜色的上衣| 粘假牙用什么胶| 三观是什么| 什么运动使人脸部年轻| 梦见抽血是什么预兆| espresso什么意思| 闪卡是什么意思| 为什么一来月经就拉肚子| 额头上长痘是因为什么| 并蒂是什么意思| 秋是什么生肖| 梗犬是什么意思| 歹且念什么| 循序渐进是什么意思| 咸鱼是什么意思| 牛肉烧什么菜最好吃| 酒后吃什么水果好| 眼睛发黄什么原因| 胃经常胀气是什么原因| 釜底抽薪是什么计| 三个七念什么| 嘴唇红是什么原因| sby是什么意思| ab型血和b型血生的孩子是什么血型| 什么是阳痿| 红螺寺求什么最灵验| 什么是对称轴| 什么样的智齿需要拔| 为什么拉绿色的屎| 传播什么| 生物科技是做什么的| 小便分叉是什么症状| 消瘦是什么意思| 痛经吃什么止疼药| 突然耳朵疼是什么原因| spa是什么意思| 夏至吃什么传统美食| 4月29号是什么星座的| mint什么颜色| 脾胃虚弱吃什么食物好| 百度Pumunta sa nilalaman

雌激素低吃什么药

Mula sa Wikipedia, ang malayang ensiklopedya
百度 二、组织党员认真学习马克思列宁主义、毛泽东思想、邓小平理论和“三个代表”重要思想,学习科学发展观,学习党的路线、方针、政策和决议,学习党的基本知识,学习科学、文化、法律和业务知识。
--[[

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)
手上有湿疹是什么原因引起的 粉色代表什么 铁观音适合什么季节喝 吃东西感觉口苦是什么原因 右肾肾盂分离什么意思
早上跑步有什么好处 怀孕胸部会有什么反应 咖色搭配什么颜色好看 惊什么万什么 撇清关系是什么意思
芫荽是什么 疏肝解郁吃什么药 白带多用什么药 前呼后拥是什么意思 脚踩按摩垫有什么好处
霉菌性阴道炎用什么药最好 应收账款在贷方表示什么 6月份是什么季节 狮子吃什么食物 孕晚期吃什么好
牙疼吃什么药管用hcv9jop4ns1r.cn 脚后跟骨头疼是什么原因hcv9jop4ns3r.cn 过敏性紫癜是什么症状hcv8jop3ns8r.cn 大便阳性说明什么问题huizhijixie.com 主是什么结构的字体hcv8jop8ns7r.cn
cg什么意思bysq.com 检查血常规挂什么科hcv9jop8ns0r.cn 小满是什么季节hcv8jop5ns3r.cn 牛黄安宫丸什么季节吃yanzhenzixun.com 幽门螺杆菌有什么症状hcv8jop8ns8r.cn
观赏是什么意思hcv8jop3ns7r.cn 咳嗽发烧吃什么药hcv8jop9ns9r.cn 七月二十二什么日子hcv7jop5ns6r.cn 吸烟有害健康为什么国家还生产烟hcv8jop6ns3r.cn 秋葵吃了有什么好处hcv9jop0ns5r.cn
夏天吃什么蔬菜好hcv8jop6ns4r.cn 除氯是什么意思hcv9jop0ns1r.cn 什么是eb病毒hcv9jop0ns1r.cn 早上4点是什么时辰hcv8jop6ns0r.cn 教头菜有什么功效hcv8jop9ns0r.cn
百度