-
Notifications
You must be signed in to change notification settings - Fork 294
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pkg/math: add tests which show the API constants
consts.txtar shows the constant values exposed via the CUE std API, and Example_constants shows the same ones exposed via the Go API. Note that we're not particular about the precision used by the Go test; we mainly aim to see whether the values look roughly correct or not. This is in preparation for https://cuelang.org/cl/557322, which will fix one of the constants to not truncate to an integer. Note that Log2E and Log10E are truncated to the integers 1 and 0, a bug which will be fixed in the next commit. Signed-off-by: Daniel Martí <mvdan@mvdan.cc> Change-Id: Ie737f7a7ff7a609cdb9fc74df64bddc2e423f00f Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/557321 Reviewed-by: Paul Jolly <paul@myitcv.io> Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com> TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
- Loading branch information
Showing
3 changed files
with
68 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
-- in.cue -- | ||
import "math" | ||
|
||
E: math.E | ||
Pi: math.Pi | ||
Phi: math.Phi | ||
|
||
Sqrt2: math.Sqrt2 | ||
SqrtE: math.SqrtE | ||
SqrtPi: math.SqrtPi | ||
SqrtPhi: math.SqrtPhi | ||
|
||
Ln2: math.Ln2 | ||
Log2E: math.Log2E | ||
Ln10: math.Ln10 | ||
Log10E: math.Log10E | ||
-- out/math -- | ||
E: 2.71828182845904523536028747135266249775724709369995957496696763 | ||
Pi: 3.14159265358979323846264338327950288419716939937510582097494459 | ||
Phi: 1.61803398874989484820458683436563811772030917980576286213544861 | ||
Sqrt2: 1.41421356237309504880168872420969807856967187537694807317667974 | ||
SqrtE: 1.64872127070012814684865078781416357165377610071014801157507931 | ||
SqrtPi: 1.77245385090551602729816748334114518279754945612238712821380779 | ||
SqrtPhi: 1.27201964951406896425242246173749149171560804184009624861664038 | ||
Ln2: 0.693147180559945309417232121458176568075500134360255254120680009 | ||
Log2E: 1.442695040888963407359924681001892137426645954152985934135449408 | ||
Ln10: 2.3025850929940456840179914546843642076011014886287729760333278 | ||
Log10E: 0.43429448190325182765112891891660508229439700580366656611445378 | ||
|
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