1 |
/* |
/* |
2 |
* Copyright (C) 2004-2006 Anders Gavare. All rights reserved. |
* Copyright (C) 2004-2007 Anders Gavare. All rights reserved. |
3 |
* |
* |
4 |
* Redistribution and use in source and binary forms, with or without |
* Redistribution and use in source and binary forms, with or without |
5 |
* modification, are permitted provided that the following conditions are met: |
* modification, are permitted provided that the following conditions are met: |
24 |
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
25 |
* SUCH DAMAGE. |
* SUCH DAMAGE. |
26 |
* |
* |
27 |
* $Id: float_emul.c,v 1.7 2006/03/30 19:36:03 debug Exp $ |
* $Id: float_emul.c,v 1.9 2006/12/30 13:30:52 debug Exp $ |
28 |
* |
* |
29 |
* Floating point emulation routines. |
* Floating point emulation routines. |
30 |
*/ |
*/ |
232 |
|
|
233 |
/* |
/* |
234 |
* How to convert back from double to exponent + fraction: |
* How to convert back from double to exponent + fraction: |
235 |
* We want fraction to be 1.xxx, that is |
* The fraction should be 1.xxx, that is |
236 |
* 1.0 <= fraction < 2.0 |
* 1.0 <= fraction < 2.0 |
237 |
* |
* |
238 |
* This method is very slow but should work: |
* This method is very slow but should work: |
239 |
|
* (TODO: Fix the performance problem!) |
240 |
*/ |
*/ |
241 |
exponent = 0; |
exponent = 0; |
242 |
while (nf < 1.0 && exponent > -1023) { |
while (nf < 1.0 && exponent > -1023) { |