stencilz Posted February 27, 2007 Report Share Posted February 27, 2007 iegūstu no dtubāzes skaitli sareizinu ar 1.5, un tad lietoju floor() taču nezkāpēc ļoti bieži iegūst 0 , kāpēc tā? Link to comment Share on other sites More sharing options...
Hamlets Posted February 27, 2007 Report Share Posted February 27, 2007 Un kāds ir tas skaitlis, butu to izvadījis uz ekrāna. Floor kā nekā apaļo uz leju un tapēc var sanākt 0, piemēram, ja skaitlis ir 0.3. Varbūt skailis ir nulle? Link to comment Share on other sites More sharing options...
cucumber Posted February 27, 2007 Report Share Posted February 27, 2007 izmanto labak round() Link to comment Share on other sites More sharing options...
andrisp Posted February 27, 2007 Report Share Posted February 27, 2007 cucumber, bet ja viņam vajag tieši floor() ? Link to comment Share on other sites More sharing options...
cucumber Posted February 27, 2007 Report Share Posted February 27, 2007 tad pirms izmanto lai maina to tipus $a=0.7; $b=0.3; $c=$a-$b; var_dump($c); //float(0.4) dot mus if ($c==0.4) echo "True"; else echo "False"; //bet tomer false :) Link to comment Share on other sites More sharing options...
andrisp Posted February 27, 2007 Report Share Posted February 27, 2007 cucumber, nesapratu, kāds tam sakars ar topika tēmu ? Link to comment Share on other sites More sharing options...
cucumber Posted February 27, 2007 Report Share Posted February 27, 2007 pirms lietot floor japarliecinas par variable type, kam tas bus pielietots Link to comment Share on other sites More sharing options...
Grey_Wolf Posted February 27, 2007 Report Share Posted February 27, 2007 cucumber --> neaizmirsti ka pirms tam tiek veikta matimaatiskaa darbiiba , taa kaa jebkuraa gadijumaa tas ir skaitlis..... Link to comment Share on other sites More sharing options...
andrisp Posted February 27, 2007 Report Share Posted February 27, 2007 (edited) cucumber, nē nu protams, bet kāds tam visam ir sakars, ko tu saki? Tu teici - "izmanto round()", es saku "bet viņam vajag floor()", un tad tu saki "nu tad lai pirms izmanto to floor(), lai izmaina tipu" + vēl arī iekopē kaut kādu kodu, kas neko tādu nedara. Varbūt manas uztveršanas spējas ir tādas kādas nu viņas ir, bet nu ne vella nesaprotu, ko tu gribi pateikt :). Edited February 27, 2007 by andrisp Link to comment Share on other sites More sharing options...
Grey_Wolf Posted February 27, 2007 Report Share Posted February 27, 2007 cucumber --> njaa Isti viiri manuali nelasa :( // Returns the next lowest integer value by rounding down // faktiski tiek atmesta dalja kas ir aiz komata.... Link to comment Share on other sites More sharing options...
bubu Posted February 27, 2007 Report Share Posted February 27, 2007 faktiski tiek atmesta dalja kas ir aiz komata.... Negatīviem skaitļiem netiek atmesta ;) Link to comment Share on other sites More sharing options...
stencilz Posted February 27, 2007 Author Report Share Posted February 27, 2007 bet skaitlis ir pozitīvs Link to comment Share on other sites More sharing options...
andrisp Posted February 27, 2007 Report Share Posted February 27, 2007 Tad varbūt pasaki kāds. Link to comment Share on other sites More sharing options...
Grey_Wolf Posted February 28, 2007 Report Share Posted February 28, 2007 Negatīviem skaitļiem netiek atmesta ;) nu jaa negatiiviem skaitljiem sakumaa tiek atnjemts 1 ... un tad atmesta ;) Link to comment Share on other sites More sharing options...
Recommended Posts