• Support
  • Articles
  • Resources
  • Products
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 113: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead

Scientific notation and floating point numbers

Moderator: boris

3 postsPage 1 of 1

IshmaelCallMe
Guru

Posts:
674
Joined: Thu Jan 26, 2006 2:28 am
by IshmaelCallMe » Wed Nov 19, 2008 4:48 pm
Last edited by IshmaelCallMe on Thu Feb 18, 2010 4:20 pm, edited 1 time in total.
shangxi
Newbie

Posts:
1
Joined: Wed Feb 17, 2010 12:11 am
by shangxi » Wed Feb 17, 2010 12:13 am
Hello!

I tried to calculate this:
s1='2.27'
s2='1.213'
call scimult
call sci2dec
messagebox stmp '2.27x1.213'

but the result is not correct.
Any idea where the error is?

Thanks

Edit:
I changed this line:
if result>=len+len1 dotpos=dotpos+1 ;add one to dotpos if mult increased order of magnatude of result

now it seems to run
IshmaelCallMe
Guru

Posts:
674
Joined: Thu Jan 26, 2006 2:28 am
by IshmaelCallMe » Thu Feb 18, 2010 4:25 pm
Fantastic, thanks for the bug fix. I changed the routine in the post above to reflect your change.

But, really, these routines actually need a complete rewrite. While working most of the time, they will fail for a couple special cases. They really need to take into account the number of significant digits, especially during multiplication (too many digits in the number will overflow the teraterm variable). I just don't have the time to do it right now.
Display posts from previous:
Sort by:

3 postsPage 1 of 1

Users browsing this forum: No registered users
cron