| 1882 | | f = to!float("1.17549e-38"); |
|---|
| 1883 | | assert(feq(cast(real)f, cast(real)1.17549e-38)); |
|---|
| 1884 | | assert(feq(cast(real)f, cast(real)float.min_normal)); |
|---|
| 1885 | | f = to!float("3.4028e+38"); |
|---|
| 1886 | | assert(to!string(f) == to!string(3.40282e+38)); |
|---|
| | 1882 | try |
|---|
| | 1883 | { |
|---|
| | 1884 | f = to!float("1.17549e-38"); |
|---|
| | 1885 | assert(feq(cast(real)f, cast(real)1.17549e-38)); |
|---|
| | 1886 | assert(feq(cast(real)f, cast(real)float.min_normal)); |
|---|
| | 1887 | f = to!float("3.40282e+38"); |
|---|
| | 1888 | assert(to!string(f) == to!string(3.40282e+38)); |
|---|
| | 1889 | } |
|---|
| | 1890 | catch (ConvError e) // strtof() bug on some platforms |
|---|
| | 1891 | { |
|---|
| | 1892 | printf(" --- std.conv(%u) broken test ---\n", cast(uint) __LINE__); |
|---|
| | 1893 | printf(" (%.*s)\n", e.msg); |
|---|
| | 1894 | } |
|---|
| 1931 | | d = to!double("2.22508e-308"); |
|---|
| 1932 | | assert(feq(cast(real)d, cast(real)2.22508e-308)); |
|---|
| 1933 | | assert(feq(cast(real)d, cast(real)double.min_normal)); |
|---|
| 1934 | | d = to!double("1.79769e+308"); |
|---|
| 1935 | | assert(to!string(d) == to!string(1.79769e+308)); |
|---|
| 1936 | | assert(to!string(d) == to!string(double.max)); |
|---|
| | 1939 | try |
|---|
| | 1940 | { |
|---|
| | 1941 | d = to!double("2.22508e-308"); |
|---|
| | 1942 | assert(feq(cast(real)d, cast(real)2.22508e-308)); |
|---|
| | 1943 | assert(feq(cast(real)d, cast(real)double.min_normal)); |
|---|
| | 1944 | d = to!double("1.79769e+308"); |
|---|
| | 1945 | assert(to!string(d) == to!string(1.79769e+308)); |
|---|
| | 1946 | assert(to!string(d) == to!string(double.max)); |
|---|
| | 1947 | } |
|---|
| | 1948 | catch (ConvError e) // strtod() bug on some platforms |
|---|
| | 1949 | { |
|---|
| | 1950 | printf(" --- std.conv(%u) broken test ---\n", cast(uint) __LINE__); |
|---|
| | 1951 | printf(" (%.*s)\n", e.msg); |
|---|
| | 1952 | } |
|---|
| 1984 | | r = to!real(to!string(real.min_normal)); |
|---|
| 1985 | | assert(to!string(r) == to!string(real.min_normal)); |
|---|
| 1986 | | r = to!real(to!string(real.max)); |
|---|
| 1987 | | assert(to!string(r) == to!string(real.max)); |
|---|
| | 2000 | try |
|---|
| | 2001 | { |
|---|
| | 2002 | r = to!real(to!string(real.min_normal)); |
|---|
| | 2003 | assert(to!string(r) == to!string(real.min_normal)); |
|---|
| | 2004 | r = to!real(to!string(real.max)); |
|---|
| | 2005 | assert(to!string(r) == to!string(real.max)); |
|---|
| | 2006 | } |
|---|
| | 2007 | catch (ConvError e) // strtold() bug on some platforms |
|---|
| | 2008 | { |
|---|
| | 2009 | printf(" --- std.conv(%u) broken test ---\n", cast(uint) __LINE__); |
|---|
| | 2010 | printf(" (%.*s)\n", e.msg); |
|---|
| | 2011 | } |
|---|