Page 1 of 1

BCMath Arbitrary Precision Mathematics Functions

Posted: Sat Sep 21, 2002 12:19 pm
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?

Posted: Sat Sep 21, 2002 1:53 pm
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

No way

Posted: Sat Sep 21, 2002 5:30 pm
by AVATAr
Theres No way to use it without recompiling

:(

Posted: Sat Sep 21, 2002 6:14 pm
by Coco
tha's what i thought 'bundled with php 4.blah' meant :)

drunk sorry :(

Posted: Sat Sep 21, 2002 7:34 pm
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.

Posted: Sun Sep 22, 2002 12:48 am
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...

Posted: Sun Sep 22, 2002 11:55 am
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.

Posted: Mon Sep 23, 2002 12:26 am
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...

Posted: Mon Sep 23, 2002 4:58 am
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?

Posted: Mon Sep 23, 2002 12:46 pm
by Takuma
How can I format a string like 12321e123 or something like that?