Created
March 9, 2018 09:46
-
-
Save IvanPizhenko/1fb04bc8570da4801a19efba5ec8945f to your computer and use it in GitHub Desktop.
Revisions
-
Ivan Pizhenko created this gist
Mar 9, 2018 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ import java.math.BigDecimal; import java.math.BigInteger; public class TeaConstants { public static void main(String[] args) { final BigDecimal z = new BigDecimal("1.6180339887498948482045868343656"); BigDecimal p = new BigDecimal("256.0000000000000000000000000000000"); for (int i = 0; i < 5; ++i) { final BigDecimal k = p.divide(z, BigDecimal.ROUND_FLOOR); final BigInteger ki = k.toBigInteger(); System.out.println(String.format("%s (0x%s)", ki, ki.toString(16))); p = p.multiply(p); } } }