Skip to content

Commit

Permalink
⎕DR fixes
Browse files Browse the repository at this point in the history
and increment app version
  • Loading branch information
dzaima committed Mar 2, 2020
1 parent ef70620 commit 4aa5af3
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion AndroidIDE/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="2" android:versionName="0.1.4" package="dzaima.aplide">
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="3" android:versionName="0.1.5" package="dzaima.aplide">
<uses-sdk android:minSdkVersion="17" android:targetSdkVersion="28"/>
<application android:icon="@mipmap/ic_launcher" android:label="">
<activity android:name=".MainActivity" android:theme="@style/Theme.AppCompat.Light.NoActionBar.FullScreen">
Expand Down
8 changes: 4 additions & 4 deletions src/APL/Scope.java
Original file line number Diff line number Diff line change
Expand Up @@ -723,26 +723,26 @@ public Obj call(Value a, Value w) {
if (f==1) return OverBuiltin.on(this, new Fun() {
public String repr() { return ""; }
public Obj call(Value w) {
return new Num(Double.longBitsToDouble(((BigValue) UTackBuiltin.on(BigValue.TWO, w, DR.this)).i.longValueExact()));
return new Num(Double.longBitsToDouble(((BigValue) UTackBuiltin.on(BigValue.TWO, w, DR.this)).longValue()));
}
}, 1, w);
if (f==5) return OverBuiltin.on(this, new Fun() {
public String repr() { return ""; }
public Obj call(Value w) {
return new Num(Double.longBitsToDouble(((BigValue) w).i.longValueExact()));
return new Num(Double.longBitsToDouble(((BigValue) w).longValue()));
}
}, 0, w);
} else {
if (t==1) return OverBuiltin.on(this, new Fun() {
public String repr() { return ""; }
public Obj call(Value w) {
return new BitArr(new long[]{Long.reverse(Double.doubleToLongBits(w.asDouble()))}, new int[]{64});
return new BitArr(new long[]{Long.reverse(Double.doubleToRawLongBits(w.asDouble()))}, new int[]{64});
}
}, 0, w);
if (t==5) return OverBuiltin.on(this, new Fun() {
public String repr() { return ""; }
public Obj call(Value w) {
return new BigValue(Double.doubleToLongBits(w.asDouble()));
return new BigValue(Double.doubleToRawLongBits(w.asDouble()));
}
}, 0, w);
}
Expand Down
4 changes: 4 additions & 0 deletions src/APL/types/BigValue.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,8 @@ public static int safeInt(BigInteger b) {
}
return b.intValue();
}
public long longValue() {
if (i.bitLength() > 64) throw new DomainError("using a bigint with more than 64 bits as long", this);
return i.longValue();
}
}
8 changes: 4 additions & 4 deletions src/APL/types/functions/builtins/dops/OverBuiltin.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@ public class OverBuiltin extends Dop {
public Obj call(Obj aa, Obj ww, Value w, DerivedDop derv) {
isFn(aa, '⍶');
int d = ((Value) ww).asInt();
return on(this, (Fun) aa, d, w);
return on(derv, (Fun) aa, d, w);
}
public static Value on(Tokenable caller, Fun f, int d, Value w) {
public static Value on(Fun caller, Fun f, int d, Value w) {
int ld = DepthBuiltin.lazy(w);
if (ld==d || ld <= -d) {
int fd = DepthBuiltin.full(w);
if (d>0 && d!=fd) throw new DomainError(caller.getToken().toRepr()+" can't match a depth " + fd + " array", caller, w);
if (d>0 && d!=fd) throw new DomainError(caller+" can't match a depth " + fd + " array", caller, w);
if (d <= fd) {
return (Value) f.call(w);
}
}
if (d>0 && ld < d) throw new DomainError(caller.getToken().toRepr()+" can't match a depth "+DepthBuiltin.full(w)+" array", caller, w);
if (d>0 && ld < d) throw new DomainError(caller+" can't match a depth "+DepthBuiltin.full(w)+" array", caller, w);
Value[] res = new Value[w.ia];
for (int i = 0; i < res.length; i++) {
res[i] = on(caller, f, d, w.get(i));
Expand Down

0 comments on commit 4aa5af3

Please sign in to comment.