aboutsummaryrefslogtreecommitdiffstats
path: root/test/mpfranswer42.awk
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2019-09-24 20:43:59 +0300
committerArnold D. Robbins <arnold@skeeve.com>2019-09-24 20:43:59 +0300
commit09efc00fdb6af9376c13db420930dd48e9b273d0 (patch)
tree6649e717231396d3450bd6ba52a3c7d9bc0c4f7e /test/mpfranswer42.awk
parentf66b9207538981ba223eae6dd22a84266dc4a9c8 (diff)
downloadegawk-09efc00fdb6af9376c13db420930dd48e9b273d0.tar.gz
egawk-09efc00fdb6af9376c13db420930dd48e9b273d0.tar.bz2
egawk-09efc00fdb6af9376c13db420930dd48e9b273d0.zip
New test: mpfranswer42.
Diffstat (limited to 'test/mpfranswer42.awk')
-rw-r--r--test/mpfranswer42.awk18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/mpfranswer42.awk b/test/mpfranswer42.awk
new file mode 100644
index 00000000..41ca6211
--- /dev/null
+++ b/test/mpfranswer42.awk
@@ -0,0 +1,18 @@
+# This test case adds some numbers and the answer is 42.
+# It was written to honour the scientists who solved a longstanding
+# problem that was made popular by Douglas Adams in his book
+# The Hitchhiker's Guide to the Galaxy.
+# https://en.wikipedia.org/wiki/42_(number)#The_Hitchhiker's_Guide_to_the_Galaxy
+# In September 2019, the University of Bristol made a release
+# about the solution they found:
+# https://www.bristol.ac.uk/news/2019/september/sum-of-three-cubes-.html
+#
+# This test case uses GAWK's big numbers to reproduce the calculation.
+
+BEGIN {
+ x = -80538738812075974
+ y = 80435758145817515
+ z = 12602123297335631
+ print x^3 + y^3 + z^3
+}
+