Re: scientific.e

new topic     » goto parent     » topic index » view thread      » older message » newer message

Shawn Pringle wrote:
> 
> Matt Lewis and Jason Gade:
> 
> I don't think it is clear what is going on
> to everyone here.  
> The scientific_to_float64 probably expects a 
> string of the form  (+-)d\.d\+e(+-)dd.

> I suggest you use a type for your function
> for the sake of illistration let us suppose
> there is a regex.e in the archive and a 
> regex_match that does what perl's // operator
> does.  Then the following is what you 
> could use as a type.

Yes, I understood what you were saying.

> include regex.e
> type scientific_string( sequence s )
>    return regex_match( s, "(+-)\d\.\d\+e(+-)\d\d" )
> end type

I think a correct regex would be (including capturing all of the interesting
substrings):

  "(-?)(\\d+)(?:\\.(\\d+))?[eE][+\\-]?(\\d+)"
 
Matt

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu