Examples of BitManipulation


Examples of gov.fnal.eag.healpix.BitManipulation

*/

public class PixToolsTest extends TestCase {

  public void testMODULO() {
    BitManipulation bm = new BitManipulation();
    double A = 8.;
    double B = 5.;
    double res = bm.MODULO(A, B);
    assertEquals("modulo = " + res, 3., res, 1e-10);
    A = -8.;
    B = 5.;
    res = bm.MODULO(A, B);
    assertEquals("modulo = " + res, 2., res, 1e-10);
    A = 8.;
    B = -5.;
    res = bm.MODULO(A, B);
    assertEquals("modulo = " + res, -2., res, 1e-10);
    A = -8.;
    B = -5.;
    res = bm.MODULO(A, B);
    assertEquals("modulo = " + res, -3., res, 1e-10);
    System.out.println(" test MODULO is done");
  }
View Full Code Here

Examples of gov.fnal.eag.healpix.BitManipulation

* @author N Kuropatkin
*
*/
public class BitManipulationTest extends TestCase {
  public void testBitManipulation() {
    BitManipulation bm = new BitManipulation();
        long mag1 = BitManipulation.magic2;
    long a = 3;
    long b = bm.swapLSBMSB(a);
    assertEquals("swapLSBMSB=" + b, 1, a/b, 1e-10);
    a = 8;
    b = bm.swapLSBMSB(a);
    assertEquals("swapLSBMSB=" + b, 2, a/b, 1e-10);
    a = 3;
    b = bm.invswapLSBMSB(a);
    assertEquals("invswapLSBMSB=" + b, -4, b, 1e-10);
    a = 8;
    b = bm.invswapLSBMSB(a);
    assertEquals("invswapLSBMSB=" + b, -5, b, 1e-10);
   
    a = 3;
    b = bm.invMSB(a);
    assertEquals("invMSB=" + b, mag1-1, b, 1e-10);
    a = 8;
    b = bm.invMSB(a);
    assertEquals("invMSB=" + b, mag1-8, b, 1e-10);
  }
View Full Code Here

Examples of gov.fnal.eag.healpix.BitManipulation

    a = 8;
    b = bm.invMSB(a);
    assertEquals("invMSB=" + b, mag1-8, b, 1e-10);
  }
  public void testMODULO() {
    BitManipulation bm = new BitManipulation();
    double a = 5.;
    double b = 3.;
    double mod = bm.MODULO(a,b);
    System.out.println("a="+a+" b="+b+" mod="+mod);
    a = -5.0;
    b = 3.0;
    mod = bm.MODULO(a,b);
    System.out.println("a="+a+" b="+b+" mod="+mod);
    a = 5.0;
    b = -3.0;
    mod = bm.MODULO(a,b);
    System.out.println("a="+a+" b="+b+" mod="+mod);
    a = -5.0;
    b = -3.0;
    mod = bm.MODULO(a,b);
    System.out.println("a="+a+" b="+b+" mod="+mod);
    a = 8.0;
    b = 5.0;
    mod = bm.MODULO(a,b);
    System.out.println("a="+a+" b="+b+" mod="+mod);
    a = -8.0;
    b = 5.0;
    mod = bm.MODULO(a,b);
    System.out.println("a="+a+" b="+b+" mod="+mod);
    a = 1.0;
    b = 4.0;
    mod = bm.MODULO(a,b);
    System.out.println("a="+a+" b="+b+" mod="+mod);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.