Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3368: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3370: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3371: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3372: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
OrbWorks Community Forum • View topic - Problem with pow(x,y) result

Problem with pow(x,y) result

Discuss OrbForms Designer and PocketC Architect

Postby orbFan on Thu Nov 03, 2005 5:08 am

I have a formula on my spreadsheet (Excel & OpenOffice) that looks like this: (1+(8.5/12/100))^335. The answer on both spreadsheets is 10.63927. If manually computed using a calculator, the result is still the same.

My problem is I can't get the exact output in OrbForms. The formula I used is pow((1+(8.5/12/100)),335), and the result is 10.63914.

The difference is a change in number on the 4th decimal. This may sound trivial but a difference in decimals is very important when computing interest.

Can anybody help me out on this?

Many thanks in advance.
orbFan
 
Posts: 21
Joined: Thu Sep 08, 2005 8:02 am
Location: Philippines

Postby Gazza on Fri Nov 04, 2005 5:39 pm

Are you using a float, if so you will get a rounding error?
Gazza
 
Posts: 146
Joined: Sat Jan 12, 2002 1:56 am
Location: United Kingdom

Postby orbFan on Fri Nov 04, 2005 9:17 pm

Yes, I am using a float. But I haven't done any rounding off of numbers except when displaying results of this formula (up to the 5th decimal). But isn't a float indicated for pow()?

I did try using an array to solve this, multiplying (1+(8.5/12/100) up to 335 times. But I still get the same result of 10.63914. I get baffled why I can't have the same output of 10.63927 as with Excel, OpenOffice Calc, or any calculator.

Thanks for seeing my concern.
orbFan
 
Posts: 21
Joined: Thu Sep 08, 2005 8:02 am
Location: Philippines

Postby Rudi on Sat Nov 05, 2005 8:33 am

Hi,
thats a problem with precission, float and double float ..

pow((1+(8.5/12/100)),335)

Lets look to this formula ... the first part:
1+(8.5/12/100)

with float, and orbforms (mathlib) caluclates with float, the result is 1,0070833. check exactly this (put in 1,0070833) with any calculator and pow with 335 is 10.63914.

ok, lets test the first part with any calculator or excel, if you want. the result is 1.0070833333..3 (and 3 go on ...)
calulate pow 335 and you get 10.63927

Thats the different!

only a few more decimals digits on double precission :)

its so easy to confuse computers an get chaos :)

what can you do?
uhoh - mathlib is a free palm mathematic library and everybody - also orbforms - can use it. many calculator apps on palm use this lib too and you get exactly the same result.

you can write your own native pow function with double float precission or you can solve this problem with an own floating point engine in orbforms - thats down your performance, but calculates with more decimal digits (as you like).

Greets,
Rudi
Rudi
 
Posts: 33
Joined: Thu Feb 12, 2004 2:42 pm
Location: Germany

Postby orbFan on Sat Nov 05, 2005 2:52 pm

Thanks for the enlightenment, Rudi. Now I can see why Gazza pointed out rounding errors using float.

Being an extreme newbie, this is my first time to encounter DOUBLE PRECISION. I just hoped OrbForms woud support double precision in its next release.

By the way, with the solution you just presented, does it mean it's possible to employ double precision in OrbForms? Please do show.

Thanks.
orbFan
 
Posts: 21
Joined: Thu Sep 08, 2005 8:02 am
Location: Philippines

Postby Gazza on Sat Nov 05, 2005 9:36 pm

Great Post Rudi,

As a newbee to this sort of thing myself, I think you may be able to solve this problem using Fixed Point Math and with 32bit Integers I can't see this being a problem.

The problem is, I don't have a clue on how to implement this, nor do I fully understand Fixed Point Math! I think this was used on 3D Engines in the past to get more precision.

Someone out there will.....
Gazza
 
Posts: 146
Joined: Sat Jan 12, 2002 1:56 am
Location: United Kingdom

Postby c0d3m0nk3y on Sat Nov 05, 2005 10:05 pm

OrbForms uses 32-bit floats, write a native add-in and use the Palm OS API's for 64-bit floating points :D

---
Thanks for reading my message, Have a nice day!
---
Thanks for reading my message, Have a nice day!
c0d3m0nk3y
 
Posts: 74
Joined: Tue Jun 22, 2004 7:51 pm
Location: Canada

Postby orbFan on Fri Nov 11, 2005 3:43 pm

That's a very wonderful advice. But being an extreme newbie, I am completely incompetent in writing a native add-in, or even any kind of add-ins. All I know about programming is what the OrbForms manual and this forum have provided. :evil:

Would you care to share us this method of obtaining double precision in OrbForms? This would be a lot of help to me and to the other newbies in this forum (if there are besides me). :D

Thanks.
orbFan
 
Posts: 21
Joined: Thu Sep 08, 2005 8:02 am
Location: Philippines


Return to OrbForms Designer and PocketC Architect

Who is online

Users browsing this forum: No registered users and 2 guests

cron