BAEL-3130 overflow and underflow in java (#8381)

* BAEL-3131 Guide to Java HashMap
http://jira.baeldung.com/browse/BAEL-3130

* Move test class to correct package
http://jira.baeldung.com/browse/BAEL-3130
This commit is contained in:
Maiklins 2019-12-15 21:07:08 +01:00 committed by Grzegorz Piwowarek
parent c5072b83f8
commit 0c3f780c4f
1 changed files with 22 additions and 0 deletions

View File

@ -0,0 +1,22 @@
package com.baeldung.overflow;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
public class OverflowUnitTest {
@Test
public void positive_and_negative_zero_are_not_always_equal() {
double a = +0f;
double b = -0f;
assertTrue(a == b);
assertTrue(1/a == Double.POSITIVE_INFINITY);
assertTrue(1/b == Double.NEGATIVE_INFINITY);
assertTrue(1/a != 1/b);
}
}