1 | /* |
1 | /* |
2 | * libecb - http://software.schmorp.de/pkg/libecb |
2 | * libecb - http://software.schmorp.de/pkg/libecb |
3 | * |
3 | * |
4 | * Copyright (©) 2009-2012 Marc Alexander Lehmann <libecb@schmorp.de> |
4 | * Copyright (©) 2009-2013 Marc Alexander Lehmann <libecb@schmorp.de> |
5 | * Copyright (©) 2011 Emanuele Giaquinta |
5 | * Copyright (©) 2011 Emanuele Giaquinta |
6 | * All rights reserved. |
6 | * All rights reserved. |
7 | * |
7 | * |
8 | * Redistribution and use in source and binary forms, with or without modifica- |
8 | * Redistribution and use in source and binary forms, with or without modifica- |
9 | * tion, are permitted provided that the following conditions are met: |
9 | * tion, are permitted provided that the following conditions are met: |
… | |
… | |
612 | float r; |
612 | float r; |
613 | |
613 | |
614 | if (!e ) r = ldexpf (m , -24); |
614 | if (!e ) r = ldexpf (m , -24); |
615 | else if (e != 31) r = ldexpf (m + 0x400, e - 25); |
615 | else if (e != 31) r = ldexpf (m + 0x400, e - 25); |
616 | else if (m ) r = ECB_NAN; |
616 | else if (m ) r = ECB_NAN; |
617 | else r = INFINITY; |
617 | else r = ECB_INFINITY; |
618 | |
618 | |
619 | return x & 0x8000 ? -r : r; |
619 | return x & 0x8000 ? -r : r; |
620 | } |
620 | } |
621 | |
621 | |
622 | /* convert a float to ieee single/binary32 */ |
622 | /* convert a float to ieee single/binary32 */ |