Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,71 @@
|
|||
#!/usr/local/bin/spar
|
||||
pragma annotate( summary, "trig" )
|
||||
@( description, "If your language has a library or built-in " )
|
||||
@( description, "functions for trigonometry, show examples of: ")
|
||||
@( description, "sine, cosine, tangent, inverses (of the above) " )
|
||||
@( description, "using the same angle in radians and degrees." )
|
||||
@( description, "" )
|
||||
@( description, "For the non-inverse functions, each radian/" )
|
||||
@( description, "degree pair should use arguments that evaluate to " )
|
||||
@( description, "the same angle (that is, it's not necessary to " )
|
||||
@( description, "use the same angle for all three regular " )
|
||||
@( description, "functions as long as the two sine calls use the " )
|
||||
@( description, "same angle). For the inverse functions, use " )
|
||||
@( description, "the same number and convert its answer to radians " )
|
||||
@( description, "and degrees." )
|
||||
@( category, "tutorials" )
|
||||
@( author, "Ken O. Burtch" )
|
||||
@( see_also, "http://rosettacode.org/wiki/Trigonometric_functions" );
|
||||
pragma license( unrestricted );
|
||||
|
||||
pragma software_model( nonstandard );
|
||||
pragma restriction( no_external_commands );
|
||||
|
||||
procedure trig is
|
||||
degrees_cycle : constant float := 360.0;
|
||||
radians_cycle : constant float := 2.0 * float( numerics.pi );
|
||||
angle_degrees : constant float := 45.0;
|
||||
angle_radians : constant float := float( numerics.pi ) / 4.0;
|
||||
begin
|
||||
put( "Sin " )
|
||||
@( numerics.sin( angle_degrees, degrees_cycle ) )
|
||||
@( numerics.sin( angle_radians, radians_cycle ) );
|
||||
new_line;
|
||||
|
||||
put( "Cos " )
|
||||
@( numerics.cos( angle_degrees, degrees_cycle ) )
|
||||
@( numerics.cos( angle_radians, radians_cycle ) );
|
||||
new_line;
|
||||
|
||||
put( "Tan " )
|
||||
@( numerics.tan( angle_degrees, degrees_cycle ) )
|
||||
@( numerics.tan( angle_radians, radians_cycle ) );
|
||||
new_line;
|
||||
|
||||
put( "Cot " )
|
||||
@( numerics.cot( angle_degrees, degrees_cycle ) )
|
||||
@( numerics.cot( angle_radians, radians_cycle ) );
|
||||
new_line;
|
||||
|
||||
put( "Arcsin" )
|
||||
@( numerics.arcsin( numerics.sin( angle_degrees, degrees_cycle ), degrees_cycle ) )
|
||||
@( numerics.arcsin( numerics.sin( angle_radians, radians_cycle ), radians_cycle ) );
|
||||
new_line;
|
||||
|
||||
put( "Arccos" )
|
||||
@( numerics.arccos( numerics.cos( angle_degrees, degrees_cycle ), degrees_cycle ) )
|
||||
@( numerics.arccos( numerics.cos( angle_radians, radians_cycle ), radians_cycle ) );
|
||||
new_line;
|
||||
|
||||
put( "Arctan" )
|
||||
@( numerics.arctan( numerics.tan( angle_degrees, degrees_cycle ), 1, degrees_cycle ) )
|
||||
@( numerics.arctan( numerics.tan( angle_radians, radians_cycle ), 1, radians_cycle ) );
|
||||
new_line;
|
||||
|
||||
put( "Arccot" )
|
||||
@( numerics.arccot( numerics.cot( angle_degrees, degrees_cycle ), 1, degrees_cycle ) )
|
||||
@( numerics.arccot( numerics.cot( angle_radians, radians_cycle ), 1, radians_cycle ) );
|
||||
new_line;
|
||||
|
||||
command_line.set_exit_status( 0 );
|
||||
end trig;
|
||||
Loading…
Add table
Add a link
Reference in a new issue