delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/03/03/16:53:19

Date: Tue, 3 Mar 1998 16:49:55 -0500 (EST)
From: Michael Phelps <loverns AT welchlink DOT welch DOT jhu DOT edu>
To: Vlad Pambucol <vlad DOT pambucol AT usa DOT net>
cc: djgpp AT delorie DOT com
Subject: Re: trigonometry problem (math.h)
In-Reply-To: <34FC4875.8672A6F3@usa.net>
Message-ID: <Pine.SOL.3.96.980303164354.21540A-100000@welchlink.welch.jhu.edu>
MIME-Version: 1.0

On Tue, 3 Mar 1998, Vlad Pambucol wrote:

> I don't follow where is the problem???
> 
> float voy;
> float x, units, second;
> int angle;

try "double angle;" instead.  As you have it now, the angle is sharply
restricted by the declaration as an integer.  It's also best if you
explicitly link in the math library (gcc sourcefile.c -o yourprog.exe
-lm), even though it's not necessary to do so in DJGPP V2.

					---Michael Phelps  

> ...
> voy = x * (units/second) * sin(angle);
> printf("%f",voy);
> //the angle is in rad.
> 
> Jesse Meyer wrote:
> 
> > I am writing some code to determine the vertical velocity of a
> > projectile.
> >
> > The physics equation is voy = x (units/second) * sin(angle)
> >
> > I want to design a program that will calculate this given the inital
> > velocity (x) and the angle.
> >
> > I am using DJGPP v2.01 and RHIDE 1.4
> >
> > This is basically a programming question because I am a begginer and all
> > the books I read don't go into using Trig with C.
> >
> > Thanks in advance
> > Jesse
> 
> 
> 
> 

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019