@@ -821,7 +821,7 @@ sub make {
821821 my $context = (Value::isContext($_ [0]) ? shift : $self -> context);
822822 my $x = shift ;
823823 $x = $context -> Package(" Formula" )-> new($context , $x )-> eval if !ref ($x ) && $x =~ m ! /! ;
824- $x = $x -> eval if @_ == 0 && Value::classMatch($x , ' Fraction' );
824+ return $x -> eval if @_ == 0 && Value::classMatch($x , ' Fraction' );
825825 return $self -> mutate($context )-> make($context , $x , @_ );
826826}
827827
@@ -860,10 +860,10 @@ sub new {
860860 return $x -> [0] if Value::classMatch($x -> [0], ' Fraction' ) && @_ == 0;
861861 $x = $context -> toFraction($x -> [0]-> value) if Value::isReal($x -> [0]) && @_ == 0;
862862 return $self -> formula($x ) if Value::isFormula($x -> [0]) || Value::isFormula($x -> [1]);
863- Value::Error(" Fraction numerators must be integers" ) unless isInteger($x -> [0]);
864- Value::Error(" Fraction denominators must be integers" ) unless isInteger($x -> [1]);
865863 my ($a , $b ) = ($x -> [0]-> value, $x -> [1]-> value);
866864 ($a , $b ) = (-$a , -$b ) if $b < 0;
865+ Value::Error(" Fraction numerators must be integers" ) unless isInteger($a );
866+ Value::Error(" Fraction denominators must be integers" ) unless isInteger($b );
867867 Value::Error(" Denominator can't be zero" ) if $b == 0;
868868 ($a , $b ) = context::Fraction::reduce($a , $b ) if $context -> flag(" reduceFractions" );
869869 bless { data => [ $a , $b ], context => $context }, $class ;
@@ -880,6 +880,8 @@ sub make {
880880 push (@_ , 0) if @_ == 0;
881881 push (@_ , 1) if @_ == 1;
882882 my ($a , $b ) = @_ ;
883+ $a = $a -> value if Value::isReal($a );
884+ $b = $b -> value if Value::isReal($b );
883885 ($a , $b ) = (-$a , -$b ) if $b < 0;
884886 return $context -> Package(" Real" )-> make($context , $a / $b ) unless isInteger($a ) && isInteger($b );
885887 ($a , $b ) = context::Fraction::reduce($a , $b ) if $context -> flag(" reduceFractions" );
0 commit comments