Re: scientific.e

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

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.

Therefore if you have no 'e' the function
crashes.  You want to pass 1 it should be
"1e+0".

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.

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

Then you declare scientific_to_float64 as:

atom scientific_to_float64( scientific_string s )

If the user enters garbage he is told it is his
bad data instead of getting an error in the body
of your function and no I am not talking about
adding builtins.

Shawn Pringle

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

Search



Quick Links

User menu

Not signed in.

Misc Menu