//#xdocFUNC1<丸め,床と天井の内近い方,指定した値を基準にして、階の高さ PARAM(unit) を以て> //#xdocP_Unit<丸め> //#xdocP_Offset<丸め> public static type RoundOffset(type value, type unit, type offset) { return(CONC(roud, type)("#(value-offset)/unit#") * unit + offset); }
//#xdocFUNC1<丸め,床と天井の内近い方,階の高さ PARAM(unit) を以て> //#xdocP_Unit<丸め> public static type Round(type value, type unit) { return(CONC(roud, type)(value / unit) * unit); }
//#xdocFUNC1<丸め,床と天井の内近い方,指定した値を基準にして> //#xdocP_Offset<丸め> public static type RoundOffset(type value, type offset) { return(CONC(roud, type)(value - offset) + offset); }
//#xdocFUNC1<床,その数以下の最大の (offset + PARAM(unit) の倍数) ##,指定した値を基準にして、階の高さ PARAM(unit) を以て> //#xdocP_Unit<床> //#xdocP_Offset<床> public static type FloorOffset(type value, type unit, type offset) { return(CONC(flor, type)("#(value-offset)/unit#") * unit + offset); }
//#xdocFUNC1<丸め,床と天井の内近い方> public static type Round(type value) { return(CONC(roud, type)(value)); }
//#xdocFUNC1<床,その数以下の最大の PARAM(unit) の倍数,階の高さ PARAM(unit) を以て> //#xdocP_Unit<床> public static type Floor(type value, type unit) { return(CONC(flor, type)(value / unit) * unit); }
//#xdocFUNC1<床,その数以下の最大の (offset + 整数) ##,指定した値を基準にして> //#xdocP_Offset<床> public static type FloorOffset(type value, type offset) { return(CONC(flor, type)(value - offset) + offset); }
//#xdocFUNC1<床,その数以下の最大の整数> public static type Floor(type value) { return(CONC(flor, type)(value)); }
//#xdocFUNC1<天井,その数以上の最小の (offset + PARAM(unit) の倍数) ##,指定した値を基準にして、階の高さ PARAM(unit) を以て> //#xdocP_Unit<天井> //#xdocP_Offset<天井> public static type CeilingOffset(type value, type unit, type offset) { return(CONC(ceil, type)("#(value-offset)/unit#") * unit + offset); }
//#xdocFUNC1<天井,その数以上の最小の (offset + 整数) ##,指定した値を基準にして> //#xdocP_Offset<天井> public static type CeilingOffset(type value, type offset) { return(CONC(ceil, type)(value - offset) + offset); }
//#xdocFUNC1<天井,その数以上の最小の PARAM(unit) の倍数,階の高さ PARAM(unit) を以て> //#xdocP_Unit<天井> public static type Ceiling(type value, type unit) { return(CONC(ceil, type)(value / unit) * unit); }
//#←template //----------------------------------------------------------- //#define ensure_not_neg(x,type) ## //#gcm<ulong> //#gcm<uint> //#gcm<ushort> //#gcm<byte> //#define ensure_not_neg(x,type) if(x<0)x=(type)(-x); //#gcm<long> //#gcm<int> //#gcm<short> //#gcm<sbyte> //#gcm<decimal> //----------------------------------------------------------- //----------------------------------------------------------- // xml documents //----------------------------------------------------------- //#→template xdocFUNC1<_name,_desc> /// <summary> /// 指定した数の##_name##を取得します。 /// 茲での##_name##とは、##_desc##を指します。 /// </summary> /// <param name="value">_name##を求めたい数を指定します。</param> /// <returns>指定した数の##_name##を返します。</returns> //#←template //#→template xdocFUNC1<_name,_desc,_desc2> /// <summary> /// _desc2、指定した数の##_name##を取得します。 /// 茲での##_name##とは、##_desc##を指します。 /// </summary> /// <param name="value">_name##を求めたい数を指定します。</param> /// <returns>指定した数の##_name##を返します。</returns> //#←template //#define PARAM(paramName) <paramref name="paramName"/> //#→template xdocP_Unit<_name> /// <param name="unit">「それぞれの階の高さ」を指定します。</param> //#←template //#→template xdocP_Offset<_name> /// <param name="offset">_name##の基準を指定します。つまり、零階の高さであると考えて下さい。</param> //#←template //=========================================================== // Template 天井/床/丸め/切り捨て/切り上げ //=========================================================== // depending functions //----------------------------------------------------------- //#define ceil_float(value) (float)System.Math.Ceiling((double)(value)) //#define ceil_double(value) System.Math.Ceiling(value) //#define ceil_decimal(value) decimal.Ceiling(value) //#define flor_float(value) (float)System.Math.Floor((double)(value)) //#define flor_double(value) System.Math.Floor(value) //#define flor_decimal(value) decimal.Floor(value) //#define roud_float(value) (float)System.Math.Round((double)(value)) //#define roud_double(value) System.Math.Round(value) //#define roud_decimal(value) decimal.Round(value) //#define CONC(str,str2) str##_##str2 //#define swch_sgn(positive,negative,type) (value>=0?CONC(positive,type)(value):CONC(negative,type)(value)) //----------------------------------------------------------- //#→template functions<type> //#xdocFUNC1<天井,その数以上の最小の整数> public static type Ceiling(type value) { return(CONC(ceil, type)(value)); }