From michael.chan.is at gmail.com Thu May 27 16:14:48 2010 From: michael.chan.is at gmail.com (Michael Chan) Date: Thu, 27 May 2010 15:14:48 +0100 Subject: [Hets-users] Writing real numbers as decimal fractions Message-ID: Hi, I have a quick question regarding writing real numbers in the form of decimal fractions: What is a good way to write, say, x * 0.5, where x is of the type Real? It appears to me DecimalFraction handles syntactic sugar like 0.5, but it's a specification for representing rationals and not reals. Any help will be appreciated. Thanks Michael From Christian.Maeder at dfki.de Thu May 27 16:45:40 2010 From: Christian.Maeder at dfki.de (Christian Maeder) Date: Thu, 27 May 2010 16:45:40 +0200 Subject: [Hets-users] Writing real numbers as decimal fractions In-Reply-To: References: Message-ID: <4BFE8594.9070300@dfki.de> Michael Chan schrieb: > Hi, > > I have a quick question regarding writing real numbers in the form of > decimal fractions: What is a good way to write, say, x * 0.5, where x > is of the type Real? It appears to me DecimalFraction handles > syntactic sugar like 0.5, but it's a specification for representing > rationals and not reals. Any help will be appreciated. You can do it as in Hets-lib/Basic/Numbers.casl using literal annotations and adding profiles of appropriate types. %number __@@__ %floating __:::__, __E__ sort Real ops 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 : Real ops __@@__, __:::__, __E__ : Real * Real -> Real . def 0.5 (If you import Basic/Numbers.casl, you could make Rat a subsort of your reals.) Cheers Christian