-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add abs, round, floor, ceil operators (#6496)
Refs #5853 * Add abs, round, floor, ceil operators * Round away from 0 * Add entries to v8.json * Test non-integer abs * Edits from review
- Loading branch information
1 parent
a48c14c
commit 6b96d69
Showing
7 changed files
with
156 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"expression": ["abs", ["get", "x"]], | ||
"inputs": [ | ||
[{}, {"properties": {"x": -2}}], | ||
[{}, {"properties": {"x": 2}}], | ||
[{}, {"properties": {"x": -1.1}}] | ||
], | ||
"expected": { | ||
"compiled": { | ||
"result": "success", | ||
"isFeatureConstant": false, | ||
"isZoomConstant": true, | ||
"type": "number" | ||
}, | ||
"outputs": [2, 2, 1.1], | ||
"serialized": ["abs", ["number", ["get", "x"]]] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"expression": ["ceil", ["get", "x"]], | ||
"inputs": [ | ||
[{}, {"properties": {"x": -2.6}}], | ||
[{}, {"properties": {"x": -2.5}}], | ||
[{}, {"properties": {"x": -2.4}}], | ||
[{}, {"properties": {"x": -2}}], | ||
[{}, {"properties": {"x": 2.6}}], | ||
[{}, {"properties": {"x": 2.5}}], | ||
[{}, {"properties": {"x": 2.4}}], | ||
[{}, {"properties": {"x": 2}}] | ||
], | ||
"expected": { | ||
"compiled": { | ||
"result": "success", | ||
"isFeatureConstant": false, | ||
"isZoomConstant": true, | ||
"type": "number" | ||
}, | ||
"outputs": [ -2, -2, -2, -2, 3, 3, 3, 2 ], | ||
"serialized": ["ceil", ["number", ["get", "x"]]] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"expression": ["floor", ["get", "x"]], | ||
"inputs": [ | ||
[{}, {"properties": {"x": -2.6}}], | ||
[{}, {"properties": {"x": -2.5}}], | ||
[{}, {"properties": {"x": -2.4}}], | ||
[{}, {"properties": {"x": -2}}], | ||
[{}, {"properties": {"x": 2.6}}], | ||
[{}, {"properties": {"x": 2.5}}], | ||
[{}, {"properties": {"x": 2.4}}], | ||
[{}, {"properties": {"x": 2}}] | ||
], | ||
"expected": { | ||
"compiled": { | ||
"result": "success", | ||
"isFeatureConstant": false, | ||
"isZoomConstant": true, | ||
"type": "number" | ||
}, | ||
"outputs": [ -3, -3, -3, -2, 2, 2, 2, 2 ], | ||
"serialized": ["floor", ["number", ["get", "x"]]] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"expression": ["round", ["get", "x"]], | ||
"inputs": [ | ||
[{}, {"properties": {"x": -2.6}}], | ||
[{}, {"properties": {"x": -2.5}}], | ||
[{}, {"properties": {"x": -2.4}}], | ||
[{}, {"properties": {"x": -2}}], | ||
[{}, {"properties": {"x": 2.6}}], | ||
[{}, {"properties": {"x": 2.5}}], | ||
[{}, {"properties": {"x": 2.4}}], | ||
[{}, {"properties": {"x": 2}}] | ||
], | ||
"expected": { | ||
"compiled": { | ||
"result": "success", | ||
"isFeatureConstant": false, | ||
"isZoomConstant": true, | ||
"type": "number" | ||
}, | ||
"outputs": [ -3, -3, -2, -2, 3, 3, 2, 2 ], | ||
"serialized": ["round", ["number", ["get", "x"]]] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters