Skip to content

Instantly share code, notes, and snippets.

@IvanPizhenko
Created March 9, 2018 09:46
Show Gist options
  • Save IvanPizhenko/1fb04bc8570da4801a19efba5ec8945f to your computer and use it in GitHub Desktop.
Save IvanPizhenko/1fb04bc8570da4801a19efba5ec8945f to your computer and use it in GitHub Desktop.

Revisions

  1. Ivan Pizhenko created this gist Mar 9, 2018.
    15 changes: 15 additions & 0 deletions TeaConstants.java
    Original 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);
    }
    }
    }