Repository: goplus/gop
Pull request #1147 (2022-04-21 16:06:28)

big.Gop_bigint => big.Int


Patch:
diff --git a/.gitignore b/.gitignore
index 9aa396cf..f4424933 100644
--- a/.gitignore
+++ b/.gitignore
@@ -48,3 +48,4 @@ format.result
 cmd/qfmt/qfmt
 
 bin/
+go-num/
diff --git a/builtin/big/big.go b/builtin/big/big.go
index dea99008..289304b3 100644
--- a/builtin/big/big.go
+++ b/builtin/big/big.go
@@ -38,58 +38,58 @@ func Gop_istmp(a interface{}) bool {
 
 // -----------------------------------------------------------------------------
 
-type Gop_untyped_bigint *big.Int
-type Gop_untyped_bigrat *big.Rat
-type Gop_untyped_bigfloat *big.Float
+type UntypedInt *big.Int
+type UntypedRat *big.Rat
+type UntypedFloat *big.Float
 
-type Gop_untyped_bigint_Default = Gop_bigint
-type Gop_untyped_bigrat_Default = Gop_bigrat
-type Gop_untyped_bigfloat_Default = Gop_bigfloat
+type UntypedInt_Default = Int
+type UntypedRat_Default = Rat
+type UntypedFloat_Default = Float
 
-func Gop_untyped_bigint_Init__0(x int) Gop_untyped_bigint {
+func UntypedInt_Init__0(x int) UntypedInt {
 	panic("make compiler happy")
 }
 
-func Gop_untyped_bigrat_Init__0(x int) Gop_untyped_bigrat {
+func UntypedRat_Init__0(x int) UntypedRat {
 	panic("make compiler happy")
 }
 
-func Gop_untyped_bigrat_Init__1(x Gop_untyped_bigint) Gop_untyped_bigrat {
+func UntypedRat_Init__1(x UntypedInt) UntypedRat {
 	panic("make compiler happy")
 }
 
 // -----------------------------------------------------------------------------
 // type bigint
 
-// A Gop_bigint represents a signed multi-precision integer.
-// The zero value for a Gop_bigint represents nil.
-type Gop_bigint struct {
+// A Int represents a signed multi-precision integer.
+// The zero value for a Int represents nil.
+type Int struct {
 	*big.Int
 }
 
-func tmpint(a, b Gop_bigint) Gop_bigint {
+func tmpint(a, b Int) Int {
 	if Gop_istmp(a) {
 		return a
 	} else if Gop_istmp(b) {
 		return b
 	}
-	return Gop_bigint{new(big.Int)}
+	return Int{new(big.Int)}
 }
 
-func tmpint1(a Gop_bigint) Gop_bigint {
+func tmpint1(a Int) Int {
 	if Gop_istmp(a) {
 		return a
 	}
-	return Gop_bigint{new(big.Int)}
+	return Int{new(big.Int)}
 }
 
 // IsNil returns a bigint object is nil or not
-func (a Gop_bigint) IsNil() bool {
+func (a Int) IsNil() bool {
 	return a.Int == nil
 }
 
 // Gop_Assign: func (a bigint) = (b bigint)
-func (a Gop_bigint) Gop_Assign(b Gop_bigint) {
+func (a Int) Gop_Assign(b Int) {
 	if Gop_istmp(b) {
 		*a.Int = *b.Int
 	} else {
@@ -98,213 +98,213 @@ func (a Gop_bigint) Gop_Assign(b Gop_bigint) {
 }
 
 // Gop_Add: func (a bigint) + (b bigint) bigint
-func (a Gop_bigint) Gop_Add(b Gop_bigint) Gop_bigint {
-	return Gop_bigint{tmpint(a, b).Add(a.Int, b.Int)}
+func (a Int) Gop_Add(b Int) Int {
+	return Int{tmpint(a, b).Add(a.Int, b.Int)}
 }
 
 // Gop_Sub: func (a bigint) - (b bigint) bigint
-func (a Gop_bigint) Gop_Sub(b Gop_bigint) Gop_bigint {
-	return Gop_bigint{tmpint(a, b).Sub(a.Int, b.Int)}
+func (a Int) Gop_Sub(b Int) Int {
+	return Int{tmpint(a, b).Sub(a.Int, b.Int)}
 }
 
 // Gop_Mul: func (a bigint) * (b bigint) bigint
-func (a Gop_bigint) Gop_Mul(b Gop_bigint) Gop_bigint {
-	return Gop_bigint{tmpint(a, b).Mul(a.Int, b.Int)}
+func (a Int) Gop_Mul(b Int) Int {
+	return Int{tmpint(a, b).Mul(a.Int, b.Int)}
 }
 
 // Gop_Quo: func (a bigint) / (b bigint) bigint {
-func (a Gop_bigint) Gop_Quo(b Gop_bigint) Gop_bigint {
-	return Gop_bigint{tmpint(a, b).Quo(a.Int, b.Int)}
+func (a Int) Gop_Quo(b Int) Int {
+	return Int{tmpint(a, b).Quo(a.Int, b.Int)}
 }
 
 // Gop_Rem: func (a bigint) % (b bigint) bigint
-func (a Gop_bigint) Gop_Rem(b Gop_bigint) Gop_bigint {
-	return Gop_bigint{tmpint(a, b).Rem(a.Int, b.Int)}
+func (a Int) Gop_Rem(b Int) Int {
+	return Int{tmpint(a, b).Rem(a.Int, b.Int)}
 }
 
 // Gop_Or: func (a bigint) | (b bigint) bigint
-func (a Gop_bigint) Gop_Or(b Gop_bigint) Gop_bigint {
-	return Gop_bigint{tmpint(a, b).Or(a.Int, b.Int)}
+func (a Int) Gop_Or(b Int) Int {
+	return Int{tmpint(a, b).Or(a.Int, b.Int)}
 }
 
 // Gop_Xor: func (a bigint) ^ (b bigint) bigint
-func (a Gop_bigint) Gop_Xor(b Gop_bigint) Gop_bigint {
-	return Gop_bigint{tmpint(a, b).Xor(a.Int, b.Int)}
+func (a Int) Gop_Xor(b Int) Int {
+	return Int{tmpint(a, b).Xor(a.Int, b.Int)}
 }
 
 // Gop_And: func (a bigint) & (b bigint) bigint
-func (a Gop_bigint) Gop_And(b Gop_bigint) Gop_bigint {
-	return Gop_bigint{tmpint(a, b).And(a.Int, b.Int)}
+func (a Int) Gop_And(b Int) Int {
+	return Int{tmpint(a, b).And(a.Int, b.Int)}
 }
 
 // Gop_AndNot: func (a bigint) &^ (b bigint) bigint
-func (a Gop_bigint) Gop_AndNot(b Gop_bigint) Gop_bigint {
-	return Gop_bigint{tmpint(a, b).AndNot(a.Int, b.Int)}
+func (a Int) Gop_AndNot(b Int) Int {
+	return Int{tmpint(a, b).AndNot(a.Int, b.Int)}
 }
 
 // Gop_Lsh: func (a bigint) << (n untyped_uint) bigint
-func (a Gop_bigint) Gop_Lsh(n Gop_ninteger) Gop_bigint {
-	return Gop_bigint{tmpint1(a).Lsh(a.Int, uint(n))}
+func (a Int) Gop_Lsh(n Gop_ninteger) Int {
+	return Int{tmpint1(a).Lsh(a.Int, uint(n))}
 }
 
 // Gop_Rsh: func (a bigint) >> (n untyped_uint) bigint
-func (a Gop_bigint) Gop_Rsh(n Gop_ninteger) Gop_bigint {
-	return Gop_bigint{tmpint1(a).Rsh(a.Int, uint(n))}
+func (a Int) Gop_Rsh(n Gop_ninteger) Int {
+	return Int{tmpint1(a).Rsh(a.Int, uint(n))}
 }
 
 // Gop_LT: func (a bigint) < (b bigint) bool
-func (a Gop_bigint) Gop_LT(b Gop_bigint) bool {
+func (a Int) Gop_LT(b Int) bool {
 	return a.Cmp(b.Int) < 0
 }
 
 // Gop_LE: func (a bigint) <= (b bigint) bool
-func (a Gop_bigint) Gop_LE(b Gop_bigint) bool {
+func (a Int) Gop_LE(b Int) bool {
 	return a.Cmp(b.Int) <= 0
 }
 
 // Gop_GT: func (a bigint) > (b bigint) bool
-func (a Gop_bigint) Gop_GT(b Gop_bigint) bool {
+func (a Int) Gop_GT(b Int) bool {
 	return a.Cmp(b.Int) > 0
 }
 
 // Gop_GE: func (a bigint) >= (b bigint) bool
-func (a Gop_bigint) Gop_GE(b Gop_bigint) bool {
+func (a Int) Gop_GE(b Int) bool {
 	return a.Cmp(b.Int) >= 0
 }
 
 // Gop_EQ: func (a bigint) == (b bigint) bool
-func (a Gop_bigint) Gop_EQ(b Gop_bigint) bool {
+func (a Int) Gop_EQ(b Int) bool {
 	return a.Cmp(b.Int) == 0
 }
 
 // Gop_NE: func (a bigint) != (b bigint) bool
-func (a Gop_bigint) Gop_NE(b Gop_bigint) bool {
+func (a Int) Gop_NE(b Int) bool {
 	return a.Cmp(b.Int) != 0
 }
 
 // Gop_Neg: func -(a bigint) bigint
-func (a Gop_bigint) Gop_Neg() Gop_bigint {
-	return Gop_bigint{tmpint1(a).Neg(a.Int)}
+func (a Int) Gop_Neg() Int {
+	return Int{tmpint1(a).Neg(a.Int)}
 }
 
 // Gop_Pos: func +(a bigint) bigint
-func (a Gop_bigint) Gop_Pos() Gop_bigint {
+func (a Int) Gop_Pos() Int {
 	return a
 }
 
 // Gop_Not: func ^(a bigint) bigint
-func (a Gop_bigint) Gop_Not() Gop_bigint {
-	return Gop_bigint{tmpint1(a).Not(a.Int)}
+func (a Int) Gop_Not() Int {
+	return Int{tmpint1(a).Not(a.Int)}
 }
 
 // Gop_Add: func (a bigint) += (b bigint)
-func (a Gop_bigint) Gop_AddAssign(b Gop_bigint) {
+func (a Int) Gop_AddAssign(b Int) {
 	a.Int.Add(a.Int, b.Int)
 }
 
 // Gop_Sub: func (a bigint) -= (b bigint)
-func (a Gop_bigint) Gop_SubAssign(b Gop_bigint) {
+func (a Int) Gop_SubAssign(b Int) {
 	a.Int.Sub(a.Int, b.Int)
 }
 
 // Gop_Mul: func (a bigint) *= (b bigint)
-func (a Gop_bigint) Gop_MulAssign(b Gop_bigint) {
+func (a Int) Gop_MulAssign(b Int) {
 	a.Int.Mul(a.Int, b.Int)
 }
 
 // Gop_Quo: func (a bigint) /= (b bigint) {
-func (a Gop_bigint) Gop_QuoAssign(b Gop_bigint) {
+func (a Int) Gop_QuoAssign(b Int) {
 	a.Int.Quo(a.Int, b.Int)
 }
 
 // Gop_Rem: func (a bigint) %= (b bigint)
-func (a Gop_bigint) Gop_RemAssign(b Gop_bigint) {
+func (a Int) Gop_RemAssign(b Int) {
 	a.Int.Rem(a.Int, b.Int)
 }
 
 // Gop_Or: func (a bigint) |= (b bigint)
-func (a Gop_bigint) Gop_OrAssign(b Gop_bigint) {
+func (a Int) Gop_OrAssign(b Int) {
 	a.Int.Or(a.Int, b.Int)
 }
 
 // Gop_Xor: func (a bigint) ^= (b bigint)
-func (a Gop_bigint) Gop_XorAssign(b Gop_bigint) {
+func (a Int) Gop_XorAssign(b Int) {
 	a.Int.Xor(a.Int, b.Int)
 }
 
 // Gop_And: func (a bigint) &= (b bigint)
-func (a Gop_bigint) Gop_AndAssign(b Gop_bigint) {
+func (a Int) Gop_AndAssign(b Int) {
 	a.Int.And(a.Int, b.Int)
 }
 
 // Gop_AndNot: func (a bigint) &^= (b bigint)
-func (a Gop_bigint) Gop_AndNotAssign(b Gop_bigint) {
+func (a Int) Gop_AndNotAssign(b Int) {
 	a.Int.AndNot(a.Int, b.Int)
 }
 
 // Gop_Lsh: func (a bigint) <<= (n untyped_uint)
-func (a Gop_bigint) Gop_LshAssign(n Gop_ninteger) {
+func (a Int) Gop_LshAssign(n Gop_ninteger) {
 	a.Int.Lsh(a.Int, uint(n))
 }
 
 // Gop_Rsh: func (a bigint) >>= (n untyped_uint)
-func (a Gop_bigint) Gop_RshAssign(n Gop_ninteger) {
+func (a Int) Gop_RshAssign(n Gop_ninteger) {
 	a.Int.Rsh(a.Int, uint(n))
 }
 
-// Gop_bigint_Cast: func bigint() bigint
-func Gop_bigint_Cast__0() Gop_bigint {
-	return Gop_bigint{new(big.Int)}
+// Int_Cast: func bigint() bigint
+func Int_Cast__0() Int {
+	return Int{new(big.Int)}
 }
 
-// Gop_bigint_Cast: func bigint(x int64) bigint
-func Gop_bigint_Cast__1(x int64) Gop_bigint {
-	return Gop_bigint{big.NewInt(x)}
+// Int_Cast: func bigint(x int64) bigint
+func Int_Cast__1(x int64) Int {
+	return Int{big.NewInt(x)}
 }
 
-// Gop_bigint_Cast: func bigint(x int) bigint
-func Gop_bigint_Cast__2(x int) Gop_bigint {
-	return Gop_bigint{big.NewInt(int64(x))}
+// Int_Cast: func bigint(x int) bigint
+func Int_Cast__2(x int) Int {
+	return Int{big.NewInt(int64(x))}
 }
 
-// Gop_bigint_Cast: func bigint(x uint64) bigint
-func Gop_bigint_Cast__3(x uint64) Gop_bigint {
-	return Gop_bigint{new(big.Int).SetUint64(x)}
+// Int_Cast: func bigint(x uint64) bigint
+func Int_Cast__3(x uint64) Int {
+	return Int{new(big.Int).SetUint64(x)}
 }
 
-// Gop_bigint_Cast: func bigint(x uint) bigint
-func Gop_bigint_Cast__4(x uint) Gop_bigint {
-	return Gop_bigint{new(big.Int).SetUint64(uint64(x))}
+// Int_Cast: func bigint(x uint) bigint
+func Int_Cast__4(x uint) Int {
+	return Int{new(big.Int).SetUint64(uint64(x))}
 }
 
-// Gop_bigint_Cast: func bigint(x *big.Int) bigint
-func Gop_bigint_Cast__5(x *big.Int) Gop_bigint {
-	return Gop_bigint{x}
+// Int_Cast: func bigint(x *big.Int) bigint
+func Int_Cast__5(x *big.Int) Int {
+	return Int{x}
 }
 
-// Gop_bigint_Cast: func bigint(x *big.Rat) bigint
-func Gop_bigint_Cast__6(x *big.Rat) Gop_bigint {
+// Int_Cast: func bigint(x *big.Rat) bigint
+func Int_Cast__6(x *big.Rat) Int {
 	if x.IsInt() {
-		return Gop_bigint{x.Num()}
+		return Int{x.Num()}
 	}
 	ret, _ := new(big.Float).SetRat(x).Int(nil)
-	return Gop_bigint{ret}
+	return Int{ret}
 }
 
-// Gop_bigint_Init: func bigint.init(x int) bigint
-func Gop_bigint_Init__0(x int) Gop_bigint {
-	return Gop_bigint{big.NewInt(int64(x))}
+// Int_Init: func bigint.init(x int) bigint
+func Int_Init__0(x int) Int {
+	return Int{big.NewInt(int64(x))}
 }
 
-// Gop_bigint_Init: func bigint.init(x *big.Int) bigint
-func Gop_bigint_Init__1(x *big.Int) Gop_bigint {
-	return Gop_bigint{x}
+// Int_Init: func bigint.init(x *big.Int) bigint
+func Int_Init__1(x *big.Int) Int {
+	return Int{x}
 }
 
-// Gop_bigint_Init: func bigint.init(x *big.Rat) bigint
-func Gop_bigint_Init__2(x *big.Rat) Gop_bigint {
+// Int_Init: func bigint.init(x *big.Rat) bigint
+func Int_Init__2(x *big.Rat) Int {
 	if x.IsInt() {
-		return Gop_bigint{x.Num()}
+		return Int{x.Num()}
 	}
 	panic("TODO: can't init bigint from bigrat")
 }
@@ -312,35 +312,35 @@ func Gop_bigint_Init__2(x *big.Rat) Gop_bigint {
 // -----------------------------------------------------------------------------
 // type bigrat
 
-// A Gop_bigrat represents a quotient a/b of arbitrary precision.
-// The zero value for a Gop_bigrat represents nil.
-type Gop_bigrat struct {
+// A Rat represents a quotient a/b of arbitrary precision.
+// The zero value for a Rat represents nil.
+type Rat struct {
 	*big.Rat
 }
 
-func tmprat(a, b Gop_bigrat) Gop_bigrat {
+func tmprat(a, b Rat) Rat {
 	if Gop_istmp(a) {
 		return a
 	} else if Gop_istmp(b) {
 		return b
 	}
-	return Gop_bigrat{new(big.Rat)}
+	return Rat{new(big.Rat)}
 }
 
-func tmprat1(a Gop_bigrat) Gop_bigrat {
+func tmprat1(a Rat) Rat {
 	if Gop_istmp(a) {
 		return a
 	}
-	return Gop_bigrat{new(big.Rat)}
+	return Rat{new(big.Rat)}
 }
 
 // IsNil returns a bigrat object is nil or not
-func (a Gop_bigrat) IsNil() bool {
+func (a Rat) IsNil() bool {
 	return a.Rat == nil
 }
 
 // Gop_Assign: func (a bigrat) = (b bigrat)
-func (a Gop_bigrat) Gop_Assign(b Gop_bigrat) {
+func (a Rat) Gop_Assign(b Rat) {
 	if Gop_istmp(b) {
 		*a.Rat = *b.Rat
 	} else {
@@ -349,136 +349,136 @@ func (a Gop_bigrat) Gop_Assign(b Gop_bigrat) {
 }
 
 // Gop_Add: func (a bigrat) + (b bigrat) bigrat
-func (a Gop_bigrat) Gop_Add(b Gop_bigrat) Gop_bigrat {
-	return Gop_bigrat{tmprat(a, b).Add(a.Rat, b.Rat)}
+func (a Rat) Gop_Add(b Rat) Rat {
+	return Rat{tmprat(a, b).Add(a.Rat, b.Rat)}
 }
 
 // Gop_Sub: func (a bigrat) - (b bigrat) bigrat
-func (a Gop_bigrat) Gop_Sub(b Gop_bigrat) Gop_bigrat {
-	return Gop_bigrat{tmprat(a, b).Sub(a.Rat, b.Rat)}
+func (a Rat) Gop_Sub(b Rat) Rat {
+	return Rat{tmprat(a, b).Sub(a.Rat, b.Rat)}
 }
 
 // Gop_Mul: func (a bigrat) * (b bigrat) bigrat
-func (a Gop_bigrat) Gop_Mul(b Gop_bigrat) Gop_bigrat {
-	return Gop_bigrat{tmprat(a, b).Mul(a.Rat, b.Rat)}
+func (a Rat) Gop_Mul(b Rat) Rat {
+	return Rat{tmprat(a, b).Mul(a.Rat, b.Rat)}
 }
 
 // Gop_Quo: func (a bigrat) / (b bigrat) bigrat
-func (a Gop_bigrat) Gop_Quo(b Gop_bigrat) Gop_bigrat {
-	return Gop_bigrat{tmprat(a, b).Quo(a.Rat, b.Rat)}
+func (a Rat) Gop_Quo(b Rat) Rat {
+	return Rat{tmprat(a, b).Quo(a.Rat, b.Rat)}
 }
 
 // Gop_LT: func (a bigrat) < (b bigrat) bool
-func (a Gop_bigrat) Gop_LT(b Gop_bigrat) bool {
+func (a Rat) Gop_LT(b Rat) bool {
 	return a.Cmp(b.Rat) < 0
 }
 
 // Gop_LE: func (a bigrat) <= (b bigrat) bool
-func (a Gop_bigrat) Gop_LE(b Gop_bigrat) bool {
+func (a Rat) Gop_LE(b Rat) bool {
 	return a.Cmp(b.Rat) <= 0
 }
 
 // Gop_GT: func (a bigrat) > (b bigrat) bool
-func (a Gop_bigrat) Gop_GT(b Gop_bigrat) bool {
+func (a Rat) Gop_GT(b Rat) bool {
 	return a.Cmp(b.Rat) > 0
 }
 
 // Gop_GE: func (a bigrat) >= (b bigrat) bool
-func (a Gop_bigrat) Gop_GE(b Gop_bigrat) bool {
+func (a Rat) Gop_GE(b Rat) bool {
 	return a.Cmp(b.Rat) >= 0
 }
 
 // Gop_EQ: func (a bigrat) == (b bigrat) bool
-func (a Gop_bigrat) Gop_EQ(b Gop_bigrat) bool {
+func (a Rat) Gop_EQ(b Rat) bool {
 	return a.Cmp(b.Rat) == 0
 }
 
 // Gop_NE: func (a bigrat) != (b bigrat) bool
-func (a Gop_bigrat) Gop_NE(b Gop_bigrat) bool {
+func (a Rat) Gop_NE(b Rat) bool {
 	return a.Cmp(b.Rat) != 0
 }
 
 // Gop_Neg: func -(a bigrat) bigrat
-func (a Gop_bigrat) Gop_Neg() Gop_bigrat {
-	return Gop_bigrat{tmprat1(a).Neg(a.Rat)}
+func (a Rat) Gop_Neg() Rat {
+	return Rat{tmprat1(a).Neg(a.Rat)}
 }
 
 // Gop_Pos: func +(a bigrat) bigrat
-func (a Gop_bigrat) Gop_Pos() Gop_bigrat {
+func (a Rat) Gop_Pos() Rat {
 	return a
 }
 
 // Gop_Inv: func /(a bigrat) bigrat
-func (a Gop_bigrat) Gop_Inv() Gop_bigrat {
-	return Gop_bigrat{tmprat1(a).Inv(a.Rat)}
+func (a Rat) Gop_Inv() Rat {
+	return Rat{tmprat1(a).Inv(a.Rat)}
 }
 
 // Gop_Add: func (a bigrat) += (b bigrat)
-func (a Gop_bigrat) Gop_AddAssign(b Gop_bigrat) {
+func (a Rat) Gop_AddAssign(b Rat) {
 	a.Rat.Add(a.Rat, b.Rat)
 }
 
 // Gop_Sub: func (a bigrat) -= (b bigrat)
-func (a Gop_bigrat) Gop_SubAssign(b Gop_bigrat) {
+func (a Rat) Gop_SubAssign(b Rat) {
 	a.Rat.Sub(a.Rat, b.Rat)
 }
 
 // Gop_Mul: func (a bigrat) *= (b bigrat)
-func (a Gop_bigrat) Gop_MulAssign(b Gop_bigrat) {
+func (a Rat) Gop_MulAssign(b Rat) {
 	a.Rat.Mul(a.Rat, b.Rat)
 }
 
 // Gop_Quo: func (a bigrat) /= (b bigrat)
-func (a Gop_bigrat) Gop_QuoAssign(b Gop_bigrat) {
+func (a Rat) Gop_QuoAssign(b Rat) {
 	a.Rat.Quo(a.Rat, b.Rat)
 }
 
-// Gop_bigrat_Cast: func bigrat() bigrat
-func Gop_bigrat_Cast__0() Gop_bigrat {
-	return Gop_bigrat{new(big.Rat)}
+// Rat_Cast: func bigrat() bigrat
+func Rat_Cast__0() Rat {
+	return Rat{new(big.Rat)}
 }
 
-// Gop_bigrat_Cast: func bigrat(a bigint) bigrat
-func Gop_bigrat_Cast__1(a Gop_bigint) Gop_bigrat {
-	return Gop_bigrat{new(big.Rat).SetInt(a.Int)}
+// Rat_Cast: func bigrat(a bigint) bigrat
+func Rat_Cast__1(a Int) Rat {
+	return Rat{new(big.Rat).SetInt(a.Int)}
 }
 
-// Gop_bigrat_Cast: func bigrat(a *big.Int) bigrat
-func Gop_bigrat_Cast__2(a *big.Int) Gop_bigrat {
-	return Gop_bigrat{new(big.Rat).SetInt(a)}
+// Rat_Cast: func bigrat(a *big.Int) bigrat
+func Rat_Cast__2(a *big.Int) Rat {
+	return Rat{new(big.Rat).SetInt(a)}
 }
 
-// Gop_bigrat_Cast: func bigrat(a, b int64) bigrat
-func Gop_bigrat_Cast__3(a, b int64) Gop_bigrat {
-	return Gop_bigrat{big.NewRat(a, b)}
+// Rat_Cast: func bigrat(a, b int64) bigrat
+func Rat_Cast__3(a, b int64) Rat {
+	return Rat{big.NewRat(a, b)}
 }
 
-// Gop_bigrat_Cast: func bigrat(a *big.Rat) bigrat
-func Gop_bigrat_Cast__4(a *big.Rat) Gop_bigrat {
-	return Gop_bigrat{a}
+// Rat_Cast: func bigrat(a *big.Rat) bigrat
+func Rat_Cast__4(a *big.Rat) Rat {
+	return Rat{a}
 }
 
-// Gop_bigrat_Init: func bigrat.init(x untyped_int) bigrat
-func Gop_bigrat_Init__0(x int) Gop_bigrat {
-	return Gop_bigrat{big.NewRat(int64(x), 1)}
+// Rat_Init: func bigrat.init(x untyped_int) bigrat
+func Rat_Init__0(x int) Rat {
+	return Rat{big.NewRat(int64(x), 1)}
 }
 
-// Gop_bigrat_Init: func bigrat.init(x untyped_bigint) bigrat
-func Gop_bigrat_Init__1(x Gop_untyped_bigint) Gop_bigrat {
-	return Gop_bigrat{new(big.Rat).SetInt(x)}
+// Rat_Init: func bigrat.init(x untyped_bigint) bigrat
+func Rat_Init__1(x UntypedInt) Rat {
+	return Rat{new(big.Rat).SetInt(x)}
 }
 
-// Gop_bigrat_Init: func bigrat.init(x *big.Rat) bigrat
-func Gop_bigrat_Init__2(x *big.Rat) Gop_bigrat {
-	return Gop_bigrat{x}
+// Rat_Init: func bigrat.init(x *big.Rat) bigrat
+func Rat_Init__2(x *big.Rat) Rat {
+	return Rat{x}
 }
 
 // -----------------------------------------------------------------------------
 // type bigfloat
 
-// A Gop_bigfloat represents a multi-precision floating point number.
-// The zero value for a Gop_bigfloat represents nil.
-type Gop_bigfloat struct {
+// A Float represents a multi-precision floating point number.
+// The zero value for a Float represents nil.
+type Float struct {
 	*big.Float
 }
 
diff --git a/cl/builtin.go b/cl/builtin.go
index b9af78d1..c7bf9af1 100644
--- a/cl/builtin.go
+++ b/cl/builtin.go
@@ -27,16 +27,17 @@ import (
 
 func initMathBig(pkg gox.PkgImporter, conf *gox.Config, big *gox.PkgRef) {
 	big.EnsureImported()
-	conf.UntypedBigInt = big.Ref("Gop_untyped_bigint").Type().(*types.Named)
-	conf.UntypedBigRat = big.Ref("Gop_untyped_bigrat").Type().(*types.Named)
-	conf.UntypedBigFloat = big.Ref("Gop_untyped_bigfloat").Type().(*types.Named)
+	conf.UntypedBigInt = big.Ref("UntypedInt").Type().(*types.Named)
+	conf.UntypedBigRat = big.Ref("UntypedRat").Type().(*types.Named)
+	conf.UntypedBigFloat = big.Ref("UntypedFloat").Type().(*types.Named)
 }
 
 func initBuiltin(pkg gox.PkgImporter, builtin *types.Package, fmt, big, buil *gox.PkgRef) {
 	scope := builtin.Scope()
-	typs := []string{"bigint", "bigrat", "bigfloat"}
+	typs := []string{"int", "rat", "float"}
 	for _, typ := range typs {
-		scope.Insert(types.NewTypeName(token.NoPos, builtin, typ, big.Ref("Gop_"+typ).Type()))
+		name := string(typ[0]-('a'-'A')) + typ[1:]
+		scope.Insert(types.NewTypeName(token.NoPos, builtin, "big"+typ, big.Ref(name).Type()))
 	}
 	fns := []string{
 		"print", "println", "printf", "errorf",


Test patch:
diff --git a/cl/compile_test.go b/cl/compile_test.go
index 7b2d9f7b..80698bff 100644
--- a/cl/compile_test.go
+++ b/cl/compile_test.go
@@ -1200,8 +1200,8 @@ var z bigint = x + y
 
 import big "github.com/goplus/gop/builtin/big"
 
-var x, y big.Gop_bigint
-var z big.Gop_bigint = x.Gop_Add(y)
+var x, y big.Int
+var z big.Int = x.Gop_Add(y)
 `)
 }
 
@@ -1215,7 +1215,7 @@ import (
 	big1 "math/big"
 )
 
-var x = big.Gop_bigint_Init__1(big1.NewInt(1))
+var x = big.Int_Init__1(big1.NewInt(1))
 `)
 }
 
@@ -1229,7 +1229,7 @@ import (
 	big1 "math/big"
 )
 
-var x = big.Gop_bigrat_Init__2(big1.NewRat(1, 2))
+var x = big.Rat_Init__2(big1.NewRat(1, 2))
 `)
 }
 
@@ -1243,7 +1243,7 @@ import (
 	big1 "math/big"
 )
 
-var x = big.Gop_bigrat_Init__2(big1.NewRat(7, 2))
+var x = big.Rat_Init__2(big1.NewRat(7, 2))
 `)
 }
 
@@ -1260,9 +1260,9 @@ import (
 	big1 "math/big"
 )
 
-var x = big.Gop_bigrat_Init__2(big1.NewRat(7, 2))
-var y = x.Gop_Add(big.Gop_bigrat_Init__0(100))
-var z = big.Gop_bigrat_Init__0(100) + y
+var x = big.Rat_Init__2(big1.NewRat(7, 2))
+var y = x.Gop_Add(big.Rat_Init__0(100))
+var z = big.Rat_Init__0(100) + y
 `)
 }
 
@@ -1346,10 +1346,10 @@ x += 3
 
 import big "github.com/goplus/gop/builtin/big"
 
-var x big.Gop_bigint
+var x big.Int
 
 func main() {
-	x.Gop_AddAssign(big.Gop_bigint_Init__0(3))
+	x.Gop_AddAssign(big.Int_Init__0(3))
 }
 `)
 }
@@ -1366,8 +1366,8 @@ import (
 )
 
 func main() {
-	x := big.Gop_bigint_Init__1(big1.NewInt(3))
-	x.Gop_MulAssign(big.Gop_bigint_Init__0(2))
+	x := big.Int_Init__1(big1.NewInt(3))
+	x.Gop_MulAssign(big.Int_Init__0(2))
 }
 `)
 }
@@ -1384,8 +1384,8 @@ import (
 )
 
 func main() {
-	x := big.Gop_bigint_Init__1(big1.NewInt(3))
-	x.Gop_MulAssign(big.Gop_bigint_Init__1(big1.NewInt(2)))
+	x := big.Int_Init__1(big1.NewInt(3))
+	x.Gop_MulAssign(big.Int_Init__1(big1.NewInt(2)))
 }
 `)
 }