Hello,
I wanted to create a currency translator with PHP.
The code looks like this:
<?php
$faktor=2.95583 ; // a double
$dm = $euro * $faktor; // $euro is a double variable with the
original value
// $dm is a double variable
echo $dm; // prints 10 when $euro is 5
?>
all varables are double, I checked this with the gettype() function
The calculation seems to take only the integers and cuttig off the .9
before calculating
Another example:
echo 5.5*2.2; // prints 10, should be about 11
what can I do if I want to multily doubles to get the correct answer?
I hope anyone can help me!
thanks in advance for your help!
christine
I wanted to create a currency translator with PHP.
The code looks like this:
<?php
$faktor=2.95583 ; // a double
$dm = $euro * $faktor; // $euro is a double variable with the
original value
// $dm is a double variable
echo $dm; // prints 10 when $euro is 5
?>
all varables are double, I checked this with the gettype() function
The calculation seems to take only the integers and cuttig off the .9
before calculating
Another example:
echo 5.5*2.2; // prints 10, should be about 11
what can I do if I want to multily doubles to get the correct answer?
I hope anyone can help me!
thanks in advance for your help!
christine
Comment