出生医学证明有什么用| 采是什么意思| 麂皮绒是什么材质| 举不胜举的举是什么意思| 什么是文科| rainbow什么意思| 胃酸烧心吃什么药可以根治| 肚子胀气吃什么通气| 女人白带多是什么原因| 虎父无犬子什么意思| 蛇肉吃了有什么好处| 起酥油是什么| 双顶径是指什么| 看破不说破什么意思| 南辕北辙的意思是什么| 什么是感光食物| 想起我叫什么了吗| 彻夜难眠什么意思| 胰岛素抵抗有什么症状| 手术前吃什么补充营养| 爆菊花什么感觉| 什么地流淌| 8月18日什么星座| 木加号读什么| 九九重阳节是什么意思| 疱疹吃什么药好| 月经来了头疼是什么原因导致的| 女人腿肿是什么原因引起的| 买手店是什么意思| 1994年出生属什么| 坏血病是什么| 梦见自己得了重病预示什么| 倚老卖老什么意思| 4a广告公司什么意思| 05是什么生肖| 甲状腺1度肿大是什么意思| 74岁属什么生肖| 蒙字五行属什么| 什么叫真菌| 胃痉挛吃什么药| 氧化钙是什么| 油腔滑调指什么生肖| 便秘吃什么食物| sad是什么意思| 乔字五行属什么| 处女男和什么星座最配| 胆没了对身体有什么影响| 给朋友送什么礼物好| 小青龙是什么龙虾| 董酒是什么香型| 女人为什么会阳虚| 者是什么意思| 金黄色葡萄球菌是什么菌| 归元寺求什么最灵验| 妇科检查bv是什么意思| 闰月年有什么讲究| 统招生是什么意思| 踏雪寻梅是什么意思| 单剂量给药是什么意思| 产后为什么脸部松弛| 七十岁老人装什么牙合适| 专硕和学硕有什么区别| 人大常委会副主任是什么级别| 出球小动脉流什么血| 嘴唇发紫是什么原因引起的| 黑猫警长为什么只有5集| 脂肪粒是什么| 晕车是什么原因引起的| 91年的羊是什么命| 兆后面的单位是什么| 肾虚吃什么中成药| 清油是什么油| 夏天喝什么汤最好| 酸梅是什么水果| 诺如病毒拉的大便是什么样的| 中国的四大发明是什么| 十八反是什么意思| 什么含钾最多| 皮肤有白点是什么原因| 头昏是什么原因引起的| 血液由什么和什么组成| hicon是什么牌子| 什么油最好| pearl什么意思| 加味逍遥丸和逍遥丸有什么区别| 己巳是什么意思| 孕妇感冒了对胎儿有什么影响| 梦见对象出轨什么征兆| 圻字五行属什么| 前列腺增生吃什么药效果最好| 结膜出血用什么眼药水| 公主病是什么意思| 药师什么时候报名| 哀嚎是什么意思| 脑溢血有什么症状| 吃什么排铅最快| 冠心病吃什么水果| 看到刺猬有什么预兆| 泰坦尼克号什么时候上映的| 卡号是什么| cac是什么意思| 上海市长什么级别| 梦见自己被抢劫了预示什么| 鱼平念什么| 肝火旺吃什么降火最快| ptsd是什么| 多尔衮是什么意思| 什么叶子| 活血化瘀吃什么| pm是什么| 擦什么能阻止毛发生长| 中秋送什么| jeep衣服什么档次| 孕激素是什么| 动力是什么意思| 11.5是什么星座| 母亲节送母亲什么礼物| 双鱼配什么星座| 什么虫子咬了会起水泡| 戴银首饰对身体有什么好处| 晚上睡觉手麻是什么原因| 花匠是什么意思| 吃什么消除肺部结节| 去乙酰毛花苷又叫什么| 嘴苦是什么原因引起的| 浑圆是什么意思| 喜欢的反义词是什么| 为什么一个月来两次姨妈| 大枕大池有什么危害| 10月16日什么星座| 八卦中代表雷的卦象叫什么| 8000年前是什么朝代| 学分是什么意思| 什么的飞翔| 变爻是什么意思| sub是什么意思| 跑酷是什么运动| 查肾功能挂什么科| 善良是什么| 腰扭伤了挂什么科| 颈椎病挂什么科| 黑玫瑰代表什么意思| 梦见好多肉是什么意思| 放的屁很臭是什么原因| 小孩爱吃手指头是什么原因| 32岁属什么| 日本为什么偷袭珍珠港| 双肺条索是什么意思| 361是什么意思| 1926年属什么生肖| 红酒配什么菜| 肾虚吃什么药好| 去离子水是什么| 彩超无回声是什么意思| 痔疮有什么症状| 小孩子睡觉磨牙是什么原因| 梦见盖房子什么意思| 许冠杰属什么生肖| 胃胀消化不好吃什么药| 心肌缺血吃什么药好| 腿肿吃什么药消肿最快最有效| 咳嗽有白痰是什么原因| 肚子胀不排便什么原因| 道歉送什么花| pa66是什么材料| 女人大腿内侧黑是什么原因引起的| 谷草谷丙偏高是什么意思| 怀孕会有什么反应| 主动脉夹层是什么病| 落差是什么意思| 经常胸闷是什么原因| 其可以组什么词| 雅漾喷雾有什么功效| 中老年补钙吃什么钙片好| 公安局属于什么机关| 手指甲软薄是缺什么| 粤语点解什么意思| 补钙吃什么维生素| 脸上长白斑是什么原因引起的| 舌苔红是什么原因| 千斤拔泡酒有什么功效| 皮脂腺囊肿看什么科| 为什么会长白头发| 区委常委是什么级别| 国师是什么职位| 梦到父母离婚是什么意思| 婴儿为什么喜欢趴着睡| 履新是什么意思| 说话不清楚去医院挂什么科| 什么是白噪音| hpv有什么症状吗| 强的松又叫什么| 淋巴细胞比率偏高是什么原因| 儿加一笔是什么字| 房水是什么| c6是什么| 小孩支气管炎吃什么药| 什么是近视| 复方木尼孜其颗粒治什么病| 肝内胆管结石有什么症状表现| 飞蚊症是什么| 肌酐高说明什么问题| 考研复试考什么| 什么开什么笑| 梦见出国了是什么意思| 侧颜杀是什么意思| 30周做什么检查| 肺炎不能吃什么| 阴阳两虚吃什么中成药| 脚踝肿是什么病| 大人有大量是什么意思| 清晨醒来口苦是什么原因| 有甲状腺结节不能吃什么| 八嘎呀路是什么意思| 牛的尾巴有什么作用| 男生下面长什么样| 脚底长鸡眼是什么原因| 血液凝固快是什么原因| 爆竹声中一岁除下一句是什么| 缺钙吃什么食物| 菊花有什么颜色| he是什么气体| 禄蠹是什么意思| 近视眼镜是什么镜| 南非叶主治什么病| 梦到洗衣服是什么意思| 加特纳菌阳性是什么病| lym是什么意思| 什么是种植牙| 飞机不能带什么东西| 水洗标是什么| 产检建档需要什么资料| 舒筋健腰丸为什么这么贵| 为什么刚小便完又有尿意| 磁共振是检查什么| 碧绿的什么| 太学是什么意思| 什么星座最好| 血糖高能吃什么食物| pick是什么意思| 吃土豆有什么好处和坏处| 葡萄籽有什么功效| 腮帮子疼吃什么药| 吃皮是什么意思| 自在什么意思| 什么是绝对值| 早上八点到九点属于什么时辰| 尿液是什么味道| 怀孕上火吃什么降火| maby什么意思| 冬天有什么花| 北京朝阳医院擅长什么| 实则是什么意思| 什么是血氧| 盆腔炎吃什么药有效| 先天性聋哑病属于什么遗传病| 雌二醇高说明什么原因| 冰镇情人果是什么水果| 渣渣辉什么意思| 肌酐测定低是什么意思| 梦见插秧是什么意思| 吃什么能长胖| 花团锦簇什么意思| 藜麦是什么东西| 百度

