Ok, thanks.
I´ll try to do it.
As soon as I get it I´ll let you know.
Thanks guys.
"Bruno Fajardo" escreveu na mensagem
news:eeb6980b0902110534p22a8c75eqd98cceaf3a150...@mail.gmail.com...
Can you extend the JPGraph class, intercepting the desired method,
formatting the output the way you ne
Can you extend the JPGraph class, intercepting the desired method,
formatting the output the way you need?
2009/2/11 João Cândido de Souza Neto
>
> No, I can´t, because if I do it how can jpgrhph render without numeric data?
> hehehe
>
> "Richard Heyes" escreveu na mensagem
> news:af872644090
No, I can´t, because if I do it how can jpgrhph render without numeric data?
hehehe
"Richard Heyes" escreveu na mensagem
news:af8726440902110523x63ce5485p6534d10063eb4...@mail.gmail.com...
>> Thanks for your answer, but my real problem is to get thousand separator
>> in
>> jpgraph class which
> Thanks for your answer, but my real problem is to get thousand separator in
> jpgraph class which uses sprintf to display almost everithing;
Can you format it first, and then pass it to JPGraph ?
--
Richard Heyes
HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
http://www.rgraph.o
chris smith wrote:
> 2009/2/11 João Cândido de Souza Neto :
>> Hello everybody.
>>
>> I´d just like to know if there´s any way of defining a thousand
>> separator to a currency value using sprintf.
>
> Use number_format instead of sprintf, it's designed to do what you
> want.
>
I wonder why
Chris,
Thanks for your answer, but my real problem is to get thousand separator in
jpgraph class which uses sprintf to display almost everithing;
"chris smith" escreveu na mensagem
news:3c1395330902110457i18cec69cy9818e08cdd3ff...@mail.gmail.com...
2009/2/11 João Cândido de Souza Neto :
> H
2009/2/11 João Cândido de Souza Neto :
> Hello everybody.
>
> I´d just like to know if there´s any way of defining a thousand separator to
> a currency value using sprintf.
Use number_format instead of sprintf, it's designed to do what you want.
--
Postgresql & php tutorials
http://www.desig
On Sat, Mar 22, 2008 at 3:37 PM, Richard <[EMAIL PROTECTED]> wrote:
[snip=code!]
> When I have one item at 10.03, the result is : Total Vat = 1.97 - Total
> without vat = 10.03 Total with vat = 12.00
> but if I have two items at 10.03 the result is : Total vat = 3.93 -
> Total without vat = 20.
sitions
on display rounds up to 1.97.
if you stored the rounded value ,on a per-item basis, you'd get what
you're after.
now, the question is whether vat is applied per item or on the
invoice total.
the difference becomes more obvious with say 3 items, at 10.03. on a
(rounded) pe
Here is a simplifie version of my code :
I get 12.00 and 23.99 ... what should I do to get 12.00 and 24.00 ?
Richard a écrit :
Hello, I'm trying to write a invoice script but I have encountered a
slight problem.
Each product needs to be listed without tax, and at the end of the
file I need
Hello, I'm trying to write a invoice script but I have encountered a
slight problem.
Each product needs to be listed without tax, and at the end of the file
I need to show the VAT. In France VAT is 19.6%
So €10.03 without vat = €12.00 with vat.
So I do this :
$totalwithoutvat = 0;
$totalwithout
On Dec 3, 2007 3:29 PM, tedd <[EMAIL PROTECTED]> wrote:
> At 2:04 PM -0500 12/3/07, Andrew Ballard wrote:
> >
> >Oh, man I'm having flashbacks to a flame war that broke out on a
> >SQL Server board I read related to "bankers rounding" versus
> >"traditional rounding" and which was more "correct
At 2:04 PM -0500 12/3/07, Andrew Ballard wrote:
Oh, man I'm having flashbacks to a flame war that broke out on a
SQL Server board I read related to "bankers rounding" versus
"traditional rounding" and which was more "correct" or "accurate".
:-)
Andrew
There really shouldn't be a debate on
On Dec 1, 2007 11:30 AM, tedd <[EMAIL PROTECTED]> wrote:
> At 7:10 AM -0500 12/1/07, Christoph Boget wrote:
> >Why does
> >
> >sprintf( '%.03f', 0.1525 )
> >
> >return 0.152 while
> >
> >sprintf( '%.03f', 0.1575 )
> >
> >return 0.158?
> >
> >The 4th significant digit in both cases is '5' bu
2007/12/1, Christoph Boget <[EMAIL PROTECTED]>:
>
> Why does
>
> sprintf( '%.03f', 0.1525 )
>
> return 0.152 while
>
> sprintf( '%.03f', 0.1575 )
>
> return 0.158?
>
Welcome to the world of f floating point numbers. Discrete mathematics,
leave all hope, ye that enter.
It's the way fl
At 6:08 AM -0500 12/2/07, Christoph wrote:
If the general rule is to round up for 5s when preceeding is odd
and round down when even, that's not occuring here when using
round().
No, you're not reading what I wrote. I said MY general rule is to
round up when the preceding digit is even, wher
The 4th significant digit in both cases is '5' but in the first case, it's
rounded down but in the second case it is rounded up. Is sprintf() basing
it's decision on the value of the 3rd significant digit? If so, why?
Shouldn't rounding decisions be based on subsequent digits and not
preceding
At 7:10 AM -0500 12/1/07, Christoph Boget wrote:
Why does
sprintf( '%.03f', 0.1525 )
return 0.152 while
sprintf( '%.03f', 0.1575 )
return 0.158?
The 4th significant digit in both cases is '5' but in the first case, it's
rounded down but in the second case it is rounded up. Is sprint
Jochem Maas wrote:
> Per Jessen wrote:
>> Christoph Boget wrote:
>>
>>> Why does
>>>
>>> sprintf( '%.03f', 0.1525 )
>>> return 0.152 while
>>> sprintf( '%.03f', 0.1575 )
>>> return 0.158?
>
> most likely it's an artifact of the fact that
> the binary representations of those floating poi
Per Jessen wrote:
> Christoph Boget wrote:
>
>> Why does
>>
>> sprintf( '%.03f', 0.1525 )
>> return 0.152 while
>> sprintf( '%.03f', 0.1575 )
>> return 0.158?
most likely it's an artifact of the fact that
the binary representations of those floating point
values are not exact e.g. 0.1575
Christoph Boget wrote:
> Why does
>
> sprintf( '%.03f', 0.1525 )
> return 0.152 while
> sprintf( '%.03f', 0.1575 )
> return 0.158?
>
> I am using PHP 4.3.11
I see the same behaviour in 5.2.4
/Per Jessen, Zürich
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit:
Why does
sprintf( '%.03f', 0.1525 )
return 0.152 while
sprintf( '%.03f', 0.1575 )
return 0.158?
The 4th significant digit in both cases is '5' but in the first case, it's
rounded down but in the second case it is rounded up. Is sprintf() basing
it's decision on the value of the 3rd si
On Tue, April 18, 2006 10:19 am, Chris Boget wrote:
> What's going on here:
>
> $number = 50.1234567890;
> echo sprintf( '%.05f', $number );
>
> result: 50.12346
>
> $number = 5.1234567890;
> echo sprintf( '%.05f', $number );
>
> result: 5.12305
>
> $number =
ample, the precision
does not even reach the decimal part.
- Original Message -
From: "Chris Boget" <[EMAIL PROTECTED]>
To:
Sent: Tuesday, April 18, 2006 5:19 PM
Subject: [PHP] sprintf() oddity
What's going on here:
$number = 50.1234567890;
echo sprin
What's going on here:
$number = 50.1234567890;
echo sprintf( '%.05f', $number );
result: 50.12346
$number = 5.1234567890;
echo sprintf( '%.05f', $number );
result: 5.12305
$number = 5000.1234567890;
echo sprintf( '%.05f', $number );
resul
On Wednesday 06 April 2005 18:05, Brent Baisley typed:
> You want to have sprintf look at the contents of the variable instead
> of the variable itself. Anytime you want to do something like this you
> use the eval() function to evaluate the contents of the variable.
Woot!
$begin_string = 'htmlen
On Wed, April 6, 2005 4:23 am, Duncan Hill said:
> I have a snippet of code that looks something like:
> if (is_array($p_sub_values)) {
> foreach ($p_sub_values as $i => $v) {
> $p_sub_values_str[$i] = "'$v'";
> }
> $s = join(',', $p_sub_values_str);
> $r =
Making life groovy has been difficult since the 60's.
You want to have sprintf look at the contents of the variable instead
of the variable itself. Anytime you want to do something like this you
use the eval() function to evaluate the contents of the variable.
On Apr 6, 2005, at 12:46 PM, Duncan
On Wednesday 06 April 2005 16:40, Brent Baisley wrote:
> For one, you are missing a right parenthesis ) in all of your examples.
> htmlentities( sprintf( $tmp[0], $s, ENT_QUOTES )
Meh, syntax blip from the cut and paste.
> Second, the string you are trying to format only has one variable
> argum
For one, you are missing a right parenthesis ) in all of your examples.
htmlentities( sprintf( $tmp[0], $s, ENT_QUOTES )
Second, the string you are trying to format only has one variable
argument: $s.
Fred likes %1$s on his %2$s
You have it numbered for ordering, but you are still ordering one
I have a snippet of code that looks something like:
if (is_array($p_sub_values)) {
foreach ($p_sub_values as $i => $v) {
$p_sub_values_str[$i] = "'$v'";
}
$s = join(',', $p_sub_values_str);
$r = htmlentities(sprintf($tmp[0], $s, ENT_QUOTES);
}
$tmp[0] in th
I need to go from
1754210747 (decimal)
to
17 54 21 a7 47 (hex per character)
Basically, reformat the string for each character, converting it to
Hex, and spacing after each two characters. Sprintf?
...Rene
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net
Hi,
Saturday, March 27, 2004, 1:31:33 AM, you wrote:
CT> Hey,
CT> Im trying to use sprintf to format a number and left pad it with spaces, but
CT> it doesnt want to add the spaces
CT> I can pad it with anyother char using sprintf("%'_8.2f, $val) which will
CT> left-pad the number with underscor
Hey,
Im trying to use sprintf to format a number and left pad it with spaces, but
it doesnt want to add the spaces
I can pad it with anyother char using sprintf("%'_8.2f, $val) which will
left-pad the number with underscores
Has anyone had any luck padding with spaces??
or is there a better way
$sql = "SELECT * FROM Vacation where StartDate LIKE '%s\\%s'";
That should work :)
Cheers,
Rob.
Tyler BIRD wrote:
>
> hey I'm trying to make dynamic database queries using
> sprintf
> any way I can get around this error?
>
> $sql = "SELECT * FROM Vacation where StartDate LIKE '%s/" .
> '\%' .
hey I'm trying to make dynamic database queries using
sprintf
any way I can get around this error?
$sql = "SELECT * FROM Vacation where StartDate LIKE '%s/" .
'\%' . "/%s'";
$sql = sprintf($sql, $_GET["month"], $_GET["year"] );
I want just a literal slash between the month and year,
printf seem
Experiment a bit and I'm sure you'll find it easy. One example, change this
portion
$formatted = sprintf("%01.2f", $money);
to
$formatted = sprintf("%01.3f", $money);
then see how it works...
HTH,
- E
>
>I read the manual page on sprintf, but I still don't understand exactly
>how the
I read the manual page on sprintf, but I still don't understand exactly
how the format string works.
$money1 = 68.75;
$money2 = 54.35;
$money = $money1 + $money2;
// echo $money will output "123.1";
$formatted = sprintf("%01.2f", $money);
// echo $formatted will output "123.10"
How does t
The manual for sprintf
http://www.php.net/manual/en/function.sprintf.php
gives a nice introduction to the idea of the different formatting
options. But, the reader is referred to the examples to see the
different ways that you can format a number. Is there a better resource
than this for fo
> I suppose when you have so few problems you get to nitpick..
>
> Guess my question is; why doesn't this work?
>
> if(sprintf("%01.2f",$Result[CurrentPrice]+$Result[Increment]) <=
sprintf("%01.2f",$BidAmt)) {
>
> when this works;
> if(0.30 <= 1.00) {
>
> I'll just settle with a workaround for now
I suppose when you have so few problems you get to nitpick..
Guess my question is; why doesn't this work?
if(sprintf("%01.2f",$Result[CurrentPrice]+$Result[Increment]) <=
sprintf("%01.2f",$BidAmt)) {
when this works;
if(0.30 <= 1.00) {
I'll just settle with a workaround for now.
Thanks,
Chri
41 matches
Mail list logo