From: Ben Pfaff Date: Mon, 23 Jul 2007 04:46:30 +0000 (+0000) Subject: (float_get_double): New function. X-Git-Tag: v0.6.0~364 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a3d1c6cd2c0ad62ada29c38b67df483abc762c44;p=pspp-builds.git (float_get_double): New function. --- diff --git a/src/libpspp/ChangeLog b/src/libpspp/ChangeLog index 8c8e30c2..f66e386c 100644 --- a/src/libpspp/ChangeLog +++ b/src/libpspp/ChangeLog @@ -1,3 +1,7 @@ +2007-07-22 Ben Pfaff + + * float-format.c (float_get_double): New function. + 2007-07-06 Ben Pfaff * copyleft.c (legal): Update startup notice to use format diff --git a/src/libpspp/float-format.c b/src/libpspp/float-format.c index 7d65375a..79ba9446 100644 --- a/src/libpspp/float-format.c +++ b/src/libpspp/float-format.c @@ -106,6 +106,16 @@ float_convert (enum float_format from, const void *src, } } +/* Converts SRC from format FROM to a native double and returns + the double. */ +double +float_get_double (enum float_format from, const void *src) +{ + double dst; + float_convert (from, src, FLOAT_NATIVE_DOUBLE, &dst); + return dst; +} + /* Returns the number of bytes in a number in the given FORMAT. */ size_t