Top "Type-conversion" questions

Type conversion is the way of implicitly or explicitly changing an entity of one data type into another.

Converting float decimal to fraction

I am trying to convert calculations keyed in by users with decimal results into fractions. For e.g.; 66.6666666667 into 66 2/3. Any …

php math floating-point type-conversion rational-numbers
Best (safest) way to convert from double to int

I'm curious as to the best way to convert a double to an int. Runtime safety is my primary concern …

c# type-conversion explicit tryparse
How to convert a double into an unsigned char?

I'm looking to change a vector of doubles into unsigned chars using c++. To make sure it works I wrote: …

c++ casting type-conversion double unsigned-char
Boost::Python- possible to automatically convert from dict --> std::map?

I've got a C++ class, with a member function that can take a small-to-large number of parameters. Lets name those …

c++ python boost type-conversion boost-python
Convert unsigned long long to double in C

I realize this question could be processor dependent, but hopefully someone can point me in the right direction. For the …

c double type-conversion c99 uint64
Convert date from milliseconds to ISODate object

I am trying to aggregate records in a MongoDB collection by hour and need to convert date stored as timestamp (…

javascript mongodb type-conversion aggregation-framework
Passing in a type variable into function

I'm trying to achieve a type assertion by passing in a type into a function. In other words, I'm trying …

go type-conversion type-assertion
Implicit type promotion rules

This post is meant to be used as a FAQ regarding implicit integer promotion in C, particularly implicit promotion caused …

c type-conversion implicit-conversion
How to convert an integer value to boolean in delphi

I have a database field value, which is an integer like 0 and 1. Is it possible to convert this integer values …

delphi type-conversion dbgrid
Conversion of boost::optional to bool

How I can prevent the last line of this code from compiling? #include <boost/optional.hpp> int main() { …

c++ boost type-conversion boost-optional