1
1
KAWASHIMA Takahiro 8eb90ae9aa mpi/c: Fix MPI_TYPE_CREATE_F90_{REAL,COMPLEX}
This commit fixes edge cases of `r = 38` and `r = 308`.

As defined in the MPI standard, `TYPE_CREATE_F90_REAL` and
`TYPE_CREATE_F90_COMPLEX` must be consistent with the Fortran
`SELECTED_REAL_KIND` function. The `SELECTED_REAL_KIND` function is
defined based on the `RANGE` function. The `RANGE` function returns
`INT(MIN(LOG10(HUGE(X)), -LOG10(TINY(X))))` for a real value `X`.

The old code considers only `INT(LOG10(HUGE(X)))` using `*_MAX_10_EXP`.
This commit adds `INT(-LOG10(TINY(X)))` part using `*_MIN_10_EXP`.

This bug affected the following `p`-`r` combinations.

| p             | r   | expected  | returned  | expected  | returned  |
| :------------ | --: | :-------- | :-------- | :-------  | :-------- |
| MPI_UNDEFINED |  38 | REAL8     | REAL4     | COMPLEX16 | COMPLEX8  |
| 0 <= p <= 6   |  38 | REAL8     | REAL4     | COMPLEX16 | COMPLEX8  |
| MPI_UNDEFINED | 308 | REAL16    | REAL8     | COMPLEX32 | COMPLEX16 |
| 0 <= p <= 15  | 308 | REAL16    | REAL8     | COMPLEX32 | COMPLEX16 |

MPICH returns the same result as Open MPI with this fix.

Signed-off-by: KAWASHIMA Takahiro <t-kawashima@jp.fujitsu.com>
(cherry picked from commit 6fb01f64fe2bcdb4668e520eb458ffd3477e5e6f)
2018-12-13 16:01:56 +09:00
..
2017-05-17 01:12:49 -04:00
2018-07-14 14:14:37 +09:00
2018-07-14 14:14:37 +09:00
2018-03-26 14:21:21 -07:00
2018-07-14 14:14:37 +09:00
2017-05-17 01:12:49 -04:00
2018-07-14 14:14:37 +09:00
2018-07-14 14:14:37 +09:00
2017-08-22 08:56:40 -07:00
2017-05-17 01:12:49 -04:00
2017-05-17 01:12:49 -04:00
2018-07-14 14:14:37 +09:00
2017-03-18 15:08:59 -05:00