Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
pow binary
//'main' method must be in a class 'Rextester'. //Compiler version 1.8.0_111 import java.util.*; import java.lang.*; class Rextester { public static void main(String args[]) { System.out.println("Hello, World!"); System.out.println(power(2.0, 1000)); } public static double power(double x, int y){ double result = 1.0; long power = y; if (y < 0) { power = -power; x = 1.0 / x ; } int i = 0; while (power != 0) { System.out.println("================= iter " + ++i); System.out.println("power = " + power + " binary = " + Long.toBinaryString(power)); System.out.println("in result = " + result); System.out.println("x = " + x); if ((power & 1) != 0) { result *= x; } x *= x ; power >>= 1 ; System.out.println("out result = " + result); } return result ; } }
run
|
edit
|
history
|
help
0
a+b
first activity
// Java Coding Challenge - 09: Find out duplicate numbers using Array
Minimum Vertices to Traverse Directed Graph
Invert sign and add
1 to 100 except 30 to40
test1
Fibonacci 2
Municipiu_Problema_2_Palindrome
1.5