# \#math

**URL:** https://clarionhub.com/tag/math/218.md

[Latest](https://clarionhub.com/latest.md) · [Categories](https://clarionhub.com/categories.md) · [Tags](https://clarionhub.com/tags.md)

---

## [Calculate the age for leap year in Clarion 8](https://clarionhub.com/t/calculate-the-age-for-leap-year-in-clarion-8/8806)

<div class="topic-metadata">

**Author:** [@Tonymarshall](https://clarionhub.com/u/Tonymarshall)\
**Replies:** 24\
**Last updated:** [November 29, 2025, 6:38pm UTC](https://clarionhub.com/t/calculate-the-age-for-leap-year-in-clarion-8/8806 "2025-11-29T18:38:15Z")

</div>

Hi What is the embed formula to calculate the age of a person whos birthday is on the 29th February. With normal formula I get 20years old. Kind regards

---

## [Trying to convert IPv4 saved as an integer back to a string](https://clarionhub.com/t/trying-to-convert-ipv4-saved-as-an-integer-back-to-a-string/8226)

<div class="topic-metadata">

**Author:** [@DavidA](https://clarionhub.com/u/DavidA)\
**Replies:** 2\
**Last updated:** [May 27, 2025, 11:56pm UTC](https://clarionhub.com/t/trying-to-convert-ipv4-saved-as-an-integer-back-to-a-string/8226 "2025-05-27T23:56:58Z")

</div>

I am trying to convert IPv4 addresses from integer to string for display. I found this example code but don't know how to convert the python right shift and bitwise to Clarion code. The Clarion BSHIFT and BOR /BXOR tak…

---

## [Formatting a Number with an Integer Picture Rounds Up](https://clarionhub.com/t/formatting-a-number-with-an-integer-picture-rounds-up/8156)

<div class="topic-metadata">

**Author:** [@Genricke](https://clarionhub.com/u/Genricke)\
**Replies:** 12\
**Last updated:** [May 13, 2025, 2:18pm UTC](https://clarionhub.com/t/formatting-a-number-with-an-integer-picture-rounds-up/8156 "2025-05-13T14:18:25Z")

</div>

Hi ! Can you please tell me why such a strange result is obtained ? Message(Format(999999.99,@n14)) ! = '1,000,000' ?!!!

---

## [Add a Period to Date & Time](https://clarionhub.com/t/add-a-period-to-date-time/7702)

<div class="topic-metadata">

**Author:** [@fred](https://clarionhub.com/u/fred)\
**Replies:** 8\
**Last updated:** [November 29, 2024, 10:04pm UTC](https://clarionhub.com/t/add-a-period-to-date-time/7702 "2024-11-29T22:04:45Z")

</div>

I'm struggling to find some Clarion code that would take a date & time as input, ADD a certain period, and then provide the END DATE & TIME as output. Closest I could find is fsdates at IceTips. but it seems not to do t…

---

## [How to Store Multiple "Flags" in One LONG](https://clarionhub.com/t/how-to-store-multiple-flags-in-one-long/7642)

<div class="topic-metadata">

**Author:** [@donridley](https://clarionhub.com/u/donridley)\
**Replies:** 25\
**Last updated:** [November 21, 2024, 2:18am UTC](https://clarionhub.com/t/how-to-store-multiple-flags-in-one-long/7642 "2024-11-21T02:18:08Z")

</div>

Hello Everyone, For some reason I am drawing a blank on this. It's something I haven't had to deal with for a long time. Scenario: Say I have multiple possible "flags" stored as Equates. For example: FlagOne Equa…

---

## [How to Calculate the Time Lapsed Between Two Dates & Times?](https://clarionhub.com/t/how-to-calculate-the-time-lapsed-between-two-dates-times/6249)

<div class="topic-metadata">

**Author:** [@kenns](https://clarionhub.com/u/kenns)\
**Replies:** 15\
**Last updated:** [November 11, 2024, 5:09pm UTC](https://clarionhub.com/t/how-to-calculate-the-time-lapsed-between-two-dates-times/6249 "2024-11-11T17:09:20Z")

</div>

The exercise records the date and time a user logs onto a program, and at a later time logs off. The exercise is to measure the time lapsed. The lapsed time may extend over multiple days, and needs to return days, hours…

---

## [Handling (+Infinity) values](https://clarionhub.com/t/handling-infinity-values/7428)

<div class="topic-metadata">

**Author:** [@xxetfxx](https://clarionhub.com/u/xxetfxx)\
**Replies:** 13\
**Last updated:** [September 4, 2024, 12:36pm UTC](https://clarionhub.com/t/handling-infinity-values/7428 "2024-09-04T12:36:29Z")

</div>

Recently, I discovered that topspeed allows infinity values (output of value that is divided by zero) to be saved on a record. I encountered this when I am converting topspeed files to sql file (mariadb/mysql via odbc c…

---

## [How to show working hours 2.5 hours like 2 hours and 30 minutes](https://clarionhub.com/t/how-to-show-working-hours-2-5-hours-like-2-hours-and-30-minutes/7293)

<div class="topic-metadata">

**Author:** [@pbouma](https://clarionhub.com/u/pbouma)\
**Replies:** 4\
**Last updated:** [July 17, 2024, 10:08pm UTC](https://clarionhub.com/t/how-to-show-working-hours-2-5-hours-like-2-hours-and-30-minutes/7293 "2024-07-17T22:08:10Z")

</div>

I have a decimal that shows working hours like 2.5 hours; is it possible to show that as 2 hours and 30 mins? I suppose in a string.

---

## [Bearing (Heading) between Two Point Calculation in CW needs ATAN2() function](https://clarionhub.com/t/bearing-heading-between-two-point-calculation-in-cw-needs-atan2-function/6589)

<div class="topic-metadata">

**Author:** [@Bostjan\_Laba](https://clarionhub.com/u/Bostjan_Laba)\
**Replies:** 16\
**Last updated:** [September 21, 2023, 12:15pm UTC](https://clarionhub.com/t/bearing-heading-between-two-point-calculation-in-cw-needs-atan2-function/6589 "2023-09-21T12:15:26Z")

</div>

I'm trying to calculate a bearing/heading between two geographical points for which I have LAT/LON in degrees like 49.12323421 -72.214342 All formulas I've found use ATAN2 which CW does not have. Does anyone have a (on…

---

## [Negative Value in formula returns -65335](https://clarionhub.com/t/negative-value-in-formula-returns-65335/6254)

<div class="topic-metadata">

**Author:** [@TjaartDM](https://clarionhub.com/u/TjaartDM)\
**Replies:** 4\
**Last updated:** [May 23, 2023, 4:26am UTC](https://clarionhub.com/t/negative-value-in-formula-returns-65335/6254 "2023-05-23T04:26:31Z")

</div>

Good day. I am having a problem where I am adding 3 numeric fields together, but as soon as one field has a negative valude, my result field, which is a variable string, returns the negative 65335 answer. If all 3 field…

---

## [Trigonometric functions are very slow](https://clarionhub.com/t/trigonometric-functions-are-very-slow/6191)

<div class="topic-metadata">

**Author:** [@Mike\_Duglas](https://clarionhub.com/u/Mike_Duglas)\
**Replies:** 25\
**Last updated:** [April 28, 2023, 7:42pm UTC](https://clarionhub.com/t/trigonometric-functions-are-very-slow/6191 "2023-04-28T19:42:57Z")

</div>

This Clarion code takes 800 milliseconds on my machine. nWidth = 1920 nHeight = 1200 Pi2\_128 = 2.0 \* 3.1415 / 128.0 nWave = 15 xo = 0 yo = 0 LOOP x=1 TO nWidth LOOP y=1 TO nHeight xo += nWave …

---

## [Age Calculations](https://clarionhub.com/t/age-calculations/5886)

<div class="topic-metadata">

**Author:** [@Tonymarshall](https://clarionhub.com/u/Tonymarshall)\
**Replies:** 19\
**Last updated:** [February 24, 2023, 5:58pm UTC](https://clarionhub.com/t/age-calculations/5886 "2023-02-24T17:58:52Z")

</div>

Hi can anyone tell me how to calculate the exact age of a person using the formula function? I am using name:age Year(Today()) - Year(LOC:DOB) which gives me the age at the next birthday and not the person's current …

---

## [Clarion Rounding Values (similar to: Math.Ceiling Method)](https://clarionhub.com/t/clarion-rounding-values-similar-to-math-ceiling-method/4786)

<div class="topic-metadata">

**Author:** [@RexCalifornia](https://clarionhub.com/u/RexCalifornia)\
**Replies:** 12\
**Last updated:** [February 1, 2022, 8:59pm UTC](https://clarionhub.com/t/clarion-rounding-values-similar-to-math-ceiling-method/4786 "2022-02-01T20:59:59Z")

</div>

Hello - What would be an ideal equivalent in Clarion to round value up/down similar to these .NET Math.Ceiling Method and Math.Floor Method Example: Math.Ceiling Method (System) | Microsoft Docs decimal values = {7.0…

---

## [Decimal Math Precision](https://clarionhub.com/t/decimal-math-precision/4536)

<div class="topic-metadata">

**Author:** [@totalhip](https://clarionhub.com/u/totalhip)\
**Replies:** 7\
**Last updated:** [October 12, 2021, 3:13pm UTC](https://clarionhub.com/t/decimal-math-precision/4536 "2021-10-12T15:13:06Z")

</div>

Using v13768, haven't tested with earlier. qty DECIMAL(3.0) amt DECIMAL(9.2) code qty = 1.0 amt = 9.99 message(format(qty \* amt,@n9.2)) Anyone expecting to see 10.00?

---

## [How to make a Checksum in clarion](https://clarionhub.com/t/how-to-make-a-checksum-in-clarion/4029)

<div class="topic-metadata">

**Author:** [@Fritsj](https://clarionhub.com/u/Fritsj)\
**Replies:** 7\
**Last updated:** [April 12, 2021, 4:56pm UTC](https://clarionhub.com/t/how-to-make-a-checksum-in-clarion/4029 "2021-04-12T16:56:44Z")

</div>

Hello, How to make a Checksum in clarion. This is an XOR of all bytes. Example: The input in Hex: 02 00 27 01 7c 30 30 30 30 30 30 30 30 30 30 32 Result CheckSum 8 Xor : 6A Regards Frits.

---

## [Picture strange behaviour rounding Real numbers](https://clarionhub.com/t/picture-strange-behaviour-rounding-real-numbers/3914)

<div class="topic-metadata">

**Author:** [@francisco\_viviers](https://clarionhub.com/u/francisco_viviers)\
**Replies:** 0\
**Last updated:** [March 3, 2021, 10:19pm UTC](https://clarionhub.com/t/picture-strange-behaviour-rounding-real-numbers/3914 "2021-03-03T22:19:00Z")

</div>

Hello everyone... I need help with a strange behavior of the picture that I have defined. My data type is Real and I use the picture @ N-16.3, when the value of my variable is 0.9998, it automatically rounds it to 1 in…

---

## [Best way to calculate date and time?](https://clarionhub.com/t/best-way-to-calculate-date-and-time/3696)

<div class="topic-metadata">

**Author:** [@Niels\_Larsen](https://clarionhub.com/u/Niels_Larsen)\
**Replies:** 6\
**Last updated:** [December 4, 2020, 7:08am UTC](https://clarionhub.com/t/best-way-to-calculate-date-and-time/3696 "2020-12-04T07:08:19Z")

</div>

I have been looking for how to best calculate the date and time in Clarion. Under normal circumstances, I would convert a date time to milliseconds, but that does not work as a LONG cannot contain the date and time of t…
