About 50 results
Open links in new tab
  1. casting - Converting double to integer in Java - Stack Overflow

    Jun 24, 2011 · is there a possibility that casting a double created via Math.round() will still result in a truncated down number No, round() will always round your double to the correct value, and then, it …

  2. java: How can I do dynamic casting of a variable from one type to ...

    2 Your problem is not the lack of "dynamic casting". Casting Integer to Double isn't possible at all. You seem to want to give Java an object of one type, a field of a possibly incompatible type, and have it …

  3. Why use static_cast<T> (x) instead of (T)x or T (x)?

    The C++ casting operators are intended to expose these issues in the code by providing compile-time or run-time errors when possible. So, for strict "value casting" you can use static_cast<>. If you want …

  4. algorithm - What is the difference between ray tracing, ray casting ...

    May 1, 2021 · I have heard a lot of different terms however and I would be interested to know what exactly is the difference between ray tracing, ray matching, ray casting, path tracing and potentially …

  5. Casting a number to a string in TypeScript - Stack Overflow

    467 "Casting" is different than conversion. In this case, window.location.hash will auto-convert a number to a string. But to avoid a TypeScript compile error, you can do the string conversion yourself:

  6. c++ - When should static_cast, dynamic_cast, const_cast, and ...

    The C-style casts can do virtually all types of casting from normally safe casts done by static_cast<> () and dynamic_cast<> () to potentially dangerous casts like const_cast<> (), where const modifier can …

  7. Casting vs using the 'as' keyword in the CLR - Stack Overflow

    Casting can be used on any compatible types, it can be overloaded, and it will throw an exception if the operation fails. The choice of which to use depends on the circumstances.

  8. c# - Why should casting be avoided? - Stack Overflow

    Aug 1, 2013 · Bad is a relative term. Avoiding casting is a best-practice, but sometimes a programmer has gotta do what a programmer has got to do. (especially if you writing a java 1.5+ program that …

  9. powershell - Why Use [PSObject] Type Casting - Stack Overflow

    Feb 5, 2025 · Why Use [PSObject] Type Casting Generally, do NOT use [psobject] casts: In most cases, it is at best an unnecessary, virtual no-op and at worst results in unexpected behavior. [psobject] is a …

  10. Regular cast vs. static_cast vs. dynamic_cast - Stack Overflow

    Aug 26, 2008 · Static cast is also used to cast pointers to related types, for example casting void* to the appropriate type. dynamic_cast Dynamic cast is used to convert pointers and references at run-time, …