equation accuracy

equation accuracy

Postby fbanag » Thu Sep 12, 2013 1:24 pm

Hi,

When I am writing as an equation in freeplane

= 35e-3 * 9.8 *(5e-2)**2/8.98e9

the node shows "0" (it should be 9.5489....E-14)
I found that using Latex format, it will shows "0E-10"

I assume it is a limitation of the floating point calculation in Java.

My question, is there a mechanism to use a specific math library like appFloat for such calculation in freeplane ?

Regards.

Franck
fbanag
 
Posts: 2
Joined: Thu Sep 05, 2013 4:55 pm

Re: equation accuracy

Postby rickhg12hs » Sat Feb 01, 2014 11:06 pm

I'm a total MM and freeplane noob and can sometimes read Java, so YMMV.

If you make one of your operands a double, it seems the whole calculation will get promoted to double and then you can change the core text format to display the answer. I have no idea what I'm doing here either, but "#E" shows plenty of digits and the exponent.

I.e., before:

= 35e-3 * 9.8 *(5e-2)**2/8.98e9

and after:

= 35e-3 * 9.8 *(5e-2)**2/8.98e9d
rickhg12hs
 
Posts: 1
Joined: Sat Feb 01, 2014 11:01 pm

Re: equation accuracy

Postby boercher » Mon Feb 03, 2014 2:10 am

Groovy takes a somewhat special approach to maths: It uses BigDecimal at places where I wouldn't expect it, see http://groovy.codehaus.org/Groovy+Math

For instance

= (35e-3 * 9.8).getClass()

is BigDecimal while

= (35e-3 * 9.8d).getClass()

is Double. The latter seems to work better as rickhg12hs has shown.

Volker
boercher
 
Posts: 644
Joined: Tue Jul 26, 2011 7:13 am


Return to Open Discussion

Who is online

Users browsing this forum: No registered users and 1 guest