From 0cd25e096a4a60388d9b705cbee7c9fc78f98986 Mon Sep 17 00:00:00 2001 From: "Davide P. Cervone" Date: Tue, 19 Mar 2013 09:30:17 -0400 Subject: [PATCH] Fix a problem with Fractions and Infinity (promote Infinity to Fraction rather than the other way around) --- macros/contextFraction.pl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/macros/contextFraction.pl b/macros/contextFraction.pl index bc5d71f731..2e2528a0c4 100644 --- a/macros/contextFraction.pl +++ b/macros/contextFraction.pl @@ -256,6 +256,7 @@ sub Init { $context->{value}{Real} = "context::Fraction::Real"; $context->{parser}{Value} = "context::Fraction::Value"; $context->{parser}{Number} = "Parser::Legacy::LimitedNumeric::Number"; + $context->{precedence}{Fraction} = $context->{precedence}{Infinity} + .5; # Fractions are above Infinity $context = $main::context{'Fraction-NoDecimals'} = $context->copy; $context->{name} = "Fraction-NoDecimals"; @@ -643,6 +644,7 @@ sub promote { return (bless {data => [$x->value,1], context => $context}, $class) if Value::isReal($x); return (bless {data => [$x,1], context => $context}, $class) if Value::matchNumber($x); } + return $x if Value::isValue($x) && $x->classMatch("Infinity"); return $self->new($context,$x,@_); }