Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Glasgow Haskell Compiler
GHC
Commits
91b0770d
Commit
91b0770d
authored
Feb 22, 1999
by
simonm
Browse files
[project @ 1999-02-22 10:51:18 by simonm]
- Fix off-by-one in __encodeFloat; - Tidy up __encodeDouble a bit.
parent
114da353
Changes
1
Hide whitespace changes
Inline
Side-by-side
ghc/rts/StgPrimFloat.c
View file @
91b0770d
/* -----------------------------------------------------------------------------
/* -----------------------------------------------------------------------------
* $Id: StgPrimFloat.c,v 1.
4
1999/02/
18 12:26
:1
2
simonm Exp $
* $Id: StgPrimFloat.c,v 1.
5
1999/02/
22 10:51
:1
8
simonm Exp $
*
*
* (c) The GHC Team, 1998-1999
* (c) The GHC Team, 1998-1999
*
*
...
@@ -51,13 +51,8 @@ __encodeDouble (I_ size, StgByteArray ba, I_ e) /* result = s * 2^e */
...
@@ -51,13 +51,8 @@ __encodeDouble (I_ size, StgByteArray ba, I_ e) /* result = s * 2^e */
I_
i
;
I_
i
;
/* Convert MP_INT to a double; knows a lot about internal rep! */
/* Convert MP_INT to a double; knows a lot about internal rep! */
i
=
__abs
(
size
)
-
1
;
for
(
r
=
0
.
0
,
i
=
__abs
(
size
)
-
1
;
i
>=
0
;
i
--
)
if
(
i
<
0
)
{
r
=
(
r
*
GMP_BASE
)
+
arr
[
i
];
r
=
0
.
0
;
}
else
{
for
(
r
=
arr
[
i
],
i
--
;
i
>=
0
;
i
--
)
r
=
r
*
GMP_BASE
+
arr
[
i
];
}
/* Now raise to the exponent */
/* Now raise to the exponent */
if
(
r
!=
0
.
0
)
/* Lennart suggests this avoids a bug in MIPS's ldexp */
if
(
r
!=
0
.
0
)
/* Lennart suggests this avoids a bug in MIPS's ldexp */
...
@@ -98,7 +93,7 @@ __encodeFloat (I_ size, StgByteArray ba, I_ e) /* result = s * 2^e */
...
@@ -98,7 +93,7 @@ __encodeFloat (I_ size, StgByteArray ba, I_ e) /* result = s * 2^e */
I_
i
;
I_
i
;
/* Convert MP_INT to a float; knows a lot about internal rep! */
/* Convert MP_INT to a float; knows a lot about internal rep! */
for
(
r
=
0
.
0
,
i
=
__abs
(
size
);
i
>=
0
;
i
--
)
for
(
r
=
0
.
0
,
i
=
__abs
(
size
)
-
1
;
i
>=
0
;
i
--
)
r
=
(
r
*
GMP_BASE
)
+
arr
[
i
];
r
=
(
r
*
GMP_BASE
)
+
arr
[
i
];
/* Now raise to the exponent */
/* Now raise to the exponent */
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment