Skip to contentSkip to conversation

QEMU x86_64: sles 64, bug in modf()

Qemu-devel Ludovic Drolez 1 participant 1 message Jan 15, 2007

lore
Share & tools
lore
#0 lore raw

Hi !

I've found a bug in Qemu x86_64 under a sles 64 10: conversion of floats to strings fails in some cases. For example, Ganglia (cluster monitoring
software), shows random values and as well as PHP5 programs.

I've trace a conversion and it seems that the modf() function is buggy under QEMU. The same code run a real system is OK.

=========
#include <stdio.h>
#include <math.h>

int main()
{
double x = 1.1;
double y;
double z;

printf("Calling modf() for %f\n", x);

z = modf(x,&y);
printf("fractional part = %f\ninteger part = %f\n", z, y);

return 0;
}
=========

Under QEMU you get:
Calling modf() for 1.100000
fractional part = 1.100000
integer part = 1.000000

And on a real system:
Calling modf() for 1.100000
fractional part = 0.100000
integer part = 1.000000

So it's a QEMU bug, maybe cause by bogus instructions generated by the SLES gcc compiler (gcc 4.1.0 !).

If anyone has an idea on how to fix this, let me know.

Cheers,

Ludovic.