Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(739)

Unified Diff: src/cmd/gc/mparith3.c

Issue 4104041: correctly compile -0 floating point constants
Patch Set: code review 4104041: correctly compile -0 floating point constants Created 13 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/cmd/cc/pswt.c ('k') | src/cmd/gc/obj.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/cmd/gc/mparith3.c
===================================================================
--- a/src/cmd/gc/mparith3.c
+++ b/src/cmd/gc/mparith3.c
@@ -34,7 +34,6 @@
if(os == 0) {
// zero
a->exp = 0;
- a->val.neg = 0;
return;
}
@@ -187,8 +186,11 @@
yyerror("mpgetflt ovf");
s = sigfig(a);
- if(s == 0)
- return 0;
+ if(s == 0) {
+ if(a->val.neg)
+ return -0.0;
+ return 0.0;
+ }
if(s != Mpnorm) {
yyerror("mpgetflt norm");
@@ -248,12 +250,12 @@
print("\nconst %g", c);
mpmovecfix(&a->val, 0);
a->exp = 0;
- if(c == 0)
- goto out;
- if(c < 0) {
+ if(signbit(c)) {
a->val.neg = 1;
c = -c;
}
+ if(c == 0)
+ goto out;
f = frexp(c, &i);
a->exp = i;
« no previous file with comments | « src/cmd/cc/pswt.c ('k') | src/cmd/gc/obj.c » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b