Annotation of loncom/homework/default_homework.lcpm, revision 1.3
1.1 harris41 1: # file name (temp): default_homework
2: # used by lonxml::xmlparse() as input variable $safeinit to Apache::run::run()
3: #
4: #
1.3 ! albertel 5: $RANDOMINIT=0;
! 6:
1.1 harris41 7: sub hinton {
8: return 0;
9: }
10:
11: sub random {
12: my ($start,$end,$step)=@_;
1.3 ! albertel 13: if ( ! $RANDOMINIT ) { srand($external::randomseed); $RANDOMINIT=1; }
1.1 harris41 14: my $num=1+int(($end-$start)/$step);
15: my $result=$start + int(rand() * $num)*$step;
16: return $result;
17: }
18:
19: sub tan { sin($_[0]) / cos($_[0]) }
20: sub acos { atan2(sqrt(1 - $_[0] * $_[0]), $_[0] ); }
21: sub asin { atan2($_[0], sqrt(1- $_[0] * $_[0]) ); }
22:
23: sub html {
24: if ( $external::target == "web" ) {
1.2 albertel 25: $SCRIPT_RESULT.=@_[0];
1.1 harris41 26: }
27: }
28:
29:
30: sub pow {return $_[0] ** $_[1]; }
31: sub ceil {return (($_[0]-int($_[0]))== 0.0) ? $_[0] : (int($_[0])+ 1); }
32: sub floor {return int($_[0]); }
33:
1.2 albertel 34: sub format {
35: my ($value,$fmt)=@_;
36: $SCRIPT_RESULT.=sprintf('%.'.$fmt,$value);
37: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>