📄 downgrade.t
字号:
#!/usr/bin/perl -wuse Test;use strict;BEGIN { $| = 1; unshift @INC, '../lib'; # for running manually my $location = $0; $location =~ s/downgrade.t//; unshift @INC, $location; # to locate the testing files chdir 't' if -d 't'; plan tests => 15; }use Math::BigInt upgrade => 'Math::BigFloat';use Math::BigFloat downgrade => 'Math::BigInt', upgrade => 'Math::BigInt';use vars qw ($scale $class $try $x $y $f @args $ans $ans1 $ans1_str $setup $ECL $CL);$class = "Math::BigInt";$CL = "Math::BigInt::Calc";$ECL = "Math::BigFloat";# simplistic test for now ok (Math::BigFloat->downgrade(),'Math::BigInt');ok (Math::BigFloat->upgrade(),'Math::BigInt');# these downgradeok (ref(Math::BigFloat->new('inf')),'Math::BigInt');ok (ref(Math::BigFloat->new('-inf')),'Math::BigInt');ok (ref(Math::BigFloat->new('NaN')),'Math::BigInt');ok (ref(Math::BigFloat->new('0')),'Math::BigInt');ok (ref(Math::BigFloat->new('1')),'Math::BigInt');ok (ref(Math::BigFloat->new('10')),'Math::BigInt');ok (ref(Math::BigFloat->new('-10')),'Math::BigInt');ok (ref(Math::BigFloat->new('-10.0E1')),'Math::BigInt');# bug until v1.67:ok (Math::BigFloat->new('0.2E0'), '0.2');ok (Math::BigFloat->new('0.2E1'), '2');# until v1.67 resulted in 200:ok (Math::BigFloat->new('0.2E2'), '20');# disable, otherwise it screws calculationsMath::BigFloat->upgrade(undef);ok (Math::BigFloat->upgrade()||'','');Math::BigFloat->div_scale(20); # make it a bit fastermy $x = Math::BigFloat->new(2); # downgrades# the following test upgrade for bsqrt() and also makes new() NOT downgrade# for the bpow() sideok (Math::BigFloat->bpow('2','0.5'),$x->bsqrt());#require 'upgrade.inc'; # all tests here for sharing
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -