Skip to content

Commit 4aa5af3

Browse files
committed
⎕DR fixes
and increment app version
1 parent ef70620 commit 4aa5af3

File tree

4 files changed

+13
-9
lines changed

4 files changed

+13
-9
lines changed

AndroidIDE/AndroidManifest.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="2" android:versionName="0.1.4" package="dzaima.aplide">
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="3" android:versionName="0.1.5" package="dzaima.aplide">
33
<uses-sdk android:minSdkVersion="17" android:targetSdkVersion="28"/>
44
<application android:icon="@mipmap/ic_launcher" android:label="">
55
<activity android:name=".MainActivity" android:theme="@style/Theme.AppCompat.Light.NoActionBar.FullScreen">

src/APL/Scope.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -723,26 +723,26 @@ public Obj call(Value a, Value w) {
723723
if (f==1) return OverBuiltin.on(this, new Fun() {
724724
public String repr() { return ""; }
725725
public Obj call(Value w) {
726-
return new Num(Double.longBitsToDouble(((BigValue) UTackBuiltin.on(BigValue.TWO, w, DR.this)).i.longValueExact()));
726+
return new Num(Double.longBitsToDouble(((BigValue) UTackBuiltin.on(BigValue.TWO, w, DR.this)).longValue()));
727727
}
728728
}, 1, w);
729729
if (f==5) return OverBuiltin.on(this, new Fun() {
730730
public String repr() { return ""; }
731731
public Obj call(Value w) {
732-
return new Num(Double.longBitsToDouble(((BigValue) w).i.longValueExact()));
732+
return new Num(Double.longBitsToDouble(((BigValue) w).longValue()));
733733
}
734734
}, 0, w);
735735
} else {
736736
if (t==1) return OverBuiltin.on(this, new Fun() {
737737
public String repr() { return ""; }
738738
public Obj call(Value w) {
739-
return new BitArr(new long[]{Long.reverse(Double.doubleToLongBits(w.asDouble()))}, new int[]{64});
739+
return new BitArr(new long[]{Long.reverse(Double.doubleToRawLongBits(w.asDouble()))}, new int[]{64});
740740
}
741741
}, 0, w);
742742
if (t==5) return OverBuiltin.on(this, new Fun() {
743743
public String repr() { return ""; }
744744
public Obj call(Value w) {
745-
return new BigValue(Double.doubleToLongBits(w.asDouble()));
745+
return new BigValue(Double.doubleToRawLongBits(w.asDouble()));
746746
}
747747
}, 0, w);
748748
}

src/APL/types/BigValue.java

+4
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,8 @@ public static int safeInt(BigInteger b) {
8383
}
8484
return b.intValue();
8585
}
86+
public long longValue() {
87+
if (i.bitLength() > 64) throw new DomainError("using a bigint with more than 64 bits as long", this);
88+
return i.longValue();
89+
}
8690
}

src/APL/types/functions/builtins/dops/OverBuiltin.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,18 @@ public class OverBuiltin extends Dop {
1313
public Obj call(Obj aa, Obj ww, Value w, DerivedDop derv) {
1414
isFn(aa, '⍶');
1515
int d = ((Value) ww).asInt();
16-
return on(this, (Fun) aa, d, w);
16+
return on(derv, (Fun) aa, d, w);
1717
}
18-
public static Value on(Tokenable caller, Fun f, int d, Value w) {
18+
public static Value on(Fun caller, Fun f, int d, Value w) {
1919
int ld = DepthBuiltin.lazy(w);
2020
if (ld==d || ld <= -d) {
2121
int fd = DepthBuiltin.full(w);
22-
if (d>0 && d!=fd) throw new DomainError(caller.getToken().toRepr()+" can't match a depth " + fd + " array", caller, w);
22+
if (d>0 && d!=fd) throw new DomainError(caller+" can't match a depth " + fd + " array", caller, w);
2323
if (d <= fd) {
2424
return (Value) f.call(w);
2525
}
2626
}
27-
if (d>0 && ld < d) throw new DomainError(caller.getToken().toRepr()+" can't match a depth "+DepthBuiltin.full(w)+" array", caller, w);
27+
if (d>0 && ld < d) throw new DomainError(caller+" can't match a depth "+DepthBuiltin.full(w)+" array", caller, w);
2828
Value[] res = new Value[w.ia];
2929
for (int i = 0; i < res.length; i++) {
3030
res[i] = on(caller, f, d, w.get(i));

0 commit comments

Comments
 (0)