Permalink
Browse files

changing the behavior of tan, atan, and makeComplexPolar when given e…

…xact 0
  • Loading branch information...
1 parent 185e321 commit 608b38f21c53684e4310ad36b06bf47c1a4f4fc3 Danny Yoo committed Jun 27, 2011
Showing with 3 additions and 1 deletion.
  1. +3 −1 src/js-numbers.js
View
@@ -616,6 +616,7 @@ if (typeof(exports) !== 'undefined') {
// tan: scheme-number -> scheme-number
var tan = function(n) {
+ if (eqv(n, 0)) { return 0; }
if (typeof(n) === 'number') {
return FloatPoint.makeInstance(Math.tan(n));
}
@@ -624,6 +625,7 @@ if (typeof(exports) !== 'undefined') {
// atan: scheme-number -> scheme-number
var atan = function(n) {
+ if (eqv(n, 0)) { return 0; }
if (typeof(n) === 'number') {
return FloatPoint.makeInstance(Math.atan(n));
}
@@ -807,7 +809,7 @@ if (typeof(exports) !== 'undefined') {
var makeComplexPolar = function(r, theta) {
// special case: if theta is zero, just return
// the scalar.
- if (equals(theta, 0)) {
+ if (eqv(theta, 0)) {
return r;
}
return Complex.makeInstance(multiply(r, cos(theta)),

0 comments on commit 608b38f

Please sign in to comment.