diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2016-04-30 05:12:20 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2016-04-30 05:12:20 +0200 |
commit | 974c4fc768c12af947af13de75c227ef7e6ca50d (patch) | |
tree | 388940981eeb5e9d313ee4b579a04e2d4c0d2773 /sys/src/cmd/awk | |
parent | ce1edc34368d192db7d3421673ca98c19cc792b2 (diff) |
awk: temporarily fix for NaN() exceptions on 386
problem is NaN() produces a SNaN, not a QNaN... and on the 387,
storing 80 bit SNaN in register to a 64-bit memory destination
traps.
SNaN/QNaN encoding is machine specific. mips has the qiet/signaling
bit inverted.
disabling fp exception in main() now, but that sucks.
i think the best solution would be to not even call strtod() in
is_number() but just write a regex or a little state machine that
will only accept numbers without nan and ±inf.
that might even make it faster and is more robust than relying on
the os's strtod() details.
Diffstat (limited to 'sys/src/cmd/awk')
-rw-r--r-- | sys/src/cmd/awk/main.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/src/cmd/awk/main.c b/sys/src/cmd/awk/main.c index 3d1ae4e0d..2695de56d 100644 --- a/sys/src/cmd/awk/main.c +++ b/sys/src/cmd/awk/main.c @@ -55,6 +55,8 @@ void main(int argc, char *argv[]) char *fs = nil, *marg; int temp; + setfcr(getfcr() & ~FPINVAL); + Binit(&stdin, 0, OREAD); Binit(&stdout, 1, OWRITE); Binit(&stderr, 2, OWRITE); |