Created
March 9, 2018 09:46
-
-
Save IvanPizhenko/1fb04bc8570da4801a19efba5ec8945f to your computer and use it in GitHub Desktop.
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 characters
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); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment