calc

iOS - rounding a float with roundf() is not working properly

巧了我就是萌 提交于 2019-12-04 07:02:29
问题 I am having issue with rounding a float in iPhone application. float f=4.845; float s= roundf(f * 100.0)/100; NSLog(@"Output-1: %.2f",s); s= roundf(484.5)/100; NSLog(@"Output-2: %.2f",s); Output-1: 4.84 Output-2: 4.85 Let me know whats problem in this and how to solve this. 回答1: The problem is that you don't yet realise one of the inherent problems with floating point: the fact that most numbers cannot be represented exactly (a) . This means that 4.845 is likely to be, in reality, something

CSS - Use calc() to keep widths of elements the same

早过忘川 提交于 2019-12-04 00:44:33
Is something like this possible in CSS? <table> <tr> <td id="elementOne">elementOne</td> <td id="elementtwo">elementtwo</td> </tr> </table> <div style="width: calc(document.getElementById(elementOne).width)"></div> So that the div is always the same width as elementOne . Is there such a feature in CSS, using calc() or some other means? leo No, it's not possible with CSS. For that you will have to use JavaScript ( document.getElementById(elementOne).offsetWidth or similar, depending on exactly what width you are looking for). Calc is used to do math, not execute scripts. There is no way of

what language do I need to write macros in LIbre Office Calc? [closed]

感情迁移 提交于 2019-12-03 17:22:51
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 5 years ago . I've written a bunch of VBA code for various things in Excel. I'm looking at migrating to libreOffice. Under Tool->Macros->Organize Macros: the two choices are LibreOffice Basic and Python. Should I learn one of those, both, or something else. Am I wasting my time altogether?

CSS中的 calc 函数

こ雲淡風輕ζ 提交于 2019-12-03 09:22:54
calc() 此CSS函数让你在声明CSS属性值时执行一些计算。它可以用在如下场合: <length> 、 <frequency> , <angle> 、 <time> 、 <number> 、或 <integer> 此 calc()函数用一个表达式作为它的参数,用这个表达式的结果作为值。这个表达式可以是任何如下操作符的组合,采用标准操作符处理法则的简单表达式。 + 加法 - 减法 * 乘法,乘数中至少要有一个是 <number> 类型的 / 除法,除数(/右面的数)必须是 <number> 类型的 表达式中的操作数可以使用任意 <length> 值。如果你愿意,你可以在一个表达式中混用这类值的不同单位。在需要时,你还可以使用小括号来建立计算顺序。 <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <style type="text/css"> .d1 { width: 400px; height: 300px; background: lavender; position: relative; } .d2 { position: absolute; left: 50px; width: calc(100% - 100px); height: 10px; background: black; }

What Is Result Of calc() In CSS

匿名 (未验证) 提交于 2019-12-03 08:44:33
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: We have now started using calc() in css, for setting widths on a result of calculation. For example: <div id='parent'> <div id='calcWidth'></div> </div> #parent{ width:100px; } #calcWidth{ width:calc(100% - 3px); height:100px; background:red; } I know how calc() works, but I just want to know what is returned in css, in the place of calc(100% - 3px); in the example given above. Whats my confusion? In the above example width:calc(100% - 3px); say the 100% width is actually 100px , which will be determined at runtime by css. So the calculated

Use css counter in calc

匿名 (未验证) 提交于 2019-12-03 08:42:37
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a list ul>li*5 (not always the same amount). I set a counter for which I get: 1 2 3 4 5 li:nth-child(n):before { counter-increment: skill; content: counter(skill); color: white; } The Question Can I use the counter(skill) inside a calc() or can I add units to it px em rem % ms s I have tried: transition: all 250ms linear #{counter(skill)} * 1s; transition: all 250ms linear counter(skill) * 1s; I want to have the delay increased for example: li 1s delay li 2s delay li 3s delay li 4s delay li Xs delay 回答1: The Question Can I use the

Use css calc() in jquery

匿名 (未验证) 提交于 2019-12-03 08:36:05
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: How can I do this? $('#element').animate({ "width": "calc(100% - 278px)" }, 800); $('#element').animate({ "width": "calc(100% - 78px)" }, 800); I can do it if it's only % or only px , but not calc() , can I use some other option of jQuery? or some other trick of JavaScript? It's a change that have to be done when the user clicks some element, so: $("#otherElement").on("click", FunctionToToggle); when the user clicks the $("#otherElement") the toggle effect has to occur. 回答1: maybe this helps: $('#element').animate({ "width": "-=278px" }, 800

CSS calc with inherit

匿名 (未验证) 提交于 2019-12-03 08:33:39
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I would like to use inherit with calc() like this : #foo{ animation-duration:10s; } #foo > .bar { animation-duration:calc(inherit + 2s); /* =12s */ } But it don't seem to works. Is it browsers bug or specs? 回答1: The inherit keyword can only exist alone as a value in a property declaration. It cannot be used with anything else as a value, because it's a value in and of itself. This means it cannot be used with functions like calc() either. See CSS2.1 and css3-cascade . Furthermore, the calc() function itself only takes literal numeric values

jquery CSS calc() function

匿名 (未验证) 提交于 2019-12-03 07:36:14
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: i came across this page CSS LINK i could't help but love the idea of that to calculate the outcome of different units... however i tried this : $('selector').css({'width':'calc(100%-20px)'}); but it doesn't work... anyone has any ideas how this works , or why doesn't this work? 回答1: jQuery does not support the calc() value, and neither does any of the current browsers. See a comparison here: http://en.wikipedia.org/wiki/Comparison_of_layout_engines_%28Cascading_Style_Sheets%29 In your example, yo can just use margins on the inner element