wierd ASIN bug

General FreeBASIC programming questions.
blahboybang
Posts: 385
Joined: Oct 16, 2005 0:15
Location: USA
Contact:

wierd ASIN bug

Postby blahboybang » Feb 17, 2006 19:57

I was playing aroun with functions and I ran some simple code:

Code: Select all

print ASin(5)
sleep


The screen printed:

1.#QNAN


What the heck is THAT?

I am using version 15.
v1ctor
Site Admin
Posts: 3799
Joined: May 27, 2005 8:08
Location: SP / Bra[s]il
Contact:

Postby v1ctor » Feb 17, 2006 21:07

printf( "%g\n", asin( 5.0 ) ); gives -1.INF# in C, so that's not a valid input.
red_Marvin
Posts: 201
Joined: Nov 13, 2005 11:37
Location: Sweden
Contact:

Postby red_Marvin » Feb 17, 2006 22:47

ASIN(X) is only valid for 1<=X<=1
jofers
Posts: 1525
Joined: May 27, 2005 17:18
Contact:

Postby jofers » Feb 18, 2006 1:40

Think about it -- how can the sine of a number be more than one or less than negative one?
ytwinky
Posts: 217
Joined: Dec 03, 2005 12:44
Location: MD, Germany

Postby ytwinky » Feb 19, 2006 17:43

..and don't forget, ACos() follows 'the same' rules:
ACos(x) is defined only for Abs(x)<=1.0
regards
ytwinky
voodooattack
Posts: 605
Joined: Feb 18, 2006 13:30
Location: Alexandria / Egypt
Contact:

Postby voodooattack » Feb 20, 2006 12:11

ASIN accepts a value as radians (double)..

that would be -1 to 1

so, you can't feed it a value larger than 1 or less than -1 :)

Return to “General”

Who is online

Users browsing this forum: fxm and 1 guest