Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
6694b327
Commit
6694b327
authored
Mar 15, 1994
by
Karl Heuer
Browse files
(Flogb): Check for 0.0. Emulate logb if needed.
parent
c2d606f4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
11 deletions
+28
-11
src/floatfns.c
src/floatfns.c
+28
-11
No files found.
src/floatfns.c
View file @
6694b327
...
...
@@ -656,23 +656,40 @@ This is the same as the exponent of a float.")
int
value
;
double
f
=
extract_float
(
arg
);
if
(
f
==
0
.
0
)
value
=
-
(
VALMASK
>>
1
);
else
{
#ifdef HAVE_LOGB
IN_FLOAT
(
value
=
logb
(
f
),
"logb"
,
arg
);
XSET
(
val
,
Lisp_Int
,
value
);
IN_FLOAT
(
value
=
logb
(
f
),
"logb"
,
arg
);
#else
#ifdef HAVE_FREXP
{
int
exp
;
IN_FLOAT
(
frexp
(
f
,
&
exp
),
"logb"
,
arg
);
XSET
(
val
,
Lisp_Int
,
exp
-
1
);
}
IN_FLOAT
(
frexp
(
f
,
&
value
),
"logb"
,
arg
);
value
--
;
#else
/* Would someone like to write code to emulate logb? */
error
(
"`logb' not implemented on this operating system"
);
int
i
;
double
d
;
if
(
f
<
0
.
0
)
f
=
-
f
;
value
=
-
1
;
while
(
f
<
0
.
5
)
{
for
(
i
=
1
,
d
=
0
.
5
;
d
*
d
>=
f
;
i
+=
i
)
d
*=
d
;
f
/=
d
;
value
-=
i
;
}
while
(
f
>=
1
.
0
)
{
for
(
i
=
1
,
d
=
2
.
0
;
d
*
d
<=
f
;
i
+=
i
)
d
*=
d
;
f
/=
d
;
value
+=
i
;
}
#endif
#endif
}
XSET
(
val
,
Lisp_Int
,
value
);
return
val
;
}
...
...
Write
Preview
Markdown
is supported
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