@@ -540,6 +540,12 @@ public override Operand Evaluate(AlgorithmEngine work, Func<string, Operand> tem
540540 var args1 = func1 . Evaluate ( work , tempParameter ) ; if ( args1 . IsError ) { return args1 ; }
541541 var args2 = func2 . Evaluate ( work , tempParameter ) ; if ( args2 . IsError ) { return args2 ; }
542542
543+ if ( args1 . IsNumber && args2 . IsNumber ) { // 优化性能
544+ if ( args1 . NumberValue == 1 ) { return args2 ; }
545+ if ( args2 . NumberValue == 1 ) { return args1 ; }
546+ return Operand . Create ( args1 . NumberValue * args2 . NumberValue ) ;
547+ }
548+
543549 if ( args1 . IsText ) {
544550 if ( decimal . TryParse ( args1 . TextValue , NumberStyles . Any , CultureInfo . InvariantCulture , out decimal d ) ) {
545551 args1 = Operand . Create ( d ) ;
@@ -606,6 +612,12 @@ public override Operand Evaluate(AlgorithmEngine work, Func<string, Operand> tem
606612 var args1 = func1 . Evaluate ( work , tempParameter ) ; if ( args1 . IsError ) { return args1 ; }
607613 var args2 = func2 . Evaluate ( work , tempParameter ) ; if ( args2 . IsError ) { return args2 ; }
608614
615+ if ( args1 . IsNumber && args2 . IsNumber ) { // 优化性能
616+ if ( args2 . NumberValue == 1 ) { return args1 ; }
617+ if ( args2 . NumberValue == 0 ) { return Operand . Error ( "Div 0 is error!" ) ; }
618+ return Operand . Create ( args1 . NumberValue / args2 . NumberValue ) ;
619+ }
620+
609621 if ( args1 . IsText ) {
610622 if ( decimal . TryParse ( args1 . TextValue , NumberStyles . Any , CultureInfo . InvariantCulture , out decimal d ) ) {
611623 args1 = Operand . Create ( d ) ;
@@ -661,6 +673,11 @@ public override Operand Evaluate(AlgorithmEngine work, Func<string, Operand> tem
661673 var args1 = func1 . Evaluate ( work , tempParameter ) ; if ( args1 . IsError ) { return args1 ; }
662674 var args2 = func2 . Evaluate ( work , tempParameter ) ; if ( args2 . IsError ) { return args2 ; }
663675
676+ if ( args1 . IsNumber && args2 . IsNumber ) { // 优化性能
677+ if ( args2 . NumberValue == 0 ) { return Operand . Error ( "Div 0 is error!" ) ; }
678+ return Operand . Create ( args1 . NumberValue % args2 . NumberValue ) ;
679+ }
680+
664681 if ( args1 . IsText ) {
665682 if ( decimal . TryParse ( args1 . TextValue , NumberStyles . Any , CultureInfo . InvariantCulture , out decimal d ) ) {
666683 args1 = Operand . Create ( d ) ;
@@ -715,6 +732,12 @@ public override Operand Evaluate(AlgorithmEngine work, Func<string, Operand> tem
715732 var args1 = func1 . Evaluate ( work , tempParameter ) ; if ( args1 . IsError ) { return args1 ; }
716733 var args2 = func2 . Evaluate ( work , tempParameter ) ; if ( args2 . IsError ) { return args2 ; }
717734
735+ if ( args1 . IsNumber && args2 . IsNumber ) { // 优化性能
736+ if ( args1 . NumberValue == 0 ) { return args2 ; }
737+ if ( args2 . NumberValue == 0 ) { return args1 ; }
738+ return Operand . Create ( args1 . NumberValue + args2 . NumberValue ) ;
739+ }
740+
718741 if ( args1 . IsText ) {
719742 if ( decimal . TryParse ( args1 . TextValue , NumberStyles . Any , CultureInfo . InvariantCulture , out decimal d ) ) {
720743 args1 = Operand . Create ( d ) ;
@@ -780,6 +803,11 @@ public override Operand Evaluate(AlgorithmEngine work, Func<string, Operand> tem
780803 var args1 = func1 . Evaluate ( work , tempParameter ) ; if ( args1 . IsError ) { return args1 ; }
781804 var args2 = func2 . Evaluate ( work , tempParameter ) ; if ( args2 . IsError ) { return args2 ; }
782805
806+ if ( args1 . IsNumber && args2 . IsNumber ) { // 优化性能
807+ if ( args2 . NumberValue == 0 ) { return args1 ; }
808+ return Operand . Create ( args1 . NumberValue - args2 . NumberValue ) ;
809+ }
810+
783811 if ( args1 . IsText ) {
784812 if ( decimal . TryParse ( args1 . TextValue , NumberStyles . Any , CultureInfo . InvariantCulture , out decimal d ) ) {
785813 args1 = Operand . Create ( d ) ;
0 commit comments