use correct signs in fixnum remainders

This commit is contained in:
Mark Thom
2020-04-18 17:37:54 -06:00
parent 1d964ef921
commit 2c8858ff2d
4 changed files with 13 additions and 2 deletions

7
Cargo.lock generated
View File

@@ -146,6 +146,11 @@ dependencies = [
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "divrem"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "downcast"
version = "0.10.0"
@@ -614,6 +619,7 @@ version = "0.8.120"
dependencies = [
"crossterm 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)",
"dirs 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"divrem 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"downcast 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
"git-version 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"indexmap 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -814,6 +820,7 @@ dependencies = [
"checksum crossterm_winapi 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "057b7146d02fb50175fd7dbe5158f6097f33d02831f43b4ee8ae4ddf67b68f5c"
"checksum dirs 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "13aea89a5c93364a98e9b37b2fa237effbb694d5cfe01c5b70941f7eb087d5e3"
"checksum dirs-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "afa0b23de8fd801745c471deffa6e12d248f962c9fd4b4c33787b055599bde7b"
"checksum divrem 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc9f8914dcb99891bdfee82536bbff8d9aa612b0dbe83872afbc66902bdec0b9"
"checksum downcast 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4bb454f0228b18c7f4c3b0ebbee346ed9c52e7443b0999cd543ff3571205701d"
"checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2"
"checksum failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea1063915fd7ef4309e222a5a07cf9c319fb9c7836b1f89b85458672dbb127e1"

View File

@@ -18,13 +18,14 @@ num = ["num-rug-adapter", "prolog_parser/num"]
[dependencies]
crossterm = "0.16.0"
dirs = "2.0.2"
divrem = "0.1.0"
downcast = "0.10.0"
git-version = "0.3.4"
indexmap = "1.0.2"
lazy_static = "1.4.0"
libc = "0.2.62"
nix = "0.15.0"
num-rug-adapter = { optional = true, version = "0.1.1" }
num-rug-adapter = { optional = true, version = "0.1.2" }
ordered-float = "0.5.0"
prolog_parser = { version = "0.8.52", default-features = false }
ref_thread_local = "0.0.0"

View File

@@ -1,4 +1,5 @@
extern crate crossterm;
extern crate divrem;
#[macro_use]
extern crate downcast;
extern crate git_version;

View File

@@ -1,3 +1,5 @@
use crate::divrem::*;
use crate::prolog_parser::ast::*;
use crate::prolog::arithmetic::*;
@@ -990,7 +992,7 @@ impl MachineState {
stub,
))
} else {
Ok(Number::from(n1 % n2))
Ok(Number::from(n1.rem_floor(n2)))
}
}
(Number::Fixnum(n1), Number::Integer(n2)) => {