Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:
  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. Be respectful, on topic and if you see a problem, Flag it.

If you would like to contact our Community Manager personally, feel free to send a private message or an email.

Really big numbers becoming "inf" in FS?

EvanReeseEvanReese Member, Mentor Posts: 2,135 ✭✭✭✭✭
edited April 2021 in FeatureScript
I'm exploring a feature for catenary curves with FS and one of my main references is this great blog post, which should help not only make the curves, but do it with a user-friendly UI. If I'm understanding it, I need to be able to calculate the hyperbolic sine of numbers like 1000, which results in numbers so big that Onshape calls it "inf" and I get a NaN error message in the FeatureScript Notices panel. I infer that "inf" means "infinity" and "NaN" means "Not a Number". Is that right? Either way it's making my "*" operator fail. Any suggestion on making this work?
Evan Reese

Answers

  • ilya_baranilya_baran Onshape Employees, Developers, HDM Posts: 1,212
    Yes, sinh(1000) and cosh are too big for floating point double-precision.  I haven't looked at the details of the math here, but I'd be really surprised if you actually needed that calculation for any practical catenary.  If you look at the cosh graph, at that point, it's really well approximated by a straight line anyway.
    Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc
  • EvanReeseEvanReese Member, Mentor Posts: 2,135 ✭✭✭✭✭
    Got it. Well in that case, here's hoping I've made some other silly mistake in my math and I don't actually need sinh(1000). This seems pretty likely. I'll let you know if I keep trying and stay stuck. Thanks, Ilya!
    Evan Reese
  • mahirmahir Member, Developers Posts: 1,307 ✭✭✭✭✭
    edited April 2021
    Not sure it'll work, but you could try the old trick of using log() to get the number down to something manageable. Or use larger units (m vs mm) for the calculation. What Ilya said is also true. I don't know how useful a catenary curve would be if its sides were virtually vertical.
Sign In or Register to comment.