Toon posts:

[php] wetenschappelijke notatie

Pagina: 1
Acties:
  • 68 views sinds 30-01-2008

Verwijderd

Topicstarter
Ik krijg mijn output in de wetenschappelijke notatie terwijl ik hem in de "normale" zou willen.. Hier is de code.


code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php 

    function elapsedTime() {
    
      if ($this->runScript == 0) {
      
        $this->start = core::getMicroTime();
        $this->runScript = 1;
        
      } else {
      
        $this->stop = core::getMicroTime();
        $this->runScript = 2;
      
      }  
      
      if ($this->runScript = 2) $this->elapsedTime = $this->stop - $this->start;;
    
    }

?>


als ik deze uitvoer krijg ik dit als output: 3.0040740966797E-005
terwijl het deze moet zijn: 0.00003004....

Hoe kan ik dit probleem van de baan helpen?

  • sjroorda
  • Registratie: December 2001
  • Laatst online: 14:01
Kijk eens naar printf.

  • ILUsion
  • Registratie: Augustus 2003
  • Laatst online: 08-11-2025
http://php.belnet.be/manual/en/function.sprintf.php

Daarmee moet wel iets te doen zijn :)

De functie sprintf is enkel de opmaak, met de functie printf stuurt hij het ook gelijk door naar de output.

  • NMe
  • Registratie: Februari 2004
  • Laatst online: 15-04 22:07

NMe

Quia Ego Sic Dico.

Misschien dat number_format het ook kan, maar dat zou je zelf even moeten testen. :P

'E's fighting in there!' he stuttered, grabbing the captain's arm.
'All by himself?' said the captain.
'No, with everyone!' shouted Nobby, hopping from one foot to the other.


  • .oisyn
  • Registratie: September 2000
  • Laatst online: 21:33

.oisyn

Moderator Devschuur®

Demotivational Speaker

Ergo, blader gewoon eens door de documentatie ipv meteen hier een topic te openen :)

Give a man a game and he'll have fun for a day. Teach a man to make games and he'll never have fun again.


Dit topic is gesloten.