Skip to content

Commit

Permalink
Hold flonum as long double in AST
Browse files Browse the repository at this point in the history
  • Loading branch information
tyfkda committed Mar 11, 2024
1 parent a05b6ae commit 8cf38e0
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 11 deletions.
4 changes: 2 additions & 2 deletions libsrc/stdio/vfprintf.c
Original file line number Diff line number Diff line change
Expand Up @@ -252,10 +252,10 @@ int vfprintf(FILE *fp, const char *fmt_, va_list ap) {
}
}

if (c == 'l') {
if (tolower(c) == 'l') {
nlong = 1;
c = fmt[++i];
if (c == 'l') {
if (tolower(c) == 'l') {
nlong = 2;
c = fmt[++i];
}
Expand Down
2 changes: 1 addition & 1 deletion src/_debug/dump_expr.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ void dump_expr(FILE *fp, Expr *expr) {
case EX_FLONUM:
{
char buf[64];
snprintf(buf, sizeof(buf) - 4, "%g", expr->flonum);
snprintf(buf, sizeof(buf) - 4, "%Lg", expr->flonum);
if (strchr(buf, '.') == NULL)
strcat(buf, ".0");
switch (expr->type->flonum.kind) {
Expand Down
4 changes: 0 additions & 4 deletions src/as/inst.h
Original file line number Diff line number Diff line change
Expand Up @@ -252,11 +252,7 @@ enum ExprKind {
};

#ifndef __NO_FLONUM
#if defined(__XCC)
typedef long double Flonum;
#else
typedef double Flonum;
#endif
#endif

typedef struct Expr {
Expand Down
4 changes: 0 additions & 4 deletions src/cc/frontend/ast.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,7 @@ typedef int64_t Fixnum;
typedef uint64_t UFixnum;

#ifndef __NO_FLONUM
#ifdef __XCC
typedef long double Flonum;
#else
typedef double Flonum; // TODO: long double
#endif
#endif

enum StrKind {
Expand Down

0 comments on commit 8cf38e0

Please sign in to comment.