We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 2274 - SDL_ceil is incorrectly implemented when HAVE_LIBC is not defined
Summary: SDL_ceil is incorrectly implemented when HAVE_LIBC is not defined
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: *don't know* (show other bugs)
Version: HG 2.0
Hardware: All All
: P2 major
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-11-26 10:00 UTC by Ghassan Al-Mashareqa
Modified: 2013-11-27 08:30 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ghassan Al-Mashareqa 2013-11-26 10:00:51 UTC
The SDL_ceil function is implemented incorrectly when HAVE_CEIL is not defined (HAVE_LIBC not defined).

The following code:

	double val = SDL_ceil(2.3);
	printf("%g", val);

prints "2.0", as STD_ceil is defined as: 

	double
	SDL_ceil(double x)
	{
	#ifdef HAVE_CEIL
	    return ceil(x);
	#else
	    return (double)(int)((x)+0.5);
	#endif /* HAVE_CEIL */
	}

This functions is used in the SDL_BuildAudioResampleCVT function of the audio subsystem (SDL_audiocvt.c), and causes a bug in that function.
Comment 1 Sam Lantinga 2013-11-27 08:30:44 UTC
Fixed, thanks!