diff options
author | Sverker Eriksson <[email protected]> | 2015-04-15 19:01:13 +0200 |
---|---|---|
committer | Sverker Eriksson <[email protected]> | 2015-04-15 19:02:13 +0200 |
commit | 1a9bb4615bebc4cc37bf436c7d5c6c8fd7b730e8 (patch) | |
tree | f385a47cbaf4b112b561c5256058b20992d0665a /erts/emulator/test | |
parent | 8846021fe1b1bcf79ec3a01037a8a656e161766c (diff) | |
download | otp-1a9bb4615bebc4cc37bf436c7d5c6c8fd7b730e8.tar.gz otp-1a9bb4615bebc4cc37bf436c7d5c6c8fd7b730e8.tar.bz2 otp-1a9bb4615bebc4cc37bf436c7d5c6c8fd7b730e8.zip |
erts: Fix divide by zero compile error in nif_SUITE.c
Diffstat (limited to 'erts/emulator/test')
-rw-r--r-- | erts/emulator/test/nif_SUITE_data/nif_SUITE.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/erts/emulator/test/nif_SUITE_data/nif_SUITE.c b/erts/emulator/test/nif_SUITE_data/nif_SUITE.c index d5109f1e58..b30c484a6c 100644 --- a/erts/emulator/test/nif_SUITE_data/nif_SUITE.c +++ b/erts/emulator/test/nif_SUITE_data/nif_SUITE.c @@ -1660,6 +1660,13 @@ static ERL_NIF_TERM call_nif_exception(ErlNifEnv* env, int argc, const ERL_NIF_T return enif_make_atom(env, "ok"); } +#if !defined(NAN) || !defined(INFINITY) +double zero(void) +{ + return 0.0; +} +#endif + static ERL_NIF_TERM call_nif_nan_or_inf(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]) { double val; @@ -1673,14 +1680,14 @@ static ERL_NIF_TERM call_nif_nan_or_inf(ErlNifEnv* env, int argc, const ERL_NIF_ #ifdef NAN val = NAN; #else - val = 0.0/0.0; + val = 0.0/zero(); #endif } else { /* Verify that enif_make_double raises a badarg for NaN and infinity */ #ifdef INFINITY val = INFINITY; #else - val = 1.0/0.0; + val = 1.0/zero(); #endif } res = enif_make_double(env, val); |