"Fossies" - the Fresh Open Source Software Archive

Member "gawk-5.1.0/test/mpfranswer42.awk" (6 Feb 2020, 657 Bytes) of package /linux/misc/gawk-5.1.0.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) (G)AWK source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 # This test case adds some numbers and the answer is 42.
    2 # It was written to honour the scientists who solved a longstanding
    3 # problem that was made popular by Douglas Adams in his book
    4 # The Hitchhiker's Guide to the Galaxy.
    5 # https://en.wikipedia.org/wiki/42_(number)#The_Hitchhiker's_Guide_to_the_Galaxy
    6 # In September 2019, the University of Bristol made a release
    7 # about the solution they found:
    8 # https://www.bristol.ac.uk/news/2019/september/sum-of-three-cubes-.html
    9 #
   10 # This test case uses GAWK's big numbers to reproduce the calculation.
   11 
   12 BEGIN {
   13   x = -80538738812075974
   14   y = 80435758145817515
   15   z = 12602123297335631
   16   print x^3 + y^3 + z^3
   17 }
   18