public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Floating Point Issue
@ 2007-09-27 11:41 mahamuni ashish
  2007-09-27 15:17 ` Jan Engelhardt
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: mahamuni ashish @ 2007-09-27 11:41 UTC (permalink / raw)
  To: linux-kernel

I have small code....

#include <stdio.h>
#include <string.h>

int main()
{
float f= 1256.35;
char ch[4];

printf("\n1. f : %f",f);
memset(ch,'\0',strlen(ch) );
printf("\n2. f : %f",f);
return 0;
}

Expected output is
1. f : 1256.35
2. f : 1256.35

But I am getting the output
(on windows)
1. f : 1256.35
2. f : 0.000000

(on Linux)
1. f : 1256.35
segmentation fault

why?


      Forgot the famous last words? Access your message archive online at http://in.messenger.yahoo.com/webmessengerpromo.php


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2007-09-28  8:32 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-27 11:41 Floating Point Issue mahamuni ashish
2007-09-27 15:17 ` Jan Engelhardt
2007-09-28  2:32   ` WANG Cong
2007-09-27 15:21 ` Xavier Bestel
2007-09-27 15:29 ` Al Viro
2007-09-27 18:25 ` Trond Myklebust
2007-09-27 20:53 ` linux-os (Dick Johnson)
2007-09-27 21:01   ` Jan Engelhardt
2007-09-28  8:31 ` Bernd Petrovitsch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox