wierd ASIN bug

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

wierd ASIN bug

Post by blahboybang »

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: 3804
Joined: May 27, 2005 8:08
Location: SP / Bra[s]il
Contact:

Post by v1ctor »

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:

Post by red_Marvin »

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

Post by jofers »

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

Post by ytwinky »

..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:

Post by voodooattack »

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 :)
Post Reply