Sep 04 2013 | 3:12 pm

hi

how to write exponent with expr ???

my operation is like this :

2.04 x 10^(-5) // = 2.04*0.00001 = 0.0000204

thanks for your help

o-O

- Sep 04 2013 | 4:31 pmThat'd be expr 2.04*pow(10.,-5)i.e. exponents in expr are written like pow(a,b), as in 'a' to the power of 'b'. Make sure that '.' is after the 10 so that the exponent will be processed as a float.Hope that helps
- Sep 04 2013 | 8:05 pmDon't forget that you have to escape special characters like the comma:[expr 20.4*pow(10\,-5)]Note that exponentiation is relatively CPU-costly; if either or both parts of the pow() function are constant, it may be worth the effort of using a precalculated value. There are also some special cases (for instance, non-negative integer exponents) where there are simpler functions you might want to use.
- Sep 04 2013 | 10:43 pmno need to backslash escape the comma anymore these days. it is 2013 after all.
- Sep 05 2013 | 12:33 amhiThanks for your reply and explanation.In fact I have a big list from ocean sensor, with lot of various number and exponential values...7.3439156e+005 6.6591366e+000 -8.8263154e-0017.3439156e+005 6.6961372e+000 -5.6900889e-0017.3439156e+005 6.6881377e+000 -9.6660798e-0011st I used "regexp" to "unpack" itand Now I can make a new list with "real" value... using expr...best0-0
- Sep 05 2013 | 1:45 amhiI find a problem on my tree !I used regexp for "unpack" my value : 7.3439156e+005if function is positive i have a list : 7.34... e +005but if function is negative (7.3439156e-005) i find : 7.34... e -5 ( zero disappear ???)next for formatted exponent (+005) i used a another regexp to have 5.but with the expression I used -5 become also 5For expr I need 5 (if positive) and -5 (if negative) ( he don't like +5)If you can help me to solve my problem...o-O
- Sep 05 2013 | 7:14 amif there occurs something like a*a in your expression, but you also might want negative output, then this expression simsply isnt finished.a typical situation where one runs into this problem is when using pythagoras to find points in a system.you will have to split the expression into one "version" for negative and one for positive.example:[expr pow($f1\,2.) * ($f1>=0.) + (pow($f1\,2.)*-1) * ($f1
- Sep 05 2013 | 8:26 amoh i am off track. you are on the regexp layer.well, try to get the exponents as symbols first or something like that?
- Sep 05 2013 | 10:46 amhiYes! I have solve my problem.I used Jash object "strfilt" & "strcut" to first look if exponent is + or -then I route it on 2 different way...I think is not the most efficient, but make what i need...
- Sep 05 2013 | 3:26 pmno need to backslash escape the comma anymore these daysOld habits die hard. Particularly those you've been using for over two decades. Leaving out the backslash used to cause tserious tsuris.