| 286 | | // TODO: real.sizeof can vary platform-to-platform! (also creal,ireal) |
|---|
| 287 | | value = decode!(VALUE)(storage.get(VALUE.sizeof)); |
|---|
| | 286 | static if( is(VALUE==real) || is(VALUE==creal) || is(VALUE==ireal)) { |
|---|
| | 287 | // TODO: implement platform independent multi-precision float |
|---|
| | 288 | // to handle any platform-specific 'real' type. |
|---|
| | 289 | |
|---|
| | 290 | // But for now (v1.1 binary format), reals are treated as doubles |
|---|
| | 291 | static if(is(VALUE==real)) { alias double DVALUE; } |
|---|
| | 292 | else static if(is(VALUE==creal)) { alias cdouble DVALUE; } |
|---|
| | 293 | else static if(is(VALUE==ireal)) { alias idouble DVALUE; } |
|---|
| | 294 | DVALUE dvalue; |
|---|
| | 295 | if (!loadNumber!(DVALUE)(dvalue)) |
|---|
| | 296 | return false; |
|---|
| | 297 | value = dvalue; |
|---|
| | 298 | return true; |
|---|
| | 299 | } |
|---|
| | 300 | else { |
|---|
| | 301 | value = decode!(VALUE)(storage.get(VALUE.sizeof)); |
|---|
| | 302 | } |
|---|
| 294 | | // TODO: real.sizeof can vary platform-to-platform! (also creal,ireal) |
|---|
| 295 | | storage.put(encode(value)); |
|---|
| | 309 | static if( is(VALUE==real) || is(VALUE==creal) || is(VALUE==ireal)) { |
|---|
| | 310 | // TODO: implement platform independent multi-precision float |
|---|
| | 311 | // to handle any platform-specific 'real' type. |
|---|
| | 312 | |
|---|
| | 313 | // But for now (v1.1 binary format), reals are treated as doubles |
|---|
| | 314 | static if(is(VALUE==real)) { alias double DVALUE; } |
|---|
| | 315 | else static if(is(VALUE==creal)) { alias cdouble DVALUE; } |
|---|
| | 316 | else static if(is(VALUE==ireal)) { alias idouble DVALUE; } |
|---|
| | 317 | DVALUE dvalue = value; |
|---|
| | 318 | if (!dumpNumber!(DVALUE)(dvalue)) |
|---|
| | 319 | return false; |
|---|
| | 320 | } |
|---|
| | 321 | else { |
|---|
| | 322 | storage.put(encode(value)); |
|---|
| | 323 | } |
|---|