| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
package stdlib |
| 7 |
|
| 8 |
import ( |
| 9 |
"go/constant" |
| 10 |
"go/token" |
| 11 |
"math" |
| 12 |
"reflect" |
| 13 |
) |
| 14 |
|
| 15 |
func init() { |
| 16 |
Symbols["math/math"] = map[string]reflect.Value{ |
| 17 |
|
| 18 |
"Abs": reflect.ValueOf(math.Abs), |
| 19 |
"Acos": reflect.ValueOf(math.Acos), |
| 20 |
"Acosh": reflect.ValueOf(math.Acosh), |
| 21 |
"Asin": reflect.ValueOf(math.Asin), |
| 22 |
"Asinh": reflect.ValueOf(math.Asinh), |
| 23 |
"Atan": reflect.ValueOf(math.Atan), |
| 24 |
"Atan2": reflect.ValueOf(math.Atan2), |
| 25 |
"Atanh": reflect.ValueOf(math.Atanh), |
| 26 |
"Cbrt": reflect.ValueOf(math.Cbrt), |
| 27 |
"Ceil": reflect.ValueOf(math.Ceil), |
| 28 |
"Copysign": reflect.ValueOf(math.Copysign), |
| 29 |
"Cos": reflect.ValueOf(math.Cos), |
| 30 |
"Cosh": reflect.ValueOf(math.Cosh), |
| 31 |
"Dim": reflect.ValueOf(math.Dim), |
| 32 |
"E": reflect.ValueOf(constant.MakeFromLiteral("2.71828182845904523536028747135266249775724709369995957496696762566337824315673231520670375558666729784504486779277967997696994772644702281675346915668215131895555530285035761295375777990557253360748291015625", token.FLOAT, 0)), |
| 33 |
"Erf": reflect.ValueOf(math.Erf), |
| 34 |
"Erfc": reflect.ValueOf(math.Erfc), |
| 35 |
"Erfcinv": reflect.ValueOf(math.Erfcinv), |
| 36 |
"Erfinv": reflect.ValueOf(math.Erfinv), |
| 37 |
"Exp": reflect.ValueOf(math.Exp), |
| 38 |
"Exp2": reflect.ValueOf(math.Exp2), |
| 39 |
"Expm1": reflect.ValueOf(math.Expm1), |
| 40 |
"FMA": reflect.ValueOf(math.FMA), |
| 41 |
"Float32bits": reflect.ValueOf(math.Float32bits), |
| 42 |
"Float32frombits": reflect.ValueOf(math.Float32frombits), |
| 43 |
"Float64bits": reflect.ValueOf(math.Float64bits), |
| 44 |
"Float64frombits": reflect.ValueOf(math.Float64frombits), |
| 45 |
"Floor": reflect.ValueOf(math.Floor), |
| 46 |
"Frexp": reflect.ValueOf(math.Frexp), |
| 47 |
"Gamma": reflect.ValueOf(math.Gamma), |
| 48 |
"Hypot": reflect.ValueOf(math.Hypot), |
| 49 |
"Ilogb": reflect.ValueOf(math.Ilogb), |
| 50 |
"Inf": reflect.ValueOf(math.Inf), |
| 51 |
"IsInf": reflect.ValueOf(math.IsInf), |
| 52 |
"IsNaN": reflect.ValueOf(math.IsNaN), |
| 53 |
"J0": reflect.ValueOf(math.J0), |
| 54 |
"J1": reflect.ValueOf(math.J1), |
| 55 |
"Jn": reflect.ValueOf(math.Jn), |
| 56 |
"Ldexp": reflect.ValueOf(math.Ldexp), |
| 57 |
"Lgamma": reflect.ValueOf(math.Lgamma), |
| 58 |
"Ln10": reflect.ValueOf(constant.MakeFromLiteral("2.30258509299404568401799145468436420760110148862877297603332784146804725494827975466552490443295866962642372461496758838959542646932914211937012833592062802600362869664962772731087170541286468505859375", token.FLOAT, 0)), |
| 59 |
"Ln2": reflect.ValueOf(constant.MakeFromLiteral("0.6931471805599453094172321214581765680755001343602552541206800092715999496201383079363438206637927920954189307729314303884387720696314608777673678644642390655170150035209453154294578780536539852619171142578125", token.FLOAT, 0)), |
| 60 |
"Log": reflect.ValueOf(math.Log), |
| 61 |
"Log10": reflect.ValueOf(math.Log10), |
| 62 |
"Log10E": reflect.ValueOf(constant.MakeFromLiteral("0.43429448190325182765112891891660508229439700580366656611445378416636798190620320263064286300825210972160277489744884502676719847561509639618196799746596688688378591625127711495224502868950366973876953125", token.FLOAT, 0)), |
| 63 |
"Log1p": reflect.ValueOf(math.Log1p), |
| 64 |
"Log2": reflect.ValueOf(math.Log2), |
| 65 |
"Log2E": reflect.ValueOf(constant.MakeFromLiteral("1.44269504088896340735992468100189213742664595415298593413544940772066427768997545329060870636212628972710992130324953463427359402479619301286929040235571747101382214539290471666532766903401352465152740478515625", token.FLOAT, 0)), |
| 66 |
"Logb": reflect.ValueOf(math.Logb), |
| 67 |
"Max": reflect.ValueOf(math.Max), |
| 68 |
"MaxFloat32": reflect.ValueOf(constant.MakeFromLiteral("340282346638528859811704183484516925440", token.FLOAT, 0)), |
| 69 |
"MaxFloat64": reflect.ValueOf(constant.MakeFromLiteral("179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368", token.FLOAT, 0)), |
| 70 |
"MaxInt": reflect.ValueOf(constant.MakeFromLiteral("9223372036854775807", token.INT, 0)), |
| 71 |
"MaxInt16": reflect.ValueOf(constant.MakeFromLiteral("32767", token.INT, 0)), |
| 72 |
"MaxInt32": reflect.ValueOf(constant.MakeFromLiteral("2147483647", token.INT, 0)), |
| 73 |
"MaxInt64": reflect.ValueOf(constant.MakeFromLiteral("9223372036854775807", token.INT, 0)), |
| 74 |
"MaxInt8": reflect.ValueOf(constant.MakeFromLiteral("127", token.INT, 0)), |
| 75 |
"MaxUint": reflect.ValueOf(constant.MakeFromLiteral("18446744073709551615", token.INT, 0)), |
| 76 |
"MaxUint16": reflect.ValueOf(constant.MakeFromLiteral("65535", token.INT, 0)), |
| 77 |
"MaxUint32": reflect.ValueOf(constant.MakeFromLiteral("4294967295", token.INT, 0)), |
| 78 |
"MaxUint64": reflect.ValueOf(constant.MakeFromLiteral("18446744073709551615", token.INT, 0)), |
| 79 |
"MaxUint8": reflect.ValueOf(constant.MakeFromLiteral("255", token.INT, 0)), |
| 80 |
"Min": reflect.ValueOf(math.Min), |
| 81 |
"MinInt": reflect.ValueOf(constant.MakeFromLiteral("-9223372036854775808", token.INT, 0)), |
| 82 |
"MinInt16": reflect.ValueOf(constant.MakeFromLiteral("-32768", token.INT, 0)), |
| 83 |
"MinInt32": reflect.ValueOf(constant.MakeFromLiteral("-2147483648", token.INT, 0)), |
| 84 |
"MinInt64": reflect.ValueOf(constant.MakeFromLiteral("-9223372036854775808", token.INT, 0)), |
| 85 |
"MinInt8": reflect.ValueOf(constant.MakeFromLiteral("-128", token.INT, 0)), |
| 86 |
"Mod": reflect.ValueOf(math.Mod), |
| 87 |
"Modf": reflect.ValueOf(math.Modf), |
| 88 |
"NaN": reflect.ValueOf(math.NaN), |
| 89 |
"Nextafter": reflect.ValueOf(math.Nextafter), |
| 90 |
"Nextafter32": reflect.ValueOf(math.Nextafter32), |
| 91 |
"Phi": reflect.ValueOf(constant.MakeFromLiteral("1.6180339887498948482045868343656381177203091798057628621354486119746080982153796619881086049305501566952211682590824739205931370737029882996587050475921915678674035433959321750307935872115194797515869140625", token.FLOAT, 0)), |
| 92 |
"Pi": reflect.ValueOf(constant.MakeFromLiteral("3.141592653589793238462643383279502884197169399375105820974944594789982923695635954704435713335896673485663389728754819466702315787113662862838515639906529162340867271374644786874341662041842937469482421875", token.FLOAT, 0)), |
| 93 |
"Pow": reflect.ValueOf(math.Pow), |
| 94 |
"Pow10": reflect.ValueOf(math.Pow10), |
| 95 |
"Remainder": reflect.ValueOf(math.Remainder), |
| 96 |
"Round": reflect.ValueOf(math.Round), |
| 97 |
"RoundToEven": reflect.ValueOf(math.RoundToEven), |
| 98 |
"Signbit": reflect.ValueOf(math.Signbit), |
| 99 |
"Sin": reflect.ValueOf(math.Sin), |
| 100 |
"Sincos": reflect.ValueOf(math.Sincos), |
| 101 |
"Sinh": reflect.ValueOf(math.Sinh), |
| 102 |
"SmallestNonzeroFloat32": reflect.ValueOf(constant.MakeFromLiteral("1.40129846432481707092372958328991613128026194187651577175706828388979108268586060148663818836212158203125e-45", token.FLOAT, 0)), |
| 103 |
"SmallestNonzeroFloat64": reflect.ValueOf(constant.MakeFromLiteral("4.940656458412465441765687928682213723650598026143247644255856825006755072702087518652998363616359923797965646954457177309266567103559397963987747960107818781263007131903114045278458171678489821036887186360569987307230500063874091535649843873124733972731696151400317153853980741262385655911710266585566867681870395603106249319452715914924553293054565444011274801297099995419319894090804165633245247571478690147267801593552386115501348035264934720193790268107107491703332226844753335720832431936092382893458368060106011506169809753078342277318329247904982524730776375927247874656084778203734469699533647017972677717585125660551199131504891101451037862738167250955837389733598993664809941164205702637090279242767544565229087538682506419718265533447265625e-324", token.FLOAT, 0)), |
| 104 |
"Sqrt": reflect.ValueOf(math.Sqrt), |
| 105 |
"Sqrt2": reflect.ValueOf(constant.MakeFromLiteral("1.414213562373095048801688724209698078569671875376948073176679739576083351575381440094441524123797447886801949755143139115339040409162552642832693297721230919563348109313505318596071447245776653289794921875", token.FLOAT, 0)), |
| 106 |
"SqrtE": reflect.ValueOf(constant.MakeFromLiteral("1.64872127070012814684865078781416357165377610071014801157507931167328763229187870850146925823776361770041160388013884200789716007979526823569827080974091691342077871211546646890155898290686309337615966796875", token.FLOAT, 0)), |
| 107 |
"SqrtPhi": reflect.ValueOf(constant.MakeFromLiteral("1.2720196495140689642524224617374914917156080418400962486166403754616080542166459302584536396369727769747312116100875915825863540562126478288118732191412003988041797518382391984914647764526307582855224609375", token.FLOAT, 0)), |
| 108 |
"SqrtPi": reflect.ValueOf(constant.MakeFromLiteral("1.772453850905516027298167483341145182797549456122387128213807789740599698370237052541269446184448945647349951047154197675245574635259260134350885938555625028620527962319730619356050738133490085601806640625", token.FLOAT, 0)), |
| 109 |
"Tan": reflect.ValueOf(math.Tan), |
| 110 |
"Tanh": reflect.ValueOf(math.Tanh), |
| 111 |
"Trunc": reflect.ValueOf(math.Trunc), |
| 112 |
"Y0": reflect.ValueOf(math.Y0), |
| 113 |
"Y1": reflect.ValueOf(math.Y1), |
| 114 |
"Yn": reflect.ValueOf(math.Yn), |
| 115 |
} |
| 116 |
} |