Efficient way to cut decimals from a float
Hello, is there a way to cut decimals from a float ?
Basically, float( floatround( fValue ) ) just sucks. PHP Code:
|
Re: Efficient way to cut decimals from a float
Code:
public test(id) |
Re: Efficient way to cut decimals from a float
Quote:
Quote:
|
Re: Efficient way to cut decimals from a float
Any way to cut only last decimals ?
I think something like following code would work, but i want something like previous formula. PHP Code:
|
Re: Efficient way to cut decimals from a float
Multiply the float argument by 10, 100, 1000 etc. before using the formula and divide the result by the same value afterwards.
|
Re: Efficient way to cut decimals from a float
This should work (not tested).
Be careful with decimals value... PHP Code:
|
Re: Efficient way to cut decimals from a float
it won't work
|
Re: Efficient way to cut decimals from a float
Quote:
|
Re: Efficient way to cut decimals from a float
It doesn't matter if you use + or -. It still will not work.
|
Re: Efficient way to cut decimals from a float
right, that method works only at some special range. so don't try it any more
|
| All times are GMT -4. The time now is 13:50. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.