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