cheyner11 Posted November 21, 2006 Share Posted November 21, 2006 I have a math issue. I am building a mortgage calculator and I cannot seem to get it to work because the pow() function makes the number an exponent - 6.37 E 45How do I convert this to a full integer.Thanks,Jeremy Quote Link to comment Share on other sites More sharing options...
btherl Posted November 21, 2006 Share Posted November 21, 2006 I think your calculator may be buggy if you are getting numbers that large (or that small, if that's a "-" in front of it). PHP's integers cannot hold numbers of that size. Quote Link to comment Share on other sites More sharing options...
cheyner11 Posted November 21, 2006 Author Share Posted November 21, 2006 The calculator is only doing: 1.5 ^ 360And it is coming back with that exponent number. I just need a way to convert it to a real number. Quote Link to comment Share on other sites More sharing options...
heckenschutze Posted November 21, 2006 Share Posted November 21, 2006 Yes, still too large...Too clarifiy it for you:[table][tr][td][b]Type[/b][/td][td][b]16 Bits[/b][/td][td][b]32 Bits[/b][/td][td][b]Range[/b][/td][/tr][tr][td][color=blue]unsigned short int[/color][/td][td]2 bytes[/td][td]2 bytes[/td][td][i]0 to 65,535[/i][/td][/tr][tr][td][color=blue]short int[/color][/td][td]2 bytes[/td][td]2 bytes[/td][td][i]-32,768 to 32,768[/i][/td][/tr][tr][td][color=blue]unsigned long int[/color][/td][td]4 bytes[/td][td]4 bytes[/td][td][i]0 to 4,294,967,295[/i][/td][/tr][tr][td][color=blue]long int[/color][/td][td]4 bytes[/td][td]4 bytes[/td][td][i]-2,147,483,648 to 2,147,483,647[/i][/td][/tr][tr][td][color=blue]int[/color][/td][td]2 bytes[/td][td]4 bytes[/td][td][i](16): -32,768 to 32,767[br] (32): -2,147,483,648 to 2,147,483,647[/i][/td][/tr][tr][td][color=blue]unsigned int[/color][/td][td]2 bytes[/td][td]4 bytes[/td][td][i](16): 0 to 65,535[br] (32): 0 to 4,294,967,295[/i][/td][/tr][tr][td][color=blue]char[/color][/td][td]1 byte[/td][td]1 byte[/td][td][i]256 character values[/i][/td][/tr][tr][td][color=blue]wchar_t[/color][/td][td]2 bytes[/td][td]2 bytes[/td][td][i]65,535 character values[/i][/td][/tr][tr][td][color=blue]bool[/color][/td][td]1 byte[/td][td]1 byte[/td][td][i]True or False[/i][/td][/tr][tr][td][color=blue]float[/color][/td][td]4 bytes[/td][td]4 bytes[/td][td][i]1.2e-38 to 3.4e38[/i][/td][/tr][tr][td][color=blue]double[/color][/td][td]8 bytes[/td][td]8 bytes[/td][td][i]2.2e-308 to 1.8e308[/i][/td][/tr][tr][td][color=blue]long double[/color][/td][td]10 bytes[/td][td]10 bytes[/td][td][i]3.4e-4932 to 1.1e+4932[/i][/td][/tr][/table]PHP uses [color=blue]long int[/color] for [color=blue]integers[/color]...hth. Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted November 21, 2006 Share Posted November 21, 2006 [quote]The calculator is only doing: 1.5 ^ 360And it is coming back with that exponent number. I just need a way to convert it to a real number.[/quote]Only??? You are multiplying 1.5 by itself 360 times. That is a large number.What are you trying to calculate?Ken Quote Link to comment Share on other sites More sharing options...
btherl Posted November 21, 2006 Share Posted November 21, 2006 That would match a principal with an interest rate of 50% PER MONTH over a period of 30 years.If you wanted an interest rate of 10% PER YEAR over 30 years, you would want (1.1)^30, which is around 17.45, much more reasonable. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.