Hi Damian - I'd like to work with you to implement this feature. Let's work out the details off-list.
Cheers, -michael ferguson On 4/20/15, 1:48 AM, "Damian McGuckin" <[email protected]> wrote: > >Well strictly speaking the IEEE754 floating point standard, e.g. > > var half : real = 0x1p-1; // 0.5 > var four : real = 0x1p2; // 4.0 > var _128 : real = 0x1p7; // 128.0 > >Can somebody please stick that onto what is already very long list? > >If somebody wants to correctly point me to the place in the compiler >which >interpret's constants, I can probably hack it in. > >With any apologies for underestimating the work in advance, but I think >that this is just adding before line 98 new definitions like, and I know >my rough attempt at a definition is wrong, > > floatLiteral4 0[xX]{hexDigit}+[pP][\+\-]?{digit}+ > floatLiteral5 0[xX]{hexDigit}+"."{hexDigit}+[pP][\+\-]?{digit}+ > >and appending to line 98 (i.e. the definition of floatLiteral > > |{floatLiteral4}|{floatLiteral5} > >Because the (bison/yacc) compiler ultimately calls > > 'strtod' > >to interpret the string (to convert it to real) down in 'build.cpp', it >should be able to handle this, except, ...., and I could not figure out >all the options used. I am assuming you do not then explicitly force the >C++ compiler to NOT handle C99 constants, which by default a strict C++ >compiler should not do, but which g++ does. > >Thanks - Damian > >When I have time to burn, I will look at the grammar below which I think >is correct for the new IEEE 754 standard and deduce up a clean Lex/Flex >definition for floatLiteral4 and floatLiteral5. Sorry my Flex/Lex and >Yacc/Bison is very, very rusty so the above was very crude. > >Digits > (one of) > 0 1 2 3 4 5 6 7 8 9 > >HexDigits > (one of) > 0 1 2 3 4 5 6 7 8 9 a b c d e f A B C D E F > >SignedInteger: > [Sign] Digits > >Sign: > (one of) > + - > >FloatTypeSuffix: > (one of) > f F d D > >HexNumeral > 0 x [HexDigits] > 0 X [HexDigits] > >HexSignificand: > HexNumeral [.] > 0 x [HexDigits] . HexDigits > 0 X [HexDigits] . HexDigits > >BinaryExponentIndicator: > (one of) > p P > >BinaryExponent: > BinaryExponentIndicator SignedInteger > >HexadecimalFloatingPointLiteral: > HexSignificand BinaryExponent [FloatTypeSuffix] > >Note that because CHAPEL only ever converts (inside build.cpp) to double >for floating point constants, i.e. never calls 'strtof', we might need to >strip the > > FloatTypeSuffix > >before feeding the constant to 'strtod'. .... Yes, that needs more >thought. > >Pacific Engineering Systems International, 277-279 Broadway, Glebe NSW >2037 >Ph:+61-2-8571-0847 .. Fx:+61-2-9692-9623 | unsolicited email not wanted >here >Views & opinions here are mine and not those of any past or present >employer > >-------------------------------------------------------------------------- >---- >BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT >Develop your own process in accordance with the BPMN 2 standard >Learn Process modeling best practices with Bonita BPM through live >exercises >http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- >event?utm_ >source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF >_______________________________________________ >Chapel-users mailing list >[email protected] >https://lists.sourceforge.net/lists/listinfo/chapel-users ------------------------------------------------------------------------------ BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT Develop your own process in accordance with the BPMN 2 standard Learn Process modeling best practices with Bonita BPM through live exercises http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_ source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF _______________________________________________ Chapel-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/chapel-users
