001/*
002 *  This file is part of the Jikes RVM project (http://jikesrvm.org).
003 *
004 *  This file is licensed to You under the Eclipse Public License (EPL);
005 *  You may not use this file except in compliance with the License. You
006 *  may obtain a copy of the License at
007 *
008 *      http://www.opensource.org/licenses/eclipse-1.0.php
009 *
010 *  See the COPYRIGHT.txt file distributed with this work for information
011 *  regarding copyright ownership.
012 */
013package org.jikesrvm.runtime;
014
015import org.vmmagic.pragma.Entrypoint;
016
017/**
018 * Placeholder for constants that are accessed from
019 * generated code.
020 */
021public class MathConstants {
022  /*
023   * Constants that are used by the compilers in generated code.
024   */
025  @Entrypoint
026  static final double I2Dconstant = Double.longBitsToDouble(0x4330000080000000L);
027  @Entrypoint
028  static final double IEEEmagic = Double.longBitsToDouble(0x4338000000000000L);
029  @Entrypoint
030  static final long longOne = 1L;
031  @Entrypoint
032  static final float minusOne = -1.0F;
033  @Entrypoint
034  static final float zero = 0.0F;
035  @Entrypoint
036  static final float half = 0.5F;
037  @Entrypoint
038  static final float one = 1.0F;
039  @Entrypoint
040  static final float two = 2.0F;
041  @Entrypoint
042  static final double zeroD = 0.0;
043  @Entrypoint
044  static final double oneD = 1.0;
045  @Entrypoint
046  static final float half32 = java.lang.Float.intBitsToFloat(0x2f800000);
047  @Entrypoint
048  static final float two32 = java.lang.Float.intBitsToFloat(0x4f800000);
049  @Entrypoint
050  static final double billionth = 1e-9;
051
052  /** largest double that can be rounded to an int */
053  @Entrypoint
054  static final double maxint = 0.5D + 0x7FFFFFFF;
055  /** largest double that can be rounded to a long */
056  @Entrypoint
057  static final double maxlong = 0.5D + 0x7FFFFFFFFFFFFFFFL;
058  /** largest float that can be rounded to an int (0x7FFFFFFF) */
059  @Entrypoint
060  static final float maxintF = java.lang.Float.intBitsToFloat(0x4F000000);
061  /** largest float that can be rounded to a long (0x7FFFFFFFFFFFFFFF) */
062  @Entrypoint
063  static final float maxlongF = java.lang.Float.intBitsToFloat(0x5F000000);
064
065  /** smallest double that can be rounded to an int */
066  @Entrypoint
067  static final double minint = Integer.MIN_VALUE;
068}