[svn:parrot] r48214 - in trunk: src/ops t/op
NotFound at svn.parrot.org
NotFound at svn.parrot.org
Thu Jul 29 17:21:10 UTC 2010
Author: NotFound
Date: Thu Jul 29 17:21:09 2010
New Revision: 48214
URL: https://trac.parrot.org/parrot/changeset/48214
Log:
fix int fdiv and add some tests for it, TT #1720
Modified:
trunk/src/ops/core_ops.c
trunk/src/ops/math.ops
trunk/t/op/integer.t
Modified: trunk/src/ops/core_ops.c
==============================================================================
--- trunk/src/ops/core_ops.c Thu Jul 29 08:29:41 2010 (r48213)
+++ trunk/src/ops/core_ops.c Thu Jul 29 17:21:09 2010 (r48214)
@@ -17906,7 +17906,7 @@
"Divide by zero");return (opcode_t *)handler;
}
- f = floor(IREG(1) / den);
+ f = floor(((FLOATVAL)IREG(1)) / den);
IREG(1) = (INTVAL)f;
return (opcode_t *)cur_opcode + 3;}
@@ -17923,7 +17923,7 @@
"Divide by zero");return (opcode_t *)handler;
}
- f = floor(IREG(1) / den);
+ f = floor(((FLOATVAL)IREG(1)) / den);
IREG(1) = (INTVAL)f;
return (opcode_t *)cur_opcode + 3;}
@@ -18001,7 +18001,7 @@
"Divide by zero");return (opcode_t *)handler;
}
- f = floor(IREG(2) / den);
+ f = floor((FLOATVAL)IREG(2) / den);
IREG(1) = (INTVAL)f;
return (opcode_t *)cur_opcode + 4;}
@@ -18018,7 +18018,7 @@
"Divide by zero");return (opcode_t *)handler;
}
- f = floor(cur_opcode[2] / den);
+ f = floor((FLOATVAL)cur_opcode[2] / den);
IREG(1) = (INTVAL)f;
return (opcode_t *)cur_opcode + 4;}
@@ -18035,7 +18035,7 @@
"Divide by zero");return (opcode_t *)handler;
}
- f = floor(IREG(2) / den);
+ f = floor((FLOATVAL)IREG(2) / den);
IREG(1) = (INTVAL)f;
return (opcode_t *)cur_opcode + 4;}
@@ -25017,7 +25017,7 @@
PARROT_FUNCTION_CORE, /* core_type = PARROT_XX_CORE */
0, /* flags */
2, /* major_version */
- 5, /* minor_version */
+ 6, /* minor_version */
0, /* patch_version */
1083, /* op_count */
core_op_info_table, /* op_info_table */
Modified: trunk/src/ops/math.ops
==============================================================================
--- trunk/src/ops/math.ops Thu Jul 29 08:29:41 2010 (r48213)
+++ trunk/src/ops/math.ops Thu Jul 29 17:21:09 2010 (r48214)
@@ -299,7 +299,7 @@
goto ADDRESS(handler);
}
- f = floor($1 / den);
+ f = floor(((FLOATVAL)$1) / den);
$1 = (INTVAL)f;
}
@@ -337,7 +337,7 @@
goto ADDRESS(handler);
}
- f = floor($2 / den);
+ f = floor((FLOATVAL)$2 / den);
$1 = (INTVAL)f;
}
Modified: trunk/t/op/integer.t
==============================================================================
--- trunk/t/op/integer.t Thu Jul 29 08:29:41 2010 (r48213)
+++ trunk/t/op/integer.t Thu Jul 29 17:21:09 2010 (r48214)
@@ -16,7 +16,7 @@
=cut
-.const int TESTS = 150
+.const int TESTS = 152
.sub 'test' :main
.include 'test_more.pir'
@@ -30,6 +30,7 @@
test_sub()
test_mul()
test_div()
+ test_fdiv()
test_mod()
mod_negative_zero_rest()
test_eq()
@@ -276,6 +277,18 @@
is($I1, 10, 'div_i_ic_ic')
.end
+.sub 'test_fdiv'
+ $I0 = 9
+ $I1 = -4
+ fdiv $I0, $I1
+ is($I0, -3, 'fdiv_i_i with negative divisor')
+
+ $I0 = 9
+ $I1 = -4
+ $I2 = fdiv $I0, $I1
+ is($I2, -3, 'fdiv_i_i_i with negative divisor')
+.end
+
.sub 'test_mod'
$I0 = 5
$I1 = 0
More information about the parrot-commits
mailing list