mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-23 00:24:11 -08:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
f07a8aec8f
|
@ -115,7 +115,7 @@ class TAbstractStringBuilder extends TObject implements TSerializable, TCharSequ
|
||||||
} else {
|
} else {
|
||||||
insertSpace(target, target + 1);
|
insertSpace(target, target + 1);
|
||||||
}
|
}
|
||||||
buffer[target++] = (char)('0' + value);
|
buffer[target++] = TCharacter.forDigit(value, radix);
|
||||||
} else {
|
} else {
|
||||||
int pos = 1;
|
int pos = 1;
|
||||||
int sz = 1;
|
int sz = 1;
|
||||||
|
|
|
@ -93,11 +93,11 @@ public final class TMath extends TObject {
|
||||||
public static native double atan2(double y, double x);
|
public static native double atan2(double y, double x);
|
||||||
|
|
||||||
public static int round(float a) {
|
public static int round(float a) {
|
||||||
return (int)(a + 0.5f);
|
return (int)(a + signum(a) * 0.5f);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static long round(double a) {
|
public static long round(double a) {
|
||||||
return (long)(a + 0.5);
|
return (long)(a + signum(a) * 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GeneratedBy(MathNativeGenerator.class)
|
@GeneratedBy(MathNativeGenerator.class)
|
||||||
|
|
|
@ -253,6 +253,9 @@ public class TCollections extends TObject {
|
||||||
}
|
}
|
||||||
int l = 0;
|
int l = 0;
|
||||||
int u = list.size() - 1;
|
int u = list.size() - 1;
|
||||||
|
if (u < 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
while (true) {
|
while (true) {
|
||||||
int i = (l + u) / 2;
|
int i = (l + u) / 2;
|
||||||
T e = list.get(i);
|
T e = list.get(i);
|
||||||
|
|
|
@ -58,6 +58,11 @@ public class IntegerTest {
|
||||||
assertEquals("kona", Integer.toString(411787, 27));
|
assertEquals("kona", Integer.toString(411787, 27));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void writesSingleDigitInteger() {
|
||||||
|
assertEquals("a", Integer.toString(10, 16));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void decodes() {
|
public void decodes() {
|
||||||
assertEquals(Integer.valueOf(123), Integer.decode("123"));
|
assertEquals(Integer.valueOf(123), Integer.decode("123"));
|
||||||
|
|
|
@ -54,4 +54,12 @@ public class MathTest {
|
||||||
public void getExponentComputed() {
|
public void getExponentComputed() {
|
||||||
assertEquals(6, Math.getExponent(123.456));
|
assertEquals(6, Math.getExponent(123.456));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void roundWorks() {
|
||||||
|
assertEquals(1, Math.round(1.3));
|
||||||
|
assertEquals(2, Math.round(1.8));
|
||||||
|
assertEquals(-1, Math.round(-1.3));
|
||||||
|
assertEquals(-2, Math.round(-1.8));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user