vlog95: switch to C99 real number classification routines
This commit is contained in:
parent
fe8e7a6261
commit
96d793ed6b
|
|
@ -78,7 +78,7 @@ else
|
||||||
endif
|
endif
|
||||||
|
|
||||||
vlog95.tgt: $O $(TGTDEPLIBS)
|
vlog95.tgt: $O $(TGTDEPLIBS)
|
||||||
$(CC) @shared@ $(LDFLAGS) -o $@ $O $(TGTLDFLAGS)
|
$(CC) @shared@ $(LDFLAGS) -o $@ $O -lm $(TGTLDFLAGS)
|
||||||
|
|
||||||
install: all installdirs $(libdir)/ivl$(suffix)/vlog95.tgt $(INSTALL_DOC) $(libdir)/ivl$(suffix)/vlog95.conf $(libdir)/ivl$(suffix)/vlog95-s.conf
|
install: all installdirs $(libdir)/ivl$(suffix)/vlog95.tgt $(INSTALL_DOC) $(libdir)/ivl$(suffix)/vlog95.conf $(libdir)/ivl$(suffix)/vlog95-s.conf
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2011-2012 Cary R. (cygcary@yahoo.com)
|
* Copyright (C) 2011-2014 Cary R. (cygcary@yahoo.com)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -16,6 +16,7 @@
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
# include <math.h>
|
||||||
# include <stdlib.h>
|
# include <stdlib.h>
|
||||||
# include <string.h>
|
# include <string.h>
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
|
|
@ -168,18 +169,19 @@ void emit_number(const char *bits, unsigned nbits, unsigned is_signed,
|
||||||
void emit_real_number(double value)
|
void emit_real_number(double value)
|
||||||
{
|
{
|
||||||
/* Check for NaN. */
|
/* Check for NaN. */
|
||||||
if (value != value) {
|
if (isnan(value)) {
|
||||||
fprintf(vlog_out, "(0.0/0.0)");
|
fprintf(vlog_out, "(0.0/0.0)");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* Check for the infinities. */
|
/* Check for the infinities. */
|
||||||
if (value && value == 0.5*value) {
|
if (isinf(value)) {
|
||||||
if (value > 0) fprintf(vlog_out, "(1.0/0.0)");
|
if (signbit(value)) fprintf(vlog_out, "(-1.0/0.0)");
|
||||||
else fprintf(vlog_out, "(-1.0/0.0)");
|
else fprintf(vlog_out, "(1.0/0.0)");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
/* Check for +/- zero. */
|
||||||
if (value == 0.0) {
|
if (value == 0.0) {
|
||||||
if (1.0/value < 0.0) fprintf(vlog_out, "-0.0");
|
if (signbit(value)) fprintf(vlog_out, "-0.0");
|
||||||
else fprintf(vlog_out, "0.0");
|
else fprintf(vlog_out, "0.0");
|
||||||
} else {
|
} else {
|
||||||
char buffer[32];
|
char buffer[32];
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue