Re: Problem with long double in MS VC++ v6.0 ?

From: Anthony Borla (ajborla_at_bigpond.com)
Date: 03/19/05


Date: Sat, 19 Mar 2005 19:02:31 GMT


"spiatek " <spiatek@neostrada.pl > wrote in message
news:d1hrfs$oi4$1@nemesis.news.tpi.pl...
> I wrote such programme:
>
> long double A,B,C;
>
> A=2e-1;
> C=1e-17;
> B=A+C;
>
> if(A==B)
> {
> A=1;
> }
> else
> {
> B=1;
> }
>
> Why does computer still sees, that A == B?
> What do to make programme to calculate correctly?
> Maybe alter something in options VC++ ?
>

Try the following code:

#include <stdio.h>

int main(void)
{
    printf("sizeof double: %d\n", sizeof(double));
    printf("sizeof long double: %d\n", sizeof(long double));
    return 0;
}

If the sizes are the same then you have your answer :) !

Cheers,

Anthony Borla



Relevant Pages

  • Re: how to count rows and columns of integers/doubles in a file?
    ... the reading and the writing programme are in the same locale, ... unsigned rows, cols, oldcols; ... int countColsInNextLine ... warning C4013: 'system' undefined; assuming extern returning int ...
    (comp.lang.c)
  • doubt about socket programing
    ... my client side programme ... int k=Integer.parseInt); ... OutputStream out1=s.getOutputStream; ... response from server for that input.and then program is hanging ...
    (comp.lang.java.programmer)
  • Re: strange thing using Process class to call outside executable file
    ... Check out Performance Counters. ... use the Process class in C#,and my thread is as follows:start a process ... int main ... it comes out that this programme uses around 1800KB memory(this may be ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: K&R2, section 1.5.3, exercise 1.8
    ... Richard Heathfield has created a C programme at his answers page: ... i have also created my programme which runs fine. ... int main{ ... disgusting style. ...
    (comp.lang.c)
  • strange thing using Process class to call outside executable file
    ... I've been working on an online judge(for ACM/ICPC) using C#.Programmes ... use the Process class in C#,and my thread is as follows:start a process ... int main ... it comes out that this programme uses around 1800KB memory(this may be ...
    (microsoft.public.dotnet.framework.aspnet)