[SOLVED]Warning: sqrt() expects parameter 1 to be float
Home – SaaS › Forums › Support questions › WooPrice Calculator (Pro) › [SOLVED]Warning: sqrt() expects parameter 1 to be float
 This topic has 0 replies, 2 voices, and was last updated 2 years, 3 months ago by bill.

AuthorPosts

January 2, 2019 at 10:01 pm #5296Brendan ThomeParticipant
Hi WPC,
I´ve been struggling quite a while with this error message. We´re presenting our material to a customer tomorrow and I just can´t find a way around this problem. On this product ([b]https://techtinyhouse.de/shop/rohbau/staenderwerk/[/b]) I get the following errormessage as you can see yourself on the site. If the calculations were still correct I wouldn´t bother with the warning for now. But the calculation isn´t correct.
[b]Warning: sqrt() expects parameter 1 to be float, string given in /home/techtiny/public_html/wpcontent/plugins/woopricecalculator/admin/resources/lib/PHPExcel/Classes/PHPExcel/Calculation.php on line 3452[/b]
I´m quite sure the warning didn´t exist before I put the conditional logic in. I deleted all of it again, but the warning doesn´t disappear anymore.I could upload fresh, but the conditional logic is mandatory.
Best Regards
Brendan[b]Attachements[/b]
– 3 screenshots of the calculation
– export ZIPfolder from WPC itself
– the phpfile the warning is directing toJanuary 3, 2019 at 8:08 pm #5304billParticipantHello Brendan,
we were working on finding the solution of the problem that you present.
The error generated form your site its not created by our plugin or conditional logic but from the PHPExcel library.
The error is caused by the formulas sqrt() that you are using inside of your excel file.
Some of them are getting a string(text) argument instead of a float(number) value.Please check the arguments that your sqrt() formulas takes.
Waiting for your feedback
Kind Regards,
Bill
AT979January 16, 2019 at 6:25 am #5303Brendan ThomeParticipantHi Bill,
[b]Documentation[/b]
I changed all “sqrt()” into “^0,5”. That solved the problem for which I initially opened this ticket. Though another occured and a second one I thought would be solved by the sqrt() is not. I documented this with the Screenshot and Excel “After” and “Before”.[b]Problem 1[/b]
As you see in the Screenshot “Wrong Numbers” the numbers in WPC are not the same as on the FrontEnd of the Website itself. How can I solve this problem since everything seems to be uploading correctly and then suddenly displays is differently on the front end.[b]Problem 2[/b]
The same goes for the screenshot “#DIV0!”. It uploads correctly, but then doesn´t display online at all. Can you help me out here?Best Regards
BrendanJanuary 16, 2019 at 10:16 pm #5302billParticipantHello Brendan,
sorry for the delay of giving you an answer.
We are trying to find a solution of the problem that you present but we cant reproduce in our local environment.
Could you please send us the calculator.zip(export of the zip folder from WPC) with the new file that you have created so we can make a check ?Waiting for your response.
Kind Regards,
Bill
AT979January 17, 2019 at 5:33 am #5301Brendan ThomeParticipantHi Bill,
let me know If I can supply more information.
Best Regards
BrendanJanuary 18, 2019 at 10:00 pm #5300billParticipantHello Brendan,
we were working on finding a solution for the problem that you present.
We notice that in the excel file that you are using in your calculator, your results have endless periodic number like in the filed of “Montage”.
You need to use “Round()” excel formula to round those endless periodic number, like this you don’t have problem with calculator.Waiting for your feedback
Kind Regards,
Bill
AT979January 19, 2019 at 2:51 pm #5299Brendan ThomeParticipantHi Bill,
thanks for that tip. The numbers weren´t endless, but they were long. Something like 12 digits long. I´m stating that in case that makes a difference.
I´m not getting the “#DIV0!” anymore since I rounded as you suggested. So thats great. It is very clear now though that numbers with many digits are not taken in very well by WPC since the number that is being display instead of the #DIV0! isn´t correct either. Somehow the programm gets messed up.
So first I had a 1,40026841817559. That became a “#DIV0!” as described in my earlier messages to you. Then I rounded. So it became round(1,40026841817559) which obviously makes it 1,40. On the front end this becomes 11,90. So the problem has improved slightly since 11,90 is better than #DIV0!. But the number being displayed is of course not quite right yet.
That´s where I see the issue. Do you see any way around this?
Best Regards
Brendan1: This is where “1,40026841817559” I´m talking about is placed.
2: This is whats being displayed on the front end with round(1,40026841817559).January 23, 2019 at 9:12 pm #5298billParticipantHi Brendan,
you have to round the cells that contain simple mathematical calculation but returns long numbers. Like for example in the excel file you are using
the cell G3 has a formula that depends on a lot of other cells for example one is CD132, that by its own depends on other cells and this goes even more deeper. You have to make sure to round the cells of which this ones depends with the Round() formula that excel has
before summing them up. So the idea is to round every cell that will produce a long number before it is involved in other calculations. This will fix the problem.Best regards
Bill
AT979January 29, 2019 at 1:38 am #5297Brendan ThomeParticipantHi Bill
I just wanted to let you know that the problem is solved. In the end it wasn´t the rounding of numbers that brought the difficulty. The problem laid in WPC pulling data differently then Excel. This isn´t a huge issue. It just means, that you have to troubleshoot extensively. Our tables are quite complex. So I might have to go back 10 steps and upload the data step for step to see where exactly the data is pulled in differently. It took me about 20 hours to solve all the problems, but what´s necessary is necessary. I just wanted to let you know that rounding the numbers is no issue at all. As far as I can see at this point WPC has no problem at all with cells that have, lets say, 15 decimals.
Take Care
Brendan 
AuthorPosts
 You must be logged in to reply to this topic.