🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #41991

printf of floating point numbers does not work o.k.?!

#41991
From: Malte Kroeger
Date: Wed, 24 Jan 1996 00:00
22 lines
986 bytes
I wrote a tiny programm for a tan and cos-calculation. something like this:

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

main()
{
    long double x;
    double y;

    x=cos(.....);      /* calculating some stuff */
    y=tan(.....);
    printf("X: %f, Y: %f\n", x, y);   /* print out vars does not work */
    
    cout << x << y;    /* this cc-output produces correct results! */
}

it doesn't matter if I use double or long double, no matter
if %f, %g, %e. It gives out stupid numbers. What am I doing wrong?
Diesn't work on BC++ 3.1 eather.

Malte
Technical Details
Message-ID: <4e5i64$inf@rzsun02.rrz.uni-hamburg.de>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,3452c4eb40912499,start
X-Google-Attributes: gid11318c,public
From: 5kroeger@informatik.uni-hamburg.de (Malte Kroeger)
Subject: printf of floating point numbers does not work o.k.?!
Date: 1996/01/24
Message-ID: <4e5i64$inf@rzsun02.rrz.uni-hamburg.de>
X-Deja-AN: 137312082
organization: University of Hamburg -- Germany
newsgroups: gnu.gcc.help