买车置换是什么意思

百度 它在SAE自动驾驶车标准上处于第二级,但它仍然可以帮助驾驶者减少长时间高速公路开车疲劳,它希望到2022年在20个不同的市场上推出配备ProPilot技术的20款车型。

Documentation for this module may be created at Module:Math/doc

--[[

This module provides a number of basic mathematical operations.

]]

local yesno = require('Module:Yesno')
local getArgs = require('Module:Arguments').getArgs

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 applyFuncToArgs(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

--[[
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 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 function maxOfTwo(a, b)
		if a > b then
			return a
		else
			return b
		end
	end
	local max_value = applyFuncToArgs(maxOfTwo, ...)
	if max_value then
		return max_value
	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 function minOfTwo(a, b)
		if a < b then
			return a
		else
			return b
		end
	end
	local min_value = applyFuncToArgs(minOfTwo, ...)
	if min_value then
		return min_value
	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 function getSum(a, b)
		return a + b
	end
	local sum, count = applyFuncToArgs(getSum, ...)
	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

--[[
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 = applyFuncToArgs(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
		orig_precision = p._precision(value_string)
		if order + orig_precision >= 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

--[[
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 frame = mw.getCurrentFrame()
		local attempt = frame:preprocess('{{#expr: ' .. number_string .. '}}')
		attempt = tonumber(attempt)
		if attempt ~= nil then
			number = attempt
			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 function makeWrapper(funcName)
	return function (frame)
		local args = getArgs(frame) -- Argument processing is left to Module:Arguments. Whitespace is trimmed and blank arguments are removed.
		return wrap[funcName](args)
	end
end

for funcName in pairs(wrap) do
	p[funcName] = makeWrapper(funcName)
end

return p
拉肚子是什么原因引起的怎么办 清热利湿是什么意思 荷花什么季节开 鳊鱼吃什么食物 转氨酶高是什么问题
为什么老是犯困想睡觉 吃什么东西涨奶最快 稳是什么意思 京东发什么快递 白醋和小苏打一起用起什么效果
沙砾是什么意思 bun什么意思 司马迁属什么生肖 野餐带什么 脚心发痒是什么原因
吴亦凡什么学历 左氧氟沙星治什么病 手术后为什么不让睡觉 金鱼吃什么食物 濒危是什么意思
肛裂出血用什么药hcv9jop5ns0r.cn 肛周脓肿吃什么消炎药hcv9jop7ns3r.cn 发烧骨头疼是什么原因hcv9jop1ns8r.cn 长疣是什么原因hcv8jop1ns6r.cn lookbook是什么意思hcv8jop8ns7r.cn
糯米是什么米inbungee.com 老年人全身无力是什么原因hcv8jop7ns8r.cn 一什么羊hcv8jop0ns2r.cn 吃什么可以让胸部变大tiangongnft.com 血常规红细胞偏高是什么原因hkuteam.com
股癣用什么药膏最好hcv8jop7ns5r.cn au是什么金属adwl56.com 处长是什么级别hcv9jop4ns9r.cn 夏天吃什么蔬菜hcv9jop4ns9r.cn 浑浊是什么意思hcv7jop9ns1r.cn
金钱草长什么样子图片hcv8jop9ns8r.cn 电镀是做什么的hcv8jop9ns4r.cn 肠息肉是什么原因造成的hcv8jop3ns0r.cn 什么是潮汐车道hcv8jop9ns6r.cn becky是什么意思hcv8jop0ns0r.cn
百度