BCMath Arbitrary Precision Mathematics Functions

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Takuma
Forum Regular
Posts: 931
Joined: Sun Aug 04, 2002 10:24 am
Location: UK
Contact:

BCMath Arbitrary Precision Mathematics Functions

Post by Takuma »

I need to use this but my host's PHP is not compiled with it... Is there a way to load this module so that I can use the functions?
Coco
Forum Contributor
Posts: 339
Joined: Sat Sep 07, 2002 5:28 am
Location: Leeds, UK
Contact:

Post by Coco »

http://www.php.net/manual/en/ref.bc.php

looks to me like someone needs to have a chat with a network administrator
User avatar
AVATAr
Forum Regular
Posts: 524
Joined: Tue Jul 16, 2002 4:19 pm
Location: Uruguay -- Montevideo
Contact:

No way

Post by AVATAr »

Theres No way to use it without recompiling

:(
Coco
Forum Contributor
Posts: 339
Joined: Sat Sep 07, 2002 5:28 am
Location: Leeds, UK
Contact:

Post by Coco »

tha's what i thought 'bundled with php 4.blah' meant :)

drunk sorry :(
Agent Dwarf
Forum Newbie
Posts: 9
Joined: Sat Sep 21, 2002 2:03 pm

Post by Agent Dwarf »

Well, if you don't have it automatically, that means you have an old version of PHP. You should probably get the latest version, at php.net.
User avatar
Takuma
Forum Regular
Posts: 931
Joined: Sun Aug 04, 2002 10:24 am
Location: UK
Contact:

Post by Takuma »

I'VE GOT A NEW VERSION, so it works when I test it on my computer. But when I put it onto my host it doesn't :cry: I was just wondering whether PHP could include a module for BCMath Arbitrary Precision Mathematics Functions (if it does exist). Looks like I can't, is there any simliar function to bcsub() then? That's the function I need to use...
User avatar
hob_goblin
Forum Regular
Posts: 978
Joined: Sun Apr 28, 2002 9:53 pm
Contact:

Post by hob_goblin »

Agent Dwarf wrote:Well, if you don't have it automatically, that means you have an old version of PHP. You should probably get the latest version, at php.net.

It's exactly the opposite.

About including it: no, php isn't like python, or c++, sorry.
About another function: What exactly does it do? I can probably write one.
User avatar
Takuma
Forum Regular
Posts: 931
Joined: Sun Aug 04, 2002 10:24 am
Location: UK
Contact:

Post by Takuma »

I'm trying to subtract a microtime() with microtime() (I'm just trying to find out how long it took for the page to load.) So here's the code

Code: Select all

<?php
$start_time	= explode(" ",microtime());
$start	= $start_timeї1].substr($start_timeї0],1,10);

//Lots of code

$end_time	= explode(" ",microtime());
$end			= $end_timeї1].substr($end_timeї0],1,10);
$time			= @bcsub($end,$start,7);
?>
If I do it just simply with "-" it would't work...
Coco
Forum Contributor
Posts: 339
Joined: Sat Sep 07, 2002 5:28 am
Location: Leeds, UK
Contact:

Post by Coco »

well your gonna have to do it manually.... ie subtract each element of the array manually and then reformat the result into something you can use...
pain in the butt ya... but if you dont got bcmath how else ya gonna do it?
User avatar
Takuma
Forum Regular
Posts: 931
Joined: Sun Aug 04, 2002 10:24 am
Location: UK
Contact:

Post by Takuma »

How can I format a string like 12321e123 or something like that?
Post Reply