Questions tagged [decimal]

Decimal is the commonly used term for the base-ten numerical system that we rely on. It can also be used to describe values that are not whole numbers and include a decimal point.

How to format decimals in Typescript/Angular with a pipe: comma or dot?

I've recently developed a custom pipe and I'm looking to enhance it by adding commas or periods to thousands values. For instance, 1000 should be displayed as either 1,000 or 1.000. Here is the code snippet for my custom pipe: import { Pipe, PipeTransfor ...

Struggling with the conversion of string data to integer, float, or decimal format in order to create plots using matplotlib

Having extracted data from a SQL database table, I am encountering persistent challenges in plotting a graph between two variables due to conversion issues with data types. I initially converted a list to a str, and now I'm attempting to further conve ...

Showing numeric values with decimals in an Angular Handsontable table

I want to display a decimal value (22.45) without rounding while using angular-handsontable in my application. Even though I specified the format, the value is not displayed as expected columns: ({ type: string; numericFormat: { pattern: string; }; } | {} ...

Performing mathematical operations in JavaScript, rounding to the nearest .05 increment with precision up to two

Apologies in advance. After reviewing multiple posts, it seems like the solution involves using the toFixed() method, but I'm struggling to implement it. $('.addsurcharge').click(function() { $('span.depositamount').text(function(i,v) { ...

Having trouble getting a Mocha test to display two decimal places in Javascript? Both Big and Decimal libraries are causing issues

After encountering an error with the Big library, I decided to switch to Decimal. First, I ran npm install Decimal Then, I added the following code: const Decimal = require('decimal'); Even after following the examples, my comparison returned { Object (i ...

Remove any unnecessary decimal points from prices

I'm currently facing an aesthetic dilemma in PHP where I need to display two prices: The first price is 123.45, and the second price is 123.00. I am looking for a way to remove the .00 from the second price when necessary so that it only appears as ...