/    Sign up×
Community /Pin to ProfileBookmark

Numbers going into E+25

Hi, I have a problem that I have no idea how to solve. I am using PHP to create huge numbers, but when I ouput the number, it gives me something like this:
2763.293E+25. How do I prevent that from happening?

Thanks in advance for anyone who can enlighten me(and hopefully help me)!

to post a comment
PHP

5 Comments(s)

Copy linkTweet thisAlerts:
@aznchong91authorAug 16.2005 — Also, how would i auto-wrap the number when i echo it?
Copy linkTweet thisAlerts:
@JuuitchanAug 16.2005 — You should look at the PHP functions bccomp, bcadd, etc.

I think these will make your numbers come out right.
Copy linkTweet thisAlerts:
@JuuitchanAug 16.2005 — Try this in PHP:

<i>
</i>a=10000000001
b=20000000001

echo (a*b); /*You were trying to do math this way */
echo bcmul( (string)a, (string)b ); /* But this way is better for your purpose */
Copy linkTweet thisAlerts:
@aznchong91authorAug 17.2005 — when i do it, it says bcmul() is an undefined function. Is there a certain PHP requirement or something? Or am I doing it wrong?

$first='59826349829';

$second='2305972';

$third=bcmul($first,$second);

Thanks!
Copy linkTweet thisAlerts:
@Stephen_PhilbinAug 17.2005 — To use the bcmath functions of PHP, you have to have your PHP module compiled with the instruction--with-bcmath[/quote]. Something I'm about to do in a few minutes. ?
×

Success!

Help @aznchong91 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...