atom feed17 messages in org.freebsd.freebsd-standardsImplementing C99's roundf(), round(),...
FromSent OnAttachments
Steve KarglNov 28, 2003 4:05 pm 
David SchultzNov 29, 2003 12:13 am 
Steve KarglNov 29, 2003 8:35 am 
David SchultzNov 30, 2003 1:42 pm 
Steve KarglNov 30, 2003 3:53 pm 
Bruce EvansDec 1, 2003 12:05 am 
David SchultzDec 1, 2003 12:54 am 
Steve KarglDec 1, 2003 12:35 pm 
Bruce EvansDec 1, 2003 2:57 pm 
Steve KarglDec 1, 2003 7:39 pm 
Bruce EvansDec 1, 2003 9:57 pm 
David SchultzJan 19, 2004 1:32 pm 
Steve KarglJan 19, 2004 2:14 pm 
Bruce EvansJan 19, 2004 8:34 pm 
Bruce EvansJan 19, 2004 10:10 pm 
David SchultzJan 21, 2004 1:18 am 
Bruce EvansJan 21, 2004 2:01 am 
Subject:Implementing C99's roundf(), round(), and roundl()
From:Steve Kargl (sg@troutmask.apl.washington.edu)
Date:Nov 28, 2003 4:05:23 pm
List:org.freebsd.freebsd-standards

Can the math functions round[fl]() be implemented in terms of other math(3) functions and still conform to the C99 and POSIX standard? For example,

#include <math.h>

float roundf(float x) { float t; if (x >= 0.0) { t = ceilf(x); if ((t - x) > 0.5) t -= 1.0; return t; } else { t = ceilf(-x); if ((t + x) > 0.5) t -= 1.0; return -t; } }