Search in sources :

Example 6 with LLVM80BitFloat

use of com.oracle.truffle.llvm.runtime.floating.LLVM80BitFloat in project sulong by graalvm.

the class LLVM80BitFromDoubleTest method testRandomNumber2.

@Test
public void testRandomNumber2() {
    LLVM80BitFloat val = LLVM80BitFloat.fromDouble(1.5);
    LLVM80BitFloat expected = LLVM80BitFloat.fromRawValues(false, 0x3fff, 0xc000000000000000L);
    assertEquals(expected, val);
}
Also used : LLVM80BitFloat(com.oracle.truffle.llvm.runtime.floating.LLVM80BitFloat) Test(org.junit.Test)

Example 7 with LLVM80BitFloat

use of com.oracle.truffle.llvm.runtime.floating.LLVM80BitFloat in project sulong by graalvm.

the class LLVM80BitFromIntTest method testQNan.

@Test
public void testQNan() {
    LLVM80BitFloat test = nan();
    assertTrue(!test.isInfinity());
    assertFalse(test.isOrdered());
}
Also used : LLVM80BitFloat(com.oracle.truffle.llvm.runtime.floating.LLVM80BitFloat) Test(org.junit.Test)

Example 8 with LLVM80BitFloat

use of com.oracle.truffle.llvm.runtime.floating.LLVM80BitFloat in project sulong by graalvm.

the class LLVM80BitFromIntTest method testNegative.

@Test
public void testNegative() {
    LLVM80BitFloat val = LLVM80BitFloat.fromInt(-1234);
    LLVM80BitFloat expected = LLVM80BitFloat.fromRawValues(true, 0x4009, 0x9a40000000000000L);
    assertEquals(expected, val);
}
Also used : LLVM80BitFloat(com.oracle.truffle.llvm.runtime.floating.LLVM80BitFloat) Test(org.junit.Test)

Example 9 with LLVM80BitFloat

use of com.oracle.truffle.llvm.runtime.floating.LLVM80BitFloat in project sulong by graalvm.

the class LLVM80BitFromIntTest method testHighValue.

@Test
public void testHighValue() {
    LLVM80BitFloat val = LLVM80BitFloat.fromInt(1234567);
    LLVM80BitFloat expected = LLVM80BitFloat.fromRawValues(false, 0b100000000010011, 0x96b4380000000000L);
    assertEquals(expected, val);
}
Also used : LLVM80BitFloat(com.oracle.truffle.llvm.runtime.floating.LLVM80BitFloat) Test(org.junit.Test)

Example 10 with LLVM80BitFloat

use of com.oracle.truffle.llvm.runtime.floating.LLVM80BitFloat in project sulong by graalvm.

the class LLVM80BitFromIntTest method testMinusOne.

@Test
public void testMinusOne() {
    LLVM80BitFloat val = LLVM80BitFloat.fromInt(-1);
    LLVM80BitFloat expected = LLVM80BitFloat.fromRawValues(true, 0x3fff, Long.reverse(1));
    assertEquals(expected, val);
}
Also used : LLVM80BitFloat(com.oracle.truffle.llvm.runtime.floating.LLVM80BitFloat) Test(org.junit.Test)

Aggregations

LLVM80BitFloat (com.oracle.truffle.llvm.runtime.floating.LLVM80BitFloat)42 Test (org.junit.Test)38 LLVMTruffleObject (com.oracle.truffle.llvm.runtime.LLVMTruffleObject)3 Specialization (com.oracle.truffle.api.dsl.Specialization)2 ExplodeLoop (com.oracle.truffle.api.nodes.ExplodeLoop)2 UnexpectedResultException (com.oracle.truffle.api.nodes.UnexpectedResultException)2 LLVMVarArgCompoundValue (com.oracle.truffle.llvm.runtime.LLVMVarArgCompoundValue)2 LLVMAddress (com.oracle.truffle.llvm.runtime.LLVMAddress)1 LLVMGlobal (com.oracle.truffle.llvm.runtime.global.LLVMGlobal)1 LLVMFloatVector (com.oracle.truffle.llvm.runtime.vector.LLVMFloatVector)1