question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Improve the `math` bif

See original GitHub issue

There is an undocumented math bif that can be used to access the Math object in JS.

We need to write docs on it.

There is also a somewhat private, but accessible -math-prop bif, we could actually make it so math could be a shortcut both for the -math and -math-prop based on the number of arguments passed.

Issue Analytics

  • State:open
  • Created 10 years ago
  • Reactions:3
  • Comments:19 (16 by maintainers)

github_iconTop GitHub Comments

1reaction
juice49commented, Oct 27, 2015

Hey @tjfwalker, bif means built in function—simply a function that is included in Stylus.

The math function accepts two arguments: a value to operate on, and a JavaScript math function to use. I have put some example on CodePen that demonstrate this.

For example, you could call Math.sqrt in the following way:

math(400, 'sqrt')

This function is limited to having one value passed, which means you can’t use a JavaScript math function that accepts/requires multiple values (Math.min, for example). It might be worth reconsidering the implementation to allow this.

0reactions
tjfwalkercommented, Oct 27, 2015

I’ve been trying to find documentation that explains the math() function used in this Codepen, http://codepen.io/kizu/pen/etmzx , without any luck. I finally found this issue, from nearly _two years ago_, stating that it’s *undocumented" BIF —built-in function. What’s the status on writing up the “math bif” documentation? How does it work, what are the args being passed to math(), et cetera? Thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Math Tips: Top 5 Ways To Improve In Math Immediately
Improve in math by using these 5 areas to focus on. As a math teacher of over 20 years experience these areas are...
Read more >
Strategies to Improve All Students' Mathematics Learning and ...
Strategies to improve all students' mathematics learning and achievement ... With a big smile, Ella said, “I'll just get another quarter and ...
Read more >
11 Strategies for Accelerating Math Fluency
5. Use Memory Aids. Several memory aids such as songs, rhymes, and even name mnemonics may be helpful in increasing a student's math...
Read more >
9 Ways to Improve Math Skills Quickly & Effectively
Need help to get better at math? Follow this guide to the best ways for improving mathematical skills.
Read more >
5 Tips for Improving Students' Success in Math | Edutopia
What does it take to improve student success and interest in math? ... Because such problems are realistic, big, and messy, student teams ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found