default to •internal.EEqual comparing 0 and ¯0 as equal
This commit is contained in:
parent
00a5ddcb89
commit
c76adb8b35
@ -275,7 +275,7 @@ po ← { # parsed options
|
|||||||
args∾↩ ( o3) / ⟨"-O3"⟩
|
args∾↩ ( o3) / ⟨"-O3"⟩
|
||||||
args∾↩ ( native) / ⟨"-march=native"⟩
|
args∾↩ ( native) / ⟨"-march=native"⟩
|
||||||
args∾↩ ( debug) / ⟨"-DDEBUG"⟩
|
args∾↩ ( debug) / ⟨"-DDEBUG"⟩
|
||||||
args∾↩ ( rtverify) / ⟨"-DRT_VERIFY", "-DEEQUAL_NEGZERO"⟩
|
args∾↩ ( rtverify) / ⟨"-DRT_VERIFY"⟩
|
||||||
args∾↩ ( heapverify) / ⟨"-DHEAP_VERIFY"⟩
|
args∾↩ ( heapverify) / ⟨"-DHEAP_VERIFY"⟩
|
||||||
args∾↩ ( exportSymbols) / ⟨"-DCBQN_EXPORT"⟩
|
args∾↩ ( exportSymbols) / ⟨"-DCBQN_EXPORT"⟩
|
||||||
args∾↩ ( ¬pie) / ⟨"-fno-pie"⟩
|
args∾↩ ( ¬pie) / ⟨"-fno-pie"⟩
|
||||||
|
|||||||
@ -113,7 +113,7 @@ Namespace of various internal functions. May change at any time.
|
|||||||
| `•internal.Variation` | Convert `𝕩` to the variation specified in `𝕨` |
|
| `•internal.Variation` | Convert `𝕩` to the variation specified in `𝕨` |
|
||||||
| `•internal.ClearRefs` | Clear references `•internal.Variation` made for `*Inc` variations |
|
| `•internal.ClearRefs` | Clear references `•internal.Variation` made for `*Inc` variations |
|
||||||
| `•internal.Unshare` | Get a unique, reference count 1 version of the argument; recursively unshares array items, doesn't touch namespaces |
|
| `•internal.Unshare` | Get a unique, reference count 1 version of the argument; recursively unshares array items, doesn't touch namespaces |
|
||||||
| `•internal.EEqual` | exactly equal (NaN equals NaN); 0 and ¯0 aren't equal, but can be made so with the C compile-time flag `-DEEQUAL_NEGZERO` |
|
| `•internal.EEqual` | exactly equal (NaN equals NaN, 0 equals ¯0) |
|
||||||
| `•internal.Temp` | place to test new features or temporarily expose some internal function |
|
| `•internal.Temp` | place to test new features or temporarily expose some internal function |
|
||||||
|
|
||||||
# FFI
|
# FFI
|
||||||
|
|||||||
2
makefile
2
makefile
@ -16,7 +16,7 @@ debug1:
|
|||||||
rtperf:
|
rtperf:
|
||||||
@"${MAKE}" i_singeli=0 i_t=rtperf i_f="-O3 -DRT_PERF" run_incremental_0
|
@"${MAKE}" i_singeli=0 i_t=rtperf i_f="-O3 -DRT_PERF" run_incremental_0
|
||||||
rtverify:
|
rtverify:
|
||||||
@"${MAKE}" i_singeli=0 i_t=rtverify i_f="-DDEBUG -O3 -DRT_VERIFY -DEEQUAL_NEGZERO" run_incremental_0
|
@"${MAKE}" i_singeli=0 i_t=rtverify i_f="-DDEBUG -O3 -DRT_VERIFY" run_incremental_0
|
||||||
heapverify:
|
heapverify:
|
||||||
@"${MAKE}" i_singeli=0 i_t=heapverify i_f="-DDEBUG -g -DHEAP_VERIFY" run_incremental_0
|
@"${MAKE}" i_singeli=0 i_t=heapverify i_f="-DDEBUG -g -DHEAP_VERIFY" run_incremental_0
|
||||||
wasi-o3:
|
wasi-o3:
|
||||||
|
|||||||
@ -513,7 +513,7 @@ bool equalSlow(B w, B x, usz ia) {
|
|||||||
|
|
||||||
bool atomEEqual(B w, B x) { // doesn't consume (not that that matters really currently)
|
bool atomEEqual(B w, B x) { // doesn't consume (not that that matters really currently)
|
||||||
if (w.u==x.u) return true;
|
if (w.u==x.u) return true;
|
||||||
#if EEQUAL_NEGZERO
|
#if !NEEQUAL_NEGZERO
|
||||||
if (isF64(w)&isF64(x)) return w.f==x.f;
|
if (isF64(w)&isF64(x)) return w.f==x.f;
|
||||||
#endif
|
#endif
|
||||||
if(isF64(w)|isF64(x)) return false;
|
if(isF64(w)|isF64(x)) return false;
|
||||||
@ -550,10 +550,10 @@ bool eequal(B w, B x) { // doesn't consume
|
|||||||
f64* xp = f64any_ptr(x);
|
f64* xp = f64any_ptr(x);
|
||||||
u64 r = 1;
|
u64 r = 1;
|
||||||
for (usz i = 0; i < ia; i++) {
|
for (usz i = 0; i < ia; i++) {
|
||||||
#if EEQUAL_NEGZERO
|
#if NEEQUAL_NEGZERO
|
||||||
r&= (wp[i]==xp[i]) | (wp[i]!=wp[i] & xp[i]!=xp[i]);
|
|
||||||
#else
|
|
||||||
r&= ((u64*)wp)[i] == ((u64*)xp)[i];
|
r&= ((u64*)wp)[i] == ((u64*)xp)[i];
|
||||||
|
#else
|
||||||
|
r&= (wp[i]==xp[i]) | (wp[i]!=wp[i] & xp[i]!=xp[i]);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
return r;
|
return r;
|
||||||
|
|||||||
@ -13,8 +13,8 @@ test/moreCfgs.sh path/to/mlochbaum/BQN // run "2+2" in a bunch of configurations
|
|||||||
./BQN test/bit.bqn // fuzz-test •bit functions
|
./BQN test/bit.bqn // fuzz-test •bit functions
|
||||||
./BQN test/mut.bqn // fuzz-test mut.h (currently just bitarr fill); requires -DTEST_MUT
|
./BQN test/mut.bqn // fuzz-test mut.h (currently just bitarr fill); requires -DTEST_MUT
|
||||||
./BQN test/hash.bqn // fuzz-test hashing
|
./BQN test/hash.bqn // fuzz-test hashing
|
||||||
./BQN test/squeezeValid.bqn // fuzz-test squeezing giving a correct result; requires -DEEQUAL_NEGZERO
|
./BQN test/squeezeValid.bqn // fuzz-test squeezing giving a correct result
|
||||||
./BQN test/squeezeExact.bqn // fuzz-test squeezing giving the exact smallest result; requires -DEEQUAL_NEGZERO
|
./BQN test/squeezeExact.bqn // fuzz-test squeezing giving the exact smallest result
|
||||||
./BQN test/various.bqn // tests for various small things
|
./BQN test/various.bqn // tests for various small things
|
||||||
./BQN test/random.bqn // test (•MakeRand n).Range
|
./BQN test/random.bqn // test (•MakeRand n).Range
|
||||||
./BQN test/joinReuse.bqn // test in-place join; requires -DPRINT_JOIN_REUSE
|
./BQN test/joinReuse.bqn // test in-place join; requires -DPRINT_JOIN_REUSE
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
# make f='-O3 -march=native -DTEST_BITCPY' singeli=1 c && ./BQN test/bitcpy.bqn
|
# make o3-singeli f=-DTEST_BITCPY && ./BQN test/bitcpy.bqn
|
||||||
⟨Temp, Type, Unshare, Squeeze, Info, Variation⟩ ← •internal
|
⟨Temp, Type, Unshare, Squeeze, Info, Variation⟩ ← •internal
|
||||||
u ← ⌊100×(•UnixTime+1|100וMonoTime)@
|
u ← ⌊100×(•UnixTime+1|100וMonoTime)@
|
||||||
# u ↩ 123
|
# u ↩ 123
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
# make f='-march=native -O3 -DEEQUAL_NEGZERO' singeli=1 c && ./BQN test/squeeze.bqn
|
|
||||||
⟨EEqual, ListVariations, ClearRefs, Variation, Squeeze, Info⟩ ← •internal
|
⟨EEqual, ListVariations, ClearRefs, Variation, Squeeze, Info⟩ ← •internal
|
||||||
u ← ⌊100×(•UnixTime+1|100וMonoTime)@
|
u ← ⌊100×(•UnixTime+1|100וMonoTime)@
|
||||||
# u ↩ 123
|
# u ↩ 123
|
||||||
|
|||||||
@ -8,7 +8,7 @@ min ← 0∾(-2⋆7‿15‿31)∾¯0.5∾0‿0‿0
|
|||||||
max ← 2∾( 2⋆7‿15‿31)∾ 0.5∾(2⋆8‿16)∾1114112
|
max ← 2∾( 2⋆7‿15‿31)∾ 0.5∾(2⋆8‿16)∾1114112
|
||||||
szs ← max-min
|
szs ← max-min
|
||||||
chr ← 0‿0‿0‿0‿0‿1‿1‿1
|
chr ← 0‿0‿0‿0‿0‿1‿1‿1
|
||||||
specF64 ⇐ (∾⟜- π‿2∾ 1÷0) ∾ (0÷0) ∾ -0÷0
|
specF64 ⇐ (∾⟜- π‿2‿∞) ∾ (0÷0) ∾ -0÷0
|
||||||
specI32 ⇐ "Ai32" •internal.Variation ∧ (<⟜(2⋆31)∧≥⟜(-2⋆31))⊸/ ∾⟜- ≥⟜0⊸/ ∧⥊(¯4+↕8) +⌜ 2⋆↕32
|
specI32 ⇐ "Ai32" •internal.Variation ∧ (<⟜(2⋆31)∧≥⟜(-2⋆31))⊸/ ∾⟜- ≥⟜0⊸/ ∧⥊(¯4+↕8) +⌜ 2⋆↕32
|
||||||
vars ⇐ "Ab"‿"Ai8"‿"Ai16"‿"Ai32"‿"Af64"‿"Ac8"‿"Ac16"‿"Ac32"
|
vars ⇐ "Ab"‿"Ai8"‿"Ai16"‿"Ai32"‿"Af64"‿"Ac8"‿"Ac16"‿"Ac32"
|
||||||
casts ⇐ 1‿8‿16‿32‿64‿8‿16‿32⋈¨"uiiifccc"
|
casts ⇐ 1‿8‿16‿32‿64‿8‿16‿32⋈¨"uiiifccc"
|
||||||
|
|||||||
@ -86,6 +86,6 @@ Mod ← {𝕊:
|
|||||||
# •Show "heap corruption test of bit/i32" ⋄ "Ai32"‿1‿50 BitSlash 1000000
|
# •Show "heap corruption test of bit/i32" ⋄ "Ai32"‿1‿50 BitSlash 1000000
|
||||||
|
|
||||||
{
|
{
|
||||||
¬0 EEQ -0? •Out "Skipping tests requiring EEQUAL_NEGZERO";
|
¬0 EEQ -0? •Out "Skipping tests requiring !NEEQUAL_NEGZERO";
|
||||||
•Show "⊔ consistency" ⋄ Group 10000
|
•Show "⊔ consistency" ⋄ Group 10000
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user