Skip to content

Commit d1e096f

Browse files
authored
Merge pull request #4 from axone-protocol/feat/apd-v3-upgrade
Feat/apd v3 upgrade
2 parents 4735815 + f8e2298 commit d1e096f

File tree

7 files changed

+12
-19
lines changed

7 files changed

+12
-19
lines changed

engine/atom.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,9 @@ var (
5656

5757
atomAbs = NewAtom("abs")
5858
atomAccess = NewAtom("access")
59-
atomAcos = NewAtom("acos")
6059
atomAlias = NewAtom("alias")
6160
atomAppend = NewAtom("append")
62-
atomAsin = NewAtom("asin")
6361
atomAt = NewAtom("at")
64-
atomAtan = NewAtom("atan")
65-
atomAtan2 = NewAtom("atan2")
6662
atomAtom = NewAtom("atom")
6763
atomAtomic = NewAtom("atomic")
6864
atomBinary = NewAtom("binary")
@@ -80,7 +76,6 @@ var (
8076
atomCloseOption = NewAtom("close_option")
8177
atomCodes = NewAtom("codes")
8278
atomCompound = NewAtom("compound")
83-
atomCos = NewAtom("cos")
8479
atomCreate = NewAtom("create")
8580
atomDebug = NewAtom("debug")
8681
atomDiscontiguous = NewAtom("discontiguous")
@@ -172,7 +167,6 @@ var (
172167
atomResourceError = NewAtom("resource_error")
173168
atomRound = NewAtom("round")
174169
atomSign = NewAtom("sign")
175-
atomSin = NewAtom("sin")
176170
atomSingletons = NewAtom("singletons")
177171
atomSmallE = NewAtom("e")
178172
atomSourceSink = NewAtom("source_sink")
@@ -184,7 +178,6 @@ var (
184178
atomStreamPosition = NewAtom("stream_position")
185179
atomStreamProperty = NewAtom("stream_property")
186180
atomSyntaxError = NewAtom("syntax_error")
187-
atomTan = NewAtom("tan")
188181
atomTermExpansion = NewAtom("term_expansion")
189182
atomText = NewAtom("text")
190183
atomTextStream = NewAtom("text_stream")

engine/float.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,18 @@ package engine
22

33
import (
44
"fmt"
5-
"github.com/cockroachdb/apd"
5+
"github.com/cockroachdb/apd/v3"
66
"io"
77
"strings"
88
)
99

10-
// Float is a prolog floating-point number.
10+
// Float is a prolog "falsy" floating-point number.
11+
//
1112
// The underlying implementation is not based on floating-point, it's a [GDA](https://speleotrove.com/decimal/)
1213
// compatible implementation to avoid approximation and determinism issues.
13-
// It uses under the hood a decimal128 with 34 precision digits.
14+
// It uses under the hood a decimal128 with 34 precision digits and must be manipulated using the `decimal128Ctx` only.
15+
//
16+
// It serves as an immutable wrapper over `apd.Decimal`.
1417
type Float struct {
1518
dec *apd.Decimal
1619
}

engine/number.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package engine
22

33
import (
44
"errors"
5-
"github.com/cockroachdb/apd"
5+
"github.com/cockroachdb/apd/v3"
66
"math"
77
)
88

engine/number_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package engine
22

33
import (
44
"context"
5-
"github.com/cockroachdb/apd"
5+
"github.com/cockroachdb/apd/v3"
66
"io"
77
"math"
88
"testing"

go.mod

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/ichiban/prolog
33
go 1.19
44

55
require (
6-
github.com/cockroachdb/apd v1.1.0
6+
github.com/cockroachdb/apd/v3 v3.2.1
77
github.com/stretchr/testify v1.7.0
88
golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897
99
)
@@ -12,7 +12,6 @@ require (
1212
github.com/davecgh/go-spew v1.1.1 // indirect
1313
github.com/kr/pretty v0.1.0 // indirect
1414
github.com/lib/pq v1.10.9 // indirect
15-
github.com/pkg/errors v0.9.1 // indirect
1615
github.com/pmezard/go-difflib v1.0.0 // indirect
1716
github.com/stretchr/objx v0.1.1 // indirect
1817
golang.org/x/sys v0.0.0-20211019181941-9d821ace8654 // indirect

go.sum

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I=
2-
github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ=
1+
github.com/cockroachdb/apd/v3 v3.2.1 h1:U+8j7t0axsIgvQUqthuNm82HIrYXodOV2iWLWtEaIwg=
2+
github.com/cockroachdb/apd/v3 v3.2.1/go.mod h1:klXJcjp+FffLTHlhIG69tezTDvdP065naDsHzKhYSqc=
33
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
44
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
55
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@@ -10,8 +10,6 @@ github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
1010
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
1111
github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw=
1212
github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
13-
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
14-
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
1513
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
1614
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
1715
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=

interpreter_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@ a.`, output: `syntax err.`},
606606
{name: "171", premise: `set_prolog_flag(double_quotes,chars).`, input: `writeq("a").`, output: `[a]`},
607607
{name: "229", premise: `set_prolog_flag(double_quotes,chars).`, input: `writeq("\z").`, output: `syntax err.`},
608608
{name: "300", premise: `set_prolog_flag(double_quotes,chars).`, input: `writeq("\0\").`, output: `['\x0\']`},
609-
{name: "172", input: `X is 10.0** -323, writeq(X).`, output: `1.0e-323`},
609+
{name: "172", input: `X is 10.0** -323, writeq(X).`, output: `1.000000000000000000000000000000000e-323`},
610610
{name: "173", input: `1.0e-323=:=10.0** -323.`},
611611
{name: "174", input: `-1 = -0x1.`},
612612
{name: "175", input: `T = t(0b1,0o1,0x1), T = t(1,1,1).`},

0 commit comments

Comments
 (0)