Summary
Implementation of C_flonum_rat is probably buggy
Metadata
- Id: d4403e20988a3350a8f873e29ed76f2539ba7196
- Trac id: 1051
- Type: defect
- Reporter: felix
- Owner: sjamaan
- Cc:
- Status: closed
- Component: core libraries
- Estimated difficulty:
- Resolution: fixed
- Priority: major
- Milestone: someday
- Version: 4.8.x
- Changetime: 2013-10-02 22:06:17 UTC
- Created: 2013-09-05 11:07:00 UTC
- Keywords: flonum_rat
Description
It seems that a tagged flonum is interpreted as an integer:
void C_ccall C_flonum_rat(C_word c, C_word closure, C_word k, C_word n)
{
double frac, tmp, numer, denom, factor, fn = C_flonum_magnitude(n);
double r1a, r1b;
double ga, gb;
C_word ab[WORDS_PER_FLONUM * 2], *ap = ab;
int i = 0;
if (n < 1 && n > -1) { <---
factor = pow(2, DBL_MANT_DIG);
fn *= factor;
} else {
factor = 1;
}
:
In the code snippet above `n` is access directly, it may be the case that `fn` is actually meant to be tested.
Changes and comments
[2013-10-02 22:06:17 UTC] sjamaan changed status from new to closed
[2013-10-02 22:06:17 UTC] sjamaan set resolution to fixed
[2013-10-02 22:06:17 UTC] sjamaan wrote:
Fixed in 18ce467a28f4f180b5efebdaeb167498c1b19508