Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save evtuhovich/556622 to your computer and use it in GitHub Desktop.
Save evtuhovich/556622 to your computer and use it in GitHub Desktop.
From 59c5b3824a16167ae975d382a8f4c293649757cd Mon Sep 17 00:00:00 2001
From: Ivan Evtukhovich <evtuhovich@gmail.com>
Date: Sun, 29 Aug 2010 23:46:40 +0400
Subject: [PATCH 2/2] Fix for Float#mod bug, issue #451
---
vm/builtin/float.cpp | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/vm/builtin/float.cpp b/vm/builtin/float.cpp
index 5b63bcf..a94d56e 100644
--- a/vm/builtin/float.cpp
+++ b/vm/builtin/float.cpp
@@ -104,8 +104,8 @@ namespace rubinius {
Float* Float::mod(STATE, Float* other) {
double res = fmod(this->val, other->val);
- if((other->val < 0.0 && this->val > 0.0) ||
- (other->val > 0.0 && this->val < 0.0)) {
+ if((other->val < 0.0 && this->val > 0.0 && res != 0) ||
+ (other->val > 0.0 && this->val < 0.0 && res != 0)) {
res += other->val;
}
return Float::create(state, res);
--
1.7.0.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment